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

: E-T-Rezept Structure Map for KBV Compounding Medication - XML Representation

Draft as of 2025-07-07

Raw xml | Download


<StructureMap xmlns="http://hl7.org/fhir">
  <id value="ERPTPrescriptionStructureMapKBVCompoundingMedication"/>
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: StructureMap ERPTPrescriptionStructureMapKBVCompoundingMedication</b></p><a name="ERPTPrescriptionStructureMapKBVCompoundingMedication"> </a><a name="hcERPTPrescriptionStructureMapKBVCompoundingMedication"> </a><pre class="fml">
<b>map</b><span style="color: navy"> &quot;</span>https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVCompoundingMedication<span style="color: navy">&quot; = &quot;</span>ERPTPrescriptionStructureMapKBVCompoundingMedication<span style="color: navy">&quot;

</span><span style="color: navy">// </span><span style="color: green">Mapping-Anweisungen zur Transformation von KBV Rezeptur-Medikamenten zu BfArM T-Prescription Format</span>

<b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/R4/medication.html" title="Medication">http://hl7.org/fhir/StructureDefinition/Medication</a><span style="color: navy">&quot; </span><b>alias </b>kbvMedicationCompounding <b>as </b><b>source</b>
<b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/R4/medication.html" title="Medication">http://hl7.org/fhir/StructureDefinition/Medication</a><span style="color: navy">&quot; </span><b>alias </b>bfarmMedication <b>as </b><b>target</b>

<span style="color: navy">// </span><span style="color: green">Mapping-Anweisungen zur Transformation von KBV Rezeptur-Medikamenten zu BfArM T-Prescription Format</span>
<b>group </b>ERPTPrescriptionStructureMapKBVCompoundingMedication<span style="color: navy">(</span><b>source</b> <span style="color: maroon">kbvMedicationCompounding</span><span style="color: navy"> : </span>kbvMedicationCompounding, <b>target</b> <span style="color: maroon">bfarmMedication</span><span style="color: navy"> : </span>bfarmMedication<span style="color: navy">)</span><span style="color: navy"> {
</span>  kbvMedicationCompounding.extension<b> as </b><span style="color: maroon">extVar</span><span style="color: navy"><b> -&gt; </b></span>bfarmMedication.extension<b> as </b><span style="color: maroon">tgtExtVar</span><b> then</b><span style="color: navy"> {
</span>    extVar<b> as </b><span style="color: maroon">extMatchVar</span><b> where </b>url='https://fhir.kbv.de/StructureDefinition/KBV_EX_ERP_Medication_Packaging'<span style="color: navy"><b> -&gt; </b></span>tgtExtVar.url = <span style="color: blue">'https://gematik.de/fhir/epa-medication/StructureDefinition/medication-formulation-packaging-extension'</span><b> then</b><span style="color: navy"> {
</span>      extMatchVar.value<b> as </b><span style="color: maroon">extValVar</span><span style="color: navy"><b> -&gt; </b></span>tgtExtVar.value = <span style="color: maroon">extValVar</span> <i>&quot;copyExtensionValue&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Übernimmt den Verpackungswert für die Rezeptur</span>
    <span style="color: navy">}</span> <i>&quot;copyFormulaPackagingExtensionUrl&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Transformiert KBV-Verpackungs-Extension in gematik-Formulierungs-Verpackungs-Extension</span>
  <span style="color: navy">}</span> <i>&quot;medicationExt&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Mappt Rezeptur-spezifische Extensions von KBV- zu BfArM-Format</span>
  kbvMedicationCompounding.id<b> as </b><span style="color: maroon">IdVar</span><span style="color: navy"><b> -&gt; </b></span>bfarmMedication.id = <span style="color: maroon">IdVar</span> <i>&quot;medicationId&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Übernimmt die eindeutige Medication-ID unverändert</span>
  kbvMedicationCompounding.code<b> as </b><span style="color: maroon">srcCodeVar</span><span style="color: navy"><b> -&gt; </b></span>bfarmMedication.code<b> as </b><span style="color: maroon">tgtCodeVar</span><b> then</b><span style="color: navy"> {
</span>    srcCodeVar.text<b> as </b><span style="color: maroon">srcCodeTextVar</span><span style="color: navy"><b> -&gt; </b></span>tgtCodeVar.text = <span style="color: maroon">srcCodeTextVar</span> <i>&quot;medicationCodeText&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Kopiert die Bezeichnung der Rezeptur (z.B. 'Hydrocortison-Salbe 1%')</span>
  <span style="color: navy">}</span> <i>&quot;medicationCode&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Mappt den Rezeptur-Code mit Bezeichnung</span>
  kbvMedicationCompounding.form<b> as </b><span style="color: maroon">formVar</span><span style="color: navy"><b> -&gt; </b></span>bfarmMedication.form = <span style="color: maroon">formVar</span> <i>&quot;medicationForm&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Übernimmt die Darreichungsform der Rezeptur (Salbe, Creme, Kapseln, etc.)</span>
  kbvMedicationCompounding.amount<b> as </b><span style="color: maroon">amountVar</span><span style="color: navy"><b> -&gt; </b></span>bfarmMedication.amount<b> as </b><span style="color: maroon">tgtAmountVar</span><b> then</b><span style="color: navy"> {
</span>    amountVar.denominator<b> as </b><span style="color: maroon">amountDenominatorVar</span><span style="color: navy"><b> -&gt; </b></span>tgtAmountVar.denominator = <span style="color: maroon">amountDenominatorVar</span> <i>&quot;medicationAmountDenominator&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Kopiert den Nenner der Mengenangabe (z.B. '1' für 'pro Rezeptur')</span>
    amountVar.numerator<b> as </b><span style="color: maroon">amountNumeratorVar</span><span style="color: navy"><b> -&gt; </b></span>tgtAmountVar.numerator<b> as </b><span style="color: maroon">tgtAmountNumeratorVar</span><b> then</b><span style="color: navy"> {
</span>      amountNumeratorVar.extension<b> as </b><span style="color: maroon">amountNumExtVar</span><span style="color: navy"><b> -&gt; </b></span>tgtAmountNumeratorVar.extension<b> as </b><span style="color: maroon">tgtAmountNumExtVar</span><b> then</b><span style="color: navy"> {
</span>        amountNumExtVar<b> where </b>url='https://fhir.kbv.de/StructureDefinition/KBV_EX_ERP_Medication_PackagingSize'<span style="color: navy"><b> -&gt; </b></span>tgtAmountNumExtVar.url = <span style="color: blue">'https://gematik.de/fhir/epa-medication/StructureDefinition/medication-packaging-size-extension'</span> <i>&quot;copyPackagingSizeExtensionUrl&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Wandelt KBV-Packungsgrößen-Extension in gematik EPA-Medication Extension um</span>
        amountNumExtVar.value<b> as </b><span style="color: maroon">extValVar</span><span style="color: navy"><b> -&gt; </b></span>tgtAmountNumExtVar.value = <span style="color: maroon">extValVar</span> <i>&quot;copyExtensionValue&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Übernimmt den Packungsgrößenwert für die Rezeptur</span>
      <span style="color: navy">}</span> <i>&quot;medicationAmountExt&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Transformiert Packungsgrößen-Extensions für Rezepturen</span>
      amountNumeratorVar.value<b> as </b><span style="color: maroon">amountNumeratorValueVar</span><span style="color: navy"><b> -&gt; </b></span>tgtAmountNumeratorVar.value = <span style="color: maroon">amountNumeratorValueVar</span> <i>&quot;medicationAmountNumeratorValue&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Kopiert den numerischen Wert der Gesamtmenge (z.B. '50' für 50g Salbe)</span>
      amountNumeratorVar.unit<b> as </b><span style="color: maroon">amountNumeratorUnitVar</span><span style="color: navy"><b> -&gt; </b></span>tgtAmountNumeratorVar.unit = <span style="color: maroon">amountNumeratorUnitVar</span> <i>&quot;medicationAmountNumeratorUnit&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Übernimmt die Mengeneinheit für die Rezeptur (g, ml, Stück, etc.)</span>
      amountNumeratorVar.system<b> as </b><span style="color: maroon">amountNumeratorSystemVar</span><span style="color: navy"><b> -&gt; </b></span>tgtAmountNumeratorVar.system = <span style="color: maroon">amountNumeratorSystemVar</span> <i>&quot;medicationAmountNumeratorSystem&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Kopiert das Codesystem für die Mengeneinheit (meist UCUM)</span>
      amountNumeratorVar.code<b> as </b><span style="color: maroon">amountNumeratorCodeVar</span><span style="color: navy"><b> -&gt; </b></span>tgtAmountNumeratorVar.code = <span style="color: maroon">amountNumeratorCodeVar</span> <i>&quot;medicationAmountNumeratorCode&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Übernimmt den standardisierten Code für die Mengeneinheit</span>
    <span style="color: navy">}</span> <i>&quot;medicationAmountNumerator&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Mappt die detaillierte Mengenangabe der Rezeptur</span>
  <span style="color: navy">}</span> <i>&quot;medicationAmount&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Mappt die Gesamtmenge der herzustellenden Rezeptur</span>
  kbvMedicationCompounding.ingredient<b> as </b><span style="color: maroon">ingredientVar</span><span style="color: navy"><b> -&gt; </b></span>bfarmMedication.ingredient<b> as </b><span style="color: maroon">tgtIngredientVar</span><b> then</b><span style="color: navy"> {
</span>    ingredientVar.item<b> as </b><span style="color: maroon">IngredientItemValueVar</span><span style="color: navy"><b> -&gt; </b></span>tgtIngredientVar.item = <span style="color: maroon">IngredientItemValueVar</span> <i>&quot;medicationIngredientItemValue&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Kopiert die Referenz oder den Code des Rezeptur-Bestandteils</span>
    ingredientVar.extension<b> as </b><span style="color: maroon">IngredientExtVar</span><span style="color: navy"><b> -&gt; </b></span>tgtIngredientVar.extension<b> as </b><span style="color: maroon">tgtIngredientExtVar</span><b> then</b><span style="color: navy"> {
</span>      IngredientExtVar<b> where </b>url='https://fhir.kbv.de/StructureDefinition/KBV_EX_ERP_Medication_Ingredient_Form'<span style="color: navy"><b> -&gt; </b></span>tgtIngredientExtVar.url = <span style="color: blue">'https://gematik.de/fhir/epa-medication/StructureDefinition/medication-ingredient-darreichungsform-extension'</span><b> then</b><span style="color: navy"> {
</span>        IngredientExtVar.value<b> as </b><span style="color: maroon">extValVar</span><span style="color: navy"><b> -&gt; </b></span>tgtIngredientExtVar.value = <span style="color: maroon">extValVar</span> <i>&quot;copyExtensionValue&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Übernimmt die Darreichungsform des Bestandteils</span>
      <span style="color: navy">}</span> <i>&quot;copyIngredientFormExtensionUrl&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Wandelt KBV-Bestandteil-Darreichungsform-Extension in gematik-Format um</span>
    <span style="color: navy">}</span> <i>&quot;medicationIngredientExt&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Transformiert Bestandteil-spezifische Extensions</span>
    ingredientVar.strength<b> as </b><span style="color: maroon">IngredientStrengthValueVar</span><span style="color: navy"><b> -&gt; </b></span>tgtIngredientVar.strength<b> as </b><span style="color: maroon">IngredientStrengthValueVar</span><b> then</b><span style="color: navy"> {
</span>      IngredientStrengthValueVar.denominator<b> as </b><span style="color: maroon">ingredientDenominatorVar</span><span style="color: navy"><b> -&gt; </b></span>IngredientStrengthValueVar.denominator = <span style="color: maroon">ingredientDenominatorVar</span> <i>&quot;medicationIngredientDenominator&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Kopiert den Nenner für die Stärkeangabe (Bezugsmenge)</span>
      IngredientStrengthValueVar.numerator<b> as </b><span style="color: maroon">ingredientNumeratorVar</span><span style="color: navy"><b> -&gt; </b></span>IngredientStrengthValueVar.numerator = <span style="color: maroon">ingredientNumeratorVar</span> <i>&quot;medicationIngredientNumerator&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Kopiert den Zähler für die Stärkeangabe (Wirkstoffmenge)</span>
      IngredientStrengthValueVar.extension<b> as </b><span style="color: maroon">IngredientStrExtVar</span><span style="color: navy"><b> -&gt; </b></span>IngredientStrengthValueVar.extension<b> as </b><span style="color: maroon">tgtIngredientStrExtVar</span><b> then</b><span style="color: navy"> {
</span>        IngredientStrExtVar<b> where </b>url='https://fhir.kbv.de/StructureDefinition/KBV_EX_ERP_Medication_Ingredient_Amount'<span style="color: navy"><b> -&gt; </b></span>tgtIngredientStrExtVar.url = <span style="color: blue">'https://gematik.de/fhir/epa-medication/StructureDefinition/medication-ingredient-amount-extension'</span><b> then</b><span style="color: navy"> {
</span>          IngredientStrExtVar.value<b> as </b><span style="color: maroon">extValVar</span><span style="color: navy"><b> -&gt; </b></span>tgtIngredientStrExtVar.value = <span style="color: maroon">extValVar</span> <i>&quot;copyExtensionValue&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Übernimmt die Mengenangabe des Bestandteils</span>
        <span style="color: navy">}</span> <i>&quot;copyIngredientAmountExtensionUrl&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Wandelt KBV-Bestandteil-Mengen-Extension in gematik-Format um</span>
      <span style="color: navy">}</span> <i>&quot;medicationIngredientStrengthExt&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Transformiert Bestandteil-Mengen-Extensions</span>
    <span style="color: navy">}</span> <i>&quot;medicationIngredientStrength&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Mappt die Stärke/Konzentration des Bestandteils in der Rezeptur</span>
  <span style="color: navy">}</span> <i>&quot;medicationIngredient&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Mappt die Bestandteile der Rezeptur mit detaillierten Mengen- und Stärkeangaben</span>
<span style="color: navy">}

</span></pre></div>
  </text>
  <url
       value="https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVCompoundingMedication"/>
  <version value="1.1.0-ballot-1"/>
  <name value="ERPTPrescriptionStructureMapKBVCompoundingMedication"/>
  <title value="E-T-Rezept Structure Map for KBV Compounding Medication"/>
  <status value="draft"/>
  <experimental value="false"/>
  <date value="2025-07-07"/>
  <publisher value="gematik GmbH"/>
  <contact>
    <name value="gematik GmbH"/>
    <telecom>
      <system value="url"/>
      <value value="https://gematik.de"/>
    </telecom>
    <telecom>
      <system value="email"/>
      <value value="erp-umsetzung@gematik.de"/>
    </telecom>
  </contact>
  <description
               value="Mapping-Anweisungen zur Transformation von KBV Rezeptur-Medikamenten zu BfArM T-Prescription Format"/>
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166"/>
      <code value="DE"/>
      <display value="Germany"/>
    </coding>
  </jurisdiction>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Medication"/>
    <mode value="source"/>
    <alias value="kbvMedicationCompounding"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Medication"/>
    <mode value="target"/>
    <alias value="bfarmMedication"/>
  </structure>
  <group>
    <name value="ERPTPrescriptionStructureMapKBVCompoundingMedication"/>
    <typeMode value="none"/>
    <documentation
                   value="Mapping-Anweisungen zur Transformation von KBV Rezeptur-Medikamenten zu BfArM T-Prescription Format"/>
    <input>
      <name value="kbvMedicationCompounding"/>
      <type value="kbvMedicationCompounding"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bfarmMedication"/>
      <type value="bfarmMedication"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="medicationExt"/>
      <source>
        <context value="kbvMedicationCompounding"/>
        <element value="extension"/>
        <variable value="extVar"/>
      </source>
      <target>
        <context value="bfarmMedication"/>
        <contextType value="variable"/>
        <element value="extension"/>
        <variable value="tgtExtVar"/>
      </target>
      <rule>
        <name value="copyFormulaPackagingExtensionUrl"/>
        <source>
          <context value="extVar"/>
          <variable value="extMatchVar"/>
          <condition
                     value="url='https://fhir.kbv.de/StructureDefinition/KBV_EX_ERP_Medication_Packaging'"/>
        </source>
        <target>
          <context value="tgtExtVar"/>
          <contextType value="variable"/>
          <element value="url"/>
          <transform value="copy"/>
          <parameter>
            <valueString
                         value="https://gematik.de/fhir/epa-medication/StructureDefinition/medication-formulation-packaging-extension"/>
          </parameter>
        </target>
        <rule>
          <name value="copyExtensionValue"/>
          <source>
            <context value="extMatchVar"/>
            <element value="value"/>
            <variable value="extValVar"/>
          </source>
          <target>
            <context value="tgtExtVar"/>
            <contextType value="variable"/>
            <element value="value"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="extValVar"/>
            </parameter>
          </target>
          <documentation
                         value="Übernimmt den Verpackungswert für die Rezeptur"/>
        </rule>
        <documentation
                       value="Transformiert KBV-Verpackungs-Extension in gematik-Formulierungs-Verpackungs-Extension"/>
      </rule>
      <documentation
                     value="Mappt Rezeptur-spezifische Extensions von KBV- zu BfArM-Format"/>
    </rule>
    <rule>
      <name value="medicationId"/>
      <source>
        <context value="kbvMedicationCompounding"/>
        <element value="id"/>
        <variable value="IdVar"/>
      </source>
      <target>
        <context value="bfarmMedication"/>
        <contextType value="variable"/>
        <element value="id"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="IdVar"/>
        </parameter>
      </target>
      <documentation
                     value="Übernimmt die eindeutige Medication-ID unverändert"/>
    </rule>
    <rule>
      <name value="medicationCode"/>
      <source>
        <context value="kbvMedicationCompounding"/>
        <element value="code"/>
        <variable value="srcCodeVar"/>
      </source>
      <target>
        <context value="bfarmMedication"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="tgtCodeVar"/>
      </target>
      <rule>
        <name value="medicationCodeText"/>
        <source>
          <context value="srcCodeVar"/>
          <element value="text"/>
          <variable value="srcCodeTextVar"/>
        </source>
        <target>
          <context value="tgtCodeVar"/>
          <contextType value="variable"/>
          <element value="text"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="srcCodeTextVar"/>
          </parameter>
        </target>
        <documentation
                       value="Kopiert die Bezeichnung der Rezeptur (z.B. 'Hydrocortison-Salbe 1%')"/>
      </rule>
      <documentation value="Mappt den Rezeptur-Code mit Bezeichnung"/>
    </rule>
    <rule>
      <name value="medicationForm"/>
      <source>
        <context value="kbvMedicationCompounding"/>
        <element value="form"/>
        <variable value="formVar"/>
      </source>
      <target>
        <context value="bfarmMedication"/>
        <contextType value="variable"/>
        <element value="form"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="formVar"/>
        </parameter>
      </target>
      <documentation
                     value="Übernimmt die Darreichungsform der Rezeptur (Salbe, Creme, Kapseln, etc.)"/>
    </rule>
    <rule>
      <name value="medicationAmount"/>
      <source>
        <context value="kbvMedicationCompounding"/>
        <element value="amount"/>
        <variable value="amountVar"/>
      </source>
      <target>
        <context value="bfarmMedication"/>
        <contextType value="variable"/>
        <element value="amount"/>
        <variable value="tgtAmountVar"/>
      </target>
      <rule>
        <name value="medicationAmountDenominator"/>
        <source>
          <context value="amountVar"/>
          <element value="denominator"/>
          <variable value="amountDenominatorVar"/>
        </source>
        <target>
          <context value="tgtAmountVar"/>
          <contextType value="variable"/>
          <element value="denominator"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="amountDenominatorVar"/>
          </parameter>
        </target>
        <documentation
                       value="Kopiert den Nenner der Mengenangabe (z.B. '1' für 'pro Rezeptur')"/>
      </rule>
      <rule>
        <name value="medicationAmountNumerator"/>
        <source>
          <context value="amountVar"/>
          <element value="numerator"/>
          <variable value="amountNumeratorVar"/>
        </source>
        <target>
          <context value="tgtAmountVar"/>
          <contextType value="variable"/>
          <element value="numerator"/>
          <variable value="tgtAmountNumeratorVar"/>
        </target>
        <rule>
          <name value="medicationAmountExt"/>
          <source>
            <context value="amountNumeratorVar"/>
            <element value="extension"/>
            <variable value="amountNumExtVar"/>
          </source>
          <target>
            <context value="tgtAmountNumeratorVar"/>
            <contextType value="variable"/>
            <element value="extension"/>
            <variable value="tgtAmountNumExtVar"/>
          </target>
          <rule>
            <name value="copyPackagingSizeExtensionUrl"/>
            <source>
              <context value="amountNumExtVar"/>
              <condition
                         value="url='https://fhir.kbv.de/StructureDefinition/KBV_EX_ERP_Medication_PackagingSize'"/>
            </source>
            <target>
              <context value="tgtAmountNumExtVar"/>
              <contextType value="variable"/>
              <element value="url"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="https://gematik.de/fhir/epa-medication/StructureDefinition/medication-packaging-size-extension"/>
              </parameter>
            </target>
            <documentation
                           value="Wandelt KBV-Packungsgrößen-Extension in gematik EPA-Medication Extension um"/>
          </rule>
          <rule>
            <name value="copyExtensionValue"/>
            <source>
              <context value="amountNumExtVar"/>
              <element value="value"/>
              <variable value="extValVar"/>
            </source>
            <target>
              <context value="tgtAmountNumExtVar"/>
              <contextType value="variable"/>
              <element value="value"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="extValVar"/>
              </parameter>
            </target>
            <documentation
                           value="Übernimmt den Packungsgrößenwert für die Rezeptur"/>
          </rule>
          <documentation
                         value="Transformiert Packungsgrößen-Extensions für Rezepturen"/>
        </rule>
        <rule>
          <name value="medicationAmountNumeratorValue"/>
          <source>
            <context value="amountNumeratorVar"/>
            <element value="value"/>
            <variable value="amountNumeratorValueVar"/>
          </source>
          <target>
            <context value="tgtAmountNumeratorVar"/>
            <contextType value="variable"/>
            <element value="value"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="amountNumeratorValueVar"/>
            </parameter>
          </target>
          <documentation
                         value="Kopiert den numerischen Wert der Gesamtmenge (z.B. '50' für 50g Salbe)"/>
        </rule>
        <rule>
          <name value="medicationAmountNumeratorUnit"/>
          <source>
            <context value="amountNumeratorVar"/>
            <element value="unit"/>
            <variable value="amountNumeratorUnitVar"/>
          </source>
          <target>
            <context value="tgtAmountNumeratorVar"/>
            <contextType value="variable"/>
            <element value="unit"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="amountNumeratorUnitVar"/>
            </parameter>
          </target>
          <documentation
                         value="Übernimmt die Mengeneinheit für die Rezeptur (g, ml, Stück, etc.)"/>
        </rule>
        <rule>
          <name value="medicationAmountNumeratorSystem"/>
          <source>
            <context value="amountNumeratorVar"/>
            <element value="system"/>
            <variable value="amountNumeratorSystemVar"/>
          </source>
          <target>
            <context value="tgtAmountNumeratorVar"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="amountNumeratorSystemVar"/>
            </parameter>
          </target>
          <documentation
                         value="Kopiert das Codesystem für die Mengeneinheit (meist UCUM)"/>
        </rule>
        <rule>
          <name value="medicationAmountNumeratorCode"/>
          <source>
            <context value="amountNumeratorVar"/>
            <element value="code"/>
            <variable value="amountNumeratorCodeVar"/>
          </source>
          <target>
            <context value="tgtAmountNumeratorVar"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="amountNumeratorCodeVar"/>
            </parameter>
          </target>
          <documentation
                         value="Übernimmt den standardisierten Code für die Mengeneinheit"/>
        </rule>
        <documentation
                       value="Mappt die detaillierte Mengenangabe der Rezeptur"/>
      </rule>
      <documentation
                     value="Mappt die Gesamtmenge der herzustellenden Rezeptur"/>
    </rule>
    <rule>
      <name value="medicationIngredient"/>
      <source>
        <context value="kbvMedicationCompounding"/>
        <element value="ingredient"/>
        <variable value="ingredientVar"/>
      </source>
      <target>
        <context value="bfarmMedication"/>
        <contextType value="variable"/>
        <element value="ingredient"/>
        <variable value="tgtIngredientVar"/>
      </target>
      <rule>
        <name value="medicationIngredientItemValue"/>
        <source>
          <context value="ingredientVar"/>
          <element value="item"/>
          <variable value="IngredientItemValueVar"/>
        </source>
        <target>
          <context value="tgtIngredientVar"/>
          <contextType value="variable"/>
          <element value="item"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="IngredientItemValueVar"/>
          </parameter>
        </target>
        <documentation
                       value="Kopiert die Referenz oder den Code des Rezeptur-Bestandteils"/>
      </rule>
      <rule>
        <name value="medicationIngredientExt"/>
        <source>
          <context value="ingredientVar"/>
          <element value="extension"/>
          <variable value="IngredientExtVar"/>
        </source>
        <target>
          <context value="tgtIngredientVar"/>
          <contextType value="variable"/>
          <element value="extension"/>
          <variable value="tgtIngredientExtVar"/>
        </target>
        <rule>
          <name value="copyIngredientFormExtensionUrl"/>
          <source>
            <context value="IngredientExtVar"/>
            <condition
                       value="url='https://fhir.kbv.de/StructureDefinition/KBV_EX_ERP_Medication_Ingredient_Form'"/>
          </source>
          <target>
            <context value="tgtIngredientExtVar"/>
            <contextType value="variable"/>
            <element value="url"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="https://gematik.de/fhir/epa-medication/StructureDefinition/medication-ingredient-darreichungsform-extension"/>
            </parameter>
          </target>
          <rule>
            <name value="copyExtensionValue"/>
            <source>
              <context value="IngredientExtVar"/>
              <element value="value"/>
              <variable value="extValVar"/>
            </source>
            <target>
              <context value="tgtIngredientExtVar"/>
              <contextType value="variable"/>
              <element value="value"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="extValVar"/>
              </parameter>
            </target>
            <documentation
                           value="Übernimmt die Darreichungsform des Bestandteils"/>
          </rule>
          <documentation
                         value="Wandelt KBV-Bestandteil-Darreichungsform-Extension in gematik-Format um"/>
        </rule>
        <documentation
                       value="Transformiert Bestandteil-spezifische Extensions"/>
      </rule>
      <rule>
        <name value="medicationIngredientStrength"/>
        <source>
          <context value="ingredientVar"/>
          <element value="strength"/>
          <variable value="IngredientStrengthValueVar"/>
        </source>
        <target>
          <context value="tgtIngredientVar"/>
          <contextType value="variable"/>
          <element value="strength"/>
          <variable value="IngredientStrengthValueVar"/>
        </target>
        <rule>
          <name value="medicationIngredientDenominator"/>
          <source>
            <context value="IngredientStrengthValueVar"/>
            <element value="denominator"/>
            <variable value="ingredientDenominatorVar"/>
          </source>
          <target>
            <context value="IngredientStrengthValueVar"/>
            <contextType value="variable"/>
            <element value="denominator"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="ingredientDenominatorVar"/>
            </parameter>
          </target>
          <documentation
                         value="Kopiert den Nenner für die Stärkeangabe (Bezugsmenge)"/>
        </rule>
        <rule>
          <name value="medicationIngredientNumerator"/>
          <source>
            <context value="IngredientStrengthValueVar"/>
            <element value="numerator"/>
            <variable value="ingredientNumeratorVar"/>
          </source>
          <target>
            <context value="IngredientStrengthValueVar"/>
            <contextType value="variable"/>
            <element value="numerator"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="ingredientNumeratorVar"/>
            </parameter>
          </target>
          <documentation
                         value="Kopiert den Zähler für die Stärkeangabe (Wirkstoffmenge)"/>
        </rule>
        <rule>
          <name value="medicationIngredientStrengthExt"/>
          <source>
            <context value="IngredientStrengthValueVar"/>
            <element value="extension"/>
            <variable value="IngredientStrExtVar"/>
          </source>
          <target>
            <context value="IngredientStrengthValueVar"/>
            <contextType value="variable"/>
            <element value="extension"/>
            <variable value="tgtIngredientStrExtVar"/>
          </target>
          <rule>
            <name value="copyIngredientAmountExtensionUrl"/>
            <source>
              <context value="IngredientStrExtVar"/>
              <condition
                         value="url='https://fhir.kbv.de/StructureDefinition/KBV_EX_ERP_Medication_Ingredient_Amount'"/>
            </source>
            <target>
              <context value="tgtIngredientStrExtVar"/>
              <contextType value="variable"/>
              <element value="url"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="https://gematik.de/fhir/epa-medication/StructureDefinition/medication-ingredient-amount-extension"/>
              </parameter>
            </target>
            <rule>
              <name value="copyExtensionValue"/>
              <source>
                <context value="IngredientStrExtVar"/>
                <element value="value"/>
                <variable value="extValVar"/>
              </source>
              <target>
                <context value="tgtIngredientStrExtVar"/>
                <contextType value="variable"/>
                <element value="value"/>
                <transform value="copy"/>
                <parameter>
                  <valueId value="extValVar"/>
                </parameter>
              </target>
              <documentation
                             value="Übernimmt die Mengenangabe des Bestandteils"/>
            </rule>
            <documentation
                           value="Wandelt KBV-Bestandteil-Mengen-Extension in gematik-Format um"/>
          </rule>
          <documentation value="Transformiert Bestandteil-Mengen-Extensions"/>
        </rule>
        <documentation
                       value="Mappt die Stärke/Konzentration des Bestandteils in der Rezeptur"/>
      </rule>
      <documentation
                     value="Mappt die Bestandteile der Rezeptur mit detaillierten Mengen- und Stärkeangaben"/>
    </rule>
  </group>
</StructureMap>