<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="ca-on-ps-profile-medicationrequest" />
  <url value="http://ontariohealth.ca/fhir/StructureDefinition/ca-on-ps-profile-medicationrequest" />
  <version value="0.10.0" />
  <name value="MedicationRequestPSON" />
  <title value="Medication Request (PS-ON)" />
  <status value="draft" />
  <date value="2024-02-01T19:39:15.322061+00:00" />
  <publisher value="Ontario Health" />
  <description value="This profile defines a set of constraints to the FHIR MedicationRequest resource for use in Ontario Patient Summaries (PS-ON).  It refines constraints applied to the MedicationRequest resource by the PS-CA project to represent a record of a medication request in the patient summary. It is informed by the constraints of the most recent direction of the IPS-UV (September Connectathon Build) and the [Canadian Baseline Profile](http://build.fhir.org/ig/HL7-Canada/ca-baseline/branches/master/StructureDefinition-profile-medicationstatement.html) to allow for cross-border and cross-jurisdiction sharing of Medication Summary information." />
  <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="v2" />
    <uri value="http://hl7.org/v2" />
    <name value="HL7 v2 Mapping" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="MedicationRequest" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/MedicationRequest" />
  <derivation value="constraint" />
  <differential>
    <element id="MedicationRequest">
      <path value="MedicationRequest" />
      <comment value="Jurisdictions mapping prescription data into FHIR profiles for the patient summary should support the MedicationRequest resource. Use of the MedicationStatement profile should be reserved for communicating a statement about the patient's usage of the medication that is ultimately provided by a patient, significant other, or a clinican." />
    </element>
    <element id="MedicationRequest.meta">
      <path value="MedicationRequest.meta" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.meta.profile">
      <path value="MedicationRequest.meta.profile" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.extension:RenderedDosageInstruction">
      <path value="MedicationRequest.extension" />
      <sliceName value="RenderedDosageInstruction" />
      <short value="Extension for representing rendered dosage instruction." />
      <definition value="A free form textual specification generated from the input specifications as created by the provider.This is made up of either an 'Ad-hoc instruction' or 'Textual rendition of the structured dosage lines', plus route, dosage unit, and other pertinent administration information specified by the provider." />
      <comment value="Use of structured fields for dosage instructions is heavily encouraged by this specification to promote interoperability of patient summaries. However, this extension is provided to make implementers aware that legacy medication data may come from some systems in this format. This extension is used by PrescribeIT implementations when the system has difficulty sending very complex dosage instructions in the form of structured data. Implementers are encouraged to read the PrescribeIT Specification (https://specs.prescribeit.ca/R5.0/erx/extension-ext-medication-rendered-dosage.html) to understand the context around its use." />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://prescribeit.ca/fhir/StructureDefinition/ext-rendered-dosage-instruction" />
      </type>
    </element>
    <element id="MedicationRequest.status">
      <path value="MedicationRequest.status" />
      <comment value="In the scope of the IPS the entered-in-error concept is not allowed." />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.intent">
      <path value="MedicationRequest.intent" />
      <comment value="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. An instance-order is an instantiation of a request or order and may be used to populate Medication Administration Record. This element is labeled as a modifier because the intent alters when and how the resource is actually applicable. This element is mandatory." />
    </element>
    <element id="MedicationRequest.medication[x]">
      <path value="MedicationRequest.medication[x]" />
      <slicing>
        <discriminator>
          <type value="type" />
          <path value="$this" />
        </discriminator>
        <rules value="closed" />
      </slicing>
      <definition value="Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code. To improve global interoperability is strongly encouraged that the reference to a medication resource is used, limiting the usage of the medicationCodeableConcept only to the cases in which no other information than a simple code is available." />
      <mustSupport value="true" />
      <binding>
        <strength value="preferred" />
        <valueSet value="https://fhir.infoway-inforoute.ca/ValueSet/prescriptionmedicinalproduct" />
      </binding>
    </element>
    <element id="MedicationRequest.medication[x]:medicationReference">
      <path value="MedicationRequest.medication[x]" />
      <sliceName value="medicationReference" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://ontariohealth.ca/fhir/StructureDefinition/ca-on-ps-profile-medication" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.medication[x]:medicationCodeableConcept">
      <path value="MedicationRequest.medication[x]" />
      <sliceName value="medicationCodeableConcept" />
      <short value="Code for the medication being administered" />
      <definition value="Code for the medication being administered." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
        <profile value="http://ontariohealth.ca/fhir/StructureDefinition/ca-on-ps-profile-codeableconcept" />
      </type>
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="https://fhir.infoway-inforoute.ca/ValueSet/prescriptionmedicinalproduct" />
      </binding>
    </element>
    <element id="MedicationRequest.subject">
      <path value="MedicationRequest.subject" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://ontariohealth.ca/fhir/StructureDefinition/ca-on-ps-profile-patient" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.subject.reference">
      <path value="MedicationRequest.subject.reference" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.authoredOn">
      <path value="MedicationRequest.authoredOn" />
      <comment value="This is a MS element in the CA Baseline that will likely make its way into the IPS-UV when/if they decide to profile MedicationRequest (likely at transition to R5). Included as preliminary analysis shows most participating systems could support this, further feedback and discussion is required on whether systems should be able to demonstrate this element for conformance" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.dosageInstruction">
      <path value="MedicationRequest.dosageInstruction" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.dosageInstruction.text">
      <path value="MedicationRequest.dosageInstruction.text" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.dosageInstruction.timing">
      <path value="MedicationRequest.dosageInstruction.timing" />
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.dosageInstruction.route">
      <path value="MedicationRequest.dosageInstruction.route" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
        <profile value="http://ontariohealth.ca/fhir/StructureDefinition/ca-on-ps-profile-codeableconcept" />
      </type>
      <binding>
        <strength value="preferred" />
        <description value="SCTCA Route of Administration" />
        <valueSet value="https://fhir.infoway-inforoute.ca/ValueSet/routeofadministration" />
      </binding>
    </element>
    <element id="MedicationRequest.dosageInstruction.route.coding">
      <path value="MedicationRequest.dosageInstruction.route.coding" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="$this" />
        </discriminator>
        <description value="Discriminated by value set" />
        <rules value="open" />
      </slicing>
      <type>
        <code value="Coding" />
        <profile value="http://ontariohealth.ca/fhir/StructureDefinition/ca-on-ps-profile-coding" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="MedicationRequest.dosageInstruction.route.coding:routeSCTCA">
      <path value="MedicationRequest.dosageInstruction.route.coding" />
      <sliceName value="routeSCTCA" />
      <short value="Optional slice for representing SNOMED CT Canadian edition routes of administration" />
      <definition value="SNOMED CT Canadian edition routes of administration" />
      <binding>
        <strength value="required" />
        <valueSet value="https://fhir.infoway-inforoute.ca/ValueSet/routeofadministration" />
      </binding>
    </element>
  </differential>
</StructureDefinition>