Kerndatensatz Senologie
0.9.0 - ci-build

Kerndatensatz Senologie - Local Development build (v0.9.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

StructureMap: SenologieToOncoBoxBrustTherapie

Official URL: https://www.senologie.org/fhir/StructureMap/SenologieToOncoBoxBrustTherapie Version: 0.9.0
Draft as of 2026-05-04 Computable Name: SenologieToOncoBoxBrustTherapie

title: Senologie Procedure (Syst / RT) to OncoBox Brust Therapie status: draft

map "https://www.senologie.org/fhir/StructureMap/SenologieToOncoBoxBrustTherapie" = "SenologieToOncoBoxBrustTherapie"

// title: Senologie Procedure (Syst / RT) to OncoBox Brust Therapie
// status: draft

uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as source
uses "http://hl7.org/fhir/StructureDefinition/Procedure" alias Procedure as source
uses "http://hl7.org/fhir/StructureDefinition/Observation" alias Observation as source

// Import-only map: no target `uses` declaration — the calling map
// (SenologieToOncoBoxBrustPrimaerfall) provides the correct BackboneElement
// context (primaerfall.systemtherapie / primaerfall.strahlentherapie /
// primaerfall.endokrineTherapie). Omitting the root-level target type avoids
// SM_TARGET_PATH false positives where the validator would resolve property
// names against oncobox-brust-meldung root.
// ============================================================================
// Systemtherapie: Procedure (Senologie_Systemtherapie_Procedure) -> Syst-Block
// Relevante Felder fuer OncoBox / Kennzahlen:
// - KB-4 / KB-5: adjuvante Chemo (invasiv / DCIS)
// - KB-7: Trastuzumab bei HER2-positiven Patientinnen
// - KB-8: First-Line-Therapie bei Metastasierung
// ============================================================================
group MapSystemtherapie(source src : Procedure, target tgt : BackboneElement) {
  src -> tgt.lnr = 1 "SetSystLnr";
  // Syst_Art (Chemo=1, Immun=2, zielgerichtet=3)
  src.code as code then {
    code.coding as c where system = 'http://snomed.info/sct' then {
      c.code as cd where $this = '367336001' -> tgt.therapieart = '1' "SetSystChemo";
      c.code as cd where $this = '76334006' -> tgt.therapieart = '2' "SetSystImmun";
      c.code as cd where $this = '169413002' -> tgt.therapieart = '3' "SetSystZiel";
    } "MapSystArtCoding";
  } "MapSystArt";
  // Syst_Stellung (neoadjuvant/adjuvant/palliativ) aus Extension (CodeableConcept)
  src.extension as ext where url = 'https://www.senologie.org/fhir/StructureDefinition/ex-senologie-therapiestellung' then {
    ext.value as val then {
      val.coding as c where code = 'neoadjuvant' -> tgt.stellungZurOP = 'N' "SetStellNeo";
      val.coding as c where code = 'adjuvant' -> tgt.stellungZurOP = 'A' "SetStellAdj";
      val.coding as c where code = 'palliativ' -> tgt.stellungZurOP = 'P' "SetStellPal";
    } "MapStellVal";
  } "MapStellExt";
  // Syst_Beginn / Syst_Ende aus performedPeriod
  src.performed as perf where $this.is(Period) then {
    perf.start as s -> tgt.beginn = s "SetSystBeginn";
    perf.end as e -> tgt.ende = e "SetSystEnde";
  } "MapSystPeriod";
  // Syst_Trastuzumab - Flag wenn Substanz Trastuzumab enthaelt (ATC L01FD01)
  // Einfachste Ableitung: Procedure.code.coding mit Trastuzumab-Code (z.B. SNOMED 387208009)
  src.code as code then {
    code.coding as c where system = 'http://snomed.info/sct' then {
      c.code as cd where $this = '387208009' -> tgt.enthaeltTrastuzumab = '1' "SetTrastuJa";
    } "MapTrastuCoding";
  } "MapTrastu";
  // Syst_FirstLine (KB-8): First-Line bei Metastasierung aus EX_Senologie_FirstLineTherapy
  src.extension as ext where url = 'https://www.senologie.org/fhir/StructureDefinition/ex-senologie-first-line-therapy' then {
    ext.value as val where $this = true -> tgt.firstLine = '1' "SetFirstLineJa";
    ext.value as val where $this = false -> tgt.firstLine = '0' "SetFirstLineNein";
  } "MapFirstLine";
  // Syst_Protokoll aus usedCode.text
  src.usedCode as uc then {
    uc.text as t -> tgt.protokoll = t "SetSystProtokollText";
  } "MapSystProtokoll";
}

// ============================================================================
// Strahlentherapie: Procedure (Senologie_Strahlentherapie) -> RT-Block
// ============================================================================
group MapStrahlentherapie(source src : Procedure, target tgt : BackboneElement) {
  src -> tgt.lnr = 1 "SetRTLnr";
  // RT_Beginn / RT_Ende aus performedPeriod
  src.performed as perf where $this.is(Period) then {
    perf.start as s -> tgt.beginn = s "SetRTBeginn";
    perf.end as e -> tgt.ende = e "SetRTEnde";
  } "MapRTPeriod";
  // RT_Stellung aus Extension therapiestellung (CodeableConcept)
  src.extension as ext where url = 'https://www.senologie.org/fhir/StructureDefinition/ex-senologie-therapiestellung' then {
    ext.value as val then {
      val.coding as c where code = 'neoadjuvant' -> tgt.stellungZurOP = 'N' "SetRTNeo";
      val.coding as c where code = 'adjuvant' -> tgt.stellungZurOP = 'A' "SetRTAdj";
      val.coding as c where code = 'palliativ' -> tgt.stellungZurOP = 'P' "SetRTPal";
    } "MapRTStellVal";
  } "MapRTStellExt";
  // RT_Dosis_Gy aus MII Onko Gesamtdosis-Extension
  src.extension as ext where url = 'https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-ex-onko-strahlentherapie-bestrahlung-gesamtdosis' then {
    ext.value as val then {
      val.value as v -> tgt.gesamtdosisGy = v "SetRTGesamtdosis";
    } "ExtractRTGesamtdosisValue";
  } "MapRTGesamtdosis";
  // RT_Einzeldosis_Gy aus Senologie Einzeldosis-Extension
  src.extension as ext where url = 'https://www.senologie.org/fhir/StructureDefinition/ex-senologie-einzeldosis' then {
    ext.value as val then {
      val.value as v -> tgt.einzeldosisGy = v "SetRTEinzeldosis";
    } "ExtractRTEinzeldosisValue";
  } "MapRTEinzeldosis";
  // RT_Zielgebiet aus Procedure.bodySite (SNOMED)
  src.bodySite as bs then {
    bs.coding as c where system = 'http://snomed.info/sct' then {
      c.code as cd where $this = '76752008' -> tgt.zielgebiet = '1' "SetRTBrust";
      c.code as cd where $this = '59441001' -> tgt.zielgebiet = '2' "SetRTLAW";
    } "MapRTZielCoding";
  } "MapRTZiel";
}

// ============================================================================
// Endokrine Therapie: Procedure (therapieart=HO) -> EndokrineTherapie-Block
// Endokrine Therapien (Tamoxifen, Aromatasehemmer, GnRH, Fulvestrant,
// CDK4/6-Inhibitoren) werden als Systemtherapie-Procedures mit therapieart=HO
// modelliert. Die Substanzklasse wird ueber ATC-Codes abgeleitet:
// 1=Tamoxifen (L02BA01), 2=Aromatasehemmer (L02BG*),
// 3=GnRH-Analogon (L02AE*), 4=Fulvestrant (L02BA03),
// 5=CDK4/6-Inhibitor (L01EF*), 9=sonstige
// ============================================================================
group MapEndokrineTherapie(source src : Procedure, target tgt : BackboneElement) {
  src -> tgt.lnr = 1 "SetEndoLnr";
  // Endo_Beginn / Endo_Ende aus performedPeriod
  src.performed as perf where $this.is(Period) then {
    perf.start as s -> tgt.beginn = s "SetEndoBeginn";
    perf.end as e -> tgt.ende = e "SetEndoEnde";
  } "MapEndoPeriod";
  // Endo_Stellung aus MII Onko Intention-Extension
  src.extension as ext where url.contains('mii-ex-onko-systemische-therapie-intention') then {
    ext.value as val then {
      val.coding as c then {
        c.code as cd where $this = 'K' -> tgt.stellungZurOP = 'A' "SetEndoAdj";
        c.code as cd where $this = 'P' -> tgt.stellungZurOP = 'P' "SetEndoPal";
        c.code as cd where $this = 'N' -> tgt.stellungZurOP = 'N' "SetEndoNeo";
      } "MapEndoStellCoding";
    } "MapEndoStellVal";
  } "MapEndoStellExt";
  // Endo_Substanz aus ATC-Code (Procedure.code oder usedCode)
  // Tamoxifen = L02BA01, Aromatasehemmer = L02BG*, GnRH = L02AE*,
  // Fulvestrant = L02BA03, CDK4/6i = L01EF*
  src.code as code then {
    code.coding as c where system = 'http://fhir.de/CodeSystem/bfarm/atc' then {
      c.code as cd where $this = 'L02BA01' -> tgt.substanz = '1' "SetEndoTamox";
      c.code as cd where $this = 'L02BA03' -> tgt.substanz = '4' "SetEndoFulv";
      c.code as cd where $this.startsWith('L02BG') -> tgt.substanz = '2' "SetEndoAI";
      c.code as cd where $this.startsWith('L02AE') -> tgt.substanz = '3' "SetEndoGnRH";
      c.code as cd where $this.startsWith('L01EF') -> tgt.substanz = '5' "SetEndoCDK";
    } "MapEndoSubstanzATCCoding";
  } "MapEndoSubstanzATC";
}