CDA-FHIR-Maps (R4)
0.3.0 - DSTU 1

This page is part of the CDA-FHIR-Maps (R4) (v0.3.0: DSTU 1) based on FHIR R4. . For a full list of available versions, see the Directory of published versions

: CDA-CH-EMED Medication List document to Bundle - XML Representation

Raw xml | Download



<StructureMap xmlns="http://hl7.org/fhir">
  <id value="CdaChEmedMedicationListDocumentToBundle"/>
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml">
         <pre>map &quot;http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaChEmedMedicationListDocumentToBundle&quot; = &quot;CdaChEmedMedicationListDocumentToBundle&quot;

// Medication List document, 2.16.756.5.30.1.1.10.1.13
// 2020-10-30 Oliver Egger, copyright ahdis ag, Apache License
// CDA-CH-EMED:  https://art-decor.org/art-decor/decor-project--cdachemed-
// FHIR CH-EMED: http://fhir.ch/ig/ch-emed/index.html

uses &quot;http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument&quot; alias ClinicalDocument as source
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/AssignedAuthor&quot; alias AssignedAuthor as source
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity&quot; alias AssignedEntity as source
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/Author&quot; alias Author as source
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/CustodianOrganization&quot; alias CustodianOrganization as source
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/IVL_TS&quot; alias IVL_TS as source
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/EIVL_TS&quot; alias EIVL_TS as source
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/Observation&quot; alias Observation as source
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/PatientRole&quot; alias PatientRole as source
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/RecordTarget&quot; alias RecordTarget as source
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/Section&quot; alias Section as source
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/SubstanceAdministration&quot; alias SubstanceAdministration as source
uses &quot;http://hl7.org/fhir/cda/StructureDefinition/SXPR_TS&quot; alias SXPR_TS as source
uses &quot;http://hl7.org/fhir/StructureDefinition/Bundle&quot; alias Bundle as target
uses &quot;http://hl7.org/fhir/StructureDefinition/Composition&quot; alias Composition as produced
uses &quot;http://hl7.org/fhir/StructureDefinition/Patient&quot; alias Patient as produced
uses &quot;http://hl7.org/fhir/StructureDefinition/Practitioner&quot; alias Practitioner as produced
uses &quot;http://hl7.org/fhir/StructureDefinition/Organization&quot; alias Organization as produced
uses &quot;http://hl7.org/fhir/StructureDefinition/MedicationStatement&quot; alias MedicationStatement as produced
uses &quot;http://hl7.org/fhir/StructureDefinition/Dosage&quot; alias Dosage as produced

imports &quot;http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaToFhirTypes&quot;
imports &quot;http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaToBundle&quot;
imports &quot;http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaChToBundle&quot;
imports &quot;http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaChEmedToBundle&quot;

// source: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&amp;id=2.16.756.5.30.1.1.10.1.13
// target: http://fhir.ch/ig/ch-emed/medication-list-document.html
group CdaChEmedMedicationListDocumentToBundle(source cda : ClinicalDocument, target bundle : Bundle) {
  cda -&gt;  bundle.entry as e,  e.resource = create('Composition') as composition,  composition.id = uuid() as uuid,  e.fullUrl = append('urn:uuid:', uuid),  bundle.entry as e2,  e2.resource = create('Patient') as patient,  patient.id = uuid() as uuid2,  e2.fullUrl = append('urn:uuid:', uuid2) then ClinicalDocumentChEmedMedicationListDocumentToBundle(cda, patient, composition, bundle) &quot;ClinicalDocumentToBody&quot;;
}

// source: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&amp;id=2.16.756.5.30.1.1.10.1.13
// target: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-MedicationList.html
group ClinicalDocumentChEmedMedicationListDocumentToBundle(source cda : ClinicalDocument, target patient : Patient, target composition : Composition, target bundle : Bundle) extends ClinicalDocumentToBundle {
  cda then ClinicalDocumentCompositionCh(cda, composition, patient, bundle) &quot;composition&quot;;
  cda.component as component then {
    component.structuredBody as body then {
      body.component as component then {
        component.section as srcSection where (templateId.where(root = '2.16.756.5.30.1.1.10.3.44')) -&gt; composition.section as tgtSection then SectionMedicationListSectionContentModule(cda, srcSection, patient, tgtSection, bundle);
        component.section as srcSection where (templateId.where(root = '2.16.756.5.30.1.1.10.3.2')) -&gt; composition.section as tgtSection then ClinicalDocumentSection(cda, srcSection, patient, tgtSection, bundle);
        component.section as srcSection where (templateId.where(root = '2.16.756.5.30.1.1.10.3.45')) -&gt; composition.section as tgtSection then SectionOriginalRepresentation(cda, srcSection, patient, tgtSection, bundle);
      };
    } &quot;body&quot;;
  };
}

// _________________________ Section Level Templates _________________________
// source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-MedicationList.html
// target:
group SectionMedicationListSectionContentModule(source cda : ClinicalDocument, source src : Section, source patient : Patient, target tgt, target bundle : Bundle) extends ClinicalDocumentSection {
  src.entry as cdaEntry where (substanceAdministration.templateId.where(root = '2.16.756.5.30.1.1.10.4.34')) -&gt;  bundle.entry as e,  e.resource = create('MedicationStatement') as medicationstatement,  medicationstatement.id = uuid() as uuid,  e.fullUrl = append('urn:uuid:', uuid),  tgt.entry = create('Reference') as reference,  reference.reference = append('urn:uuid:', uuid) then {
    cdaEntry.substanceAdministration as substanceAdministration then MedicationTreatmentPlanItemEntryContentModule(src, substanceAdministration, patient, medicationstatement);
  } &quot;MedicationTreatmentPlanItemEntryContentModule&quot;;
  src.entry as cdaEntry where (substanceAdministration.templateId.where(root = '2.16.756.5.30.1.1.10.4.43')) -&gt;  bundle.entry as e,  e.resource = create('MedicationRequest') as medicationrequest,  medicationrequest.id = uuid() as uuid,  e.fullUrl = append('urn:uuid:', uuid),  tgt.entry = create('Reference') as reference,  reference.reference = append('urn:uuid:', uuid) then {
    cdaEntry.substanceAdministration as substanceAdministration then PrescriptionItemEntryContentModule(src, substanceAdministration, patient, medicationrequest);
  } &quot;PrescriptionItemEntryContentModule&quot;;
  src.entry as cdaEntry where (supply.templateId.where(root = '2.16.756.5.30.1.1.10.4.42')) -&gt;  bundle.entry as e,  e.resource = create('MedicationDispense') as medicationdispense,  medicationdispense.id = uuid() as uuid,  e.fullUrl = append('urn:uuid:', uuid),  tgt.entry = create('Reference') as reference,  reference.reference = append('urn:uuid:', uuid) then {
    cdaEntry.supply as supply then DispenseItemEntryContentModule(src, supply, patient, medicationdispense);
  } &quot;DispenseItemEntryContentModule&quot;;
  src.entry as cdaEntry where (observation.templateId.where(root = '2.16.756.5.30.1.1.10.4.44')) -&gt;  bundle.entry as e,  e.resource = create('Observation') as fhirobservation,  fhirobservation.id = uuid() as uuid,  e.fullUrl = append('urn:uuid:', uuid),  tgt.entry = create('Reference') as reference,  reference.reference = append('urn:uuid:', uuid) then {
    cdaEntry.observation as cdaobservation then PharmaceuticalAdviceItemEntryContentModule(src, cdaobservation, patient, fhirobservation, bundle);
  } &quot;PharmaceuticalAdviceItemEntryContentModule&quot;;
}

</pre>
      </div>
  </text>
  <url
       value="http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaChEmedMedicationListDocumentToBundle"/>
  <version value="0.3.0"/>
  <name value="CdaChEmedMedicationListDocumentToBundle"/>
  <status value="draft"/>
  <date value="2022-02-11T11:14:39+01:00"/>
  <publisher value="ahdis"/>
  <contact>
    <name value="ahdis"/>
    <telecom>
      <system value="url"/>
      <value value="http://www.ahdis.ch/"/>
    </telecom>
  </contact>
  <description
               value="Medication List document, 2.16.756.5.30.1.1.10.1.13 2020-10-30 Oliver Egger, copyright ahdis ag, Apache License CDA-CH-EMED:  https://art-decor.org/art-decor/decor-project--cdachemed- FHIR CH-EMED: http://fhir.ch/ig/ch-emed/index.html"/>
  <copyright value="CC-BY-SA-4.0"/>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/ClinicalDocument"/>
    <mode value="source"/>
    <alias value="ClinicalDocument"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/AssignedAuthor"/>
    <mode value="source"/>
    <alias value="AssignedAuthor"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/AssignedEntity"/>
    <mode value="source"/>
    <alias value="AssignedEntity"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/Author"/>
    <mode value="source"/>
    <alias value="Author"/>
  </structure>
  <structure>
    <url
         value="http://hl7.org/fhir/cda/StructureDefinition/CustodianOrganization"/>
    <mode value="source"/>
    <alias value="CustodianOrganization"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/IVL_TS"/>
    <mode value="source"/>
    <alias value="IVL_TS"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/EIVL_TS"/>
    <mode value="source"/>
    <alias value="EIVL_TS"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/Observation"/>
    <mode value="source"/>
    <alias value="Observation"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/PatientRole"/>
    <mode value="source"/>
    <alias value="PatientRole"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/RecordTarget"/>
    <mode value="source"/>
    <alias value="RecordTarget"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/Section"/>
    <mode value="source"/>
    <alias value="Section"/>
  </structure>
  <structure>
    <url
         value="http://hl7.org/fhir/cda/StructureDefinition/SubstanceAdministration"/>
    <mode value="source"/>
    <alias value="SubstanceAdministration"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/cda/StructureDefinition/SXPR_TS"/>
    <mode value="source"/>
    <alias value="SXPR_TS"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Bundle"/>
    <mode value="target"/>
    <alias value="Bundle"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Composition"/>
    <mode value="produced"/>
    <alias value="Composition"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Patient"/>
    <mode value="produced"/>
    <alias value="Patient"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Practitioner"/>
    <mode value="produced"/>
    <alias value="Practitioner"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Organization"/>
    <mode value="produced"/>
    <alias value="Organization"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/MedicationStatement"/>
    <mode value="produced"/>
    <alias value="MedicationStatement"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Dosage"/>
    <mode value="produced"/>
    <alias value="Dosage"/>
  </structure>
  <import value="http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaToFhirTypes"/>
  <import value="http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaToBundle"/>
  <import value="http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaChToBundle"/>
  <import value="http://fhir.ch/ig/cda-fhir-maps/StructureMap/CdaChEmedToBundle"/>
  <group>
    <name value="CdaChEmedMedicationListDocumentToBundle"/>
    <typeMode value="none"/>
    <documentation
                   value="source: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&amp;id=2.16.756.5.30.1.1.10.1.13 target: http://fhir.ch/ig/ch-emed/medication-list-document.html"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="ClinicalDocumentToBody"/>
      <source>
        <context value="cda"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="composition"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Composition"/>
        </parameter>
      </target>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="urn:uuid:"/>
        </parameter>
        <parameter>
          <valueId value="uuid"/>
        </parameter>
      </target>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e2"/>
      </target>
      <target>
        <context value="e2"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="patient"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Patient"/>
        </parameter>
      </target>
      <target>
        <context value="patient"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid2"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e2"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="urn:uuid:"/>
        </parameter>
        <parameter>
          <valueId value="uuid2"/>
        </parameter>
      </target>
      <dependent>
        <name value="ClinicalDocumentChEmedMedicationListDocumentToBundle"/>
        <variable value="cda"/>
        <variable value="patient"/>
        <variable value="composition"/>
        <variable value="bundle"/>
      </dependent>
    </rule>
  </group>
  <group>
    <name value="ClinicalDocumentChEmedMedicationListDocumentToBundle"/>
    <extends value="ClinicalDocumentToBundle"/>
    <typeMode value="none"/>
    <documentation
                   value="source: https://art-decor.org/art-decor/decor-templates--cdachemed-?section=templates&amp;id=2.16.756.5.30.1.1.10.1.13 target: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-MedicationList.html"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="composition"/>
      <type value="Composition"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="composition"/>
      <source>
        <context value="cda"/>
      </source>
      <dependent>
        <name value="ClinicalDocumentCompositionCh"/>
        <variable value="cda"/>
        <variable value="composition"/>
        <variable value="patient"/>
        <variable value="bundle"/>
      </dependent>
    </rule>
    <rule>
      <name value="component"/>
      <source>
        <context value="cda"/>
        <element value="component"/>
        <variable value="component"/>
      </source>
      <rule>
        <name value="body"/>
        <source>
          <context value="component"/>
          <element value="structuredBody"/>
          <variable value="body"/>
        </source>
        <rule>
          <name value="component"/>
          <source>
            <context value="body"/>
            <element value="component"/>
            <variable value="component"/>
          </source>
          <rule>
            <name value="section"/>
            <source>
              <context value="component"/>
              <element value="section"/>
              <variable value="srcSection"/>
              <condition
                         value="(templateId.where(root = &#39;2.16.756.5.30.1.1.10.3.44&#39;))"/>
            </source>
            <target>
              <context value="composition"/>
              <contextType value="variable"/>
              <element value="section"/>
              <variable value="tgtSection"/>
            </target>
            <dependent>
              <name value="SectionMedicationListSectionContentModule"/>
              <variable value="cda"/>
              <variable value="srcSection"/>
              <variable value="patient"/>
              <variable value="tgtSection"/>
              <variable value="bundle"/>
            </dependent>
          </rule>
          <rule>
            <name value="section"/>
            <source>
              <context value="component"/>
              <element value="section"/>
              <variable value="srcSection"/>
              <condition
                         value="(templateId.where(root = &#39;2.16.756.5.30.1.1.10.3.2&#39;))"/>
            </source>
            <target>
              <context value="composition"/>
              <contextType value="variable"/>
              <element value="section"/>
              <variable value="tgtSection"/>
            </target>
            <dependent>
              <name value="ClinicalDocumentSection"/>
              <variable value="cda"/>
              <variable value="srcSection"/>
              <variable value="patient"/>
              <variable value="tgtSection"/>
              <variable value="bundle"/>
            </dependent>
          </rule>
          <rule>
            <name value="section"/>
            <source>
              <context value="component"/>
              <element value="section"/>
              <variable value="srcSection"/>
              <condition
                         value="(templateId.where(root = &#39;2.16.756.5.30.1.1.10.3.45&#39;))"/>
            </source>
            <target>
              <context value="composition"/>
              <contextType value="variable"/>
              <element value="section"/>
              <variable value="tgtSection"/>
            </target>
            <dependent>
              <name value="SectionOriginalRepresentation"/>
              <variable value="cda"/>
              <variable value="srcSection"/>
              <variable value="patient"/>
              <variable value="tgtSection"/>
              <variable value="bundle"/>
            </dependent>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="SectionMedicationListSectionContentModule"/>
    <extends value="ClinicalDocumentSection"/>
    <typeMode value="none"/>
    <documentation
                   value="_________________________ Section Level Templates _________________________ source: http://build.fhir.org/ig/hl7ch/ch-emed/StructureDefinition-ch-emed-composition-MedicationList.html target:"/>
    <input>
      <name value="cda"/>
      <type value="ClinicalDocument"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="src"/>
      <type value="Section"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="tgt"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="MedicationTreatmentPlanItemEntryContentModule"/>
      <source>
        <context value="src"/>
        <element value="entry"/>
        <variable value="cdaEntry"/>
        <condition
                   value="(substanceAdministration.templateId.where(root = &#39;2.16.756.5.30.1.1.10.4.34&#39;))"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="medicationstatement"/>
        <transform value="create"/>
        <parameter>
          <valueString value="MedicationStatement"/>
        </parameter>
      </target>
      <target>
        <context value="medicationstatement"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="urn:uuid:"/>
        </parameter>
        <parameter>
          <valueId value="uuid"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="append"/>
        <parameter>
          <valueString value="urn:uuid:"/>
        </parameter>
        <parameter>
          <valueId value="uuid"/>
        </parameter>
      </target>
      <rule>
        <name value="substanceAdministration"/>
        <source>
          <context value="cdaEntry"/>
          <element value="substanceAdministration"/>
          <variable value="substanceAdministration"/>
        </source>
        <dependent>
          <name value="MedicationTreatmentPlanItemEntryContentModule"/>
          <variable value="src"/>
          <variable value="substanceAdministration"/>
          <variable value="patient"/>
          <variable value="medicationstatement"/>
        </dependent>
      </rule>
    </rule>
    <rule>
      <name value="PrescriptionItemEntryContentModule"/>
      <source>
        <context value="src"/>
        <element value="entry"/>
        <variable value="cdaEntry"/>
        <condition
                   value="(substanceAdministration.templateId.where(root = &#39;2.16.756.5.30.1.1.10.4.43&#39;))"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="medicationrequest"/>
        <transform value="create"/>
        <parameter>
          <valueString value="MedicationRequest"/>
        </parameter>
      </target>
      <target>
        <context value="medicationrequest"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="urn:uuid:"/>
        </parameter>
        <parameter>
          <valueId value="uuid"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="append"/>
        <parameter>
          <valueString value="urn:uuid:"/>
        </parameter>
        <parameter>
          <valueId value="uuid"/>
        </parameter>
      </target>
      <rule>
        <name value="substanceAdministration"/>
        <source>
          <context value="cdaEntry"/>
          <element value="substanceAdministration"/>
          <variable value="substanceAdministration"/>
        </source>
        <dependent>
          <name value="PrescriptionItemEntryContentModule"/>
          <variable value="src"/>
          <variable value="substanceAdministration"/>
          <variable value="patient"/>
          <variable value="medicationrequest"/>
        </dependent>
      </rule>
    </rule>
    <rule>
      <name value="DispenseItemEntryContentModule"/>
      <source>
        <context value="src"/>
        <element value="entry"/>
        <variable value="cdaEntry"/>
        <condition
                   value="(supply.templateId.where(root = &#39;2.16.756.5.30.1.1.10.4.42&#39;))"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="medicationdispense"/>
        <transform value="create"/>
        <parameter>
          <valueString value="MedicationDispense"/>
        </parameter>
      </target>
      <target>
        <context value="medicationdispense"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="urn:uuid:"/>
        </parameter>
        <parameter>
          <valueId value="uuid"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="append"/>
        <parameter>
          <valueString value="urn:uuid:"/>
        </parameter>
        <parameter>
          <valueId value="uuid"/>
        </parameter>
      </target>
      <rule>
        <name value="supply"/>
        <source>
          <context value="cdaEntry"/>
          <element value="supply"/>
          <variable value="supply"/>
        </source>
        <dependent>
          <name value="DispenseItemEntryContentModule"/>
          <variable value="src"/>
          <variable value="supply"/>
          <variable value="patient"/>
          <variable value="medicationdispense"/>
        </dependent>
      </rule>
    </rule>
    <rule>
      <name value="PharmaceuticalAdviceItemEntryContentModule"/>
      <source>
        <context value="src"/>
        <element value="entry"/>
        <variable value="cdaEntry"/>
        <condition
                   value="(observation.templateId.where(root = &#39;2.16.756.5.30.1.1.10.4.44&#39;))"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="fhirobservation"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="fhirobservation"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="urn:uuid:"/>
        </parameter>
        <parameter>
          <valueId value="uuid"/>
        </parameter>
      </target>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="reference"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Reference"/>
        </parameter>
      </target>
      <target>
        <context value="reference"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="append"/>
        <parameter>
          <valueString value="urn:uuid:"/>
        </parameter>
        <parameter>
          <valueId value="uuid"/>
        </parameter>
      </target>
      <rule>
        <name value="observation"/>
        <source>
          <context value="cdaEntry"/>
          <element value="observation"/>
          <variable value="cdaobservation"/>
        </source>
        <dependent>
          <name value="PharmaceuticalAdviceItemEntryContentModule"/>
          <variable value="src"/>
          <variable value="cdaobservation"/>
          <variable value="patient"/>
          <variable value="fhirobservation"/>
          <variable value="bundle"/>
        </dependent>
      </rule>
    </rule>
  </group>
</StructureMap>