<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="http://pharmacyeclaims.ca/FHIR/v1.0/StructureDefinition/profile-medication-dispense" />
  <name value="MedicationDispense" />
  <status value="draft" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="MedicationDispense" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/MedicationDispense" />
  <derivation value="constraint" />
  <differential>
    <element id="MedicationDispense.contained">
      <path value="MedicationDispense.contained" />
      <comment value="Usage:   The medication resource is contained as it will never be stored/viewed independent of a claim.   &#xD;&#xA;&#xD;&#xA;This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. Contained resources may have profiles and tags in their meta elements, but SHALL NOT have security labels." />
      <type>
        <code value="Resource" />
        <profile value="http://pharmacyeclaims.ca/FHIR/v1.0/StructureDefinition/profile-medication" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.extension:renderedDosageInstruction">
      <path value="MedicationDispense.extension" />
      <sliceName value="renderedDosageInstruction" />
      <comment value="Usage Note: This is intended to provide all dosage instructions in a clear human-readable format.  This must be as clear as possible and must include all instructions as recorded in the PMS.      &#xD;&#xA;Usage Note:   This extension aligns with PrescribeIT and the Canadian Core-CA  &#xD;&#xA;Conformance Rule: The rendered dosage instruction MUST contain ALL dosage instructions. This includes ALL child elements of dosage instruction, such as dosage quantity, dosage unit, frequency, etc) in human readable form and must be able to stand on its own. This field will include all of the information contained in the structured dosage as well as patient instructions (eg take with food, starting one day before dental appointment), assembled into one field and formatted as human-readable. &#xD;&#xA;&#xD;&#xA;CPHA Mapping:  None&#xD;&#xA;&#xD;&#xA;Coded values codes should not be used (e.g. 'days' should be used instead of 'd', the code of PO as 'oral' )There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone." />
      <type>
        <code value="Extension" />
        <profile value="http://pharmacyeclaims.ca/FHIR/v1.0/StructureDefinition/ext-RenderedDosageInstruction" />
      </type>
      <mustSupport value="true" />
      <isModifier value="false" />
    </element>
    <element id="MedicationDispense.extension:languageIndicator">
      <path value="MedicationDispense.extension" />
      <sliceName value="languageIndicator" />
      <comment value="Usage:   This indicates the language associated with the text in this resource (eg renderedDosageInstruction)&#xD;&#xA;&#xD;&#xA;There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone." />
      <type>
        <code value="Extension" />
        <profile value="http://pharmacyeclaims.ca/FHIR/v1.0/StructureDefinition/ext-LanguageIndicator" />
      </type>
      <mustSupport value="true" />
      <isModifier value="false" />
    </element>
    <element id="MedicationDispense.identifier">
      <path value="MedicationDispense.identifier" />
      <comment value="Usage:   This is used to convey the current RX Number and the Original RX Number, as applicable&#xD;&#xA;&#xD;&#xA;This is a business identifier, not a resource identifier." />
      <mustSupport value="false" />
    </element>
    <element id="MedicationDispense.status">
      <path value="MedicationDispense.status" />
      <comment value="Usage Note:   Set value = &quot;in-progress&quot; if ready for pickup.   &#xD;&#xA;&#xD;&#xA;CPHA Mapping:  None, new data element&#xD;&#xA;This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.medication[x]">
      <path value="MedicationDispense.medication[x]" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://pharmacyeclaims.ca/FHIR/v1.0/StructureDefinition/profile-medication" />
        <aggregation value="contained" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.subject">
      <path value="MedicationDispense.subject" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://pharmacyeclaims.ca/FHIR/v1.0/StructureDefinition/profile-patient" />
        <aggregation value="bundled" />
      </type>
    </element>
    <element id="MedicationDispense.subject.reference">
      <path value="MedicationDispense.subject.reference" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.performer">
      <path value="MedicationDispense.performer" />
      <comment value="Usage Note:  This provides an opportunity to identify the pharmacist involved in an intervention or a DUR.  There may be situations where it is beneficial for the pharmacist who is involved in an intervention or drug utilization review to be &#xD;&#xA;identified. &#xD;&#xA;Usage:   This is the licence number of the pharmacists, issued by the licencing authority.&#xD;&#xA;CPHA Map:  D.76.03 Pharmacist ID" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.performer.actor">
      <path value="MedicationDispense.performer.actor" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.performer.actor.identifier">
      <path value="MedicationDispense.performer.actor.identifier" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.performer.actor.identifier.system">
      <path value="MedicationDispense.performer.actor.identifier.system" />
      <comment value="Usage Note:   This must be populated where a value exists.&#xD;&#xA;&#xD;&#xA;Identifier.system is always case sensitive." />
      <mustSupport value="true" />
      <binding>
        <strength value="extensible" />
        <valueSet value="http://pharmacyeclaims.ca/FHIR/ValueSet/pharmacist-licence-identifier-system" />
      </binding>
    </element>
    <element id="MedicationDispense.performer.actor.identifier.value">
      <path value="MedicationDispense.performer.actor.identifier.value" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.type">
      <path value="MedicationDispense.type" />
      <comment value="Usage Note:  A code to indicate whether the prescription is new or an authorized refill/repeat.  A &quot;new prescription&quot; is an order, verbal or written, for a specific supply of medication for a patient. This may include authorization to &quot;refill&quot; or &quot;repeat&quot; a stated amount for a stated number of times. A &quot;prescription refill/repeat&quot; Usage Note: refers only to supplies which were authorized on a &quot;new prescription&quot;. When all authorized refills have been supplied, another &quot;new prescription&quot; is required if the patient is to continue on the medication.   &#xD;&#xA; &#xD;&#xA;CPHA Map:  New/Refill Code     D.52.03 Optional A1&#xD;&#xA;&#xD;&#xA;FF =new prescription (maps to CPHA N)&#xD;&#xA;RFP=part fill - refill/repeat prescription (CPHA Q)&#xD;&#xA;FFP = first fill, part fill (CPHA P)&#xD;&#xA;RF=prescription refill/repeat (CPHA R)&#xD;&#xA;TF =  Trial Fill -  &#xD;&#xA;TB =  Trial Balance    &#xD;&#xA; &#xD;&#xA;Not all terminology uses fit this general pattern. In some cases, models should not use CodeableConcept and use Coding directly and provide their own structure for managing text, codings, translations and the relationship between elements and pre- and post-coordination." />
      <mustSupport value="true" />
      <binding>
        <strength value="extensible" />
        <description value="New/Refill" />
      </binding>
    </element>
    <element id="MedicationDispense.type.coding">
      <path value="MedicationDispense.type.coding" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.type.coding.system">
      <path value="MedicationDispense.type.coding.system" />
      <min value="1" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/v3-ActCode" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.type.coding.code">
      <path value="MedicationDispense.type.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.quantity">
      <path value="MedicationDispense.quantity" />
      <comment value="Usage Note:  Quantity of medication dispensed.   A value of &quot;U&quot; for unit can be used as the unit where others do not apply.     It may be a drug form (e.g. TAB) an administrable drug (e.g. PUFF) form or a unit of measure (e.g. mg).&#xD;&#xA;Conformance Rule:  Implementers must be capable of understanding quantity values up to three decimal places in the claim request, and the coded unit.&#xD;&#xA;&#xD;&#xA;CPHA Map:  Quantity D.58.03, Limited to one decimal place  O Q6  No &quot;unit&quot; is expressed&#xD;&#xA;&#xD;&#xA;CPHA:   Quantities always describe dosage units (e.g. tablet, puff, suppository) or metric weights or measures when they apply to liquids, solids, semi-solids or powders. Software suppliers should program their systems to convert unit or metric inputs into package units to comply with specific plan requirements such as the ODB, before communicating the claim. Use &quot;0&quot; unit items for claims for approved special services&#xD;&#xA;&#xD;&#xA;The context of use may frequently define what kind of quantity this is and therefore what kind of units can be used. The context of use may also restrict the values for the comparator." />
      <min value="1" />
      <mustSupport value="true" />
      <binding>
        <strength value="extensible" />
        <valueSet value="http://pharmacyeclaims.ca/FHIR/ValueSet/dispensed-quantity-unit" />
      </binding>
    </element>
    <element id="MedicationDispense.quantity.value">
      <path value="MedicationDispense.quantity.value" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.quantity.unit">
      <path value="MedicationDispense.quantity.unit" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.quantity.system">
      <path value="MedicationDispense.quantity.system" />
      <comment value="Usage:  This will either be http://unitsofmeasure.org or http://snomed.info/sct, as identified in the Value Set&#xD;&#xA;CPHA Map:  New&#xD;&#xA;&#xD;&#xA;see http://en.wikipedia.org/wiki/Uniform_resource_identifier" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.quantity.code">
      <path value="MedicationDispense.quantity.code" />
      <comment value="Usage:  Most common are tabs, pack, mg, grams, kg, ml, litres&#xD;&#xA;Rationale:   Allows for validation in pricing where necessary.  Reduces auditing as pricing be verified and must be supplied when known&#xD;&#xA;CPHA Map:  None - this is new&#xD;&#xA;&#xD;&#xA;The preferred system is UCUM, but SNOMED CT can also be used (for customary units) or ISO 4217 for currency.  The context of use may additionally require a code from a particular system." />
      <mustSupport value="true" />
      <binding>
        <strength value="extensible" />
        <valueSet value="http://pharmacyeclaims.ca/FHIR/ValueSet/dispensed-quantity-unit" />
      </binding>
    </element>
    <element id="MedicationDispense.daysSupply">
      <path value="MedicationDispense.daysSupply" />
      <comment value="Usage Note:  Estimate of number of days of treatment contained in the Rx.    &#xD;&#xA;Conformance rule:   This is restricted to 4 characters only and will only support &quot;days&quot;.   The move to 4 digits will address medications with a days supply that may be over several years.&#xD;&#xA;CPHA Map:  Days Supply D.59.02  N3 Optional&#xD;&#xA;Mapping Note:   FHIR does not restrict this to 3 characters, as does CPHA3.   &#xD;&#xA;&#xD;&#xA;The context of use may frequently define what kind of quantity this is and therefore what kind of units can be used. The context of use may also restrict the values for the comparator." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.daysSupply.value">
      <path value="MedicationDispense.daysSupply.value" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.substitution">
      <path value="MedicationDispense.substitution" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.substitution.wasSubstituted">
      <path value="MedicationDispense.substitution.wasSubstituted" />
      <comment value="Usage Note:   Substitution must only specified when &quot;no substitution&quot; has occurred, and the reason code must be provided.&#xD;&#xA;CPHA Map:   None; this is a new field." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.substitution.type">
      <path value="MedicationDispense.substitution.type" />
      <binding>
        <strength value="extensible" />
      </binding>
    </element>
    <element id="MedicationDispense.substitution.reason">
      <path value="MedicationDispense.substitution.reason" />
      <comment value="CPHA Mapping:  D.62.03 Product Selection&#xD;&#xA;Usage: Code to indicate reason for &quot;no substitution&quot; or other reason for the selection of the product dispensed.  &#xD;&#xA;&#xD;&#xA;Not all terminology uses fit this general pattern. In some cases, models should not use CodeableConcept and use Coding directly and provide their own structure for managing text, codings, translations and the relationship between elements and pre- and post-coordination." />
      <mustSupport value="true" />
      <binding>
        <strength value="example" />
        <valueSet value="http://pharmacyeclaims.ca/FHIR/ValueSet/substitution-reason-codes" />
      </binding>
    </element>
    <element id="MedicationDispense.substitution.reason.coding">
      <path value="MedicationDispense.substitution.reason.coding" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.substitution.reason.coding.system">
      <path value="MedicationDispense.substitution.reason.coding.system" />
      <comment value="Usage note:  Set value = http://pharmacyeclaims.ca/FHIR/CodeSystem/substitution-reason-codes&#xD;&#xA;&#xD;&#xA;The URI may be an OID (urn:oid:...) or a UUID (urn:uuid:...).  OIDs and UUIDs SHALL be references to the HL7 OID registry. Otherwise, the URI should come from HL7's list of FHIR defined special URIs or it should reference to some definition that establishes the system clearly and unambiguously." />
      <min value="1" />
    </element>
    <element id="MedicationDispense.substitution.reason.coding.code">
      <path value="MedicationDispense.substitution.reason.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.detectedIssue">
      <path value="MedicationDispense.detectedIssue" />
      <comment value="Usage Note:   This is TBD.  This is a reference to the Detected issues resource that is used to convey clinical issues/action.    &#xD;&#xA;Note:  In CPHA 3, these are conveyed through intervention codes (Table 2), such as CI = significant drug interaction.    Should further detail be desired, a detected issue may be used&#xD;&#xA;&#xD;&#xA;This element can include a detected issue that has been identified either by a decision support system or by a clinician and may include information on the steps that were taken to address the issue." />
      <type>
        <code value="Reference" />
        <targetProfile value="http://pharmacyeclaims.ca/FHIR/v1.0/StructureDefinition/profile-detected-issue" />
        <aggregation value="bundled" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="MedicationDispense.detectedIssue.reference">
      <path value="MedicationDispense.detectedIssue.reference" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>