@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# - resource -------------------------------------------------------------------

<https://gematik.de/fhir/tiflow-bfarm/StructureMap/ERPTPrescriptionStructureMapMedicationRequest> a fhir:StructureMap ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "ERPTPrescriptionStructureMapMedicationRequest"] ; # 
  fhir:text [
     fhir:status [ fhir:v "generated" ] ;
     fhir:div [ fhir:v "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap ERPTPrescriptionStructureMapMedicationRequest</b></p><a name=\"ERPTPrescriptionStructureMapMedicationRequest\"> </a><a name=\"hcERPTPrescriptionStructureMapMedicationRequest\"> </a><pre class=\"fml\">#xD;\n<b>map</b><span style=\"color: navy\"> \"</span>https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapMedicationRequest<span style=\"color: navy\">\" = \"</span>ERPTPrescriptionStructureMapMedicationRequest<span style=\"color: navy\">\"#xD;\n#xD;\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Mapping-Anweisungen zur Transformation von KBV MedicationRequest zu BfArM T-Prescription MedicationRequest</span>#xD;\n#xD;\n<b>uses</b><span style=\"color: navy\"> \"</span><a href=\"http://hl7.org/fhir/R4/medicationrequest.html\" title=\"MedicationRequest\">http://hl7.org/fhir/StructureDefinition/MedicationRequest</a><span style=\"color: navy\">\" </span><b>alias </b>kbvMedicationRequest <b>as </b><b>source</b>#xD;\n<b>uses</b><span style=\"color: navy\"> \"</span><a href=\"http://hl7.org/fhir/R4/medicationrequest.html\" title=\"MedicationRequest\">http://hl7.org/fhir/StructureDefinition/MedicationRequest</a><span style=\"color: navy\">\" </span><b>alias </b>bfarmMedicationRequest <b>as </b><b>target</b>#xD;\n#xD;\n<span style=\"color: navy\">// </span><span style=\"color: green\">Mapping-Anweisungen zur Transformation von KBV MedicationRequest zu BfArM T-Prescription MedicationRequest</span>#xD;\n<b>group </b>ERPTPrescriptionStructureMapMedicationRequest<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">kbvMedicationRequest</span><span style=\"color: navy\"> : </span>kbvMedicationRequest, <b>target</b> <span style=\"color: maroon\">bfarmMedicationRequest</span><span style=\"color: navy\"> : </span>bfarmMedicationRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {#xD;\n</span>  kbvMedicationRequest.status<b> as </b><span style=\"color: maroon\">srcStatus</span><span style=\"color: navy\"><b> -&gt; </b></span>bfarmMedicationRequest.status = <span style=\"color: blue\">'completed'</span> <i>\"medicationRequestStatus\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Setzt den Status auf 'completed' für den digitalen Durchschlag (Verschreibung ist bereits abgeschlossen)</span>#xD;\n  kbvMedicationRequest.intent<span style=\"color: navy\"><b> -&gt; </b></span>bfarmMedicationRequest.intent = <span style=\"color: blue\">'order'</span> <i>\"medicationRequestIntent\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Setzt den Intent auf 'order' entsprechend der BfArM-Spezifikation für T-Prescription</span>#xD;\n  kbvMedicationRequest.extension<b> as </b><span style=\"color: maroon\">extVar</span><b> where </b>url='https://fhir.kbv.de/StructureDefinition/KBV_EX_ERP_Teratogenic'<span style=\"color: navy\"><b> -&gt; </b></span>bfarmMedicationRequest.extension<b> as </b><span style=\"color: maroon\">tgtExtVar</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    extVar<b> as </b><span style=\"color: maroon\">extMatchVar</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtExtVar.url = <span style=\"color: blue\">'https://gematik.de/fhir/epa-medication/StructureDefinition/teratogenic-extension'</span> <i>\"copyTPrescriptionExtensionUrl\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Kopiert teratogene Extensions für T-Rezept Kennzeichnung</span>#xD;\n    extVar.extension<b> as </b><span style=\"color: maroon\">offLabelVar</span><b> where </b>url='Off-Label'<span style=\"color: navy\"><b> -&gt; </b></span> tgtExtVar.extension = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Extension'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">tgtOffLabelExt</span><span style=\"color: navy\">, </span> tgtOffLabelExt.url = <span style=\"color: blue\">'off-label'</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      offLabelVar.value<b> as </b><span style=\"color: maroon\">offLabelValue</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtOffLabelExt.value = <span style=\"color: maroon\">offLabelValue</span> <i>\"mapOffLabelValue\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Übernimmt den Off-Label Booleschen Wert</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"mapOffLabelExtension\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Mappt Off-Label Extension</span>#xD;\n    extVar.extension<b> as </b><span style=\"color: maroon\">gebaerfaehigeFrauVar</span><b> where </b>url='GebaerfaehigeFrau'<span style=\"color: navy\"><b> -&gt; </b></span> tgtExtVar.extension = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Extension'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">tgtGebaerfaehigeFrauExt</span><span style=\"color: navy\">, </span> tgtGebaerfaehigeFrauExt.url = <span style=\"color: blue\">'childbearing-potential'</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      gebaerfaehigeFrauVar.value<b> as </b><span style=\"color: maroon\">gebaerfaehigeFrauValue</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtGebaerfaehigeFrauExt.value = <span style=\"color: maroon\">gebaerfaehigeFrauValue</span> <i>\"mapGebaerfaehigeFrauValue\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Übernimmt den Booleschen Wert für childbearing-potential</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"mapGebaerfaehigeFrauExtension\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Mappt GebaerfaehigeFrau Extension zu childbearing-potential</span>#xD;\n    extVar.extension<b> as </b><span style=\"color: maroon\">sicherheitsVar</span><b> where </b>url='EinhaltungSicherheitsmassnahmen'<span style=\"color: navy\"><b> -&gt; </b></span> tgtExtVar.extension = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Extension'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">tgtSicherheitsExt</span><span style=\"color: navy\">, </span> tgtSicherheitsExt.url = <span style=\"color: blue\">'security-compliance'</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      sicherheitsVar.value<b> as </b><span style=\"color: maroon\">sicherheitsValue</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtSicherheitsExt.value = <span style=\"color: maroon\">sicherheitsValue</span> <i>\"mapEinhaltungSicherheitsmassnahmenValue\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Übernimmt den Booleschen Wert für security-compliance</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"mapEinhaltungSicherheitsmassnahmenExtension\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Mappt EinhaltungSicherheitsmassnahmen Extension zu security-compliance</span>#xD;\n    extVar.extension<b> as </b><span style=\"color: maroon\">infoMatVar</span><b> where </b>url='AushaendigungInformationsmaterialien'<span style=\"color: navy\"><b> -&gt; </b></span> tgtExtVar.extension = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Extension'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">tgtInfoMatExt</span><span style=\"color: navy\">, </span> tgtInfoMatExt.url = <span style=\"color: blue\">'hand-out-information-material'</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      infoMatVar.value<b> as </b><span style=\"color: maroon\">infoMatValue</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtInfoMatExt.value = <span style=\"color: maroon\">infoMatValue</span> <i>\"mapAushaendigungInformationsmaterialienValue\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Übernimmt den Booleschen Wert für hand-out-information-material</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"mapAushaendigungInformationsmaterialienExtension\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Mappt AushaendigungInformationsmaterialien Extension zu hand-out-information-material</span>#xD;\n    extVar.extension<b> as </b><span style=\"color: maroon\">sachkenntnisVar</span><b> where </b>url='ErklaerungSachkenntnis'<span style=\"color: navy\"><b> -&gt; </b></span> tgtExtVar.extension = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Extension'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">tgtSachkenntnisExt</span><span style=\"color: navy\">, </span> tgtSachkenntnisExt.url = <span style=\"color: blue\">'declaration-of-expertise'</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      sachkenntnisVar.value<b> as </b><span style=\"color: maroon\">sachkenntnisValue</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtSachkenntnisExt.value = <span style=\"color: maroon\">sachkenntnisValue</span> <i>\"mapErklaerungSachkenntnisValue\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Übernimmt den Booleschen Wert für declaration-of-expertise</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"mapErklaerungSachkenntnisExtension\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Mappt ErklaerungSachkenntnis Extension zu declaration-of-expertise</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"medicationRequestExt\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Mappt T-Rezept spezifische Extensions vom KBV- zum BfArM-Format</span>#xD;\n  kbvMedicationRequest.extension<b> as </b><span style=\"color: maroon\">extDosageMetaVar</span><b> where </b>url='http://ig.fhir.de/igs/medication/StructureDefinition/GeneratedDosageInstructionsMeta'<span style=\"color: navy\"><b> -&gt; </b></span>bfarmMedicationRequest.extension = <span style=\"color: maroon\">extDosageMetaVar</span> <i>\"medicationRequestExt\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Kopiert Dosage Metadata Extension</span>#xD;\n  kbvMedicationRequest.extension<b> as </b><span style=\"color: maroon\">extDosageRenderedVar</span><b> where </b>url='http://hl7.org/fhir/5.0/StructureDefinition/extension-MedicationRequest.renderedDosageInstruction'<span style=\"color: navy\"><b> -&gt; </b></span>bfarmMedicationRequest.extension = <span style=\"color: maroon\">extDosageRenderedVar</span> <i>\"medicationRequestExt\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Kopiert RenderedDosageText</span>#xD;\n  kbvMedicationRequest.subject<b> as </b><span style=\"color: maroon\">srcSubject</span><span style=\"color: navy\"><b> -&gt; </b></span>bfarmMedicationRequest.subject<b> as </b><span style=\"color: maroon\">tgtSubject</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    kbvMedicationRequest.subject<b> as </b><span style=\"color: maroon\">srcSubject</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtSubject.identifier<b> as </b><span style=\"color: maroon\">tgtSubjectIdentifier</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      kbvMedicationRequest.subject<b> as </b><span style=\"color: maroon\">srcSubject</span><span style=\"color: navy\"><b> -&gt; </b></span> tgtSubjectIdentifier.system<b> as </b><span style=\"color: maroon\">tgtSubjectIdentifierSystem</span><span style=\"color: navy\">, </span> tgtSubjectIdentifier.value<b> as </b><span style=\"color: maroon\">tgtSubjectIdentifierValue</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>        kbvMedicationRequest.subject<b> as </b><span style=\"color: maroon\">srcSubject</span><span style=\"color: navy\"><b> -&gt; </b></span> tgtSubjectIdentifierSystem.extension<b> as </b><span style=\"color: maroon\">tgtSubjectIdentifierSystemEx</span><span style=\"color: navy\">, </span> tgtSubjectIdentifierValue.extension<b> as </b><span style=\"color: maroon\">tgtSubjectIdentifierValueEx</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>          kbvMedicationRequest.subject<b> as </b><span style=\"color: maroon\">srcSubject</span><span style=\"color: navy\"><b> -&gt; </b></span> tgtSubjectIdentifierSystemEx.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/data-absent-reason'</span><span style=\"color: navy\">, </span> tgtSubjectIdentifierSystemEx.value = <b>cast</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'not-permitted'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span> <i>\"medicationRequestsubjectIdentifierSystemExtension\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Setzt data-absent-reason auf 'not-permitted' um Patientendaten zu anonymisieren</span>#xD;\n          kbvMedicationRequest.subject<b> as </b><span style=\"color: maroon\">srcSubject</span><span style=\"color: navy\"><b> -&gt; </b></span> tgtSubjectIdentifierValueEx.url = <span style=\"color: blue\">'http://hl7.org/fhir/StructureDefinition/data-absent-reason'</span><span style=\"color: navy\">, </span> tgtSubjectIdentifierValueEx.value = <b>cast</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'not-permitted'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span> <i>\"medicationRequestsubjectIdentifierValueExtension\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Setzt data-absent-reason auf 'not-permitted' um Patientendaten zu anonymisieren</span>#xD;\n        <span style=\"color: navy\">}</span> <i>\"medicationRequestsubjectIdentifierSystem\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erstellt data-absent-reason Extension für Subject Identifier</span>#xD;\n      <span style=\"color: navy\">}</span> <i>\"medicationRequestsubjectIdentifierExtension\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erstellt data-absent-reason Extension für Subject Identifier</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"medicationRequestsubjectIdentifier\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"medicationRequestsubject\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Entfernt Patientenbezug durch data-absent-reason Extension für Datenschutz im digitalen Durchschlag</span>#xD;\n  kbvMedicationRequest.authoredOn<b> as </b><span style=\"color: maroon\">srcAuthoredOnVar</span><span style=\"color: navy\"><b> -&gt; </b></span>bfarmMedicationRequest.authoredOn = <span style=\"color: maroon\">srcAuthoredOnVar</span> <i>\"medicationRequestAuthoredOn\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Übernimmt das Verschreibungsdatum unverändert vom KBV MedicationRequest</span>#xD;\n  kbvMedicationRequest.dosageInstruction<b> as </b><span style=\"color: maroon\">srcDosageInstructionVar</span><span style=\"color: navy\"><b> -&gt; </b></span>bfarmMedicationRequest.dosageInstruction = <span style=\"color: maroon\">srcDosageInstructionVar</span> <i>\"medicationRequestDosageInstruction\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Kopiert die Dosierungsanweisungen vollständig für den digitalen Durchschlag</span>#xD;\n  kbvMedicationRequest.dispenseRequest<b> as </b><span style=\"color: maroon\">srcDispenseRequestVar</span><span style=\"color: navy\"><b> -&gt; </b></span>bfarmMedicationRequest.dispenseRequest = <span style=\"color: maroon\">srcDispenseRequestVar</span> <i>\"medicationRequestDispenseRequest\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Übernimmt Abgabeanweisungen (Menge, Wiederholungen) aus der ursprünglichen Verschreibung</span>#xD;\n  kbvMedicationRequest.medication<b> as </b><span style=\"color: maroon\">medicationVar</span><span style=\"color: navy\"><b> -&gt; </b></span>bfarmMedicationRequest.medication = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">tgtMedicationReference</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    medicationVar.reference<b> as </b><span style=\"color: maroon\">medicationReferenceValue</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      medicationReferenceValue<b> as </b><span style=\"color: maroon\">currentMedicationReferenceValue</span><span style=\"color: navy\"><b> -&gt; </b></span>tgtMedicationReference.reference = <span style=\"color: navy\">(</span>iif(%currentMedicationReferenceValue.startsWith('urn:uuid:'), %currentMedicationReferenceValue, 'urn:uuid:' &amp; %currentMedicationReferenceValue.replaceMatches('.*[:/]', ''))<span style=\"color: navy\">)</span> <i>\"normalizeMedicationReferenceTransformation\"</i><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span> <i>\"normalizeMedicationReference\"</i><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"medicationReference\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Transformiert die Medication-Referenz zu urn:uuid Format</span>#xD;\n<span style=\"color: navy\">}#xD;\n#xD;\n</span></pre></div>"^^rdf:XMLLiteral ]
  ] ; # 
  fhir:url [
     fhir:v "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapMedicationRequest"^^xsd:anyURI ;
     fhir:l <https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapMedicationRequest>
  ] ; # 
  fhir:version [ fhir:v "2.0.0-ballot.1"] ; # 
  fhir:name [ fhir:v "ERPTPrescriptionStructureMapMedicationRequest"] ; # 
  fhir:title [ fhir:v "E-T-Rezept Structure Map for MedicationRequest"] ; # 
  fhir:status [ fhir:v "draft"] ; # 
  fhir:experimental [ fhir:v false] ; # 
  fhir:date [ fhir:v "2026-05-26"^^xsd:date] ; # 
  fhir:publisher [ fhir:v "gematik GmbH"] ; # 
  fhir:contact ( [
     fhir:name [ fhir:v "gematik GmbH" ] ;
     fhir:telecom ( [
       fhir:system [ fhir:v "url" ] ;
       fhir:value [ fhir:v "https://gematik.de" ]
     ] [
       fhir:system [ fhir:v "email" ] ;
       fhir:value [ fhir:v "erp-umsetzung@gematik.de" ]
     ] )
  ] ) ; # 
  fhir:description [ fhir:v "Mapping-Anweisungen zur Transformation von KBV MedicationRequest zu BfArM T-Prescription MedicationRequest"] ; # 
  fhir:jurisdiction ( [
     fhir:coding ( [
       fhir:system [
         fhir:v "urn:iso:std:iso:3166"^^xsd:anyURI ;
         fhir:l <urn:iso:std:iso:3166>
       ] ;
       fhir:code [ fhir:v "DE" ] ;
       fhir:display [ fhir:v "Germany" ]
     ] )
  ] ) ; # 
  fhir:structure ( [
     fhir:url [
       fhir:v "http://hl7.org/fhir/StructureDefinition/MedicationRequest"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/StructureDefinition/MedicationRequest>
     ] ;
     fhir:mode [ fhir:v "source" ] ;
     fhir:alias [ fhir:v "kbvMedicationRequest" ]
  ] [
     fhir:url [
       fhir:v "http://hl7.org/fhir/StructureDefinition/MedicationRequest"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/StructureDefinition/MedicationRequest>
     ] ;
     fhir:mode [ fhir:v "target" ] ;
     fhir:alias [ fhir:v "bfarmMedicationRequest" ]
  ] ) ; # 
  fhir:group ( [
     fhir:name [ fhir:v "ERPTPrescriptionStructureMapMedicationRequest" ] ;
     fhir:typeMode [ fhir:v "none" ] ;
     fhir:documentation [ fhir:v "Mapping-Anweisungen zur Transformation von KBV MedicationRequest zu BfArM T-Prescription MedicationRequest" ] ;
     fhir:input ( [
       fhir:name [ fhir:v "kbvMedicationRequest" ] ;
       fhir:type [ fhir:v "kbvMedicationRequest" ] ;
       fhir:mode [ fhir:v "source" ]
     ] [
       fhir:name [ fhir:v "bfarmMedicationRequest" ] ;
       fhir:type [ fhir:v "bfarmMedicationRequest" ] ;
       fhir:mode [ fhir:v "target" ]
     ] ) ;
     fhir:rule ( [
       fhir:name [ fhir:v "medicationRequestStatus" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "kbvMedicationRequest" ] ;
         fhir:element [ fhir:v "status" ] ;
         fhir:variable [ fhir:v "srcStatus" ]
       ] ) ;
       fhir:target ( [
         fhir:context [ fhir:v "bfarmMedicationRequest" ] ;
         fhir:contextType [ fhir:v "variable" ] ;
         fhir:element [ fhir:v "status" ] ;
         fhir:transform [ fhir:v "copy" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:String ;
             fhir:v "completed"
           ]
         ] )
       ] ) ;
       fhir:documentation [ fhir:v "Setzt den Status auf 'completed' für den digitalen Durchschlag (Verschreibung ist bereits abgeschlossen)" ]
     ] [
       fhir:name [ fhir:v "medicationRequestIntent" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "kbvMedicationRequest" ] ;
         fhir:element [ fhir:v "intent" ]
       ] ) ;
       fhir:target ( [
         fhir:context [ fhir:v "bfarmMedicationRequest" ] ;
         fhir:contextType [ fhir:v "variable" ] ;
         fhir:element [ fhir:v "intent" ] ;
         fhir:transform [ fhir:v "copy" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:String ;
             fhir:v "order"
           ]
         ] )
       ] ) ;
       fhir:documentation [ fhir:v "Setzt den Intent auf 'order' entsprechend der BfArM-Spezifikation für T-Prescription" ]
     ] [
       fhir:name [ fhir:v "medicationRequestExt" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "kbvMedicationRequest" ] ;
         fhir:element [ fhir:v "extension" ] ;
         fhir:variable [ fhir:v "extVar" ] ;
         fhir:condition [ fhir:v "url='https://fhir.kbv.de/StructureDefinition/KBV_EX_ERP_Teratogenic'" ]
       ] ) ;
       fhir:target ( [
         fhir:context [ fhir:v "bfarmMedicationRequest" ] ;
         fhir:contextType [ fhir:v "variable" ] ;
         fhir:element [ fhir:v "extension" ] ;
         fhir:variable [ fhir:v "tgtExtVar" ]
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "copyTPrescriptionExtensionUrl" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "extVar" ] ;
           fhir:variable [ fhir:v "extMatchVar" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgtExtVar" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "url" ] ;
           fhir:transform [ fhir:v "copy" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "https://gematik.de/fhir/epa-medication/StructureDefinition/teratogenic-extension"
             ]
           ] )
         ] ) ;
         fhir:documentation [ fhir:v "Kopiert teratogene Extensions für T-Rezept Kennzeichnung" ]
       ] [
         fhir:name [ fhir:v "mapOffLabelExtension" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "extVar" ] ;
           fhir:element [ fhir:v "extension" ] ;
           fhir:variable [ fhir:v "offLabelVar" ] ;
           fhir:condition [ fhir:v "url='Off-Label'" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgtExtVar" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "extension" ] ;
           fhir:variable [ fhir:v "tgtOffLabelExt" ] ;
           fhir:transform [ fhir:v "create" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "Extension"
             ]
           ] )
         ] [
           fhir:context [ fhir:v "tgtOffLabelExt" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "url" ] ;
           fhir:transform [ fhir:v "copy" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "off-label"
             ]
           ] )
         ] ) ;
         fhir:rule ( [
           fhir:name [ fhir:v "mapOffLabelValue" ] ;
           fhir:source ( [
             fhir:context [ fhir:v "offLabelVar" ] ;
             fhir:element [ fhir:v "value" ] ;
             fhir:variable [ fhir:v "offLabelValue" ]
           ] ) ;
           fhir:target ( [
             fhir:context [ fhir:v "tgtOffLabelExt" ] ;
             fhir:contextType [ fhir:v "variable" ] ;
             fhir:element [ fhir:v "value" ] ;
             fhir:transform [ fhir:v "copy" ] ;
             fhir:parameter ( [
               fhir:value [
                 a fhir:Id ;
                 fhir:v "offLabelValue"
               ]
             ] )
           ] ) ;
           fhir:documentation [ fhir:v "Übernimmt den Off-Label Booleschen Wert" ]
         ] ) ;
         fhir:documentation [ fhir:v "Mappt Off-Label Extension" ]
       ] [
         fhir:name [ fhir:v "mapGebaerfaehigeFrauExtension" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "extVar" ] ;
           fhir:element [ fhir:v "extension" ] ;
           fhir:variable [ fhir:v "gebaerfaehigeFrauVar" ] ;
           fhir:condition [ fhir:v "url='GebaerfaehigeFrau'" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgtExtVar" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "extension" ] ;
           fhir:variable [ fhir:v "tgtGebaerfaehigeFrauExt" ] ;
           fhir:transform [ fhir:v "create" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "Extension"
             ]
           ] )
         ] [
           fhir:context [ fhir:v "tgtGebaerfaehigeFrauExt" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "url" ] ;
           fhir:transform [ fhir:v "copy" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "childbearing-potential"
             ]
           ] )
         ] ) ;
         fhir:rule ( [
           fhir:name [ fhir:v "mapGebaerfaehigeFrauValue" ] ;
           fhir:source ( [
             fhir:context [ fhir:v "gebaerfaehigeFrauVar" ] ;
             fhir:element [ fhir:v "value" ] ;
             fhir:variable [ fhir:v "gebaerfaehigeFrauValue" ]
           ] ) ;
           fhir:target ( [
             fhir:context [ fhir:v "tgtGebaerfaehigeFrauExt" ] ;
             fhir:contextType [ fhir:v "variable" ] ;
             fhir:element [ fhir:v "value" ] ;
             fhir:transform [ fhir:v "copy" ] ;
             fhir:parameter ( [
               fhir:value [
                 a fhir:Id ;
                 fhir:v "gebaerfaehigeFrauValue"
               ]
             ] )
           ] ) ;
           fhir:documentation [ fhir:v "Übernimmt den Booleschen Wert für childbearing-potential" ]
         ] ) ;
         fhir:documentation [ fhir:v "Mappt GebaerfaehigeFrau Extension zu childbearing-potential" ]
       ] [
         fhir:name [ fhir:v "mapEinhaltungSicherheitsmassnahmenExtension" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "extVar" ] ;
           fhir:element [ fhir:v "extension" ] ;
           fhir:variable [ fhir:v "sicherheitsVar" ] ;
           fhir:condition [ fhir:v "url='EinhaltungSicherheitsmassnahmen'" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgtExtVar" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "extension" ] ;
           fhir:variable [ fhir:v "tgtSicherheitsExt" ] ;
           fhir:transform [ fhir:v "create" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "Extension"
             ]
           ] )
         ] [
           fhir:context [ fhir:v "tgtSicherheitsExt" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "url" ] ;
           fhir:transform [ fhir:v "copy" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "security-compliance"
             ]
           ] )
         ] ) ;
         fhir:rule ( [
           fhir:name [ fhir:v "mapEinhaltungSicherheitsmassnahmenValue" ] ;
           fhir:source ( [
             fhir:context [ fhir:v "sicherheitsVar" ] ;
             fhir:element [ fhir:v "value" ] ;
             fhir:variable [ fhir:v "sicherheitsValue" ]
           ] ) ;
           fhir:target ( [
             fhir:context [ fhir:v "tgtSicherheitsExt" ] ;
             fhir:contextType [ fhir:v "variable" ] ;
             fhir:element [ fhir:v "value" ] ;
             fhir:transform [ fhir:v "copy" ] ;
             fhir:parameter ( [
               fhir:value [
                 a fhir:Id ;
                 fhir:v "sicherheitsValue"
               ]
             ] )
           ] ) ;
           fhir:documentation [ fhir:v "Übernimmt den Booleschen Wert für security-compliance" ]
         ] ) ;
         fhir:documentation [ fhir:v "Mappt EinhaltungSicherheitsmassnahmen Extension zu security-compliance" ]
       ] [
         fhir:name [ fhir:v "mapAushaendigungInformationsmaterialienExtension" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "extVar" ] ;
           fhir:element [ fhir:v "extension" ] ;
           fhir:variable [ fhir:v "infoMatVar" ] ;
           fhir:condition [ fhir:v "url='AushaendigungInformationsmaterialien'" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgtExtVar" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "extension" ] ;
           fhir:variable [ fhir:v "tgtInfoMatExt" ] ;
           fhir:transform [ fhir:v "create" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "Extension"
             ]
           ] )
         ] [
           fhir:context [ fhir:v "tgtInfoMatExt" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "url" ] ;
           fhir:transform [ fhir:v "copy" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "hand-out-information-material"
             ]
           ] )
         ] ) ;
         fhir:rule ( [
           fhir:name [ fhir:v "mapAushaendigungInformationsmaterialienValue" ] ;
           fhir:source ( [
             fhir:context [ fhir:v "infoMatVar" ] ;
             fhir:element [ fhir:v "value" ] ;
             fhir:variable [ fhir:v "infoMatValue" ]
           ] ) ;
           fhir:target ( [
             fhir:context [ fhir:v "tgtInfoMatExt" ] ;
             fhir:contextType [ fhir:v "variable" ] ;
             fhir:element [ fhir:v "value" ] ;
             fhir:transform [ fhir:v "copy" ] ;
             fhir:parameter ( [
               fhir:value [
                 a fhir:Id ;
                 fhir:v "infoMatValue"
               ]
             ] )
           ] ) ;
           fhir:documentation [ fhir:v "Übernimmt den Booleschen Wert für hand-out-information-material" ]
         ] ) ;
         fhir:documentation [ fhir:v "Mappt AushaendigungInformationsmaterialien Extension zu hand-out-information-material" ]
       ] [
         fhir:name [ fhir:v "mapErklaerungSachkenntnisExtension" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "extVar" ] ;
           fhir:element [ fhir:v "extension" ] ;
           fhir:variable [ fhir:v "sachkenntnisVar" ] ;
           fhir:condition [ fhir:v "url='ErklaerungSachkenntnis'" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgtExtVar" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "extension" ] ;
           fhir:variable [ fhir:v "tgtSachkenntnisExt" ] ;
           fhir:transform [ fhir:v "create" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "Extension"
             ]
           ] )
         ] [
           fhir:context [ fhir:v "tgtSachkenntnisExt" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "url" ] ;
           fhir:transform [ fhir:v "copy" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:String ;
               fhir:v "declaration-of-expertise"
             ]
           ] )
         ] ) ;
         fhir:rule ( [
           fhir:name [ fhir:v "mapErklaerungSachkenntnisValue" ] ;
           fhir:source ( [
             fhir:context [ fhir:v "sachkenntnisVar" ] ;
             fhir:element [ fhir:v "value" ] ;
             fhir:variable [ fhir:v "sachkenntnisValue" ]
           ] ) ;
           fhir:target ( [
             fhir:context [ fhir:v "tgtSachkenntnisExt" ] ;
             fhir:contextType [ fhir:v "variable" ] ;
             fhir:element [ fhir:v "value" ] ;
             fhir:transform [ fhir:v "copy" ] ;
             fhir:parameter ( [
               fhir:value [
                 a fhir:Id ;
                 fhir:v "sachkenntnisValue"
               ]
             ] )
           ] ) ;
           fhir:documentation [ fhir:v "Übernimmt den Booleschen Wert für declaration-of-expertise" ]
         ] ) ;
         fhir:documentation [ fhir:v "Mappt ErklaerungSachkenntnis Extension zu declaration-of-expertise" ]
       ] ) ;
       fhir:documentation [ fhir:v "Mappt T-Rezept spezifische Extensions vom KBV- zum BfArM-Format" ]
     ] [
       fhir:name [ fhir:v "medicationRequestExt" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "kbvMedicationRequest" ] ;
         fhir:element [ fhir:v "extension" ] ;
         fhir:variable [ fhir:v "extDosageMetaVar" ] ;
         fhir:condition [ fhir:v "url='http://ig.fhir.de/igs/medication/StructureDefinition/GeneratedDosageInstructionsMeta'" ]
       ] ) ;
       fhir:target ( [
         fhir:context [ fhir:v "bfarmMedicationRequest" ] ;
         fhir:contextType [ fhir:v "variable" ] ;
         fhir:element [ fhir:v "extension" ] ;
         fhir:transform [ fhir:v "copy" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:Id ;
             fhir:v "extDosageMetaVar"
           ]
         ] )
       ] ) ;
       fhir:documentation [ fhir:v "Kopiert Dosage Metadata Extension" ]
     ] [
       fhir:name [ fhir:v "medicationRequestExt" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "kbvMedicationRequest" ] ;
         fhir:element [ fhir:v "extension" ] ;
         fhir:variable [ fhir:v "extDosageRenderedVar" ] ;
         fhir:condition [ fhir:v "url='http://hl7.org/fhir/5.0/StructureDefinition/extension-MedicationRequest.renderedDosageInstruction'" ]
       ] ) ;
       fhir:target ( [
         fhir:context [ fhir:v "bfarmMedicationRequest" ] ;
         fhir:contextType [ fhir:v "variable" ] ;
         fhir:element [ fhir:v "extension" ] ;
         fhir:transform [ fhir:v "copy" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:Id ;
             fhir:v "extDosageRenderedVar"
           ]
         ] )
       ] ) ;
       fhir:documentation [ fhir:v "Kopiert RenderedDosageText" ]
     ] [
       fhir:name [ fhir:v "medicationRequestsubject" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "kbvMedicationRequest" ] ;
         fhir:element [ fhir:v "subject" ] ;
         fhir:variable [ fhir:v "srcSubject" ]
       ] ) ;
       fhir:target ( [
         fhir:context [ fhir:v "bfarmMedicationRequest" ] ;
         fhir:contextType [ fhir:v "variable" ] ;
         fhir:element [ fhir:v "subject" ] ;
         fhir:variable [ fhir:v "tgtSubject" ]
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "medicationRequestsubjectIdentifier" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "kbvMedicationRequest" ] ;
           fhir:element [ fhir:v "subject" ] ;
           fhir:variable [ fhir:v "srcSubject" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgtSubject" ] ;
           fhir:contextType [ fhir:v "variable" ] ;
           fhir:element [ fhir:v "identifier" ] ;
           fhir:variable [ fhir:v "tgtSubjectIdentifier" ]
         ] ) ;
         fhir:rule ( [
           fhir:name [ fhir:v "medicationRequestsubjectIdentifierExtension" ] ;
           fhir:source ( [
             fhir:context [ fhir:v "kbvMedicationRequest" ] ;
             fhir:element [ fhir:v "subject" ] ;
             fhir:variable [ fhir:v "srcSubject" ]
           ] ) ;
           fhir:target ( [
             fhir:context [ fhir:v "tgtSubjectIdentifier" ] ;
             fhir:contextType [ fhir:v "variable" ] ;
             fhir:element [ fhir:v "system" ] ;
             fhir:variable [ fhir:v "tgtSubjectIdentifierSystem" ]
           ] [
             fhir:context [ fhir:v "tgtSubjectIdentifier" ] ;
             fhir:contextType [ fhir:v "variable" ] ;
             fhir:element [ fhir:v "value" ] ;
             fhir:variable [ fhir:v "tgtSubjectIdentifierValue" ]
           ] ) ;
           fhir:rule ( [
             fhir:name [ fhir:v "medicationRequestsubjectIdentifierSystem" ] ;
             fhir:source ( [
               fhir:context [ fhir:v "kbvMedicationRequest" ] ;
               fhir:element [ fhir:v "subject" ] ;
               fhir:variable [ fhir:v "srcSubject" ]
             ] ) ;
             fhir:target ( [
               fhir:context [ fhir:v "tgtSubjectIdentifierSystem" ] ;
               fhir:contextType [ fhir:v "variable" ] ;
               fhir:element [ fhir:v "extension" ] ;
               fhir:variable [ fhir:v "tgtSubjectIdentifierSystemEx" ]
             ] [
               fhir:context [ fhir:v "tgtSubjectIdentifierValue" ] ;
               fhir:contextType [ fhir:v "variable" ] ;
               fhir:element [ fhir:v "extension" ] ;
               fhir:variable [ fhir:v "tgtSubjectIdentifierValueEx" ]
             ] ) ;
             fhir:rule ( [
               fhir:name [ fhir:v "medicationRequestsubjectIdentifierSystemExtension" ] ;
               fhir:source ( [
                 fhir:context [ fhir:v "kbvMedicationRequest" ] ;
                 fhir:element [ fhir:v "subject" ] ;
                 fhir:variable [ fhir:v "srcSubject" ]
               ] ) ;
               fhir:target ( [
                 fhir:context [ fhir:v "tgtSubjectIdentifierSystemEx" ] ;
                 fhir:contextType [ fhir:v "variable" ] ;
                 fhir:element [ fhir:v "url" ] ;
                 fhir:transform [ fhir:v "copy" ] ;
                 fhir:parameter ( [
                   fhir:value [
                     a fhir:String ;
                     fhir:v "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
                   ]
                 ] )
               ] [
                 fhir:context [ fhir:v "tgtSubjectIdentifierSystemEx" ] ;
                 fhir:contextType [ fhir:v "variable" ] ;
                 fhir:element [ fhir:v "value" ] ;
                 fhir:transform [ fhir:v "cast" ] ;
                 fhir:parameter ( [
                   fhir:value [
                     a fhir:String ;
                     fhir:v "not-permitted"
                   ]
                 ] [
                   fhir:value [
                     a fhir:String ;
                     fhir:v "code"
                   ]
                 ] )
               ] ) ;
               fhir:documentation [ fhir:v "Setzt data-absent-reason auf 'not-permitted' um Patientendaten zu anonymisieren" ]
             ] [
               fhir:name [ fhir:v "medicationRequestsubjectIdentifierValueExtension" ] ;
               fhir:source ( [
                 fhir:context [ fhir:v "kbvMedicationRequest" ] ;
                 fhir:element [ fhir:v "subject" ] ;
                 fhir:variable [ fhir:v "srcSubject" ]
               ] ) ;
               fhir:target ( [
                 fhir:context [ fhir:v "tgtSubjectIdentifierValueEx" ] ;
                 fhir:contextType [ fhir:v "variable" ] ;
                 fhir:element [ fhir:v "url" ] ;
                 fhir:transform [ fhir:v "copy" ] ;
                 fhir:parameter ( [
                   fhir:value [
                     a fhir:String ;
                     fhir:v "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
                   ]
                 ] )
               ] [
                 fhir:context [ fhir:v "tgtSubjectIdentifierValueEx" ] ;
                 fhir:contextType [ fhir:v "variable" ] ;
                 fhir:element [ fhir:v "value" ] ;
                 fhir:transform [ fhir:v "cast" ] ;
                 fhir:parameter ( [
                   fhir:value [
                     a fhir:String ;
                     fhir:v "not-permitted"
                   ]
                 ] [
                   fhir:value [
                     a fhir:String ;
                     fhir:v "code"
                   ]
                 ] )
               ] ) ;
               fhir:documentation [ fhir:v "Setzt data-absent-reason auf 'not-permitted' um Patientendaten zu anonymisieren" ]
             ] ) ;
             fhir:documentation [ fhir:v "Erstellt data-absent-reason Extension für Subject Identifier" ]
           ] ) ;
           fhir:documentation [ fhir:v "Erstellt data-absent-reason Extension für Subject Identifier" ]
         ] )
       ] ) ;
       fhir:documentation [ fhir:v "Entfernt Patientenbezug durch data-absent-reason Extension für Datenschutz im digitalen Durchschlag" ]
     ] [
       fhir:name [ fhir:v "medicationRequestAuthoredOn" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "kbvMedicationRequest" ] ;
         fhir:element [ fhir:v "authoredOn" ] ;
         fhir:variable [ fhir:v "srcAuthoredOnVar" ]
       ] ) ;
       fhir:target ( [
         fhir:context [ fhir:v "bfarmMedicationRequest" ] ;
         fhir:contextType [ fhir:v "variable" ] ;
         fhir:element [ fhir:v "authoredOn" ] ;
         fhir:transform [ fhir:v "copy" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:Id ;
             fhir:v "srcAuthoredOnVar"
           ]
         ] )
       ] ) ;
       fhir:documentation [ fhir:v "Übernimmt das Verschreibungsdatum unverändert vom KBV MedicationRequest" ]
     ] [
       fhir:name [ fhir:v "medicationRequestDosageInstruction" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "kbvMedicationRequest" ] ;
         fhir:element [ fhir:v "dosageInstruction" ] ;
         fhir:variable [ fhir:v "srcDosageInstructionVar" ]
       ] ) ;
       fhir:target ( [
         fhir:context [ fhir:v "bfarmMedicationRequest" ] ;
         fhir:contextType [ fhir:v "variable" ] ;
         fhir:element [ fhir:v "dosageInstruction" ] ;
         fhir:transform [ fhir:v "copy" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:Id ;
             fhir:v "srcDosageInstructionVar"
           ]
         ] )
       ] ) ;
       fhir:documentation [ fhir:v "Kopiert die Dosierungsanweisungen vollständig für den digitalen Durchschlag" ]
     ] [
       fhir:name [ fhir:v "medicationRequestDispenseRequest" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "kbvMedicationRequest" ] ;
         fhir:element [ fhir:v "dispenseRequest" ] ;
         fhir:variable [ fhir:v "srcDispenseRequestVar" ]
       ] ) ;
       fhir:target ( [
         fhir:context [ fhir:v "bfarmMedicationRequest" ] ;
         fhir:contextType [ fhir:v "variable" ] ;
         fhir:element [ fhir:v "dispenseRequest" ] ;
         fhir:transform [ fhir:v "copy" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:Id ;
             fhir:v "srcDispenseRequestVar"
           ]
         ] )
       ] ) ;
       fhir:documentation [ fhir:v "Übernimmt Abgabeanweisungen (Menge, Wiederholungen) aus der ursprünglichen Verschreibung" ]
     ] [
       fhir:name [ fhir:v "medicationReference" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "kbvMedicationRequest" ] ;
         fhir:element [ fhir:v "medication" ] ;
         fhir:variable [ fhir:v "medicationVar" ]
       ] ) ;
       fhir:target ( [
         fhir:context [ fhir:v "bfarmMedicationRequest" ] ;
         fhir:contextType [ fhir:v "variable" ] ;
         fhir:element [ fhir:v "medication" ] ;
         fhir:variable [ fhir:v "tgtMedicationReference" ] ;
         fhir:transform [ fhir:v "create" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:String ;
             fhir:v "Reference"
           ]
         ] )
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "normalizeMedicationReference" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "medicationVar" ] ;
           fhir:element [ fhir:v "reference" ] ;
           fhir:variable [ fhir:v "medicationReferenceValue" ]
         ] ) ;
         fhir:rule ( [
           fhir:name [ fhir:v "normalizeMedicationReferenceTransformation" ] ;
           fhir:source ( [
             fhir:context [ fhir:v "medicationReferenceValue" ] ;
             fhir:variable [ fhir:v "currentMedicationReferenceValue" ]
           ] ) ;
           fhir:target ( [
             fhir:context [ fhir:v "tgtMedicationReference" ] ;
             fhir:contextType [ fhir:v "variable" ] ;
             fhir:element [ fhir:v "reference" ] ;
             fhir:transform [ fhir:v "evaluate" ] ;
             fhir:parameter ( [
               fhir:value [
                 a fhir:String ;
                 fhir:v "iif(%currentMedicationReferenceValue.startsWith('urn:uuid:'), %currentMedicationReferenceValue, 'urn:uuid:' & %currentMedicationReferenceValue.replaceMatches('.*[:/]', ''))"
               ]
             ] )
           ] )
         ] )
       ] ) ;
       fhir:documentation [ fhir:v "Transformiert die Medication-Referenz zu urn:uuid Format" ]
     ] )
  ] ) . # 

# -------------------------------------------------------------------------------------

