Implementation Guide
E-T-Rezept Datenaustausch
Version 1.1.0-ballot-1 - ballot

StructureMap: E-T-Rezept Structure Map for KBV Ingredient Medication

Official URL: https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVIngredientMedication Version: 1.1.0-ballot-1
Draft as of 2025-07-07 Computable Name: ERPTPrescriptionStructureMapKBVIngredientMedication

Maps KBV-Ingredient ERP Medication to BfArM T-Prescription Medication format

map "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVIngredientMedication" = "ERPTPrescriptionStructureMapKBVIngredientMedication"

// Maps KBV-Ingredient ERP Medication to BfArM T-Prescription Medication format

uses "http://hl7.org/fhir/StructureDefinition/Medication" alias kbvMedicationIngredient as source
uses "http://hl7.org/fhir/StructureDefinition/Medication" alias bfarmMedication as target

// Mapping-Anweisungen zur Transformation von KBV Wirkstoff-Medikamenten zu BfArM T-Prescription Format
group ERPTPrescriptionStructureMapKBVIngredientMedication(source kbvMedicationIngredient : kbvMedicationIngredient, target bfarmMedication : bfarmMedication) {
  kbvMedicationIngredient.id as IdVar -> bfarmMedication.id = IdVar "medicationId"; // Übernimmt die eindeutige Medication-ID unverändert
  kbvMedicationIngredient.form as formVar -> bfarmMedication.form = formVar "medicationForm"; // Kopiert die gewünschte Darreichungsform für die Wirkstoff-Verordnung (Kapseln, Salbe, Lösung, etc.)
  kbvMedicationIngredient.amount as amountVar -> bfarmMedication.amount as tgtAmountVar then {
    amountVar.denominator as amountDenominatorVar -> tgtAmountVar.denominator = amountDenominatorVar "medicationAmountDenominator"; // Kopiert den Nenner der Mengenangabe (z.B. '1' für 'pro Herstellung')
    amountVar.numerator as amountNumeratorVar -> tgtAmountVar.numerator as tgtAmountNumeratorVar then {
      amountNumeratorVar.extension as amountNumExtVar -> tgtAmountNumeratorVar.extension as tgtAmountNumExtVar then {
        amountNumExtVar where url='https://fhir.kbv.de/StructureDefinition/KBV_EX_ERP_Medication_PackagingSize' -> tgtAmountNumExtVar.url = 'https://gematik.de/fhir/epa-medication/StructureDefinition/medication-packaging-size-extension' then {
          amountNumExtVar.value as extValVar -> tgtAmountNumExtVar.value = extValVar "copyExtensionValue"; // Übernimmt den Packungsgrößenwert
        } "copyPackagingSizeExtensionUrl"; // Wandelt KBV-Packungsgrößen-Extension in gematik EPA-Medication Extension um
      } "medicationAmountExt"; // Transformiert Packungsgrößen-Extensions von KBV- zu gematik-Format für Wirkstoff Verordnung
      amountNumeratorVar.value as amountNumeratorValueVar -> tgtAmountNumeratorVar.value = amountNumeratorValueVar "medicationAmountNumeratorValue"; // Kopiert den numerischen Wert der Gesamtmenge (z.B. '100' für 100g Salbe)
      amountNumeratorVar.unit as amountNumeratorUnitVar -> tgtAmountNumeratorVar.unit = amountNumeratorUnitVar "medicationAmountNumeratorUnit"; // Übernimmt die Mengeneinheit (g, ml, Stück, etc.)
      amountNumeratorVar.system as amountNumeratorSystemVar -> tgtAmountNumeratorVar.system = amountNumeratorSystemVar "medicationAmountNumeratorSystem"; // Kopiert das Codesystem für die Mengeneinheit (meist UCUM)
      amountNumeratorVar.code as amountNumeratorCodeVar -> tgtAmountNumeratorVar.code = amountNumeratorCodeVar "medicationAmountNumeratorCode"; // Übernimmt den standardisierten Code für die Mengeneinheit
    } "medicationAmountNumerator"; // Mappt die detaillierte Mengenangabe
  } "medicationAmount"; // Mappt die Gesamtmenge der herzustellenden Wirkstoff-Verordnung
  kbvMedicationIngredient.ingredient as ingredientVar -> bfarmMedication.ingredient = ingredientVar "medicationIngredient"; // Kopiert die detaillierten Wirkstoffinformationen mit Konzentrationen und Mengenangaben
}