@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/ERPTPrescriptionStructureMapMedication> a fhir:StructureMap ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "ERPTPrescriptionStructureMapMedication"] ; # 
  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 ERPTPrescriptionStructureMapMedication</b></p><a name=\"ERPTPrescriptionStructureMapMedication\"> </a><a name=\"hcERPTPrescriptionStructureMapMedication\"> </a><pre class=\"fml\">#xD;\n<b>map</b><span style=\"color: navy\"> \"</span>https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapMedication<span style=\"color: navy\">\" = \"</span>ERPTPrescriptionStructureMapMedication<span style=\"color: navy\">\"#xD;\n#xD;\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Router-Mapping zur Auswahl der korrekten Medication-Transformation basierend auf dem KBV/gematik Profil</span>#xD;\n#xD;\n<b>uses</b><span style=\"color: navy\"> \"</span><a href=\"http://hl7.org/fhir/R4/medication.html\" title=\"Medication\">http://hl7.org/fhir/StructureDefinition/Medication</a><span style=\"color: navy\">\" </span><b>alias </b>srcMedication <b>as </b><b>source</b>#xD;\n<b>uses</b><span style=\"color: navy\"> \"</span><a href=\"http://hl7.org/fhir/R4/medication.html\" title=\"Medication\">http://hl7.org/fhir/StructureDefinition/Medication</a><span style=\"color: navy\">\" </span><b>alias </b>tgtMedication <b>as </b><b>target</b>#xD;\n#xD;\n<b>imports</b><span style=\"color: navy\"> \"</span><a href=\"StructureMap-ERPTPrescriptionStructureMapGEMMedication.html\" title=\"E-T-Rezept Structure Map for Medication\">https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapGEMMedication</a><span style=\"color: navy\">\"#xD;\n</span><b>imports</b><span style=\"color: navy\"> \"</span><a href=\"StructureMap-ERPTPrescriptionStructureMapKBVCompoundingMedication.html\" title=\"E-T-Rezept Structure Map for KBV Compounding Medication\">https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVCompoundingMedication</a><span style=\"color: navy\">\"#xD;\n</span><b>imports</b><span style=\"color: navy\"> \"</span><a href=\"StructureMap-ERPTPrescriptionStructureMapKBVPZNMedication.html\" title=\"E-T-Rezept Structure Map for KBV PZN Medication\">https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVPZNMedication</a><span style=\"color: navy\">\"#xD;\n</span><b>imports</b><span style=\"color: navy\"> \"</span><a href=\"StructureMap-ERPTPrescriptionStructureMapKBVFreeTextMedication.html\" title=\"E-T-Rezept Structure Map for KBV FreeText Medication\">https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVFreeTextMedication</a><span style=\"color: navy\">\"#xD;\n</span><b>imports</b><span style=\"color: navy\"> \"</span><a href=\"StructureMap-ERPTPrescriptionStructureMapKBVIngredientMedication.html\" title=\"E-T-Rezept Structure Map for KBV Ingredient Medication\">https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVIngredientMedication</a><span style=\"color: navy\">\"#xD;\n</span>#xD;\n<span style=\"color: navy\">// </span><span style=\"color: green\">Router-Mapping zur Auswahl der korrekten Medication-Transformation basierend auf dem KBV/gematik Profil</span>#xD;\n<b>group </b>ERPTPrescriptionStructureMapMedication<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcMedication</span><span style=\"color: navy\"> : </span>srcMedication, <b>target</b> <span style=\"color: maroon\">tgtMedication</span><span style=\"color: navy\"> : </span>tgtMedication<span style=\"color: navy\">)</span><span style=\"color: navy\"> {#xD;\n</span>  srcMedication<b> as </b><span style=\"color: maroon\">srcPZN</span><b> where </b>meta.profile.contains('KBV_PR_ERP_Medication_PZN')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>    srcPZN<b> then </b>ERPTPrescriptionStructureMapKBVPZNMedication<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcMedication</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtMedication</span><span style=\"color: navy\">)</span> <i>\"mapPZN\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Führt die Transformation für PZN-Medikamente durch (Fertigarzneimittel mit Pharmazentralnummer)</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"decideOnMedicationPZN\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erkennt PZN-basierte Medikamente und leitet an spezialisiertes PZN-Mapping weiter</span>#xD;\n  srcMedication<b> as </b><span style=\"color: maroon\">srcFreeText</span><b> where </b>meta.profile.contains('KBV_PR_ERP_Medication_FreeText')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>    srcFreeText<b> then </b>ERPTPrescriptionStructureMapKBVFreeTextMedication<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcMedication</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtMedication</span><span style=\"color: navy\">)</span> <i>\"mapFreeText\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Führt die Transformation für Freitext-Medikamente durch (nicht standardisierte Arzneimittelangaben)</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"decideOnMedicationFreeText\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erkennt Freitext-Medikamente und leitet an spezialisiertes FreeText-Mapping weiter</span>#xD;\n  srcMedication<b> as </b><span style=\"color: maroon\">srcIngredient</span><b> where </b>meta.profile.contains('KBV_PR_ERP_Medication_Ingredient')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>    srcIngredient<b> then </b>ERPTPrescriptionStructureMapKBVIngredientMedication<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcMedication</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtMedication</span><span style=\"color: navy\">)</span> <i>\"mapIngredient\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Führt die Transformation für wirkstoffbasierte Medikamente durch (Rezeptur nach Wirkstoffen)</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"decideOnMedicationIngredient\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erkennt wirkstoffbasierte Medikamente und leitet an spezialisiertes Ingredient-Mapping weiter</span>#xD;\n  srcMedication<b> as </b><span style=\"color: maroon\">srcCompounding</span><b> where </b>meta.profile.contains('KBV_PR_ERP_Medication_Compounding')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>    srcCompounding<b> then </b>ERPTPrescriptionStructureMapKBVCompoundingMedication<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcMedication</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtMedication</span><span style=\"color: navy\">)</span> <i>\"mapCompounding\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Führt die Transformation für Rezeptur-Medikamente durch (individuell hergestellte Arzneimittel)</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"decideOnMedicationCompounding\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erkennt Rezeptur-Medikamente und leitet an spezialisiertes Compounding-Mapping weiter</span>#xD;\n  srcMedication<b> as </b><span style=\"color: maroon\">srcGemMed</span><b> where </b>meta.profile.contains('GEM_ERP_PR_Medication')<b> then</b><span style=\"color: navy\"> {#xD;\n</span>    srcGemMed<b> then </b>ERPTPrescriptionStructureMapGEMMedication<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcMedication</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgtMedication</span><span style=\"color: navy\">)</span> <i>\"mapGemMed\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Führt die Transformation für gematik-Medikamente durch (abgegebene Arzneimittel aus der Apotheke)</span>#xD;\n  <span style=\"color: navy\">}</span> <i>\"decideOnMedicationGematik\"</i><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">Erkennt gematik-Medikamente und leitet an spezialisiertes gematik-Mapping weiter</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/ERPTPrescriptionStructureMapMedication"^^xsd:anyURI ;
     fhir:l <https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapMedication>
  ] ; # 
  fhir:version [ fhir:v "2.0.0-ballot.1"] ; # 
  fhir:name [ fhir:v "ERPTPrescriptionStructureMapMedication"] ; # 
  fhir:title [ fhir:v "E-T-Rezept Structure Map for Medication"] ; # 
  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 "Router-Mapping zur Auswahl der korrekten Medication-Transformation basierend auf dem KBV/gematik Profil"] ; # 
  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/Medication"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/StructureDefinition/Medication>
     ] ;
     fhir:mode [ fhir:v "source" ] ;
     fhir:alias [ fhir:v "srcMedication" ]
  ] [
     fhir:url [
       fhir:v "http://hl7.org/fhir/StructureDefinition/Medication"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/StructureDefinition/Medication>
     ] ;
     fhir:mode [ fhir:v "target" ] ;
     fhir:alias [ fhir:v "tgtMedication" ]
  ] ) ; # 
  fhir:import ( [
     fhir:v "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapGEMMedication"^^xsd:anyURI ;
     fhir:l <https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapGEMMedication>
  ] [
     fhir:v "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVCompoundingMedication"^^xsd:anyURI ;
     fhir:l <https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVCompoundingMedication>
  ] [
     fhir:v "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVPZNMedication"^^xsd:anyURI ;
     fhir:l <https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVPZNMedication>
  ] [
     fhir:v "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVFreeTextMedication"^^xsd:anyURI ;
     fhir:l <https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVFreeTextMedication>
  ] [
     fhir:v "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVIngredientMedication"^^xsd:anyURI ;
     fhir:l <https://gematik.de/fhir/erp-t-prescription/StructureMap/ERPTPrescriptionStructureMapKBVIngredientMedication>
  ] ) ; # 
  fhir:group ( [
     fhir:name [ fhir:v "ERPTPrescriptionStructureMapMedication" ] ;
     fhir:typeMode [ fhir:v "none" ] ;
     fhir:documentation [ fhir:v "Router-Mapping zur Auswahl der korrekten Medication-Transformation basierend auf dem KBV/gematik Profil" ] ;
     fhir:input ( [
       fhir:name [ fhir:v "srcMedication" ] ;
       fhir:type [ fhir:v "srcMedication" ] ;
       fhir:mode [ fhir:v "source" ]
     ] [
       fhir:name [ fhir:v "tgtMedication" ] ;
       fhir:type [ fhir:v "tgtMedication" ] ;
       fhir:mode [ fhir:v "target" ]
     ] ) ;
     fhir:rule ( [
       fhir:name [ fhir:v "decideOnMedicationPZN" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "srcMedication" ] ;
         fhir:variable [ fhir:v "srcPZN" ] ;
         fhir:condition [ fhir:v "meta.profile.contains('KBV_PR_ERP_Medication_PZN')" ]
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "mapPZN" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "srcPZN" ]
         ] ) ;
         fhir:dependent ( [
           fhir:name [ fhir:v "ERPTPrescriptionStructureMapKBVPZNMedication" ] ;
           fhir:variable ( [ fhir:v "srcMedication" ] [ fhir:v "tgtMedication" ] )
         ] ) ;
         fhir:documentation [ fhir:v "Führt die Transformation für PZN-Medikamente durch (Fertigarzneimittel mit Pharmazentralnummer)" ]
       ] ) ;
       fhir:documentation [ fhir:v "Erkennt PZN-basierte Medikamente und leitet an spezialisiertes PZN-Mapping weiter" ]
     ] [
       fhir:name [ fhir:v "decideOnMedicationFreeText" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "srcMedication" ] ;
         fhir:variable [ fhir:v "srcFreeText" ] ;
         fhir:condition [ fhir:v "meta.profile.contains('KBV_PR_ERP_Medication_FreeText')" ]
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "mapFreeText" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "srcFreeText" ]
         ] ) ;
         fhir:dependent ( [
           fhir:name [ fhir:v "ERPTPrescriptionStructureMapKBVFreeTextMedication" ] ;
           fhir:variable ( [ fhir:v "srcMedication" ] [ fhir:v "tgtMedication" ] )
         ] ) ;
         fhir:documentation [ fhir:v "Führt die Transformation für Freitext-Medikamente durch (nicht standardisierte Arzneimittelangaben)" ]
       ] ) ;
       fhir:documentation [ fhir:v "Erkennt Freitext-Medikamente und leitet an spezialisiertes FreeText-Mapping weiter" ]
     ] [
       fhir:name [ fhir:v "decideOnMedicationIngredient" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "srcMedication" ] ;
         fhir:variable [ fhir:v "srcIngredient" ] ;
         fhir:condition [ fhir:v "meta.profile.contains('KBV_PR_ERP_Medication_Ingredient')" ]
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "mapIngredient" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "srcIngredient" ]
         ] ) ;
         fhir:dependent ( [
           fhir:name [ fhir:v "ERPTPrescriptionStructureMapKBVIngredientMedication" ] ;
           fhir:variable ( [ fhir:v "srcMedication" ] [ fhir:v "tgtMedication" ] )
         ] ) ;
         fhir:documentation [ fhir:v "Führt die Transformation für wirkstoffbasierte Medikamente durch (Rezeptur nach Wirkstoffen)" ]
       ] ) ;
       fhir:documentation [ fhir:v "Erkennt wirkstoffbasierte Medikamente und leitet an spezialisiertes Ingredient-Mapping weiter" ]
     ] [
       fhir:name [ fhir:v "decideOnMedicationCompounding" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "srcMedication" ] ;
         fhir:variable [ fhir:v "srcCompounding" ] ;
         fhir:condition [ fhir:v "meta.profile.contains('KBV_PR_ERP_Medication_Compounding')" ]
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "mapCompounding" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "srcCompounding" ]
         ] ) ;
         fhir:dependent ( [
           fhir:name [ fhir:v "ERPTPrescriptionStructureMapKBVCompoundingMedication" ] ;
           fhir:variable ( [ fhir:v "srcMedication" ] [ fhir:v "tgtMedication" ] )
         ] ) ;
         fhir:documentation [ fhir:v "Führt die Transformation für Rezeptur-Medikamente durch (individuell hergestellte Arzneimittel)" ]
       ] ) ;
       fhir:documentation [ fhir:v "Erkennt Rezeptur-Medikamente und leitet an spezialisiertes Compounding-Mapping weiter" ]
     ] [
       fhir:name [ fhir:v "decideOnMedicationGematik" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "srcMedication" ] ;
         fhir:variable [ fhir:v "srcGemMed" ] ;
         fhir:condition [ fhir:v "meta.profile.contains('GEM_ERP_PR_Medication')" ]
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "mapGemMed" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "srcGemMed" ]
         ] ) ;
         fhir:dependent ( [
           fhir:name [ fhir:v "ERPTPrescriptionStructureMapGEMMedication" ] ;
           fhir:variable ( [ fhir:v "srcMedication" ] [ fhir:v "tgtMedication" ] )
         ] ) ;
         fhir:documentation [ fhir:v "Führt die Transformation für gematik-Medikamente durch (abgegebene Arzneimittel aus der Apotheke)" ]
       ] ) ;
       fhir:documentation [ fhir:v "Erkennt gematik-Medikamente und leitet an spezialisiertes gematik-Mapping weiter" ]
     ] )
  ] ) . # 

# -------------------------------------------------------------------------------------

