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

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

title: Senologie FHIR to oBDS Strahlentherapie (ST) status: draft

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

// title: Senologie FHIR to oBDS Strahlentherapie (ST)
// status: draft

uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as source
uses "https://www.senologie.org/fhir/StructureDefinition/obds-meldung" alias OBDSMeldung as target

imports "https://www.senologie.org/fhir/StructureMap/SenologieToObdsTumorzuordnung"
imports "https://www.senologie.org/fhir/StructureMap/SenologieToObdsNebenwirkung"

// Known limitation: Sub-groups (MapST, MapBestrahlung) use
// `target tgt : BackboneElement` because FML has no syntax to declare the
// Logical Model sub-path for BackboneElement slices passed from parent groups.
// The IG Publisher produces SM_TARGET_PATH errors (~19). The element names are
// correct per the oBDS Logical Model.
// ============================================================================
// Hauptgruppe: Bundle → oBDS ST (Strahlentherapie)
// Ein Bundle enthaelt Strahlentherapie-Procedures (einzelne Bestrahlungsserien)
// und ggf. Observations fuer Nebenwirkungen (CTCAE).
// ============================================================================
group SenologieToObdsST(source src : Bundle, target tgt : OBDSMeldung) {
  // Strahlentherapie-Procedure extrahieren
  src.entry as entry where resource.is(Procedure) and resource.meta.profile.exists($this.contains('senologie-strahlentherapie')) then {
    entry.resource as proc -> tgt.st as st then MapST(proc, st) "CallMapST";
    // Nebenwirkungen (moved from MapST)
    entry.resource as proc2 ->  tgt.st as st2,  st2.nebenwirkungen as nw then MapNebenwirkungenST(src, nw) "CallMapNebenwirkungen";
  } "EntryST";
}

// ============================================================================
// MapST: Procedure → oBDS ST Basisdaten
// Mapped Intention, Stellung zur OP und erzeugt Bestrahlungs-Eintraege
// ============================================================================
group MapST(source src : Procedure, target tgt : BackboneElement) {
  // ST_ID: Procedure.id
  src.id as id -> tgt.stID = id "SetStID";
  // Meldeanlass: abgeleitet aus vorhandenem Enddatum
  src where performedPeriod.end.exists() -> tgt.meldeanlass = 'behandlungsende' "MeldeanlassEnde";
  src where performedPeriod.end.exists().not() -> tgt.meldeanlass = 'behandlungsbeginn' "MeldeanlassBeginn";
  // Intention: aus MII Onko Strahlentherapie-Intention Extension
  // MII Onko CodeSystem nutzt bereits oBDS-Codes (K, P, D, R, S, X)
  src.extension as ext where url = 'https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-ex-onko-strahlentherapie-intention' then {
    ext.value as val then {
      val.coding as c then {
        c.code as cd -> tgt.intention = cd "SetIntention";
      } "ExtractIntentionCode";
    } "ExtractIntentionCoding";
  } "MapIntention";
  // Stellung zur OP: aus Procedure.category (MII Onko StellungZurOp)
  // MII Onko CodeSystem nutzt bereits oBDS-Codes (O, A, N, I, S)
  src.category as cat then {
    cat.coding as c where system = 'https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/CodeSystem/mii-cs-onko-therapie-stellungzurop' then {
      c.code as cd -> tgt.stellungOP = cd "SetStellungOP";
    } "ExtractStellungCode";
  } "MapStellungOP";
  // Bestrahlung: jede Procedure bildet eine einzelne Bestrahlungsserie ab
  // Im Senologie-Profil ist jede Procedure eine Bestrahlung
  src -> tgt.bestrahlungen as best then MapBestrahlung(src, best) "CallMapBestrahlung";
  // Ende-Grund: aus Procedure.outcome.coding
  src.outcome as oc then {
    oc.coding as c -> tgt.endeGrund = (c.code) "SetEndeGrundCode";
  } "MapEndeGrund";
// Nebenwirkungen bundle lookup moved to calling group.
}

// ============================================================================
// MapBestrahlung: Procedure → oBDS Bestrahlung
// Extrahiert Bestrahlungsdetails: Zeitraum, Applikationsart, Zielgebiet,
// Dosis und Boost aus den MII Onko Extensions
// ============================================================================
group MapBestrahlung(source src : Procedure, target tgt : BackboneElement) {
  // Beginn: aus performedPeriod.start
  src.performed as perf then {
    perf.start as s -> tgt.beginn = s "SetBestrahlungBeginn";
  } "MapBestrahlungBeginn";
  // Ende: aus performedPeriod.end
  src.performed as perf then {
    perf.end as e -> tgt.ende = e "SetBestrahlungEnde";
  } "MapBestrahlungEnde";
  // Applikationsart: aus Procedure.code oder MII Extension
  // Perkutan vs. Kontakt (Brachytherapie)
  // OPS 8-522 = Perkutane Hochvoltstrahlentherapie
  // OPS 8-524 = Brachytherapie
  src.code as code then {
    code.coding as c where code.startsWith('8-522') -> tgt.applikationsart = 'P' "ApplikationsartPerkutan";
    code.coding as c where code.startsWith('8-524') -> tgt.applikationsart = 'K' "ApplikationsartKontakt";
  } "MapApplikationsart";
  // Zielgebiet: aus Procedure.bodySite.coding
  src.bodySite as bs then {
    bs.coding as c then {
      c.display as d -> tgt.zielgebiet = d "SetZielgebiet";
    } "ExtractZielgebietCoding";
  } "MapZielgebiet";
  // Seite des Zielgebiets: aus bodySite-Extension Seitenlokalisation
  // oder abgeleitet aus bodySite-SNOMED-Code (z.B. "Left breast")
  src.bodySite as bs then {
    bs.extension as ext where url = 'https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-ex-onko-strahlentherapie-bestrahlung-seitenlokalisation' then {
      ext.value as val then {
        val.coding as c -> tgt.seiteZielgebiet = translate(c, 'https://www.senologie.org/fhir/ConceptMap/cm-sct-to-obds-seitenlokalisation', 'code') "TranslateSeiteZielgebiet";
      } "ExtractSeiteCoding";
    } "MapSeiteExtension";
  } "MapSeiteZielgebiet";
  // Gesamtdosis: 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.gesamtdosis = v "SetGesamtdosis";
      val.unit as u -> tgt.gesamtdosisEinheit = u "SetGesamtdosisEinheit";
    } "ExtractGesamtdosisValue";
  } "MapGesamtdosis";
  // Einzeldosis: 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.einzeldosis = v "SetEinzeldosis";
      val.unit as u -> tgt.einzeldosisEinheit = u "SetEinzeldosisEinheit";
    } "ExtractEinzeldosisValue";
  } "MapEinzeldosis";
  // Boost: aus MII Onko Boost-Extension
  // J=ja, N=nein, SIB=simultan integrierter Boost
  src.extension as ext where url = 'https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-ex-onko-strahlentherapie-bestrahlung-boost' then {
    ext.value as val then {
      val.coding as c -> tgt.boost = (c.code) "SetBoost";
    } "ExtractBoostCoding";
  } "MapBoost";
}