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: SenologieToOncoBoxBrustOperation

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

title: Senologie Procedure + Specimen to OncoBox Brust Operation status: draft

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

// title: Senologie Procedure + Specimen to OncoBox Brust Operation
// 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/Specimen" alias Specimen as source
uses "http://hl7.org/fhir/StructureDefinition/Observation" alias Observation as source
uses "http://hl7.org/fhir/StructureDefinition/ServiceRequest" alias ServiceRequest as source

// Import-only map: no target `uses` declaration — the calling map
// (SenologieToOncoBoxBrustPrimaerfall) provides the correct BackboneElement
// context (primaerfall.operation). Omitting the root-level target type avoids
// SM_TARGET_PATH false positives where the validator would resolve property
// names against oncobox-brust-meldung root.
// ============================================================================
// Operation: Procedure (+ Specimen / Observation) -> Operation-Block
// Pro Brust-Procedure wird ein Operation-Block erzeugt mit OP-Datum,
// Seitenlokalisation, OPS-Kodes, Operationsart, Drahtmarkierung, Sentinel,
// Residualstatus und Komplikationen.
// ============================================================================
group MapOperation(source src : Procedure, target tgt : BackboneElement) {
  // LNR Default 1
  src -> tgt.lnr = 1 "SetOpLnr";
  // Op_Datum
  src.performed as perf where $this.is(dateTime) -> tgt.datum = perf "SetOpDatum";
  src.performed as perf where $this.is(Period) then {
    perf.start as s -> tgt.datum = s "SetOpDatumPeriod";
  } "MapOpDatumPeriod";
  // Op_Seite
  src.bodySite as bs then {
    bs.coding as c where system = 'http://snomed.info/sct' then {
      c.code as cd where $this = '24028007' -> tgt.seitenlokalisation = 'R' "SetOpSeiteR";
      c.code as cd where $this = '7771000' -> tgt.seitenlokalisation = 'L' "SetOpSeiteL";
      c.code as cd where $this = '51440002' -> tgt.seitenlokalisation = 'B' "SetOpSeiteB";
    } "MapOpSeiteSCT";
  } "MapOpSeite";
  // OPS-Kodes
  src.code as code then {
    code.coding as c where system = 'http://fhir.de/CodeSystem/bfarm/ops' -> tgt.opsCodes as ops then {
      c.code as cd -> ops.code = cd "SetOpsCode";
      c.version as v -> ops.version = v "SetOpsVer";
    } "MapOpsCoding";
  } "MapOpsCodes";
  // Op_Art aus OPS-Prefix
  // 5-870* = BET, 5-871* = Mast einfach, 5-872* = SSM, 5-883* = NSM,
  // 5-885* = Rekon, 5-401.1* = SLNB, 5-402* = Axilla
  src.code as code then {
    code.coding as c where system = 'http://fhir.de/CodeSystem/bfarm/ops' then {
      c.code as cd where $this.startsWith('5-870') -> tgt.operationsart = '1' "SetOpArtBET";
      c.code as cd where $this.startsWith('5-871') -> tgt.operationsart = '2' "SetOpArtMastEinf";
      c.code as cd where $this.startsWith('5-872') -> tgt.operationsart = '3' "SetOpArtSSM";
      c.code as cd where $this.startsWith('5-883') -> tgt.operationsart = '4' "SetOpArtNSM";
      c.code as cd where $this.startsWith('5-885') -> tgt.operationsart = '6' "SetOpArtRekon";
      c.code as cd where $this.startsWith('5-402') -> tgt.operationsart = '7' "SetOpArtAxilla";
      c.code as cd where $this.startsWith('5-401.1') -> tgt.operationsart = '8' "SetOpArtSLNB";
    } "MapOpArtOPS";
  } "MapOpArt";
  // Op_Sentinel durchgefuehrt (OPS 5-401.1*)
  src.code as code then {
    code.coding as c where system = 'http://fhir.de/CodeSystem/bfarm/ops' then {
      c.code as cd where $this.startsWith('5-401.1') -> tgt.sentinel = '1' "SetSentinelJa";
    } "MapSentinelOPS";
  } "MapSentinel";
  // Op_Axdissektion (OPS 5-402*)
  src.code as code then {
    code.coding as c where system = 'http://fhir.de/CodeSystem/bfarm/ops' then {
      c.code as cd where $this.startsWith('5-402') -> tgt.axillaDissektion = '1' "SetAxDissJa";
    } "MapAxDissOPS";
  } "MapAxDiss";
  // Residualstatus aus Procedure.outcome (SNOMED)
  src.outcome as out then {
    out.coding as c where system = 'http://snomed.info/sct' then {
      c.code as cd where $this = '122538001' -> tgt.residualstatusLokal = 'R0' "SetRLokR0";
      c.code as cd where $this = '122538001' -> tgt.residualstatusGesamt = 'R0' "SetRGesR0";
      c.code as cd where $this = '122539009' -> tgt.residualstatusLokal = 'R1' "SetRLokR1";
      c.code as cd where $this = '122539009' -> tgt.residualstatusGesamt = 'R1' "SetRGesR1";
      c.code as cd where $this = '122540006' -> tgt.residualstatusLokal = 'R2' "SetRLokR2";
      c.code as cd where $this = '122540006' -> tgt.residualstatusGesamt = 'R2' "SetRGesR2";
      c.code as cd where $this = '122541005' -> tgt.residualstatusLokal = 'RX' "SetRLokRX";
      c.code as cd where $this = '122541005' -> tgt.residualstatusGesamt = 'RX' "SetRGesRX";
    } "MapROutcomeCoding";
  } "MapROutcome";
  // Revisionsoperation (OncoBox 2.0)
  // Op_Revision: 0=nein, 1=ja
  // Abgeleitet aus: operationsart = 5 (Revision) oder
  // Procedure.reasonCode enthält "Revision" / SNOMED 282032007
  src -> tgt.revisionsOp = '0' "SetRevisionDefault";
  src.code as code then {
    code.coding as c where system = 'http://fhir.de/CodeSystem/bfarm/ops' "MapRevisionOPS";
  } "MapRevisionCode";
  src.reasonCode as rc then {
    rc.coding as c where system = 'http://snomed.info/sct' then {
      c.code as cd where $this = '282032007' -> tgt.revisionsOp = '1' "SetRevisionJaSCT";
    } "MapRevisionReasonSCT";
    rc.text as txt where $this.contains('Revision') -> tgt.revisionsOp = '1' "SetRevisionJaText";
    rc.text as txt where $this.contains('Nachresektion') -> tgt.revisionsOp = '1' "SetRevisionJaNachresekt";
  } "MapRevisionReason";
  // Anzahl Eingriffe bis R0 (KB-14, OncoBox 2.0)
  // Op_Anzahl_bis_R0: Aggregation aller Procedures für dieselbe Condition
  // bis zum Erreichen von R0. In FML nur als Einzelwert setzbar —
  // die tatsächliche Aggregation erfolgt in der CQL-Auswerteschicht.
  // Hier wird der Defaultwert gesetzt: 1 wenn R0, sonst leer.
  src.outcome as out then {
    out.coding as c where system.exists() then {
      c.code as cd where $this = 'R0' -> tgt.anzahlEingriffeR0 = 1 "SetAnzahlR0Default";
    } "MapAnzahlR0Coding";
  } "MapAnzahlR0";
  // Komplikationen ICD-10: aus Procedure.complication (compl_icd10 Slice)
  src.complication as comp then {
    comp.coding as c where system = 'http://fhir.de/CodeSystem/bfarm/icd-10-gm' -> tgt.komplikationen as komp then {
      c.code as cd -> komp.icdCode = cd "SetKompIcdCode";
    } "MapKompIcdCoding";
  } "MapKompIcd";
}