<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="profile-medicationdispense-dataConnector" />
  <meta>
    <lastUpdated value="2021-03-17T16:41:45.236+00:00" />
  </meta>
  <url value="https://fhir.infoway-inforoute.ca/StructureDefinition/profile-medicationDispense" />
  <name value="PHIAccessMedicationDispense" />
  <title value="PHI Access MedicationDispense" />
  <status value="draft" />
  <date value="2021-03-17T16:38:01.11052+00:00" />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="workflow" />
    <uri value="http://hl7.org/fhir/workflow" />
    <name value="Workflow Pattern" />
  </mapping>
  <mapping>
    <identity value="rim" />
    <uri value="http://hl7.org/v3" />
    <name value="RIM Mapping" />
  </mapping>
  <mapping>
    <identity value="w5" />
    <uri value="http://hl7.org/fhir/fivews" />
    <name value="FiveWs Pattern Mapping" />
  </mapping>
  <mapping>
    <identity value="rx-dispense-rmim" />
    <uri value="http://www.hl7.org/v3/PORX_RM020070UV" />
    <name value="V3 Pharmacy Dispense RMIM" />
  </mapping>
  <mapping>
    <identity value="v2" />
    <uri value="http://hl7.org/v2" />
    <name value="HL7 v2 Mapping" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="MedicationDispense" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/MedicationDispense" />
  <derivation value="constraint" />
  <differential>
    <element id="MedicationDispense.id">
      <path value="MedicationDispense.id" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.meta">
      <path value="MedicationDispense.meta" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.meta.versionId">
      <path value="MedicationDispense.meta.versionId" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.meta.lastUpdated">
      <path value="MedicationDispense.meta.lastUpdated" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.meta.source">
      <path value="MedicationDispense.meta.source" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.text">
      <path value="MedicationDispense.text" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.identifier">
      <path value="MedicationDispense.identifier" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.identifier.system">
      <path value="MedicationDispense.identifier.system" />
      <min value="1" />
      <example>
        <label value="New Brunswick DIS ID" />
        <valueUri value="https://fhir.infoway-inforoute.ca/NamingSystem/ca-nb-dis-id" />
      </example>
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.identifier.value">
      <path value="MedicationDispense.identifier.value" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.status">
      <path value="MedicationDispense.status" />
      <requirements value="Included to support the ability to query for and group medication dispenses based on the status of the dispense (e.g., in-progress, completed, stopped, etc.)." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]">
      <path value="MedicationDispense.medication[x]" />
      <slicing>
        <discriminator>
          <type value="type" />
          <path value="$this" />
        </discriminator>
        <rules value="closed" />
      </slicing>
      <requirements value="Identification of the medication is critical for citizens and clinicians to understand what was dispensed.&#xD;&#xA;&#xD;&#xA;Included to support the ability to query for medication dispenses pertaining to a specific medication." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationReference">
      <path value="MedicationDispense.medication[x]" />
      <sliceName value="medicationReference" />
      <comment value="If only a code is specified, then it needs to be a code for a specific product. If more information is required, then the use of the medication resource is recommended.  For example, if you require form or lot number, then you must reference the Medication resource.&#xD;&#xA;&#xD;&#xA;Implementors should anticipate a mixture of FHIR references that are persistant and/or retrievable outside of the initial response to the request, as well as references that are provided in the bundle response but are not retrievable using their resource.id. See implementation guidance." />
      <requirements value="MedicationReference has been marked as mustSupport to ensure that implementors can support medications that include additional information (i.e. form, lot number, etc.) if provided." />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-medicationdispense" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept">
      <path value="MedicationDispense.medicationCodeableConcept" />
      <sliceName value="medicationCodeableConcept" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <binding>
        <strength value="example" />
        <description value="A Drug Identification Number (DIN) is a number assigned by Health Canada to a drug product prior to being marketed in Canada. It consists of eight digits (numbers) generated by a computer system in the Submission and Information Policy Division. http://www.hc-sc.gc.ca/dhp-mps/prodpharma/databasdon/index_e.html" />
        <valueSet value="https://fhir.infoway-inforoute.ca/ValueSet/CA-HC-DIN" />
      </binding>
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding">
      <path value="MedicationDispense.medicationCodeableConcept.coding" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="system" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding.system">
      <path value="MedicationDispense.medicationCodeableConcept.coding.system" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding.code">
      <path value="MedicationDispense.medicationCodeableConcept.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding.display">
      <path value="MedicationDispense.medicationCodeableConcept.coding.display" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding:DIN">
      <path value="MedicationDispense.medicationCodeableConcept.coding" />
      <sliceName value="DIN" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding:DIN.system">
      <path value="MedicationDispense.medicationCodeableConcept.coding.system" />
      <min value="1" />
      <patternUri value="https://fhir.infoway-inforoute.ca/ValueSet/CA-HC-DIN" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding:DIN.code">
      <path value="MedicationDispense.medicationCodeableConcept.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding:DIN.display">
      <path value="MedicationDispense.medicationCodeableConcept.coding.display" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding:NPN">
      <path value="MedicationDispense.medicationCodeableConcept.coding" />
      <sliceName value="NPN" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding:NPN.system">
      <path value="MedicationDispense.medicationCodeableConcept.coding.system" />
      <min value="1" />
      <patternUri value="https://fhir.infoway-inforoute.ca/ValueSet/CA-HC-NPN" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding:NPN.code">
      <path value="MedicationDispense.medicationCodeableConcept.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding:NPN.display">
      <path value="MedicationDispense.medicationCodeableConcept.coding.display" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding:CCDD">
      <path value="MedicationDispense.medicationCodeableConcept.coding" />
      <sliceName value="CCDD" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding:CCDD.system">
      <path value="MedicationDispense.medicationCodeableConcept.coding.system" />
      <min value="1" />
      <patternUri value="https://fhir.infoway-inforoute.ca/ValueSet/prescriptionmedicinalproduct" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding:CCDD.code">
      <path value="MedicationDispense.medicationCodeableConcept.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.coding:CCDD.display">
      <path value="MedicationDispense.medicationCodeableConcept.coding.display" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]:medicationCodeableConcept.text">
      <path value="MedicationDispense.medicationCodeableConcept.text" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.subject">
      <path value="MedicationDispense.subject" />
      <definition value="A link to a resource representing the person to whom the medication will be given." />
      <comment value="Implementors should anticipate a mixture of FHIR references that are persistant and/or retrievable outside of the initial response to the request, as well as references that are provided in the bundle response but are not retrievable using their resource.id. See implementation guidance." />
      <requirements value="MedicationReference has been marked as mustSupport and mandatory to support the search for medicationDispenses that have occured for a particular patient." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.subject.reference">
      <path value="MedicationDispense.subject.reference" />
      <requirements value="The string value for this element can be used to communicate an absolute or relative reference for a resource that is persistant and/or retrievable through REST (see https://www.hl7.org/fhir/references.html#literal) as well as a urn:uuid for a reference to resource that is provided in the bundle response but not retrievable using their resource.id. See implementation guidance." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.location">
      <path value="MedicationDispense.location" />
      <requirements value="Included to support the ability to query for medications dispensed at a specified pharmacy location." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.location.reference">
      <path value="MedicationDispense.location.reference" />
      <comment value="Using absolute URLs provides a stable scalable approach suitable for a cloud/web context, while using relative/logical references provides a flexible approach suitable for use when trading across closed eco-system boundaries.   Absolute URLs do not need to point to a FHIR RESTful server, though this is the preferred approach. If the URL conforms to the structure &quot;/[type]/[id]&quot; then it should be assumed that the reference is to a FHIR RESTful server.&#xD;&#xA;&#xD;&#xA;Initially, very few participating jurisdictions are expected to support a literal reference for the location resource. When some information about location is known, but a literal reference is not available, the location SHALL be communicated as a contained resource with a reference value that matches the id value in the contained resource. See example on http://www.hl7.org/implement/standards/fhir/references.html#contained" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.authorizingPrescription">
      <path value="MedicationDispense.authorizingPrescription" />
      <comment value="Maps to basedOn in Event logical model.&#xD;&#xA;&#xD;&#xA;When known, minimal information about a prescription (prescription id, prescriber, etc.) will be included in a referenced resource." />
      <requirements value="Included to support the ability to query for and group medication dispenses based on authorizing prescription, as well as to support queries for medication dispenses based on the prescriber of the medication." />
      <type>
        <code value="Reference" />
        <aggregation value="contained" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.authorizingPrescription.reference">
      <path value="MedicationDispense.authorizingPrescription.reference" />
      <comment value="Using absolute URLs provides a stable scalable approach suitable for a cloud/web context, while using relative/logical references provides a flexible approach suitable for use when trading across closed eco-system boundaries.   Absolute URLs do not need to point to a FHIR RESTful server, though this is the preferred approach. If the URL conforms to the structure &quot;/[type]/[id]&quot; then it should be assumed that the reference is to a FHIR RESTful server.&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;Initially, very few participating jurisdictions are expected to support a literal reference for the medicationRequest resource. When some information about medicationRequest is known, but a literal reference is not available, the medicationRequest SHALL be communicated as a contained resource with a reference value that matches the id value in the contained resource. See example on http://www.hl7.org/implement/standards/fhir/references.html#contained" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.quantity">
      <path value="MedicationDispense.quantity" />
      <requirements value="Quantity of the medication dispensed should be provided if known. Patient and Clinician applications may use quantity in combination with other elements to help determine what dispenses are expected to still expected to have remaining supply." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.daysSupply">
      <path value="MedicationDispense.daysSupply" />
      <requirements value="daysSupply of the medication dispensed should be provided if known. Patient and Clinician applications may use daysSupply in combination with other elements to help determine what dispenses are expected to still expected to have remaining supply." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.whenPrepared">
      <path value="MedicationDispense.whenPrepared" />
      <requirements value="Included to support the ability to query for dispenses that occured suring a specific time period." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.dosageInstruction">
      <path value="MedicationDispense.dosageInstruction" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.dosageInstruction.text">
      <path value="MedicationDispense.dosageInstruction.text" />
      <comment value="Note that FHIR strings SHALL NOT exceed 1MB in size." />
      <requirements value="Free text dosage instructions can be used for cases where the instructions are too complex to code.  The content of this attribute does not include the name or description of the medication. When coded instructions are present, the free text instructions may still be present for display to humans taking or administering the medication. It is expected that the text instructions will always be populated.  If the dosage.timing attribute is also populated, then the dosage.text should reflect the same information as the timing.  Additional information about administration or preparation of the medication should be included as text.&#xD;&#xA; &#xD;&#xA;Because v3 CeRX specifications (common input for participating data sources) do not differentiate patient specific instructions from dosage instructions, dosageInstruction.text is considered must support and mandatory (as opposed to separating into additional instructions and patientInstruction)." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>