TIFlow - Datenaustausch BfArM Webdienst
Version 2.0.0-ballot.1 - ci-build

## : E-T-Rezept Structure Map for CarbonCopy - JSON Representation

Draft as of 2026-05-26

Raw json | Download

    {
      "resourceType" : "StructureMap",
      "id" : "ERPTPrescriptionStructureMapCarbonCopy",
      "text" : {
        "status" : "generated",
        "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap ERPTPrescriptionStructureMapCarbonCopy</b></p><a name=\"ERPTPrescriptionStructureMapCarbonCopy\"> </a><a name=\"hcERPTPrescriptionStructureMapCarbonCopy\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapCarbonCopy<span style=\"color: navy\">&quot; = &quot;</span>ERPTPrescriptionStructureMapCarbonCopy<span style=\"color: navy\">&quot;\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Diese Ressource beschreibt das Mapping und führt die Mappings aller Teilressourcen zusammen. Weitere Informationen und Beschreibungen zum Mapping können auf der Seite [Mapping des digitalen Durchschlag E-T-Rezept](./trezept.html#mapping-des-digitalen-durchschlags-e-t-rezept) eingesehen werden.</span>\r\n\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">&quot; </span><b>alias </b>bundle <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureDefinition-erp-tprescription-carbon-copy.html\" title=\"Digitaler Durchschlag T-Rezept\">https://gematik.de/fhir/tiflow-bfarm/StructureDefinition/erp-tprescription-carbon-copy</a><span style=\"color: navy\">&quot; </span><b>alias </b>erpTCarbonCopy <b>as </b><b>target</b>\r\n\r\n<b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-ERPTPrescriptionStructureMapMedicationDispense.html\" title=\"E-T-Rezept Structure Map for MedicationDispense\">https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapMedicationDispense</a><span style=\"color: navy\">&quot;\r\n</span><b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-ERPTPrescriptionStructureMapMedicationRequest.html\" title=\"E-T-Rezept Structure Map for MedicationRequest\">https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapMedicationRequest</a><span style=\"color: navy\">&quot;\r\n</span><b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-ERPTPrescriptionStructureMapOrganization.html\" title=\"E-T-Rezept Structure Map for Organization\">https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapOrganization</a><span style=\"color: navy\">&quot;\r\n</span><b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-ERPTPrescriptionStructureMapTask.html\" title=\"E-T-Rezept Structure Map for Task\">https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapTask</a><span style=\"color: navy\">&quot;\r\n</span><b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-ERPTPrescriptionStructureMapMedication.html\" title=\"E-T-Rezept Structure Map for Medication\">https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapMedication</a><span style=\"color: navy\">&quot;\r\n</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Mapping des digitalen Durchschlags T-Rezept aus einem E-Rezept Bundle in das BfArM CarbonCopy Format</span>\r\n<b>group </b>erpTPrescriptionCarbonCopy<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>bundle, <b>target</b> <span style=\"color: maroon\">erpTCarbonCopy</span><span style=\"color: navy\"> : </span>erpTCarbonCopy<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  bundle<span style=\"color: navy\"><b> -&gt; </b></span>erpTCarbonCopy.meta<b> as </b><span style=\"color: maroon\">erpTCarbonCopyMeta</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    bundle<span style=\"color: navy\"><b> -&gt; </b></span>erpTCarbonCopyMeta.profile = <span style=\"color: blue\">'https://gematik.de/fhir/tiflow/bfarm/StructureDefinition/erp-tprescription-carbon-copy|1.1'</span> <i>&quot;tgtMetaProfile&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Setzt das meta.profile des digitalen Durchschlags T-Rezept</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;tgtMeta&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Setzt die Metadaten für den digitalen Durchschlag</span>\r\n  bundle<span style=\"color: navy\"><b> -&gt; </b></span> erpTCarbonCopy.parameter<b> as </b><span style=\"color: maroon\">tgtRxPrescription</span><span style=\"color: navy\">, </span> tgtRxPrescription.part<b> as </b><span style=\"color: maroon\">tgtRxPrescriptionPartId</span><span style=\"color: navy\">, </span> tgtRxPrescription.part<b> as </b><span style=\"color: maroon\">tgtRxPrescriptionPartMR</span><span style=\"color: navy\">, </span> tgtRxPrescription.part<b> as </b><span style=\"color: maroon\">tgtRxPrescriptionPartMed</span><span style=\"color: navy\">, </span> tgtRxPrescription.name = <span style=\"color: blue\">'rxPrescription'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    bundle.entry<b> as </b><span style=\"color: maroon\">srcEntryVar</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      srcEntryVar.resource<b> as </b><span style=\"color: maroon\">srcEntryResourceVar</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        srcEntryVar.resource<span style=\"color: navy\"> : </span>Task<b> as </b><span style=\"color: maroon\">srcEntryTaskVar</span><b> where </b>ofType(Task)<span style=\"color: navy\"><b> -&gt; </b></span> tgtRxPrescriptionPartId.name = <span style=\"color: blue\">'prescriptionId'</span><span style=\"color: navy\">, </span> tgtRxPrescriptionPartId.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Identifier'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">newIdentifier</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          srcEntryTaskVar<b> then </b>ERPTPrescriptionStructureMapTask<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcEntryTaskVar</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newIdentifier</span><span style=\"color: navy\">)</span> <i>&quot;parameterrXPrescriptionPartIdentifier&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Mappt Task-Informationen auf Identifier für die Rezept-ID</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;parameterrXPrescriptionPart&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Extrahiert die E-Rezept-ID aus dem Task und erstellt den prescriptionId Parameter</span>\r\n        srcEntryVar.resource<span style=\"color: navy\"> : </span>MedicationRequest<b> as </b><span style=\"color: maroon\">srcEntryBundleMRVar</span><b> where </b>ofType(MedicationRequest)<span style=\"color: navy\"><b> -&gt; </b></span>tgtRxPrescriptionPartMR.name = <span style=\"color: blue\">'medicationRequest'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          srcEntryBundleMRVar<span style=\"color: navy\"><b> -&gt; </b></span>tgtRxPrescriptionPartMR.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'MedicationRequest'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">newMedicationRequest</span><b> then</b><span style=\"color: navy\"> {\r\n</span>            srcEntryBundleMRVar<b> then </b>ERPTPrescriptionStructureMapMedicationRequest<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcEntryBundleMRVar</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newMedicationRequest</span><span style=\"color: navy\">)</span> <i>&quot;entryMedicationRequestPartResourceSet&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Führt die detaillierte MedicationRequest-Transformation durch</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;entryMedicationRequestPart&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Transformiert KBV-MedicationRequest in BfArM MedicationRequest Format</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;entryMedicationRequest&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erstellt den medicationRequest Parameter für Verschreibungsdetails</span>\r\n        srcEntryVar<b> as </b><span style=\"color: maroon\">srcMedicationRequestId</span><b> where </b>resource.ofType(MedicationRequest)<span style=\"color: navy\"><b> -&gt; </b></span>tgtRxPrescriptionPartMed.name = <span style=\"color: blue\">'medication'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          bundle.entry<b> as </b><span style=\"color: maroon\">srcEntryVar2</span><b> then</b><span style=\"color: navy\"> {\r\n</span>            srcEntryVar2<b> as </b><span style=\"color: maroon\">srcEntryBundleMRMedIdVar</span><b> where </b>resource.ofType(Medication).where(id=%srcMedicationRequestId.resource.medication.reference.replace('urn:uuid:', '').split('/').last())<span style=\"color: navy\"><b> -&gt; </b></span>tgtRxPrescriptionPartMed.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Medication'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">newMedicationPrescriptionMedication</span><b> then</b><span style=\"color: navy\"> {\r\n</span>              srcEntryBundleMRMedIdVar.resource<span style=\"color: navy\"> : </span>Medication<b> as </b><span style=\"color: maroon\">srcEntryBundleMRMedIdVarRes</span><b> then </b>ERPTPrescriptionStructureMapMedication<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcEntryBundleMRMedIdVarRes</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newMedicationPrescriptionMedication</span><span style=\"color: navy\">)</span> <i>&quot;entryMedicationPrescriptionMedicationPartResourceSet&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Führt die detaillierte Medication-Transformation für das verschriebene Arzneimittel durch</span>\r\n            <span style=\"color: navy\">}</span> <i>&quot;entryMedicationPrescriptionMedicationPart&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Findet die vom MedicationRequest referenzierte Medication und transformiert sie in BfArM Format</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;prepMedication&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Bereitet die Suche nach der referenzierten Medication vor</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;entryMedicationRequestMedication&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erstellt den medication Parameter für das verschriebene Arzneimittel</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;rxPrescriptionParameter&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Extrahiert relevante Ressourcen für die Verschreibung</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;bundleEntries&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Verarbeitet alle Einträge des Quell-Bundles für Verschreibungsinformationen</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;rxPrescriptionRule&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erstellt den rxPrescription Parameter mit allen Verschreibungsinformationen</span>\r\n  bundle<span style=\"color: navy\"><b> -&gt; </b></span> erpTCarbonCopy.parameter<b> as </b><span style=\"color: maroon\">tgtRxDispensation</span><span style=\"color: navy\">, </span> tgtRxDispensation.part<b> as </b><span style=\"color: maroon\">tgtRxDispensationPartOrg</span><span style=\"color: navy\">, </span> tgtRxDispensation.name = <span style=\"color: blue\">'rxDispensation'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    bundle.entry<b> as </b><span style=\"color: maroon\">srcEntryVar</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      srcEntryVar.resource<b> as </b><span style=\"color: maroon\">srcEntryResourceVar</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        srcEntryVar.resource<span style=\"color: navy\"> : </span>Bundle<b> as </b><span style=\"color: maroon\">srcEntryBundleOrgVar</span><b> where </b>ofType(Bundle).where(entry.first().fullUrl.contains('fhir-directory'))<span style=\"color: navy\"><b> -&gt; </b></span>tgtRxDispensationPartOrg.name = <span style=\"color: blue\">'dispenseOrganization'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          srcEntryBundleOrgVar<span style=\"color: navy\"><b> -&gt; </b></span>tgtRxDispensationPartOrg.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Organization'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">newOrganization</span><b> then</b><span style=\"color: navy\"> {\r\n</span>            srcEntryBundleOrgVar<b> then </b>ERPTPrescriptionStructureMapOrganization<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcEntryBundleOrgVar</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newOrganization</span><span style=\"color: navy\">)</span> <i>&quot;entryOrganizationPartResourceSet&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Führt die detaillierte Organization-Transformation durch</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;entryOrganizationPart&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Transformiert VZD SearchSet in BfArM Organization Format für die abgebende Apotheke</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;entryVZDSearchSet&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Identifiziert VZD SearchSet Bundle für Apothekeninformationen</span>\r\n        srcEntryVar.resource<span style=\"color: navy\"> : </span>MedicationDispense<b> as </b><span style=\"color: maroon\">srcEntryBundleMDVar</span><b> where </b>ofType(MedicationDispense)<span style=\"color: navy\"><b> -&gt; </b></span>tgtRxDispensation.part<b> as </b><span style=\"color: maroon\">tgtDispenseInformationPart</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          srcEntryBundleMDVar<span style=\"color: navy\"><b> -&gt; </b></span> tgtDispenseInformationPart.name = <span style=\"color: blue\">'dispenseInformation'</span><span style=\"color: navy\">, </span> tgtDispenseInformationPart.part<b> as </b><span style=\"color: maroon\">tgtDispenseInformationMedDispPart</span><span style=\"color: navy\">, </span> tgtDispenseInformationPart.part<b> as </b><span style=\"color: maroon\">tgtDispenseInformationMedicationPart</span><b> then</b><span style=\"color: navy\"> {\r\n</span>            srcEntryBundleMDVar<span style=\"color: navy\"><b> -&gt; </b></span> tgtDispenseInformationMedDispPart.name = <span style=\"color: blue\">'medicationDispense'</span><span style=\"color: navy\">, </span> tgtDispenseInformationMedDispPart.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'MedicationDispense'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">newMedicationDispense</span><b> then</b><span style=\"color: navy\"> {\r\n</span>              srcEntryBundleMDVar<b> then </b>ERPTPrescriptionStructureMapMedicationDispense<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcEntryBundleMDVar</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newMedicationDispense</span><span style=\"color: navy\">)</span> <i>&quot;entryMedicationDispensePartResourceSet&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Führt die detaillierte MedicationDispense-Transformation durch</span>\r\n            <span style=\"color: navy\">}</span> <i>&quot;entryDispenseInformationMedicationDispense&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Transformiert gematik MedicationDispense in BfArM MedicationDispense Format</span>\r\n            srcEntryBundleMDVar<span style=\"color: navy\"><b> -&gt; </b></span>tgtDispenseInformationMedicationPart.name = <span style=\"color: blue\">'medication'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>              bundle.entry<b> as </b><span style=\"color: maroon\">srcEntryVarDisp</span><b> then</b><span style=\"color: navy\"> {\r\n</span>                srcEntryVarDisp<b> as </b><span style=\"color: maroon\">srcEntryBundleMDMedIdVar</span><b> where </b>resource.ofType(Medication).where(id=%srcEntryBundleMDVar.medicationReference.reference.replace('urn:uuid:', '').split('/').last())<span style=\"color: navy\"><b> -&gt; </b></span>tgtDispenseInformationMedicationPart.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Medication'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">newMedicationDispensationMedication</span><b> then</b><span style=\"color: navy\"> {\r\n</span>                  srcEntryBundleMDMedIdVar.resource<span style=\"color: navy\"> : </span>Medication<b> as </b><span style=\"color: maroon\">srcEntryBundleMDMedIdVarRes</span><b> then </b>ERPTPrescriptionStructureMapMedication<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcEntryBundleMDMedIdVarRes</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">newMedicationDispensationMedication</span><span style=\"color: navy\">)</span> <i>&quot;entryMedicationDispensationMedicationPartResourceSet&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Führt die detaillierte Medication-Transformation für das abgegebene Arzneimittel durch</span>\r\n                <span style=\"color: navy\">}</span> <i>&quot;entryDispenseMedicationPart&quot;</i><span style=\"color: navy\">;</span>\r\n              <span style=\"color: navy\">}</span> <i>&quot;prepDispenseMedication&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Bereitet die Suche nach der referenzierten Medication im Bundle vor</span>\r\n            <span style=\"color: navy\">}</span> <i>&quot;entryDispenseInformationMedication&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Findet die vom MedicationDispense referenzierte Medication und transformiert sie in BfArM Format</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;entryDispenseInformation&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Bündelt MedicationDispense und zugehörige Medication unter dispenseInformation</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;entryMedicationDispense&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erstellt eine dispenseInformation Part pro abgegebener MedicationDispense</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;rxDispensationParameter&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Extrahiert relevante Ressourcen für die Abgabe</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;bundleEntries&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Verarbeitet alle Einträge des Quell-Bundles für Abgabeinformationen</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;MedicationDispenseFromBundle&quot;</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erstellt den rxDispensation Parameter mit allen Abgabeinformationen</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
      },
      "url" : "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapCarbonCopy",
      "version" : "2.0.0-ballot.1",
      "name" : "ERPTPrescriptionStructureMapCarbonCopy",
      "title" : "E-T-Rezept Structure Map for CarbonCopy",
      "status" : "draft",
      "experimental" : false,
      "date" : "2026-05-26",
      "publisher" : "gematik GmbH",
      "contact" : [
        {
          "name" : "gematik GmbH",
          "telecom" : [
            {
              "system" : "url",
              "value" : "https://gematik.de"
            },
            {
              "system" : "email",
              "value" : "erp-umsetzung@gematik.de"
            }
          ]
        }
      ],
      "description" : "Diese Ressource beschreibt das Mapping und führt die Mappings aller Teilressourcen zusammen. Weitere Informationen und Beschreibungen zum Mapping können auf der Seite [Mapping des digitalen Durchschlag E-T-Rezept](./trezept.html#mapping-des-digitalen-durchschlags-e-t-rezept) eingesehen werden.",
      "jurisdiction" : [
        {
          "coding" : [
            {
              "system" : "urn:iso:std:iso:3166",
              "code" : "DE",
              "display" : "Germany"
            }
          ]
        }
      ],
      "structure" : [
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
          "mode" : "source",
          "alias" : "bundle"
        },
        {
          "url" : "https://gematik.de/fhir/tiflow-bfarm/StructureDefinition/erp-tprescription-carbon-copy",
          "mode" : "target",
          "alias" : "erpTCarbonCopy"
        }
      ],
      "import" : [
        🔗 "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapMedicationDispense"🔗 ,
        "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapMedicationRequest"🔗 ,
        "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapOrganization"🔗 ,
        "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapTask"🔗 ,
        "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapMedication"
      ],
      "group" : [
        {
          "name" : "erpTPrescriptionCarbonCopy",
          "typeMode" : "none",
          "documentation" : "Mapping des digitalen Durchschlags T-Rezept aus einem E-Rezept Bundle in das BfArM CarbonCopy Format",
          "input" : [
            {
              "name" : "bundle",
              "type" : "bundle",
              "mode" : "source"
            },
            {
              "name" : "erpTCarbonCopy",
              "type" : "erpTCarbonCopy",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "tgtMeta",
              "source" : [
                {
                  "context" : "bundle"
                }
              ],
              "target" : [
                {
                  "context" : "erpTCarbonCopy",
                  "contextType" : "variable",
                  "element" : "meta",
                  "variable" : "erpTCarbonCopyMeta"
                }
              ],
              "rule" : [
                {
                  "name" : "tgtMetaProfile",
                  "source" : [
                    {
                      "context" : "bundle"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "erpTCarbonCopyMeta",
                      "contextType" : "variable",
                      "element" : "profile",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "https://gematik.de/fhir/tiflow/bfarm/StructureDefinition/erp-tprescription-carbon-copy|1.1"
                        }
                      ]
                    }
                  ],
                  "documentation" : "Setzt das meta.profile des digitalen Durchschlags T-Rezept"
                }
              ],
              "documentation" : "Setzt die Metadaten für den digitalen Durchschlag"
            },
            {
              "name" : "rxPrescriptionRule",
              "source" : [
                {
                  "context" : "bundle"
                }
              ],
              "target" : [
                {
                  "context" : "erpTCarbonCopy",
                  "contextType" : "variable",
                  "element" : "parameter",
                  "variable" : "tgtRxPrescription"
                },
                {
                  "context" : "tgtRxPrescription",
                  "contextType" : "variable",
                  "element" : "part",
                  "variable" : "tgtRxPrescriptionPartId"
                },
                {
                  "context" : "tgtRxPrescription",
                  "contextType" : "variable",
                  "element" : "part",
                  "variable" : "tgtRxPrescriptionPartMR"
                },
                {
                  "context" : "tgtRxPrescription",
                  "contextType" : "variable",
                  "element" : "part",
                  "variable" : "tgtRxPrescriptionPartMed"
                },
                {
                  "context" : "tgtRxPrescription",
                  "contextType" : "variable",
                  "element" : "name",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "rxPrescription"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "bundleEntries",
                  "source" : [
                    {
                      "context" : "bundle",
                      "element" : "entry",
                      "variable" : "srcEntryVar"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "rxPrescriptionParameter",
                      "source" : [
                        {
                          "context" : "srcEntryVar",
                          "element" : "resource",
                          "variable" : "srcEntryResourceVar"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "parameterrXPrescriptionPart",
                          "source" : [
                            {
                              "context" : "srcEntryVar",
                              "type" : "Task",
                              "element" : "resource",
                              "variable" : "srcEntryTaskVar",
                              "condition" : "ofType(Task)"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "tgtRxPrescriptionPartId",
                              "contextType" : "variable",
                              "element" : "name",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "prescriptionId"
                                }
                              ]
                            },
                            {
                              "context" : "tgtRxPrescriptionPartId",
                              "contextType" : "variable",
                              "element" : "value",
                              "variable" : "newIdentifier",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "Identifier"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "parameterrXPrescriptionPartIdentifier",
                              "source" : [
                                {
                                  "context" : "srcEntryTaskVar"
                                }
                              ],
                              "dependent" : [
                                {
                                  "name" : "ERPTPrescriptionStructureMapTask",
                                  "variable" : [
                                    "srcEntryTaskVar",
                                    "newIdentifier"
                                  ]
                                }
                              ],
                              "documentation" : "Mappt Task-Informationen auf Identifier für die Rezept-ID"
                            }
                          ],
                          "documentation" : "Extrahiert die E-Rezept-ID aus dem Task und erstellt den prescriptionId Parameter"
                        },
                        {
                          "name" : "entryMedicationRequest",
                          "source" : [
                            {
                              "context" : "srcEntryVar",
                              "type" : "MedicationRequest",
                              "element" : "resource",
                              "variable" : "srcEntryBundleMRVar",
                              "condition" : "ofType(MedicationRequest)"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "tgtRxPrescriptionPartMR",
                              "contextType" : "variable",
                              "element" : "name",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "medicationRequest"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "entryMedicationRequestPart",
                              "source" : [
                                {
                                  "context" : "srcEntryBundleMRVar"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "tgtRxPrescriptionPartMR",
                                  "contextType" : "variable",
                                  "element" : "resource",
                                  "variable" : "newMedicationRequest",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "MedicationRequest"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "entryMedicationRequestPartResourceSet",
                                  "source" : [
                                    {
                                      "context" : "srcEntryBundleMRVar"
                                    }
                                  ],
                                  "dependent" : [
                                    {
                                      "name" : "ERPTPrescriptionStructureMapMedicationRequest",
                                      "variable" : [
                                        "srcEntryBundleMRVar",
                                        "newMedicationRequest"
                                      ]
                                    }
                                  ],
                                  "documentation" : "Führt die detaillierte MedicationRequest-Transformation durch"
                                }
                              ],
                              "documentation" : "Transformiert KBV-MedicationRequest in BfArM MedicationRequest Format"
                            }
                          ],
                          "documentation" : "Erstellt den medicationRequest Parameter für Verschreibungsdetails"
                        },
                        {
                          "name" : "entryMedicationRequestMedication",
                          "source" : [
                            {
                              "context" : "srcEntryVar",
                              "variable" : "srcMedicationRequestId",
                              "condition" : "resource.ofType(MedicationRequest)"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "tgtRxPrescriptionPartMed",
                              "contextType" : "variable",
                              "element" : "name",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "medication"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "prepMedication",
                              "source" : [
                                {
                                  "context" : "bundle",
                                  "element" : "entry",
                                  "variable" : "srcEntryVar2"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "entryMedicationPrescriptionMedicationPart",
                                  "source" : [
                                    {
                                      "context" : "srcEntryVar2",
                                      "variable" : "srcEntryBundleMRMedIdVar",
                                      "condition" : "resource.ofType(Medication).where(id=%srcMedicationRequestId.resource.medication.reference.replace('urn:uuid:', '').split('/').last())"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "tgtRxPrescriptionPartMed",
                                      "contextType" : "variable",
                                      "element" : "resource",
                                      "variable" : "newMedicationPrescriptionMedication",
                                      "transform" : "create",
                                      "parameter" : [
                                        {
                                          "valueString" : "Medication"
                                        }
                                      ]
                                    }
                                  ],
                                  "rule" : [
                                    {
                                      "name" : "entryMedicationPrescriptionMedicationPartResourceSet",
                                      "source" : [
                                        {
                                          "context" : "srcEntryBundleMRMedIdVar",
                                          "type" : "Medication",
                                          "element" : "resource",
                                          "variable" : "srcEntryBundleMRMedIdVarRes"
                                        }
                                      ],
                                      "dependent" : [
                                        {
                                          "name" : "ERPTPrescriptionStructureMapMedication",
                                          "variable" : [
                                            "srcEntryBundleMRMedIdVarRes",
                                            "newMedicationPrescriptionMedication"
                                          ]
                                        }
                                      ],
                                      "documentation" : "Führt die detaillierte Medication-Transformation für das verschriebene Arzneimittel durch"
                                    }
                                  ],
                                  "documentation" : "Findet die vom MedicationRequest referenzierte Medication und transformiert sie in BfArM Format"
                                }
                              ],
                              "documentation" : "Bereitet die Suche nach der referenzierten Medication vor"
                            }
                          ],
                          "documentation" : "Erstellt den medication Parameter für das verschriebene Arzneimittel"
                        }
                      ],
                      "documentation" : "Extrahiert relevante Ressourcen für die Verschreibung"
                    }
                  ],
                  "documentation" : "Verarbeitet alle Einträge des Quell-Bundles für Verschreibungsinformationen"
                }
              ],
              "documentation" : "Erstellt den rxPrescription Parameter mit allen Verschreibungsinformationen"
            },
            {
              "name" : "MedicationDispenseFromBundle",
              "source" : [
                {
                  "context" : "bundle"
                }
              ],
              "target" : [
                {
                  "context" : "erpTCarbonCopy",
                  "contextType" : "variable",
                  "element" : "parameter",
                  "variable" : "tgtRxDispensation"
                },
                {
                  "context" : "tgtRxDispensation",
                  "contextType" : "variable",
                  "element" : "part",
                  "variable" : "tgtRxDispensationPartOrg"
                },
                {
                  "context" : "tgtRxDispensation",
                  "contextType" : "variable",
                  "element" : "name",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "rxDispensation"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "bundleEntries",
                  "source" : [
                    {
                      "context" : "bundle",
                      "element" : "entry",
                      "variable" : "srcEntryVar"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "rxDispensationParameter",
                      "source" : [
                        {
                          "context" : "srcEntryVar",
                          "element" : "resource",
                          "variable" : "srcEntryResourceVar"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "entryVZDSearchSet",
                          "source" : [
                            {
                              "context" : "srcEntryVar",
                              "type" : "Bundle",
                              "element" : "resource",
                              "variable" : "srcEntryBundleOrgVar",
                              "condition" : "ofType(Bundle).where(entry.first().fullUrl.contains('fhir-directory'))"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "tgtRxDispensationPartOrg",
                              "contextType" : "variable",
                              "element" : "name",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueString" : "dispenseOrganization"
                                }
                              ]
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "entryOrganizationPart",
                              "source" : [
                                {
                                  "context" : "srcEntryBundleOrgVar"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "tgtRxDispensationPartOrg",
                                  "contextType" : "variable",
                                  "element" : "resource",
                                  "variable" : "newOrganization",
                                  "transform" : "create",
                                  "parameter" : [
                                    {
                                      "valueString" : "Organization"
                                    }
                                  ]
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "entryOrganizationPartResourceSet",
                                  "source" : [
                                    {
                                      "context" : "srcEntryBundleOrgVar"
                                    }
                                  ],
                                  "dependent" : [
                                    {
                                      "name" : "ERPTPrescriptionStructureMapOrganization",
                                      "variable" : [
                                        "srcEntryBundleOrgVar",
                                        "newOrganization"
                                      ]
                                    }
                                  ],
                                  "documentation" : "Führt die detaillierte Organization-Transformation durch"
                                }
                              ],
                              "documentation" : "Transformiert VZD SearchSet in BfArM Organization Format für die abgebende Apotheke"
                            }
                          ],
                          "documentation" : "Identifiziert VZD SearchSet Bundle für Apothekeninformationen"
                        },
                        {
                          "name" : "entryMedicationDispense",
                          "source" : [
                            {
                              "context" : "srcEntryVar",
                              "type" : "MedicationDispense",
                              "element" : "resource",
                              "variable" : "srcEntryBundleMDVar",
                              "condition" : "ofType(MedicationDispense)"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "tgtRxDispensation",
                              "contextType" : "variable",
                              "element" : "part",
                              "variable" : "tgtDispenseInformationPart"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "entryDispenseInformation",
                              "source" : [
                                {
                                  "context" : "srcEntryBundleMDVar"
                                }
                              ],
                              "target" : [
                                {
                                  "context" : "tgtDispenseInformationPart",
                                  "contextType" : "variable",
                                  "element" : "name",
                                  "transform" : "copy",
                                  "parameter" : [
                                    {
                                      "valueString" : "dispenseInformation"
                                    }
                                  ]
                                },
                                {
                                  "context" : "tgtDispenseInformationPart",
                                  "contextType" : "variable",
                                  "element" : "part",
                                  "variable" : "tgtDispenseInformationMedDispPart"
                                },
                                {
                                  "context" : "tgtDispenseInformationPart",
                                  "contextType" : "variable",
                                  "element" : "part",
                                  "variable" : "tgtDispenseInformationMedicationPart"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "entryDispenseInformationMedicationDispense",
                                  "source" : [
                                    {
                                      "context" : "srcEntryBundleMDVar"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "tgtDispenseInformationMedDispPart",
                                      "contextType" : "variable",
                                      "element" : "name",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueString" : "medicationDispense"
                                        }
                                      ]
                                    },
                                    {
                                      "context" : "tgtDispenseInformationMedDispPart",
                                      "contextType" : "variable",
                                      "element" : "resource",
                                      "variable" : "newMedicationDispense",
                                      "transform" : "create",
                                      "parameter" : [
                                        {
                                          "valueString" : "MedicationDispense"
                                        }
                                      ]
                                    }
                                  ],
                                  "rule" : [
                                    {
                                      "name" : "entryMedicationDispensePartResourceSet",
                                      "source" : [
                                        {
                                          "context" : "srcEntryBundleMDVar"
                                        }
                                      ],
                                      "dependent" : [
                                        {
                                          "name" : "ERPTPrescriptionStructureMapMedicationDispense",
                                          "variable" : [
                                            "srcEntryBundleMDVar",
                                            "newMedicationDispense"
                                          ]
                                        }
                                      ],
                                      "documentation" : "Führt die detaillierte MedicationDispense-Transformation durch"
                                    }
                                  ],
                                  "documentation" : "Transformiert gematik MedicationDispense in BfArM MedicationDispense Format"
                                },
                                {
                                  "name" : "entryDispenseInformationMedication",
                                  "source" : [
                                    {
                                      "context" : "srcEntryBundleMDVar"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "tgtDispenseInformationMedicationPart",
                                      "contextType" : "variable",
                                      "element" : "name",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueString" : "medication"
                                        }
                                      ]
                                    }
                                  ],
                                  "rule" : [
                                    {
                                      "name" : "prepDispenseMedication",
                                      "source" : [
                                        {
                                          "context" : "bundle",
                                          "element" : "entry",
                                          "variable" : "srcEntryVarDisp"
                                        }
                                      ],
                                      "rule" : [
                                        {
                                          "name" : "entryDispenseMedicationPart",
                                          "source" : [
                                            {
                                              "context" : "srcEntryVarDisp",
                                              "variable" : "srcEntryBundleMDMedIdVar",
                                              "condition" : "resource.ofType(Medication).where(id=%srcEntryBundleMDVar.medicationReference.reference.replace('urn:uuid:', '').split('/').last())"
                                            }
                                          ],
                                          "target" : [
                                            {
                                              "context" : "tgtDispenseInformationMedicationPart",
                                              "contextType" : "variable",
                                              "element" : "resource",
                                              "variable" : "newMedicationDispensationMedication",
                                              "transform" : "create",
                                              "parameter" : [
                                                {
                                                  "valueString" : "Medication"
                                                }
                                              ]
                                            }
                                          ],
                                          "rule" : [
                                            {
                                              "name" : "entryMedicationDispensationMedicationPartResourceSet",
                                              "source" : [
                                                {
                                                  "context" : "srcEntryBundleMDMedIdVar",
                                                  "type" : "Medication",
                                                  "element" : "resource",
                                                  "variable" : "srcEntryBundleMDMedIdVarRes"
                                                }
                                              ],
                                              "dependent" : [
                                                {
                                                  "name" : "ERPTPrescriptionStructureMapMedication",
                                                  "variable" : [
                                                    "srcEntryBundleMDMedIdVarRes",
                                                    "newMedicationDispensationMedication"
                                                  ]
                                                }
                                              ],
                                              "documentation" : "Führt die detaillierte Medication-Transformation für das abgegebene Arzneimittel durch"
                                            }
                                          ]
                                        }
                                      ],
                                      "documentation" : "Bereitet die Suche nach der referenzierten Medication im Bundle vor"
                                    }
                                  ],
                                  "documentation" : "Findet die vom MedicationDispense referenzierte Medication und transformiert sie in BfArM Format"
                                }
                              ],
                              "documentation" : "Bündelt MedicationDispense und zugehörige Medication unter dispenseInformation"
                            }
                          ],
                          "documentation" : "Erstellt eine dispenseInformation Part pro abgegebener MedicationDispense"
                        }
                      ],
                      "documentation" : "Extrahiert relevante Ressourcen für die Abgabe"
                    }
                  ],
                  "documentation" : "Verarbeitet alle Einträge des Quell-Bundles für Abgabeinformationen"
                }
              ],
              "documentation" : "Erstellt den rxDispensation Parameter mit allen Abgabeinformationen"
            }
          ]
        }
      ]
    }