### ----------------------------------------------------
### -- FHIR
### -- Licenses: Artistic-2.0
### -- Authors: Hugh Simpson
### -- File: t/resources/structureDefinition/MedicationDispense.json
### ----------------------------------------------------
### -- Chunk 9 of 9
identity" : "workflow",
        "map" : "Event.context"
      },
      {
        "identity" : "rim",
        "map" : ".inboundRelationship[typeCode=COMP].source[classCode=ENC, moodCode=EVN, code=\"type of encounter or episode\"]"
      }]
    },
    {
      "id" : "MedicationDispense.supportingInformation",
      "path" : "MedicationDispense.supportingInformation",
      "short" : "Information that supports the dispensing of the medication",
      "definition" : "Additional information that supports the medication being dispensed.",
      "min" : 0,
      "max" : "*",
      "type" : [{
        "code" : "Reference",
        "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Resource"]
      }],
      "mapping" : [{
        "identity" : "w5",
        "map" : "FiveWs.context"
      },
      {
        "identity" : "rim",
        "map" : ".outboundRelationship[typeCode=PERT].target[A_SupportingClinicalStatement CMET minimal with many different choices of classCodes(ORG, ENC, PROC, SPLY, SBADM, OBS) and each of the act class codes draws from one or more of the following moodCodes (EVN, DEF, INT PRMS, RQO, PRP, APT, ARQ, GOL)]"
      }]
    },
    {
      "id" : "MedicationDispense.performer",
      "path" : "MedicationDispense.performer",
      "short" : "Who performed event",
      "definition" : "Indicates who or what performed the event.",
      "min" : 0,
      "max" : "*",
      "type" : [{
        "code" : "BackboneElement"
      }],
      "mapping" : [{
        "identity" : "workflow",
        "map" : "Event.performer"
      },
      {
        "identity" : "rim",
        "map" : ".participation[typeCode=PRF]"
      }]
    },
    {
      "id" : "MedicationDispense.performer.function",
      "path" : "MedicationDispense.performer.function",
      "short" : "Who performed the dispense and what they did",
      "definition" : "Distinguishes the type of performer in the dispense.  For example, date enterer, packager, final checker.",
      "requirements" : "Allows disambiguation of the types of involvement of different performers.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "CodeableConcept"
      }],
      "binding" : {
        "extension" : [{
          "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
          "valueString" : "MedicationDispensePerformerFunction"
        }],
        "strength" : "example",
        "description" : "A code describing the role an individual played in dispensing a medication.",
        "valueSet" : "http://hl7.org/fhir/ValueSet/medicationdispense-performer-function"
      },
      "mapping" : [{
        "identity" : "rim",
        "map" : "participation[typeCode=PRF].functionCode"
      }]
    },
    {
      "id" : "MedicationDispense.performer.actor",
      "path" : "MedicationDispense.performer.actor",
      "short" : "Individual who was performing",
      "definition" : "The device, practitioner, etc. who performed the action.  It should be assumed that the actor is the dispenser of the medication.",
      "min" : 1,
      "max" : "1",
      "type" : [{
        "code" : "Reference",
        "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Practitioner",
        "http://hl7.org/fhir/StructureDefinition/PractitionerRole",
        "http://hl7.org/fhir/StructureDefinition/Organization",
        "http://hl7.org/fhir/StructureDefinition/Patient",
        "http://hl7.org/fhir/StructureDefinition/Device",
        "http://hl7.org/fhir/StructureDefinition/RelatedPerson"]
      }],
      "mapping" : [{
        "identity" : "workflow",
        "map" : "Event.performer.actor"
      },
      {
        "identity" : "rim",
        "map" : ".role"
      }]
    },
    {
      "id" : "MedicationDispense.location",
      "path" : "MedicationDispense.location",
      "short" : "Where the dispense occurred",
      "definition" : "The principal physical location where the dispense was performed.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Reference",
        "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Location"]
      }],
      "mapping" : [{
        "identity" : "rim",
        "map" : ".participation[typeCode=LOC].role"
      }]
    },
    {
      "id" : "MedicationDispense.authorizingPrescription",
      "path" : "MedicationDispense.authorizingPrescription",
      "short" : "Medication order that authorizes the dispense",
      "definition" : "Indicates the medication order that is being dispensed against.",
      "comment" : "Maps to basedOn in Event logical model.",
      "min" : 0,
      "max" : "*",
      "type" : [{
        "code" : "Reference",
        "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/MedicationRequest"]
      }],
      "mapping" : [{
        "identity" : "workflow",
        "map" : "Event.basedOn"
      },
      {
        "identity" : "v2",
        "map" : "ORC-2 Placer Order Number"
      },
      {
        "identity" : "rim",
        "map" : ".outboundRelationship[typeCode=FLFS].target[moodCode=RQO]"
      },
      {
        "identity" : "rx-dispense-rmim",
        "map" : "CombinedMedicationDispense.inFulfillmentOf"
      }]
    },
    {
      "id" : "MedicationDispense.type",
      "path" : "MedicationDispense.type",
      "short" : "Trial fill, partial fill, emergency fill, etc.",
      "definition" : "Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "CodeableConcept"
      }],
      "binding" : {
        "extension" : [{
          "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
          "valueString" : "MedicationDispenseType"
        }],
        "strength" : "example",
        "description" : "Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.",
        "valueSet" : "http://terminology.hl7.org/ValueSet/v3-ActPharmacySupplyType"
      },
      "mapping" : [{
        "identity" : "v2",
        "map" : "RXD-33-Dispense Type"
      },
      {
        "identity" : "rim",
        "map" : ".code"
      },
      {
        "identity" : "rx-dispense-rmim",
        "map" : "CombinedMedicationDispense.SupplyEvent.code"
      }]
    },
    {
      "id" : "MedicationDispense.quantity",
      "path" : "MedicationDispense.quantity",
      "short" : "Amount dispensed",
      "definition" : "The amount of medication that has been dispensed. Includes unit of measure.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Quantity",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]
      }],
      "mapping" : [{
        "identity" : "v2",
        "map" : "RXD-4-Actual Dispense Amount / RXD-5.1-Actual Dispense Units.code / RXD-5.3-Actual Dispense Units.name of coding system"
      },
      {
        "identity" : "rim",
        "map" : ".quantity"
      },
      {
        "identity" : "rx-dispense-rmim",
        "map" : "CombinedMedicationDispense.SupplyEvent.quantity"
      }]
    },
    {
      "id" : "MedicationDispense.daysSupply",
      "path" : "MedicationDispense.daysSupply",
      "short" : "Amount of medication expressed as a timing amount",
      "definition" : "The amount of medication expressed as a timing amount.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Quantity",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]
      }],
      "mapping" : [{
        "identity" : "v2",
        "map" : "TQ1.6 Timing/Quantity Segment Service Duration.\rPrior to v2.5, ORC.7.3 Common Order Segment / Quantity/Timing / Duration component.  This is a formatted string, first character for the time unit (e.g., D=days), followed by the value.  For example, “D14” represents “14 days supply”\rFrom v2.5 on, TQ1.6 Timing/Quantity Segment / Service Duration.  This is a CQ data type (<Quantity (NM)> ^ <Units (CWE)>), thus for days supply, assuming the unit of measure is “days”, the numeric value is TQ1.6.1 (…|14^\rFor backwards compatibility, ORC.7 was permitted through v2.6.  Both forms (field and segment) may be present in v2.5, v2.5.1, and v2.6"
      },
      {
        "identity" : "rim",
        "map" : "effectiveUseTime"
      }]
    },
    {
      "id" : "MedicationDispense.whenPrepared",
      "path" : "MedicationDispense.whenPrepared",
      "short" : "When product was packaged and reviewed",
      "definition" : "The time when the dispensed product was packaged and reviewed.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "dateTime"
      }],
      "isSummary" : true,
      "mapping" : [{
        "identity" : "v2",
        "map" : "RXD-3-Date/Time Dispensed"
      },
      {
        "identity" : "rim",
        "map" : ".effectiveTime[xmi:type=IVL_TS].low"
      },
      {
        "identity" : "rx-dispense-rmim",
        "map" : "CombinedMedicationDispense.SupplyEvent.effectiveTime"
      }]
    },
    {
      "id" : "MedicationDispense.whenHandedOver",
      "path" : "MedicationDispense.whenHandedOver",
      "short" : "When product was given out",
      "definition" : "The time the dispensed product was provided to the patient or their representative.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "dateTime"
      }],
      "mapping" : [{
        "identity" : "workflow",
        "map" : "Event.occurrence[x]"
      },
      {
        "identity" : "v2",
        "map" : "RXD-3-Date/Time Dispensed"
      },
      {
        "identity" : "rim",
        "map" : ".effectiveTime[xmi:type=IVL_TS].high"
      },
      {
        "identity" : "rx-dispense-rmim",
        "map" : "CombinedMedicationDispense.SupplyEvent.effectiveTime"
      }]
    },
    {
      "id" : "MedicationDispense.destination",
      "path" : "MedicationDispense.destination",
      "short" : "Where the medication was sent",
      "definition" : "Identification of the facility/location where the medication was shipped to, as part of the dispense event.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Reference",
        "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Location"]
      }],
      "mapping" : [{
        "identity" : "v2",
        "map" : "RXD-13 Dispense-to Location; RXD-30 Dispense to Pharmacy; RXD-31 Dispense to Pharmacy Address"
      },
      {
        "identity" : "rim",
        "map" : ".participation[typeCode=DST].role"
      },
      {
        "identity" : "rx-dispense-rmim",
        "map" : "CombinedMedicationDispense.SupplyEvent.destination"
      }]
    },
    {
      "id" : "MedicationDispense.receiver",
      "path" : "MedicationDispense.receiver",
      "short" : "Who collected the medication",
      "definition" : "Identifies the person who picked up the medication.  This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional.",
      "min" : 0,
      "max" : "*",
      "type" : [{
        "code" : "Reference",
        "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Patient",
        "http://hl7.org/fhir/StructureDefinition/Practitioner"]
      }],
      "mapping" : [{
        "identity" : "rim",
        "map" : ".participation[typeCode=RCV].role"
      },
      {
        "identity" : "rx-dispense-rmim",
        "map" : "CombinedMedicationDispense.SupplyEvent.receiver"
      }]
    },
    {
      "id" : "MedicationDispense.note",
      "path" : "MedicationDispense.note",
      "short" : "Information about the dispense",
      "definition" : "Extra information about the dispense that could not be conveyed in the other attributes.",
      "min" : 0,
      "max" : "*",
      "type" : [{
        "code" : "Annotation"
      }],
      "mapping" : [{
        "identity" : "workflow",
        "map" : "Event.note"
      },
      {
        "identity" : "v2",
        "map" : "RXD-9 Dispense Notes"
      },
      {
        "identity" : "rim",
        "map" : ".inboundRelationship[typeCode=SUBJ]/source[classCode=ACT,moodCode=EVN]"
      }]
    },
    {
      "id" : "MedicationDispense.dosageInstruction",
      "path" : "MedicationDispense.dosageInstruction",
      "short" : "How the medication is to be used by the patient or administered by the caregiver",
      "definition" : "Indicates how the medication is to be used by the patient.",
      "comment" : "When the dose or rate is intended to change over the entire administration period (e.g. Tapering dose prescriptions), multiple instances of dosage instructions will need to be supplied to convey the different doses/rates.\rThe pharmacist reviews the medication order prior to dispense and updates the dosageInstruction based on the actual product being dispensed.",
      "min" : 0,
      "max" : "*",
      "type" : [{
        "code" : "Dosage"
      }],
      "mapping" : [{
        "identity" : "rim",
        "map" : ".outboundRelationship[typeCode=COMP].target[classCode=SBADM, moodCode=INT]"
      }]
    },
    {
      "id" : "MedicationDispense.substitution",
      "path" : "MedicationDispense.substitution",
      "short" : "Whether a substitution was performed on the dispense",
      "definition" : "Indicates whether or not substitution was made as part of the dispense.  In some cases, substitution will be expected but does not happen, in other cases substitution is not expected but does happen.  This block explains what substitution did or did not happen and why.  If nothing is specified, substitution was not done.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "BackboneElement"
      }],
      "mapping" : [{
        "identity" : "rim",
        "map" : ".outboundRelationship[typeCode=COMP].target[classCode=SUBST, moodCode=EVN]"
      },
      {
        "identity" : "rx-dispense-rmim",
        "map" : "CombinedMedicationDispense.substitutionMade"
      }]
    },
    {
      "id" : "MedicationDispense.substitution.wasSubstituted",
      "path" : "MedicationDispense.substitution.wasSubstituted",
      "short" : "Whether a substitution was or was not performed on the dispense",
      "definition" : "True if the dispenser dispensed a different drug or product from what was prescribed.",
      "min" : 1,
      "max" : "1",
      "type" : [{
        "code" : "boolean"
      }],
      "mapping" : [{
        "identity" : "rim",
        "map" : ".actionNegationInd"
      }]
    },
    {
      "id" : "MedicationDispense.substitution.type",
      "path" : "MedicationDispense.substitution.type",
      "short" : "Code signifying whether a different drug was dispensed from what was prescribed",
      "definition" : "A code signifying whether a different drug was dispensed from what was prescribed.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "CodeableConcept"
      }],
      "binding" : {
        "extension" : [{
          "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
          "valueString" : "MedicationIntendedSubstitutionType"
        }],
        "strength" : "example",
        "description" : "A coded concept describing whether a different medicinal product may be dispensed other than the product as specified exactly in the prescription.",
        "valueSet" : "http://terminology.hl7.org/ValueSet/v3-ActSubstanceAdminSubstitutionCode"
      },
      "mapping" : [{
        "identity" : "v2",
        "map" : "RXO-9-Allow Substitutions / RXE-9-Substitution Status"
      },
      {
        "identity" : "rim",
        "map" : ".code"
      },
      {
        "identity" : "rx-dispense-rmim",
        "map" : "CombinedMedicationDispense.substitutionMade.code"
      }]
    },
    {
      "id" : "MedicationDispense.substitution.reason",
      "path" : "MedicationDispense.substitution.reason",
      "short" : "Why was substitution made",
      "definition" : "Indicates the reason for the substitution (or lack of substitution) from what was prescribed.",
      "min" : 0,
      "max" : "*",
      "type" : [{
        "code" : "CodeableConcept"
      }],
      "binding" : {
        "extension" : [{
          "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
          "valueString" : "MedicationIntendedSubstitutionReason"
        }],
        "strength" : "example",
        "description" : "A coded concept describing the reason that a different medication should (or should not) be substituted from what was prescribed.",
        "valueSet" : "http://terminology.hl7.org/ValueSet/v3-SubstanceAdminSubstitutionReason"
      },
      "mapping" : [{
        "identity" : "rim",
        "map" : ".reasonCode"
      },
      {
        "identity" : "rx-dispense-rmim",
        "map" : "CombinedMedicationDispense.substitutionMade.reasonCode"
      }]
    },
    {
      "id" : "MedicationDispense.substitution.responsibleParty",
      "path" : "MedicationDispense.substitution.responsibleParty",
      "short" : "Who is responsible for the substitution",
      "definition" : "The person or organization that has primary responsibility for the substitution.",
      "min" : 0,
      "max" : "*",
      "type" : [{
        "code" : "Reference",
        "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Practitioner",
        "http://hl7.org/fhir/StructureDefinition/PractitionerRole"]
      }],
      "mapping" : [{
        "identity" : "rim",
        "map" : ".participation[typeCode=PFM].role[classCode=ASSIGN]"
      },
      {
        "identity" : "rx-dispense-rmim",
        "map" : "CombinedMedicationDispense.substitutionMade.ResponsibleParty"
      }]
    },
    {
      "id" : "MedicationDispense.detectedIssue",
      "path" : "MedicationDispense.detectedIssue",
      "short" : "Clinical issue with action",
      "definition" : "Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. drug-drug interaction, duplicate therapy, dosage alert etc.",
      "comment" : "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.",
      "alias" : ["Contraindication",
      "Drug Utilization Review (DUR)",
      "Alert"],
      "min" : 0,
      "max" : "*",
      "type" : [{
        "code" : "Reference",
        "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/DetectedIssue"]
      }],
      "mapping" : [{
        "identity" : "rim",
        "map" : ".inboundRelationship[typeCode=SUBJ]/source[classCode=ALRT,moodCode=EVN].value"
      }]
    },
    {
      "id" : "MedicationDispense.eventHistory",
      "path" : "MedicationDispense.eventHistory",
      "short" : "A list of relevant lifecycle events",
      "definition" : "A summary of the events of interest that have occurred, such as when the dispense was verified.",
      "comment" : "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" : 0,
      "max" : "*",
      "type" : [{
        "code" : "Reference",
        "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Provenance"]
      }],
      "mapping" : [{
        "identity" : "rim",
        "map" : ".inboundRelationship(typeCode=SUBJ].source[classCode=CACT, moodCode=EVN]"
      }]
    }]
  }
}


