@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 -------------------------------------------------------------------

<http://hl7.org/fhir/uv/omop/StructureMap/MedicationMap> a fhir:StructureMap ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "MedicationMap"] ; # 
  fhir:language [ fhir:v "en"] ; # 
  fhir:text [
     fhir:status [ fhir:v "generated" ] ;
     fhir:div [ fhir:v "<div xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap MedicationMap</b></p><a name=\"MedicationMap\"> </a><a name=\"hcMedicationMap\"> </a><div style=\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\"><p style=\"margin-bottom: 0px\">Language: en</p></div><pre class=\"fml\">#xD;\n<span style=\"color: #cc00cc\">/// <b>url</b> = </span><span style=\"color: blue\">'http://hl7.org/fhir/uv/omop/StructureMap/MedicationMap'</span>#xD;\n<span style=\"color: #cc00cc\">/// <b>name</b> = </span><span style=\"color: blue\">'MedicationMap'</span>#xD;\n<span style=\"color: #cc00cc\">/// <b>title</b> = </span><span style=\"color: blue\">'Mapping MedicationStatement resource to DrugExposure OMOP Domain'</span>#xD;\n<span style=\"color: #cc00cc\">/// <b>status</b> = </span><span style=\"color: blue\">'draft'</span>#xD;\n#xD;\n<b>uses</b><span style=\"color: navy\"> \"</span><a href=\"http://hl7.org/fhir/R5/medicationstatement.html\" title=\"MedicationStatement\">http://hl7.org/fhir/StructureDefinition/MedicationStatement</a><span style=\"color: navy\">\" </span><b>alias </b>MedState <b>as </b><b>source</b>#xD;\n<b>uses</b><span style=\"color: navy\"> \"</span><a href=\"StructureDefinition-DrugExposure.html\" title=\"Drug Exposure OMOP Table\">http://hl7.org/fhir/uv/omop/StructureDefinition/DrugExposure</a><span style=\"color: navy\">\" </span><b>alias </b>DrugExpTable <b>as </b><b>target</b>#xD;\n#xD;\n<b>group </b>MedExposure<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>MedState, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>DrugExpTable<span style=\"color: navy\">)</span><span style=\"color: navy\"> {#xD;\n</span>  src.medication<span style=\"color: navy\"> : </span>CodeableReference<b> as </b><span style=\"color: maroon\">s</span><span style=\"color: navy\"><b> -&gt; </b></span><span style=\"color: maroon\">tgt</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    s.concept<b> as </b><span style=\"color: maroon\">scs</span><span style=\"color: navy\"><b> -&gt; </b></span><span style=\"color: maroon\">tgt</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      scs.coding<b> as </b><span style=\"color: maroon\">sc</span><span style=\"color: navy\"><b> -&gt; </b></span><span style=\"color: maroon\">tgt</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>        sc.code<b> as </b><span style=\"color: maroon\">a</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.drug_concept_id = <span style=\"color: maroon\">a</span><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span> <span style=\"color: navy\">// </span><span style=\"color: green\">src.id as id -&gt; tgt.drug_exposure_id = cast(id, \"integer\");</span>#xD;\n  src.effective<span style=\"color: navy\"> : </span>dateTime<b> as </b><span style=\"color: maroon\">edt</span><span style=\"color: navy\"><b> -&gt; </b></span> tgt.drug_exposure_start_datetime = <span style=\"color: maroon\">edt</span><span style=\"color: navy\">, </span> tgt.drug_exposure_start_date = <b>cast</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">edt</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'date'</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>#xD;\n  src.effective<span style=\"color: navy\"> : </span>Period<b> as </b><span style=\"color: maroon\">s</span><span style=\"color: navy\"><b> -&gt; </b></span><span style=\"color: maroon\">tgt</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    s.start<b> as </b><span style=\"color: maroon\">fps</span><span style=\"color: navy\"><b> -&gt; </b></span> tgt.drug_exposure_start_datetime = <span style=\"color: maroon\">fps</span><span style=\"color: navy\">, </span> tgt.drug_exposure_start_date = <b>cast</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">fps</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'date'</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>#xD;\n  src.effective<span style=\"color: navy\"> : </span>Period<b> as </b><span style=\"color: maroon\">s</span><span style=\"color: navy\"><b> -&gt; </b></span><span style=\"color: maroon\">tgt</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    s.end<b> as </b><span style=\"color: maroon\">fpe</span><span style=\"color: navy\"><b> -&gt; </b></span> tgt.drug_exposure_end_datetime = <span style=\"color: maroon\">fpe</span><span style=\"color: navy\">, </span> tgt.drug_exposure_end_date = <b>cast</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">fps</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'date'</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>#xD;\n  src.effective<span style=\"color: navy\"> : </span>Period<b> as </b><span style=\"color: maroon\">s</span><span style=\"color: navy\"><b> -&gt; </b></span><span style=\"color: maroon\">tgt</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    s.end<b> as </b><span style=\"color: maroon\">fpe</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.verbatim_end_date = <b>cast</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">fps</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'date'</span><span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>#xD;\n  src.category<span style=\"color: navy\"> : </span>CodeableConcept<b> as </b><span style=\"color: maroon\">s</span><span style=\"color: navy\"><b> -&gt; </b></span><span style=\"color: maroon\">tgt</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    s.coding<b> as </b><span style=\"color: maroon\">sc</span><span style=\"color: navy\"><b> -&gt; </b></span><span style=\"color: maroon\">tgt</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      sc.code<b> as </b><span style=\"color: maroon\">a</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.drug_type_concept_id = <span style=\"color: maroon\">a</span><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>#xD;\n  src.reason<span style=\"color: navy\"> : </span>CodeableReference<b> as </b><span style=\"color: maroon\">s</span><span style=\"color: navy\"><b> -&gt; </b></span><span style=\"color: maroon\">tgt</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>    s.concept<b> as </b><span style=\"color: maroon\">scs</span><span style=\"color: navy\"><b> -&gt; </b></span><span style=\"color: maroon\">tgt</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>      scs.coding<b> as </b><span style=\"color: maroon\">sc</span><span style=\"color: navy\"><b> -&gt; </b></span><span style=\"color: maroon\">tgt</span><b> then</b><span style=\"color: navy\"> {#xD;\n</span>        sc.code<b> as </b><span style=\"color: maroon\">a</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.stop_reason = <span style=\"color: maroon\">a</span><span style=\"color: navy\">;</span>#xD;\n      <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>#xD;\n    <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>#xD;\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>#xD;\n<span style=\"color: navy\">}#xD;\n#xD;\n</span></pre></div>"^^rdf:XMLLiteral ]
  ] ; # 
  fhir:extension ( [
     fhir:url [
       fhir:v "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/StructureDefinition/structuredefinition-wg>
     ] ;
     fhir:value [
       a fhir:Code ;
       fhir:v "brr"
     ]
  ] [
     fhir:url [
       fhir:v "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm>
     ] ;
     fhir:value [
       a fhir:Integer ;
       fhir:v 1 ;
       fhir:extension ( [
         fhir:url [
           fhir:v "http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom"^^xsd:anyURI ;
           fhir:l <http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom>
         ] ;
         fhir:value [
           a fhir:Canonical ;
           fhir:v "http://hl7.org/fhir/uv/omop/ImplementationGuide/hl7.fhir.uv.omop"^^xsd:anyURI ;
           fhir:l <http://hl7.org/fhir/uv/omop/ImplementationGuide/hl7.fhir.uv.omop>
         ]
       ] )
     ]
  ] [
     fhir:url [
       fhir:v "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status>
     ] ;
     fhir:value [
       a fhir:Code ;
       fhir:v "informative" ;
       fhir:extension ( [
         fhir:url [
           fhir:v "http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom"^^xsd:anyURI ;
           fhir:l <http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom>
         ] ;
         fhir:value [
           a fhir:Canonical ;
           fhir:v "http://hl7.org/fhir/uv/omop/ImplementationGuide/hl7.fhir.uv.omop"^^xsd:anyURI ;
           fhir:l <http://hl7.org/fhir/uv/omop/ImplementationGuide/hl7.fhir.uv.omop>
         ]
       ] )
     ]
  ] ) ; # 
  fhir:url [
     fhir:v "http://hl7.org/fhir/uv/omop/StructureMap/MedicationMap"^^xsd:anyURI ;
     fhir:l <http://hl7.org/fhir/uv/omop/StructureMap/MedicationMap>
  ] ; # 
  fhir:version [ fhir:v "1.0.0"] ; # 
  fhir:name [ fhir:v "MedicationMap"] ; # 
  fhir:title [ fhir:v "Mapping MedicationStatement resource to DrugExposure OMOP Domain"] ; # 
  fhir:status [ fhir:v "draft"] ; # 
  fhir:date [ fhir:v "2026-04-02T22:51:15+00:00"^^xsd:dateTime] ; # 
  fhir:publisher [ fhir:v "HL7 International / Biomedical Research and Regulation"] ; # 
  fhir:contact ( [
     fhir:name [ fhir:v "HL7 International / Biomedical Research and Regulation" ] ;
     fhir:telecom ( [
       fhir:system [ fhir:v "url" ] ;
       fhir:value [ fhir:v "http://www.hl7.org/Special/committees/rcrim" ]
     ] )
  ] ) ; # 
  fhir:description [ fhir:v "This mapping maps FHIR MedicationStatement instances to OMOP Drug Exposure Table objects.  NOTE: It does not map FHIR MedicationRequest instances although there is a discussion of those instances in the notes."] ; # 
  fhir:jurisdiction ( [
     fhir:coding ( [
       fhir:system [
         fhir:v "http://unstats.un.org/unsd/methods/m49/m49.htm"^^xsd:anyURI ;
         fhir:l <http://unstats.un.org/unsd/methods/m49/m49.htm>
       ] ;
       fhir:code [ fhir:v "001" ] ;
       fhir:display [ fhir:v "World" ]
     ] )
  ] ) ; # 
  fhir:structure ( [
     fhir:url [
       fhir:v "http://hl7.org/fhir/StructureDefinition/MedicationStatement"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/StructureDefinition/MedicationStatement>
     ] ;
     fhir:mode [ fhir:v "source" ] ;
     fhir:alias [ fhir:v "MedState" ]
  ] [
     fhir:url [
       fhir:v "http://hl7.org/fhir/uv/omop/StructureDefinition/DrugExposure"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/uv/omop/StructureDefinition/DrugExposure>
     ] ;
     fhir:mode [ fhir:v "target" ] ;
     fhir:alias [ fhir:v "DrugExpTable" ]
  ] ) ; # 
  fhir:group ( [
     fhir:name [ fhir:v "MedExposure" ] ;
     fhir:input ( [
       fhir:name [ fhir:v "src" ] ;
       fhir:type [ fhir:v "MedState" ] ;
       fhir:mode [ fhir:v "source" ]
     ] [
       fhir:name [ fhir:v "tgt" ] ;
       fhir:type [ fhir:v "DrugExpTable" ] ;
       fhir:mode [ fhir:v "target" ]
     ] ) ;
     fhir:rule ( [
       fhir:name [ fhir:v "medicationCodeableReference" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "src" ] ;
         fhir:type [ fhir:v "CodeableReference" ] ;
         fhir:element [ fhir:v "medication" ] ;
         fhir:variable [ fhir:v "s" ]
       ] ) ;
       fhir:target ( [
         fhir:transform [ fhir:v "copy" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:Id ;
             fhir:v "tgt"
           ]
         ] )
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "concept" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "s" ] ;
           fhir:element [ fhir:v "concept" ] ;
           fhir:variable [ fhir:v "scs" ]
         ] ) ;
         fhir:target ( [
           fhir:transform [ fhir:v "copy" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:Id ;
               fhir:v "tgt"
             ]
           ] )
         ] ) ;
         fhir:rule ( [
           fhir:name [ fhir:v "coding" ] ;
           fhir:source ( [
             fhir:context [ fhir:v "scs" ] ;
             fhir:element [ fhir:v "coding" ] ;
             fhir:variable [ fhir:v "sc" ]
           ] ) ;
           fhir:target ( [
             fhir:transform [ fhir:v "copy" ] ;
             fhir:parameter ( [
               fhir:value [
                 a fhir:Id ;
                 fhir:v "tgt"
               ]
             ] )
           ] ) ;
           fhir:rule ( [
             fhir:name [ fhir:v "code" ] ;
             fhir:source ( [
               fhir:context [ fhir:v "sc" ] ;
               fhir:element [ fhir:v "code" ] ;
               fhir:variable [ fhir:v "a" ]
             ] ) ;
             fhir:target ( [
               fhir:context [ fhir:v "tgt" ] ;
               fhir:element [ fhir:v "drug_concept_id" ] ;
               fhir:transform [ fhir:v "copy" ] ;
               fhir:parameter ( [
                 fhir:value [
                   a fhir:Id ;
                   fhir:v "a"
                 ]
               ] )
             ] )
           ] )
         ] )
       ] ) ;
       fhir:documentation [ fhir:v "src.id as id -> tgt.drug_exposure_id = cast(id, \"integer\");" ]
     ] [
       fhir:name [ fhir:v "effectiveDateTime" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "src" ] ;
         fhir:type [ fhir:v "dateTime" ] ;
         fhir:element [ fhir:v "effective" ] ;
         fhir:variable [ fhir:v "edt" ]
       ] ) ;
       fhir:target ( [
         fhir:context [ fhir:v "tgt" ] ;
         fhir:element [ fhir:v "drug_exposure_start_datetime" ] ;
         fhir:transform [ fhir:v "copy" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:Id ;
             fhir:v "edt"
           ]
         ] )
       ] [
         fhir:context [ fhir:v "tgt" ] ;
         fhir:element [ fhir:v "drug_exposure_start_date" ] ;
         fhir:transform [ fhir:v "cast" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:Id ;
             fhir:v "edt"
           ]
         ] [
           fhir:value [
             a fhir:String ;
             fhir:v "date"
           ]
         ] )
       ] )
     ] [
       fhir:name [ fhir:v "effectivePeriod" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "src" ] ;
         fhir:type [ fhir:v "Period" ] ;
         fhir:element [ fhir:v "effective" ] ;
         fhir:variable [ fhir:v "s" ]
       ] ) ;
       fhir:target ( [
         fhir:transform [ fhir:v "copy" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:Id ;
             fhir:v "tgt"
           ]
         ] )
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "start" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "s" ] ;
           fhir:element [ fhir:v "start" ] ;
           fhir:variable [ fhir:v "fps" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgt" ] ;
           fhir:element [ fhir:v "drug_exposure_start_datetime" ] ;
           fhir:transform [ fhir:v "copy" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:Id ;
               fhir:v "fps"
             ]
           ] )
         ] [
           fhir:context [ fhir:v "tgt" ] ;
           fhir:element [ fhir:v "drug_exposure_start_date" ] ;
           fhir:transform [ fhir:v "cast" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:Id ;
               fhir:v "fps"
             ]
           ] [
             fhir:value [
               a fhir:String ;
               fhir:v "date"
             ]
           ] )
         ] )
       ] )
     ] [
       fhir:name [ fhir:v "effectivePeriod" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "src" ] ;
         fhir:type [ fhir:v "Period" ] ;
         fhir:element [ fhir:v "effective" ] ;
         fhir:variable [ fhir:v "s" ]
       ] ) ;
       fhir:target ( [
         fhir:transform [ fhir:v "copy" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:Id ;
             fhir:v "tgt"
           ]
         ] )
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "end" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "s" ] ;
           fhir:element [ fhir:v "end" ] ;
           fhir:variable [ fhir:v "fpe" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgt" ] ;
           fhir:element [ fhir:v "drug_exposure_end_datetime" ] ;
           fhir:transform [ fhir:v "copy" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:Id ;
               fhir:v "fpe"
             ]
           ] )
         ] [
           fhir:context [ fhir:v "tgt" ] ;
           fhir:element [ fhir:v "drug_exposure_end_date" ] ;
           fhir:transform [ fhir:v "cast" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:Id ;
               fhir:v "fps"
             ]
           ] [
             fhir:value [
               a fhir:String ;
               fhir:v "date"
             ]
           ] )
         ] )
       ] )
     ] [
       fhir:name [ fhir:v "effectivePeriod" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "src" ] ;
         fhir:type [ fhir:v "Period" ] ;
         fhir:element [ fhir:v "effective" ] ;
         fhir:variable [ fhir:v "s" ]
       ] ) ;
       fhir:target ( [
         fhir:transform [ fhir:v "copy" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:Id ;
             fhir:v "tgt"
           ]
         ] )
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "end" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "s" ] ;
           fhir:element [ fhir:v "end" ] ;
           fhir:variable [ fhir:v "fpe" ]
         ] ) ;
         fhir:target ( [
           fhir:context [ fhir:v "tgt" ] ;
           fhir:element [ fhir:v "verbatim_end_date" ] ;
           fhir:transform [ fhir:v "cast" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:Id ;
               fhir:v "fps"
             ]
           ] [
             fhir:value [
               a fhir:String ;
               fhir:v "date"
             ]
           ] )
         ] )
       ] )
     ] [
       fhir:name [ fhir:v "categoryCodeableConcept" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "src" ] ;
         fhir:type [ fhir:v "CodeableConcept" ] ;
         fhir:element [ fhir:v "category" ] ;
         fhir:variable [ fhir:v "s" ]
       ] ) ;
       fhir:target ( [
         fhir:transform [ fhir:v "copy" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:Id ;
             fhir:v "tgt"
           ]
         ] )
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "coding" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "s" ] ;
           fhir:element [ fhir:v "coding" ] ;
           fhir:variable [ fhir:v "sc" ]
         ] ) ;
         fhir:target ( [
           fhir:transform [ fhir:v "copy" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:Id ;
               fhir:v "tgt"
             ]
           ] )
         ] ) ;
         fhir:rule ( [
           fhir:name [ fhir:v "code" ] ;
           fhir:source ( [
             fhir:context [ fhir:v "sc" ] ;
             fhir:element [ fhir:v "code" ] ;
             fhir:variable [ fhir:v "a" ]
           ] ) ;
           fhir:target ( [
             fhir:context [ fhir:v "tgt" ] ;
             fhir:element [ fhir:v "drug_type_concept_id" ] ;
             fhir:transform [ fhir:v "copy" ] ;
             fhir:parameter ( [
               fhir:value [
                 a fhir:Id ;
                 fhir:v "a"
               ]
             ] )
           ] )
         ] )
       ] )
     ] [
       fhir:name [ fhir:v "reasonCodeableReference" ] ;
       fhir:source ( [
         fhir:context [ fhir:v "src" ] ;
         fhir:type [ fhir:v "CodeableReference" ] ;
         fhir:element [ fhir:v "reason" ] ;
         fhir:variable [ fhir:v "s" ]
       ] ) ;
       fhir:target ( [
         fhir:transform [ fhir:v "copy" ] ;
         fhir:parameter ( [
           fhir:value [
             a fhir:Id ;
             fhir:v "tgt"
           ]
         ] )
       ] ) ;
       fhir:rule ( [
         fhir:name [ fhir:v "concept" ] ;
         fhir:source ( [
           fhir:context [ fhir:v "s" ] ;
           fhir:element [ fhir:v "concept" ] ;
           fhir:variable [ fhir:v "scs" ]
         ] ) ;
         fhir:target ( [
           fhir:transform [ fhir:v "copy" ] ;
           fhir:parameter ( [
             fhir:value [
               a fhir:Id ;
               fhir:v "tgt"
             ]
           ] )
         ] ) ;
         fhir:rule ( [
           fhir:name [ fhir:v "coding" ] ;
           fhir:source ( [
             fhir:context [ fhir:v "scs" ] ;
             fhir:element [ fhir:v "coding" ] ;
             fhir:variable [ fhir:v "sc" ]
           ] ) ;
           fhir:target ( [
             fhir:transform [ fhir:v "copy" ] ;
             fhir:parameter ( [
               fhir:value [
                 a fhir:Id ;
                 fhir:v "tgt"
               ]
             ] )
           ] ) ;
           fhir:rule ( [
             fhir:name [ fhir:v "code" ] ;
             fhir:source ( [
               fhir:context [ fhir:v "sc" ] ;
               fhir:element [ fhir:v "code" ] ;
               fhir:variable [ fhir:v "a" ]
             ] ) ;
             fhir:target ( [
               fhir:context [ fhir:v "tgt" ] ;
               fhir:element [ fhir:v "stop_reason" ] ;
               fhir:transform [ fhir:v "copy" ] ;
               fhir:parameter ( [
                 fhir:value [
                   a fhir:Id ;
                   fhir:v "a"
                 ]
               ] )
             ] )
           ] )
         ] )
       ] )
     ] )
  ] ) . # 

# -------------------------------------------------------------------------------------

