<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="profile-prescription" />
  <url value="http://pharmacyeclaims.ca/FHIR/v1.0/StructureDefinition/profile-prescription" />
  <name value="Prescription" />
  <title value="Prescription" />
  <status value="active" />
  <description value="This resource contains key information about the prescription data in support of the claim request." />
  <purpose value="Prescription Details" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="MedicationRequest" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/MedicationRequest" />
  <derivation value="constraint" />
  <differential>
    <element id="MedicationRequest.id">
      <path value="MedicationRequest.id" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier">
      <path value="MedicationRequest.identifier" />
      <slicing>
        <discriminator>
          <type value="type" />
          <path value="type.coding.code" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <comment value="Usage Note:  There must be least one identifier for the presciption (type=FILL) that is the Current RX Number.    A second one may be included, as directed by provincial implementers, to capture the provincial prescription number (type=JRX).    For secondary payors identified in the claim, where the provincial plan is primary, this identifier may also be included.&#xD;&#xA; &#xD;&#xA;CPHA Mapping:  Current RX number, D.55.03&#xD;&#xA;No mapping from CPHA to a jurisdictional prescription number  &#xD;&#xA;&#xD;&#xA;This is a business identifier, not a resource identifier." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier.type">
      <path value="MedicationRequest.identifier.type" />
      <comment value="Conformance Rule:   Set value for code system = http://terminology.hl7.org/CodeSystem/v2-0203&quot;   Set value of PrescribeITRX when the identifier is assigned by PrescribeIT.      Set value = &quot;JRX&quot;  (extensible) to indicate the jurisdictional prescription number.&#xD;&#xA;&#xD;&#xA;This element deals only with general categories of identifiers.  It SHOULD not be used for codes that correspond 1..1 with the Identifier.system. Some identifiers may fall into multiple categories due to common usage.   Where the system is known, a type is unnecessary because the type is always part of the system definition. However systems often need to handle identifiers where the system is not known. There is not a 1:1 relationship between type and system, since many different systems have the same type." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier.system">
      <path value="MedicationRequest.identifier.system" />
      <min value="1" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/v2-0203" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier.value">
      <path value="MedicationRequest.identifier.value" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier:CurrentRXID">
      <path value="MedicationRequest.identifier" />
      <sliceName value="CurrentRXID" />
      <comment value="CPHA Mapping:  Current RX number, D.55.03 assigned by the pharmacy&#xD;&#xA;Usage Note:   This is replicated in the ClaimRequest.identifier as per current practices&#xD;&#xA;&#xD;&#xA;This is a business identifier, not a resource identifier." />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier:CurrentRXID.system">
      <path value="MedicationRequest.identifier.system" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier:CurrentRXID.value">
      <path value="MedicationRequest.identifier.value" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier:ePrescribingID">
      <path value="MedicationRequest.identifier" />
      <sliceName value="ePrescribingID" />
      <comment value="Usage:   Future use ONLY, if ePrescribing is in place&#xD;&#xA; This is a business identifier, not a resource identifier." />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier:ePrescribingID.type">
      <path value="MedicationRequest.identifier.type" />
      <comment value="Usage:  Indicates that this identifier was issued by the order Filler (aka the Pharmacy)&#xD;&#xA;&#xD;&#xA;This element deals only with general categories of identifiers.  It SHOULD not be used for codes that correspond 1..1 with the Identifier.system. Some identifiers may fall into multiple categories due to common usage.   Where the system is known, a type is unnecessary because the type is always part of the system definition. However systems often need to handle identifiers where the system is not known. There is not a 1:1 relationship between type and system, since many different systems have the same type." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier:ePrescribingID.type.coding">
      <path value="MedicationRequest.identifier.type.coding" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier:ePrescribingID.type.coding.code">
      <path value="MedicationRequest.identifier.type.coding.code" />
      <min value="1" />
      <fixedCode value="ePrescribingID" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier:ePrescribingID.system">
      <path value="MedicationRequest.identifier.system" />
      <comment value="Usage Note:  Must be populated.     Essential for ensuring global uniqueness for this identifier&#xD;&#xA;CPHA Map Rule:   This is a new field.   &#xD;&#xA;&#xD;&#xA;Identifier.system is always case sensitive." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier:ePrescribingID.value">
      <path value="MedicationRequest.identifier.value" />
      <comment value="Usage Note:   If known, the ePrescribing identiifer must be included&#xD;&#xA;&#xD;&#xA;If the value is a full URI, then the system SHALL be urn:ietf:rfc:3986.  The value's primary purpose is computational mapping.  As a result, it may be normalized for comparison purposes (e.g. removing non-significant whitespace, dashes, etc.)  A value formatted for human display can be conveyed using the [Rendered Value extension](extension-rendered-value.html). Identifier.value is to be treated as case sensitive unless knowledge of the Identifier.system allows the processer to be confident that non-case-sensitive processing is safe." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier:JurisdictionalRXID">
      <path value="MedicationRequest.identifier" />
      <sliceName value="JurisdictionalRXID" />
      <comment value="Usage Note:  This is the Jurisdictional Prescription Number and must be conveyed where known.&#xD;&#xA;This is a business identifier, not a resource identifier." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier:JurisdictionalRXID.type">
      <path value="MedicationRequest.identifier.type" />
      <min value="1" />
      <fixedCodeableConcept>
        <coding>
          <code value="JRX" />
        </coding>
      </fixedCodeableConcept>
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier:JurisdictionalRXID.type.coding">
      <path value="MedicationRequest.identifier.type.coding" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier:JurisdictionalRXID.type.coding.code">
      <path value="MedicationRequest.identifier.type.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier:JurisdictionalRXID.system">
      <path value="MedicationRequest.identifier.system" />
      <comment value="CPHA Map:   This is a new field&#xD;&#xA;Usage:  Must be provided if known&#xD;&#xA;Identifier.system is always case sensitive." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.identifier:JurisdictionalRXID.value">
      <path value="MedicationRequest.identifier.value" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.status">
      <path value="MedicationRequest.status" />
      <comment value="Usage:   Set value = completed for dipensed claims.   For professional services pertaining to adapted prescription, set value to stopped or cancelled or completed,  as applicable  &#xD;&#xA;&#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="MedicationRequest.intent">
      <path value="MedicationRequest.intent" />
      <comment value="Usage Note:  Set value = &quot;order&quot; when including prescription details on a dispense claim.   &#xD;&#xA;&#xD;&#xA;It is expected that the type of requester will be restricted for different stages of a MedicationRequest.  For example, Proposals can be created by a patient, relatedPerson, Practitioner or Device.  Plans can be created by Practitioners, Patients, RelatedPersons and Devices.  Original orders can be created by a Practitioner only.&#xD;&#xD;An instance-order is an instantiation of a request or order and may be used to populate Medication Administration Record.&#xD;&#xD;This element is labeled as a modifier because the intent alters when and how the resource is actually applicable." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.medication[x]">
      <path value="MedicationRequest.medication[x]" />
      <comment value="Usage Noe:  This is mandatory in FHIR; must contain the same medication code as in the Medication.code field.&#xD;&#xA;&#xD;&#xA;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 or if the medication is compounded or extemporaneously prepared, then you must reference the Medication resource." />
      <type>
        <code value="CodeableConcept" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.medication[x].coding">
      <path value="MedicationRequest.medication[x].coding" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.medication[x].coding.system">
      <path value="MedicationRequest.medication[x].coding.system" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.medication[x].coding.code">
      <path value="MedicationRequest.medication[x].coding.code" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.medication[x].text">
      <path value="MedicationRequest.medication[x].text" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.subject">
      <path value="MedicationRequest.subject" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://pharmacyeclaims.ca/FHIR/v1.0/R4/StructureDefinition/profile-patient" />
        <aggregation value="bundled" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.requester">
      <path value="MedicationRequest.requester" />
      <comment value="Usage Note:   The identifier maps to the Prescriber ID and is therefore considered mandatory (though optional in the CPHA3 specification).     This must be present where possible.  &#xD;&#xA;&#xD;&#xA;A reference to the Prescriber resource is optional and may be used if additional details about the prescriber are required by an implementer.&#xD;&#xA; &#xD;&#xA;&#xD;&#xA;References SHALL be a reference to an actual FHIR resource, and SHALL be resolveable (allowing for access control, temporary unavailability, etc.). Resolution can be either by retrieval from the URL, or, where applicable by resource type, by treating an absolute reference as a canonical URL and looking it up in a local registry/repository." />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.requester.reference">
      <path value="MedicationRequest.requester.reference" />
      <comment value="Usage:   Future Use.  May be required by some impelmenters who wish more details&#xD;&#xA;&#xD;&#xA;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." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.requester.identifier">
      <path value="MedicationRequest.requester.identifier" />
      <comment value="CPHA Mapping:   D.60.03 Prescriber ID Reference and D.61.03 Prescriber ID&#xD;&#xA;Usage:  In some professional services, the prescriber may be the Pharmacist&#xD;&#xA;&#xD;&#xA;When an identifier is provided in place of a reference, any system processing the reference will only be able to resolve the identifier to a reference if it understands the business context in which the identifier is used. Sometimes this is global (e.g. a national identifier) but often it is not. For this reason, none of the useful mechanisms described for working with references (e.g. chaining, includes) are possible, nor should servers be expected to be able resolve the reference. Servers may accept an identifier based reference untouched, resolve it, and/or reject it - see CapabilityStatement.rest.resource.referencePolicy. &#xA;&#xA;When both an identifier and a literal reference are provided, the literal reference is preferred. Applications processing the resource are allowed - but not required - to check that the identifier matches the literal reference&#xA;&#xA;Applications converting a logical reference to a literal reference may choose to leave the logical reference present, or remove it.&#xA;&#xA;Reference is intended to point to a structure that can potentially be expressed as a FHIR resource, though there is no need for it to exist as an actual FHIR resource instance - except in as much as an application wishes to actual find the target of the reference. The content referred to be the identifier must meet the logical constraints implied by any limitations on what resource types are permitted for the reference.  For example, it would not be legitimate to send the identifier for a drug prescription if the type were Reference(Observation|DiagnosticReport).  One of the use-cases for Reference.identifier is the situation where no FHIR representation exists (where the type is Reference (Any)." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.requester.identifier.system">
      <path value="MedicationRequest.requester.identifier.system" />
      <comment value="CPHA Mapping:   D.60.03 Prescriber ID Reference.   Refer to Terminology listing for details&#xD;&#xA;&#xD;&#xA;Identifier.system is always case sensitive." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.requester.identifier.value">
      <path value="MedicationRequest.requester.identifier.value" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.note">
      <path value="MedicationRequest.note" />
      <comment value="Usage:  May be used for professional services to convey notes, that may be useful for audit purposes, however they will not be used for real-time adjudication.&#xD;&#xA;&#xD;&#xA;For systems that do not have structured annotations, they can simply communicate a single annotation with no author or time.  This element may need to be included in narrative because of the potential for modifying information.  *Annotations SHOULD NOT* be used to communicate &quot;modifying&quot; information that could be computable. (This is a SHOULD because enforcing user behavior is nearly impossible)." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.priorPrescription">
      <path value="MedicationRequest.priorPrescription" />
      <comment value="Usage:  Future Use.  May be used for professional services, where an original prescription has been adapted.   Provides for inclusion of the original prescription and the replacement/adapted one if necessary&#xD;&#xA;&#xD;&#xA;References SHALL be a reference to an actual FHIR resource, and SHALL be resolveable (allowing for access control, temporary unavailability, etc.). Resolution can be either by retrieval from the URL, or, where applicable by resource type, by treating an absolute reference as a canonical URL and looking it up in a local registry/repository." />
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>