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

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

title: Senologie Procedure + Specimen to IQTIG 18.1 Teildatensatz Operation status: draft

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

// title: Senologie Procedure + Specimen to IQTIG 18.1 Teildatensatz 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/Condition" alias Condition as source

// Import-only map: no target `uses` declaration — the calling map
// (SenologieToIqtigMammachirurgie181) provides the correct BackboneElement
// context (teildatensatzOperation). Omitting the root-level target type avoids
// SM_TARGET_PATH false positives where the validator would resolve property
// names against iqtig-mammachirurgie-181 root.
// ============================================================================
// Teildatensatz Operation (O): Procedure + Specimen + Observations -> O:*
// Pro Eingriff wird ein Operations-Teildatensatz erzeugt. Quellen:
// - Procedure (Senologie_BrustOP / Senologie_Operation) -> OP-Datum, OPS,
// Seitenlokalisation, Operationsart
// - Specimen (Senologie_Pathologie_Praeparat) -> Schnellschnitt,
// Praeparatkontrolle, Praeparat-spezifische Daten
// - Observation (Pathologie-Befund) -> Histologie, Grading, pTNM, R-Status
// - Observation (Rezeptorstatus: ER/PR/HER2) -> QI-relevante Felder
// ============================================================================
group MapOperation(source src : Procedure, target tgt : BackboneElement) {
  // O:LNROP - Laufende Nummer der Operation (Default 1; ueber Slicing iterierbar)
  src -> tgt.laufendeNummer = 1 "SetLnrOp";
  // O:LNRBRUST - Zuordnung zum Brust-Teildatensatz (Default 1)
  src -> tgt.bezugLnrBrust = 1 "SetLnrBrustRef";
  // O:OPDATUM - aus Procedure.performedDateTime
  src.performed as perf where $this.is(dateTime) -> tgt.operationsdatum = perf "SetOpDatum";
  src.performed as perf where $this.is(Period) then {
    perf.start as s -> tgt.operationsdatum = s "SetOpDatumPeriod";
  } "MapOpDatumPeriod";
  // O:SEITE - Seitenlokalisation aus Procedure.bodySite (SNOMED CT)
  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";
  } "MapOpSeitenlokalisation";
  // O:OPSCHLUESSEL - OPS-Kodes aus Procedure.code
  src.code as code then {
    code.coding as c where system = 'http://fhir.de/CodeSystem/bfarm/ops' -> tgt.prozeduren as opsItem then {
      c.code as cd -> opsItem.code = cd "SetOpsCode";
      c.version as v -> opsItem.version = v "SetOpsVersion";
    } "MapOpsCoding";
  } "MapProzeduren";
  // O:OPART - Operationsart aus Procedure.category oder Senologie-Operation-Art VS
  // BET (5-870) -> 1, Mastektomie einfach (5-871) -> 2, Mastektomie SSM (5-872) -> 3,
  // Mastektomie NSM (5-883) -> 4, Revision -> 5, Wiederaufbau (5-885) -> 6
  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' "SetOpArtMastEinfach";
      c.code as cd where $this.startsWith('5-872') -> tgt.operationsart = '3' "SetOpArtMastSSM";
      c.code as cd where $this.startsWith('5-883') -> tgt.operationsart = '4' "SetOpArtMastNSM";
      c.code as cd where $this.startsWith('5-885') -> tgt.operationsart = '6' "SetOpArtRekon";
    } "MapOpArtOPS";
  } "MapOpArtFromOPS";
  // Direkter Map aus Senologie-Operation-Art CodeSystem (falls vorhanden)
  src.category as cat then {
    cat.coding as c where system = 'https://www.senologie.org/fhir/CodeSystem/cs-senologie-brustop-art' then {
      c.code as cd -> tgt.operationsart = cd "SetOpArtDirect";
    } "MapOpArtCoding";
  } "MapOpArtCategory";
  // Bundle lookups for O:DIGNITAET, O:SCHNELLSCHNITT, O:PRAEPKONTROLLE,
  // O:HISTMORPH, O:GRADING, O:TGROESSEINV, O:TGROESSEDCIS, O:MULTIFOK,
  // O:PT/PN/PM, O:UICCPATHO have been moved to the calling orchestrator
  // (SenologieToIqtigMammachirurgie181.map) to avoid multiple source parameters.
  // --- Residualstatus R0/R1/R2 aus Procedure.outcome ---
  // O:RSTATUSLOK / O:RSTATUSGES - aus Procedure.outcome (SNOMED CT)
  // 122538001=R0, 122539009=R1, 122540006=R2, 122541005=RX
  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' "SetRStatusLokR0";
      c.code as cd where $this = '122538001' -> tgt.residualstatusGesamt = 'R0' "SetRStatusGesR0";
      c.code as cd where $this = '122539009' -> tgt.residualstatusLokal = 'R1' "SetRStatusLokR1";
      c.code as cd where $this = '122539009' -> tgt.residualstatusGesamt = 'R1' "SetRStatusGesR1";
      c.code as cd where $this = '122540006' -> tgt.residualstatusLokal = 'R2' "SetRStatusLokR2";
      c.code as cd where $this = '122540006' -> tgt.residualstatusGesamt = 'R2' "SetRStatusGesR2";
      c.code as cd where $this = '122541005' -> tgt.residualstatusLokal = 'RX' "SetRStatusLokRX";
      c.code as cd where $this = '122541005' -> tgt.residualstatusGesamt = 'RX' "SetRStatusGesRX";
    } "MapOutcomeCoding";
  } "MapResidualstatus";
  // --- Lymphknoten aus Pathologie-Observations ---
  // O:SENTINEL - Sentinel-Biopsie 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.sentinelDurchgefuehrt = '1' "SetSentinelJa";
    } "MapSentinelOPS";
  } "MapSentinel";
  // O:AXDISSEKTION - Axilladissektion (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";
  } "MapAxillaDissektion";
// LK counts, Rezeptorstatus, and Komplikationen bundle lookups
// have been moved to the calling orchestrator.
}