<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="DeviceDispense" />
  <meta>
    <lastUpdated value="2021-01-02T08:58:31.578+11:00" />
  </meta>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-category">
    <valueString value="Clinical.Device" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
    <valueCode value="trial-use" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm">
    <valueInteger value="1" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-security-category">
    <valueCode value="business" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
    <valueCode value="phx" />
  </extension>
  <extension url="http://hl7.org/fhir/build/StructureDefinition/entered-in-error-status">
    <valueCode value=".status = entered-in-error" />
  </extension>
  <url value="http://hl7.org/fhir/StructureDefinition/DeviceDispense" />
  <version value="4.5.0" />
  <name value="DeviceDispense" />
  <status value="draft" />
  <date value="2021-01-02T08:58:31+11:00" />
  <publisher value="Health Level Seven International (Pharmacy)" />
  <contact>
    <telecom>
      <system value="url" />
      <value value="http://hl7.org/fhir" />
    </telecom>
  </contact>
  <contact>
    <telecom>
      <system value="url" />
      <value value="http://www.hl7.org/Special/committees/medication/index.cfm" />
    </telecom>
  </contact>
  <description value="Indicates that a device is to be or has been dispensed for a named person/patient.  This includes a description of the product (supply) provided and the instructions for using the device." />
  <fhirVersion value="4.5.0" />
  <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>
  <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>
  <kind value="resource" />
  <abstract value="false" />
  <type value="DeviceDispense" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/DomainResource" />
  <derivation value="specialization" />
  <differential>
    <element id="DeviceDispense">
      <extension url="http://hl7.org/fhir/build/StructureDefinition/svg">
        <valueCode value="-170,0" />
      </extension>
      <path value="DeviceDispense" />
      <short value="Device Dispense" />
      <definition value="A record of dispensation of a device." />
      <min value="0" />
      <max value="*" />
      <mapping>
        <identity value="w5" />
        <map value="administrative.device" />
      </mapping>
    </element>
    <element id="DeviceDispense.identifier">
      <path value="DeviceDispense.identifier" />
      <short value="Business identifier for this dispensation" />
      <definition value="Business identifier for this dispensation." />
      <comment value="This is a business identifier, not a resource identifier." />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Identifier" />
      </type>
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.identifier" />
      </mapping>
      <isSummary value="true" />
    </element>
    <element id="DeviceDispense.basedOn">
      <path value="DeviceDispense.basedOn" />
      <short value="The order or request that this dispense is fulfilling" />
      <definition value="The order or request that this dispense is fulfilling." />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/CarePlan" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/DeviceRequest" />
      </type>
    </element>
    <element id="DeviceDispense.partOf">
      <path value="DeviceDispense.partOf" />
      <short value="The bigger event that this dispense is a part of" />
      <definition value="The bigger event that this dispense is a part of." />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Procedure" />
      </type>
      <mapping>
        <identity value="workflow" />
        <map value="Event.partOf" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".outboundRelationship[typeCode=COMP]/target[classCode=PROC,moodCode=EVN]" />
      </mapping>
    </element>
    <element id="DeviceDispense.status">
      <path value="DeviceDispense.status" />
      <short value="preparation | in-progress | cancelled | on-hold | completed | entered-in-error | stopped | declined | unknown" />
      <definition value="A code specifying the state of the set of dispense events." />
      <comment value="This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
      <isModifier value="true" />
      <isModifierReason value="This element is labelled as a modifier because it is a status element that contains status entered-in-error which means that the resource should not be treated as valid" />
      <isSummary value="true" />
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="DeviceDispenseStatus" />
        </extension>
        <extension url="http://hl7.org/fhir/build/StructureDefinition/definition">
          <valueString value="A coded concept specifying the state of the dispense event." />
        </extension>
        <extension url="http://hl7.org/fhir/build/StructureDefinition/v3-map">
          <valueString value="ActStatus" />
        </extension>
        <strength value="required" />
        <description value="Describes the lifecycle of the dispense." />
        <valueSet value="http://hl7.org/fhir/ValueSet/devicedispense-status" />
      </binding>
      <mapping>
        <identity value="workflow" />
        <map value="Event.status" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.status" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".statusCode" />
      </mapping>
    </element>
    <element id="DeviceDispense.statusReason">
      <path value="DeviceDispense.statusReason" />
      <short value="Why a dispense was or was not performed" />
      <definition value="Indicates the reason why a dispense was or was not performed." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="CodeableReference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/DetectedIssue" />
      </type>
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="DeviceDispenseStatusReason" />
        </extension>
        <extension url="http://hl7.org/fhir/build/StructureDefinition/definition">
          <valueString value="A code describing why a dispense was or was not performed." />
        </extension>
        <strength value="example" />
        <valueSet value="http://hl7.org/fhir/ValueSet/devicedispense-status-reason" />
      </binding>
      <mapping>
        <identity value="workflow" />
        <map value="Event.statusReason" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".outboundRelationship[typeCode=RSON]/target[classCode=OBS,moodCode=EVN, code=&quot;not done reason&quot;].value" />
      </mapping>
    </element>
    <element id="DeviceDispense.category">
      <path value="DeviceDispense.category" />
      <short value="Type of device dispense" />
      <definition value="Indicates the type of device dispense." />
      <comment value="The category can be used to include where the device is expected to be consumed or other types of dispenses.  Invariants can be used to bind to different value sets when profiling to bind." />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="CodeableConcept" />
      </type>
    </element>
    <element id="DeviceDispense.device">
      <path value="DeviceDispense.device" />
      <short value="What device was supplied" />
      <definition value="Identifies the device being dispensed. This is either a link to a resource representing the details of the device or a simple attribute carrying a code that identifies the device from a known list of devices." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="CodeableReference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Device" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/DeviceDefinition" />
      </type>
      <isSummary value="true" />
      <mapping>
        <identity value="workflow" />
        <map value="Event.code" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.what[x]" />
      </mapping>
    </element>
    <element id="DeviceDispense.subject">
      <path value="DeviceDispense.subject" />
      <short value="Who the dispense is for" />
      <definition value="A link to a resource representing the person to whom the device is intended." />
      <comment value="What about 'this measuring Device is now asigned to Dr X who needs it now'?" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Patient" />
      </type>
      <isSummary value="true" />
      <mapping>
        <identity value="workflow" />
        <map value="Event.subject" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.subject[x]" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="PID-3-Patient ID List" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".participation[typeCode=SBJ].role[classCode=PAT]" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.subject" />
      </mapping>
    </element>
    <element id="DeviceDispense.encounter">
      <path value="DeviceDispense.encounter" />
      <short value="Encounter associated with event" />
      <definition value="The encounter that establishes the context for this event." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Encounter" />
      </type>
      <mapping>
        <identity value="workflow" />
        <map value="Event.context" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".inboundRelationship[typeCode=COMP].source[classCode=ENC, moodCode=EVN, code=&quot;type of encounter or episode&quot;]" />
      </mapping>
    </element>
    <element id="DeviceDispense.supportingInformation">
      <path value="DeviceDispense.supportingInformation" />
      <short value="Information that supports the dispensing of the device" />
      <definition value="Additional information that supports the device being dispensed." />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Resource" />
      </type>
      <mapping>
        <identity value="w5" />
        <map value="FiveWs.context" />
      </mapping>
    </element>
    <element id="DeviceDispense.performer">
      <path value="DeviceDispense.performer" />
      <short value="Who performed event" />
      <definition value="Indicates who or what performed the event." />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="BackboneElement" />
      </type>
      <mapping>
        <identity value="workflow" />
        <map value="Event.performer" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".participation[typeCode=PRF]" />
      </mapping>
    </element>
    <element id="DeviceDispense.performer.function">
      <path value="DeviceDispense.performer.function" />
      <short value="Who performed the dispense and what they did" />
      <definition value="Distinguishes the type of performer in the dispense.  For example, date enterer, packager, final checker." />
      <requirements value="Allows disambiguation of the types of involvement of different performers." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <mapping>
        <identity value="rim" />
        <map value="participation[typeCode=PRF].functionCode" />
      </mapping>
    </element>
    <element id="DeviceDispense.performer.actor">
      <path value="DeviceDispense.performer.actor" />
      <short value="Individual who was performing" />
      <definition value="The device, practitioner, etc. who performed the action.  It should be assumed that the actor is the dispenser of the device." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/PractitionerRole" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Organization" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Patient" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Device" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/RelatedPerson" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/CareTeam" />
      </type>
      <mapping>
        <identity value="workflow" />
        <map value="Event.performer.actor" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".role" />
      </mapping>
    </element>
    <element id="DeviceDispense.location">
      <path value="DeviceDispense.location" />
      <short value="Where the dispense occurred" />
      <definition value="The principal physical location where the dispense was performed." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Location" />
      </type>
      <mapping>
        <identity value="rim" />
        <map value=".participation[typeCode=LOC].role" />
      </mapping>
    </element>
    <element id="DeviceDispense.type">
      <path value="DeviceDispense.type" />
      <short value="Trial fill, partial fill, emergency fill, etc." />
      <definition value="Indicates the type of dispensing event that is performed." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
    </element>
    <element id="DeviceDispense.quantity">
      <path value="DeviceDispense.quantity" />
      <short value="Amount dispensed" />
      <definition value="The number of devices that have been dispensed." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Quantity" />
        <profile value="http://hl7.org/fhir/StructureDefinition/SimpleQuantity" />
      </type>
      <mapping>
        <identity value="rim" />
        <map value=".quantity" />
      </mapping>
    </element>
    <element id="DeviceDispense.preparedDate">
      <extension url="http://hl7.org/fhir/build/StructureDefinition/committee-notes">
        <valueString value="This is time of dispense (preparation).  The time of supply to the patient is a separate attribute." />
      </extension>
      <path value="DeviceDispense.preparedDate" />
      <short value="When product was packaged and reviewed" />
      <definition value="The time when the dispensed product was packaged and reviewed." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="dateTime" />
      </type>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value=".effectiveTime[xmi:type=IVL_TS].low" />
      </mapping>
    </element>
    <element id="DeviceDispense.whenHandedOver">
      <extension url="http://hl7.org/fhir/build/StructureDefinition/committee-notes">
        <valueString value="The time of handing over to the patient (pickup/handover in community or supply in inpatient)." />
      </extension>
      <path value="DeviceDispense.whenHandedOver" />
      <short value="When product was given out" />
      <definition value="The time the dispensed product was made available to the patient or their representative." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="dateTime" />
      </type>
      <mapping>
        <identity value="workflow" />
        <map value="Event.occurrence[x]" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".effectiveTime[xmi:type=IVL_TS].high" />
      </mapping>
    </element>
    <element id="DeviceDispense.destination">
      <extension url="http://hl7.org/fhir/build/StructureDefinition/committee-notes">
        <valueString value="for inpatient setting this is core, but this might not be core for community setting.  Also core for internet pharmacy.  Core for radioactive materials  Will service delivery location be defined by another group?" />
      </extension>
      <path value="DeviceDispense.destination" />
      <short value="Where the device was sent or should be sent" />
      <definition value="Identification of the facility/location where the device was /should be shipped to, as part of the dispense process." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Location" />
      </type>
      <mapping>
        <identity value="rim" />
        <map value=".participation[typeCode=DST].role" />
      </mapping>
    </element>
    <element id="DeviceDispense.note">
      <path value="DeviceDispense.note" />
      <short value="Information about the dispense" />
      <definition value="Extra information about the dispense that could not be conveyed in the other attributes." />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Annotation" />
      </type>
      <mapping>
        <identity value="workflow" />
        <map value="Event.note" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value=".inboundRelationship[typeCode=SUBJ]/source[classCode=ACT,moodCode=EVN]" />
      </mapping>
    </element>
    <element id="DeviceDispense.usageInstruction">
      <path value="DeviceDispense.usageInstruction" />
      <short value="Full representation of the usage instructions" />
      <definition value="The full representation of the instructions." />
      <comment value="The content of the renderedDosageInstructions must not be different than the dose represented in the dosageInstruction content." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element id="DeviceDispense.eventHistory">
      <path value="DeviceDispense.eventHistory" />
      <short value="A list of relevant lifecycle events" />
      <definition value="A summary of the events of interest that have occurred, such as when the dispense was verified." />
      <comment value="This might not include provenances for all versions of the request – only those deemed “relevant” or important. This SHALL NOT include the Provenance associated with this current version of the resource. (If that provenance is deemed to be a “relevant” change, it will need to be added as part of a later update. Until then, it can be queried directly as the Provenance that points to this version using _revinclude All Provenances should have some historical version of this Request as their subject.)." />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Provenance" />
      </type>
      <mapping>
        <identity value="rim" />
        <map value=".inboundRelationship(typeCode=SUBJ].source[classCode=CACT, moodCode=EVN]" />
      </mapping>
    </element>
  </differential>
</StructureDefinition>