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

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

title: Senologie Encounter + Condition to IRegG Entlassung + DiagnoseBrustimplantat status: draft

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

// title: Senologie Encounter + Condition to IRegG Entlassung + DiagnoseBrustimplantat
// status: draft

uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as source
uses "http://hl7.org/fhir/StructureDefinition/Encounter" alias Encounter as source
uses "http://hl7.org/fhir/StructureDefinition/Condition" alias Condition as source
uses "https://www.senologie.org/fhir/StructureDefinition/ireg-brustimplantat-meldung" alias IRegMeldung as target

// Known limitation: Sub-groups use `target tgt : BackboneElement` because FML
// has no syntax to declare the specific Logical Model sub-path when a parent
// group passes a BackboneElement slice (e.g., `tgt.entlassung as entl then ...`).
// The IG Publisher resolves target paths against BackboneElement, producing
// SM_TARGET_PATH / SM_SOURCE_PATH errors. The element names are correct and
// match the IRegG Brustimplantat Logical Model. These errors are cosmetic.
// ============================================================================
// Entlassung: Encounter + Condition -> ENT_* + DBI_*
// Entlassungsdaten und Brustimplantat-spezifische Entlassungsdiagnosen.
// ENT_Datum kommt aus Encounter.period.end.
// ENT_GrundSchluessel kommt aus Encounter.hospitalization.dischargeDisposition.
// DBI_* Diagnosen kommen aus Condition-Ressourcen im Bundle (ICD-10-GM).
// ============================================================================
group MapEntlassung(source src : Encounter, target tgt : BackboneElement) {
  // --- ENT_* Entlassungsdaten ---
  // ENT_Datum: aus Encounter.period.end (Entlassungsdatum)
  src.period as period then {
    period.end as e -> tgt.datum = e "SetEntlassungsDatum";
  } "MapEntlassungsDatum";
  // ENT_GrundSchluessel: aus Encounter.hospitalization.dischargeDisposition
  // 2-stelliger Entlassungs-/Verlegungsgrund nach §301 SGB V
  src.hospitalization as hosp then {
    hosp.dischargeDisposition as dd then {
      dd.coding as c where system = 'http://fhir.de/CodeSystem/dkgev/Entlassungsgrund' then {
        c.code as cd -> tgt.grundSchluessel = cd "SetEntlassungsgrund";
      } "MapEntlassungsgrundCoding";
      // Fallback: beliebiges Coding
      dd.coding as c where system != 'http://fhir.de/CodeSystem/dkgev/Entlassungsgrund' then {
        c.code as cd -> tgt.grundSchluessel = cd "SetEntlassungsgrundFallback";
      } "MapEntlassungsgrundFallbackCoding";
    } "MapDischargeDisposition";
  } "MapHospitalization";
}