<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="pr-medication-dispense" />
  <meta>
    <source value="https://www.icanbwell.com/fhir_profile_definitions" />
    <security>
      <system value="https://www.icanbwell.com/owner" />
      <code value="bwell" />
    </security>
    <security>
      <system value="https://www.icanbwell.com/access" />
      <code value="bwell" />
    </security>
  </meta>
  <url value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-medication-dispense" />
  <version value="1.00" />
  <name value="MedicationDispense" />
  <title value="Profile: Medication Dispense" />
  <status value="active" />
  <experimental value="false" />
  <date value="2022-07-27" />
  <publisher value="b.Well Connected Health" />
  <description value="Medication (re)fills" />
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166" />
      <code value="US" />
      <display value="United States of America" />
    </coding>
    <text value="United States of America" />
  </jurisdiction>
  <fhirVersion value="4.0.0" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="MedicationDispense" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/MedicationDispense" />
  <derivation value="constraint" />
  <differential>
    <element id="MedicationDispense">
      <path value="MedicationDispense" />
    </element>
    <element id="MedicationDispense.id">
      <path value="MedicationDispense.id" />
    </element>
    <element id="MedicationDispense.meta">
      <path value="MedicationDispense.meta" />
      <label value="meta" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Meta" />
      </type>
    </element>
    <element id="MedicationDispense.meta.source">
      <path value="MedicationDispense.meta.source" />
      <sliceName value="meta-source" />
      <label value="meta" />
      <short value="uri of the data source" />
      <definition value="Typically the data owner's URL followed by a source/file description" />
      <requirements value="mandatory for all resources in bWell's FHIR Server" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
      <example>
        <label value="example of meta.source" />
        <valueUri value="https://www.icanbwell.com/provider-directory" />
      </example>
    </element>
    <element id="MedicationDispense.meta.security">
      <path value="MedicationDispense.meta.security" />
      <sliceName value="meta-security" />
      <label value="meta" />
      <short value="security tags representing the data's owner, vendor, and accessibility" />
      <definition value="data owner: &#xA; &#xA; data vendor: &#xA; &#xA; data access:" />
      <requirements value="/owner &amp; /access are mandatory for all resources in bWell's FHIR Server" />
      <min value="1" />
      <max value="*" />
      <type>
        <code value="Coding" />
      </type>
      <example>
        <label value="example of data owner security tag" />
        <valueCoding>
          <system value="https://www.icanbwell.com/owner" />
          <code value="bwell" />
        </valueCoding>
      </example>
      <example>
        <label value="example of data access security tag" />
        <valueCoding>
          <system value="https://www.icanbwell.com/access" />
          <code value="bwell" />
        </valueCoding>
      </example>
      <example>
        <label value="example of data vendor security tag" />
        <valueCoding>
          <system value="https://www.icanbwell.com/vendor" />
          <code value="bwell" />
        </valueCoding>
      </example>
    </element>
    <element id="MedicationDispense.extension">
      <path value="MedicationDispense.extension" />
      <slicing>
        <description value="slice by url" />
        <rules value="open" />
      </slicing>
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
      </type>
    </element>
    <element id="ex-refills-remaining">
      <path value="MedicationDispense.extension" />
      <sliceName value="refills-remaining" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/ex-refills-remaining" />
      </type>
    </element>
    <element id="de-identifier">
      <path value="MedicationDispense.identifier" />
      <label value="identifier" />
      <slicing>
        <description value="slice by types" />
        <rules value="open" />
      </slicing>
      <short value="a value to identify the resource by" />
      <type>
        <code value="Identifier" />
      </type>
    </element>
    <element id="identifier.id">
      <path value="MedicationDispense.identifier.id" />
      <label value="identifier" />
      <short value="set case-by-case" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element id="identifier.use">
      <path value="MedicationDispense.identifier.use" />
      <label value="identifier" />
      <short value="usual | official | temp | secondary | old (If known)" />
      <definition value="The purpose of this identifier." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
    </element>
    <element id="identifier.type">
      <path value="MedicationDispense.identifier.type" />
      <label value="identifier" />
      <short value="Description of identifier" />
      <definition value="A coded type for the identifier that can be used to determine which identifier to use for a specific purpose." />
      <requirements value="Needs binding valueset" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
    </element>
    <element id="identifier.system">
      <path value="MedicationDispense.identifier.system" />
      <label value="identifier" />
      <short value="The system which created the identifier" />
      <definition value="Values may be an oid, uri, url, or canonical" />
      <comment value="for mapped data, this is frequently a canonical url" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
      <example>
        <label value="a client's unknown system" />
        <valueUri value="https://www.health.org/person-identifier" />
      </example>
    </element>
    <element id="identifier.value">
      <path value="MedicationDispense.identifier.value" />
      <label value="identifier" />
      <short value="The unique value" />
      <definition value="The raw identifier value that represents a resource" />
      <requirements value="This should be the raw value, as it exists in the source data (ie without prefix)" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element id="de-rx-number">
      <path value="MedicationDispense.identifier" />
      <sliceName value="identifier-rx-number" />
      <label value="identifier-rx-number" />
      <code>
        <system value="https://www.icanbwell.com/product-feature-code" />
      </code>
      <short value="The prescription (rx) number" />
      <requirements value="system = source URI" />
      <type>
        <code value="Identifier" />
      </type>
      <example>
        <label value="RX Number" />
        <valueIdentifier id="rx-number">
          <type>
            <coding id="rx-number-type">
              <system value="https://fhir.icanbwell.com/4_0_0/CodeSystem/vs-identifier-type" />
              <code value="RX" />
            </coding>
          </type>
        </valueIdentifier>
      </example>
    </element>
    <element id="MedicationDispense.status">
      <path value="MedicationDispense.status" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
    </element>
    <element id="MedicationDispense.medication[x]">
      <path value="MedicationDispense.medication[x]" />
      <short value="The value representing the medication" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <type>
        <code value="Reference" />
      </type>
    </element>
    <element id="MedicationDispense.subject">
      <path value="MedicationDispense.subject" />
      <short value="The patient" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-patient" />
      </type>
    </element>
    <element id="MedicationDispense.supportingInformation">
      <path value="MedicationDispense.supportingInformation" />
      <short value="Reference to the MedicationStatement, if there is one" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-medication-statement" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-medication-request" />
      </type>
    </element>
    <element id="MedicationDispense.performer">
      <path value="MedicationDispense.performer" />
      <slicing>
        <description value="slice by types" />
        <rules value="open" />
      </slicing>
      <short value="The providers involved with the medication authoring and dispensing" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="BackboneElement" />
      </type>
    </element>
    <element id="MedicationDispense.performer.id">
      <path value="MedicationDispense.performer.id" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="MedicationDispense.performer.function">
      <path value="MedicationDispense.performer.function" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
    </element>
    <element id="MedicationDispense.performer.actor">
      <path value="MedicationDispense.performer.actor" />
      <short value="A reference to the provider" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-practitioner" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-organization" />
      </type>
    </element>
    <element id="de-medication-dispense-performer-prescribing">
      <path value="MedicationDispense.performer" />
      <sliceName value="prescriber" />
      <short value="The prescribing practitioner" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="BackboneElement" />
      </type>
    </element>
    <element id="de-medication-dispense-performer-prescribing-function">
      <path value="MedicationDispense.performer.function" />
      <sliceName value="prescriber" />
      <short value="The coded function" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <patternCodeableConcept>
        <coding id="prescribing">
          <system value="https://fhir.icanbwell.com/4_0_0/CodeSystem/vs-performer-role-code" />
          <code value="prescribing" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="de-medication-dispense-performer-prescribing-actor">
      <path value="MedicationDispense.performer.actor" />
      <sliceName value="prescriber" />
      <short value="The practitioner" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-practitioner" />
      </type>
    </element>
    <element id="de-medication-dispense-performer-dispensing">
      <path value="MedicationDispense.performer" />
      <sliceName value="dispensing-pharmacy" />
      <short value="The dispensing pharmacy" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="BackboneElement" />
      </type>
    </element>
    <element id="de-medication-dispense-performer-dispensing-function">
      <path value="MedicationDispense.performer.function" />
      <sliceName value="dispensing-pharmacy" />
      <short value="The coded function" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <patternCodeableConcept>
        <coding id="dispensing">
          <system value="https://fhir.icanbwell.com/4_0_0/CodeSystem/vs-performer-role-code" />
          <code value="dispensing" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="de-medication-dispense-performer-dispensing-actor">
      <path value="MedicationDispense.performer.actor" />
      <sliceName value="dispensing-pharmacy" />
      <short value="The pharmacy organization" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-organization" />
      </type>
    </element>
    <element id="MedicationDispense.location">
      <path value="MedicationDispense.location" />
      <label value="dispensing-pharmacy-location" />
      <short value="The pharmacy location" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-location" />
      </type>
    </element>
    <element id="MedicationDispense.authorizingPrescription">
      <path value="MedicationDispense.authorizingPrescription" />
      <short value="The prescription" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-medication-request" />
      </type>
    </element>
    <element id="MedicationDispense.type">
      <path value="MedicationDispense.type" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <example>
        <label value="refill" />
        <valueCodeableConcept>
          <coding id="refill">
            <system value="http://terminology.hl7.org/CodeSystem/v3-ActCode" />
            <code value="RF" />
            <display value="Refill" />
          </coding>
        </valueCodeableConcept>
      </example>
    </element>
    <element id="MedicationDispense.quantity">
      <path value="MedicationDispense.quantity" />
      <min value="0" />
      <max value="1" />
      <example>
        <label value="quantity" />
        <valueQuantity>
          <value value="250" />
          <system value="http://unitsofmeasure.org" />
          <code value="mL" />
        </valueQuantity>
      </example>
    </element>
    <element id="MedicationDispense.daysSupply">
      <path value="MedicationDispense.daysSupply" />
      <min value="0" />
      <max value="1" />
      <example>
        <label value="days-supply" />
        <valueQuantity>
          <value value="1" />
          <unit value="Day" />
          <system value="http://unitsofmeasure.org" />
          <code value="d" />
        </valueQuantity>
      </example>
    </element>
    <element id="MedicationDispense.whenHandedOver">
      <path value="MedicationDispense.whenHandedOver" />
      <short value="When the medication was dispensed" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="dateTime" />
      </type>
    </element>
    <element id="MedicationDispense.dosageInstruction">
      <path value="MedicationDispense.dosageInstruction" />
      <short value="When the medication was dispensed" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Dosage" />
      </type>
    </element>
    <element id="MedicationDispense.dosageInstruction.patientInstruction">
      <path value="MedicationDispense.dosageInstruction.patientInstruction" />
      <short value="Specific dosage instruction or verbal instruction given to the patient" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
    </element>
  </differential>
</StructureDefinition>