### ----------------------------------------------------
### -- FHIR
### -- Licenses: Artistic-2.0
### -- Authors: Hugh Simpson
### -- File: t/resources/structureDefinition/MedicationRequest.json
### ----------------------------------------------------
### -- Chunk 13 of 13
edicationPrescribed/ExpirationDate"
      },
      {
        "identity" : "rim",
        "map" : "component.supplyEvent"
      }]
    },
    {
      "id" : "MedicationRequest.dispenseRequest.initialFill",
      "path" : "MedicationRequest.dispenseRequest.initialFill",
      "short" : "First fill details",
      "definition" : "Indicates the quantity or duration for the first dispense of the medication.",
      "comment" : "If populating this element, either the quantity or the duration must be included.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "BackboneElement"
      }],
      "mapping" : [{
        "identity" : "rim",
        "map" : "SubstanceAdministration -> ActRelationship[sequenceNumber = '1'] -> Supply"
      }]
    },
    {
      "id" : "MedicationRequest.dispenseRequest.initialFill.quantity",
      "path" : "MedicationRequest.dispenseRequest.initialFill.quantity",
      "short" : "First fill quantity",
      "definition" : "The amount or quantity to provide as part of the first dispense.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Quantity",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]
      }],
      "mapping" : [{
        "identity" : "rim",
        "map" : "Supply.quantity[moodCode=RQO]"
      }]
    },
    {
      "id" : "MedicationRequest.dispenseRequest.initialFill.duration",
      "path" : "MedicationRequest.dispenseRequest.initialFill.duration",
      "short" : "First fill duration",
      "definition" : "The length of time that the first dispense is expected to last.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Duration"
      }],
      "mapping" : [{
        "identity" : "rim",
        "map" : "Supply.effectivetime[moodCode=RQO]"
      }]
    },
    {
      "id" : "MedicationRequest.dispenseRequest.dispenseInterval",
      "path" : "MedicationRequest.dispenseRequest.dispenseInterval",
      "short" : "Minimum period of time between dispenses",
      "definition" : "The minimum period of time that must occur between dispenses of the medication.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Duration"
      }],
      "mapping" : [{
        "identity" : "rim",
        "map" : "Supply.effectivetime[moodCode=RQO]"
      }]
    },
    {
      "id" : "MedicationRequest.dispenseRequest.validityPeriod",
      "path" : "MedicationRequest.dispenseRequest.validityPeriod",
      "short" : "Time period supply is authorized for",
      "definition" : "This indicates the validity period of a prescription (stale dating the Prescription).",
      "comment" : "It reflects the prescribers' perspective for the validity of the prescription. Dispenses must not be made against the prescription outside of this period. The lower-bound of the Dispensing Window signifies the earliest date that the prescription can be filled for the first time. If an upper-bound is not specified then the Prescription is open-ended or will default to a stale-date based on regulations.",
      "requirements" : "Indicates when the Prescription becomes valid, and when it ceases to be a dispensable Prescription.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Period"
      }],
      "mapping" : [{
        "identity" : "script10.6",
        "map" : "Message/Body/NewRx/MedicationPrescribed/Refills"
      },
      {
        "identity" : "rim",
        "map" : "effectiveTime"
      }]
    },
    {
      "id" : "MedicationRequest.dispenseRequest.numberOfRepeatsAllowed",
      "path" : "MedicationRequest.dispenseRequest.numberOfRepeatsAllowed",
      "short" : "Number of refills authorized",
      "definition" : "An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus \"3 repeats\", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.  A prescriber may explicitly say that zero refills are permitted after the initial dispense.",
      "comment" : "If displaying \"number of authorized fills\", add 1 to this number.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "unsignedInt"
      }],
      "mapping" : [{
        "identity" : "script10.6",
        "map" : "Message/Body/NewRx/MedicationPrescribed/Quantity"
      },
      {
        "identity" : "v2",
        "map" : "RXE-12-Number of Refills"
      },
      {
        "identity" : "rim",
        "map" : "repeatNumber"
      }]
    },
    {
      "id" : "MedicationRequest.dispenseRequest.quantity",
      "path" : "MedicationRequest.dispenseRequest.quantity",
      "short" : "Amount of medication to supply per dispense",
      "definition" : "The amount that is to be dispensed for one fill.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Quantity",
        "profile" : ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]
      }],
      "mapping" : [{
        "identity" : "script10.6",
        "map" : "Message/Body/NewRx/MedicationPrescribed/DaysSupply"
      },
      {
        "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"
      }]
    },
    {
      "id" : "MedicationRequest.dispenseRequest.expectedSupplyDuration",
      "path" : "MedicationRequest.dispenseRequest.expectedSupplyDuration",
      "short" : "Number of days supply per dispense",
      "definition" : "Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.",
      "comment" : "In some situations, this attribute may be used instead of quantity to identify the amount supplied by how long it is expected to last, rather than the physical quantity issued, e.g. 90 days supply of medication (based on an ordered dosage). When possible, it is always better to specify quantity, as this tends to be more precise. expectedSupplyDuration will always be an estimate that can be influenced by external factors.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Duration"
      }],
      "mapping" : [{
        "identity" : "script10.6",
        "map" : "Message/Body/NewRx/MedicationPrescribed/Substitutions"
      },
      {
        "identity" : "rim",
        "map" : "expectedUseTime"
      }]
    },
    {
      "id" : "MedicationRequest.dispenseRequest.performer",
      "path" : "MedicationRequest.dispenseRequest.performer",
      "short" : "Intended dispenser",
      "definition" : "Indicates the intended dispensing Organization specified by the prescriber.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Reference",
        "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Organization"]
      }],
      "mapping" : [{
        "identity" : "w5",
        "map" : "FiveWs.who"
      },
      {
        "identity" : "rim",
        "map" : ".outboundRelationship[typeCode=COMP].target[classCode=SPLY, moodCode=RQO] .participation[typeCode=PRF].role[scoper.determinerCode=INSTANCE]"
      }]
    },
    {
      "id" : "MedicationRequest.substitution",
      "path" : "MedicationRequest.substitution",
      "short" : "Any restrictions on medication substitution",
      "definition" : "Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "BackboneElement"
      }],
      "mapping" : [{
        "identity" : "script10.6",
        "map" : "specific values within Message/Body/NewRx/MedicationPrescribed/Substitutions"
      },
      {
        "identity" : "rim",
        "map" : "subjectOf.substitutionPersmission"
      }]
    },
    {
      "id" : "MedicationRequest.substitution.allowed[x]",
      "path" : "MedicationRequest.substitution.allowed[x]",
      "short" : "Whether substitution is allowed or not",
      "definition" : "True if the prescriber allows a different drug to be dispensed from what was prescribed.",
      "comment" : "This element is labeled as a modifier because whether substitution is allow or not, it cannot be ignored.",
      "min" : 1,
      "max" : "1",
      "type" : [{
        "code" : "boolean"
      },
      {
        "code" : "CodeableConcept"
      }],
      "binding" : {
        "extension" : [{
          "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
          "valueString" : "MedicationRequestSubstitution"
        }],
        "strength" : "example",
        "description" : "Identifies the type of substitution allowed.",
        "valueSet" : "http://terminology.hl7.org/ValueSet/v3-ActSubstanceAdminSubstitutionCode"
      },
      "mapping" : [{
        "identity" : "script10.6",
        "map" : "specific values within Message/Body/NewRx/MedicationPrescribed/Substitutions"
      },
      {
        "identity" : "v2",
        "map" : "RXO-9-Allow Substitutions / RXE-9-Substitution Status"
      },
      {
        "identity" : "rim",
        "map" : "code"
      }]
    },
    {
      "id" : "MedicationRequest.substitution.reason",
      "path" : "MedicationRequest.substitution.reason",
      "short" : "Why should (not) substitution be made",
      "definition" : "Indicates the reason for the substitution, or why substitution must or must not be performed.",
      "min" : 0,
      "max" : "1",
      "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" : "script10.6",
        "map" : "not mapped"
      },
      {
        "identity" : "v2",
        "map" : "RXE-9 Substition status"
      },
      {
        "identity" : "rim",
        "map" : "reasonCode"
      }]
    },
    {
      "id" : "MedicationRequest.priorPrescription",
      "path" : "MedicationRequest.priorPrescription",
      "short" : "An order/prescription that is being replaced",
      "definition" : "A link to a resource representing an earlier order related order or prescription.",
      "min" : 0,
      "max" : "1",
      "type" : [{
        "code" : "Reference",
        "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/MedicationRequest"]
      }],
      "mapping" : [{
        "identity" : "workflow",
        "map" : "Request.replaces"
      },
      {
        "identity" : "script10.6",
        "map" : "not mapped"
      },
      {
        "identity" : "rim",
        "map" : ".outboundRelationship[typeCode=?RPLC or ?SUCC]/target[classCode=SBADM,moodCode=RQO]"
      }]
    },
    {
      "id" : "MedicationRequest.detectedIssue",
      "path" : "MedicationRequest.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" : "MedicationRequest.eventHistory",
      "path" : "MedicationRequest.eventHistory",
      "short" : "A list of events of interest in the lifecycle",
      "definition" : "Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.",
      "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" : "workflow",
        "map" : "Request.relevantHistory"
      },
      {
        "identity" : "rim",
        "map" : ".inboundRelationship(typeCode=SUBJ].source[classCode=CACT, moodCode=EVN]"
      }]
    }]
  }
}


