R4 Ballot #1 #2 (Mixed Normative/Trial use)

This page is part of the FHIR Specification (v3.3.0: (v3.5.0: R4 Ballot 2). #2). The current version which supercedes this version is 5.0.0 . For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4 R3

Pharmacy Work Group Maturity Level : N/A Ballot Status : Informative Compartments : Patient , Practitioner

R2 : R3 : R4 Conversion maps for MedicationDispense.

Functional status for this map: 7 31 tests that all of which 20 fail to execute ok. . 7 11 fail round-trip testing and 1 11 r3 resources are invalid (2 (0 errors). ( see documentation)

map "http://hl7.org/fhir/StructureMap/MedicationDispense2to3" = "R2 to R3 Conversions for MedicationDispense"

map "http://hl7.org/fhir/StructureMap/MedicationDispense3to4" = "R3 to R4 Conversions for MedicationDispense"


uses "http://hl7.org/fhir/DSTU2/StructureDefinition/MedicationDispense" alias MedicationDispenseR2 as source


uses "http://hl7.org/fhir/3.0/StructureDefinition/MedicationDispense" alias MedicationDispenseR3 as source

uses "http://hl7.org/fhir/StructureDefinition/MedicationDispense" alias MedicationDispense as target

imports "http://hl7.org/fhir/StructureMap/*2to3"

imports "http://hl7.org/fhir/StructureMap/*3to4"


group for type+types  MedicationDispense extends DomainResource
  input src : MedicationDispenseR2 as source
  input tgt : MedicationDispense as target


  "MedicationDispense-identifier" : for src.identifier make tgt.identifier
  "MedicationDispense-status" : for src.status make tgt.status
  "MedicationDispense-patient" : for src.patient make tgt.subject
  "MedicationDispense-dispenser" : for src.dispenser as v make tgt.performer as d, d.actor as v
  "MedicationDispense-authorizingPrescription" : for src.authorizingPrescription make tgt.authorizingPrescription
  "MedicationDispense-type" : for src.type make tgt.type
  "MedicationDispense-quantity" : for src.quantity make tgt.quantity
  "MedicationDispense-daysSupply" : for src.daysSupply make tgt.daysSupply
  "MedicationDispense-medication" : for src.medication make tgt.medication 
  "MedicationDispense-whenPrepared" : for src.whenPrepared make tgt.whenPrepared
  "MedicationDispense-whenHandedOver" : for src.whenHandedOver make tgt.whenHandedOver
  "MedicationDispense-destination" : for src.destination make tgt.destination
  "MedicationDispense-receiver" : for src.receiver make tgt.receiver
  "MedicationDispense-note" : for src.note make tgt.note
  
  "MedicationDispense-dosageInstruction" : for src.dosageInstruction as vs0 make tgt.dosageInstruction as vt0 then mddDosage(vs0, vt0)
  "MedicationDispense-substitution" : for src.substitution as vs0 make tgt.substitution as vt0 then mddSubstitution(vs0, vt0)
endgroup


group mddSubstitution extends BackboneElement
  input src as source
  input tgt as target

group MedicationDispense extends DomainResource
  input src : MedicationDispenseR3 as source
  input tgt : MedicationDispense as target


  "MedicationDispense.substitution-was" : for src as su make tgt.wasSubstituted = true
  "MedicationDispense.substitution-type" : for src.type make tgt.type
  "MedicationDispense.substitution-reason" : for src.reason make tgt.reason
  "MedicationDispense.substitution-responsibleParty" : for src.responsibleParty make tgt.responsibleParty

  "MedicationDispense.identifier" : for src.identifier as vs make tgt.identifier as vt
  "MedicationDispense.partOf" : for src.partOf as vs make tgt.partOf as vt
  "MedicationDispense.status" : for src.status as vs make tgt.status as vt
  "MedicationDispense.category" : for src.category as vs make tgt.category as vt
  "MedicationDispense.medication-CodeableConcept" : for src.medication  : CodeableConcept as vs make tgt.medication = create("CodeableConcept") as vt then CodeableConcept(vs,vt)
  "MedicationDispense.medication-Reference" : for src.medication  : Reference as vs make tgt.medication = create("Reference") as vt then Reference(vs,vt)
  "MedicationDispense.subject" : for src.subject as vs make tgt.subject as vt
  "MedicationDispense.context" : for src.context as vs make tgt.context as vt
  "MedicationDispense.supportingInformation" : for src.supportingInformation as vs make tgt.supportingInformation as vt
  "MedicationDispense.performer" : for src.performer as vs0 make tgt.performer as vt0 then {
    "MedicationDispense.performer.actor" : for vs0.actor as vs make vt0.actor as vt
  }
  "MedicationDispense.authorizingPrescription" : for src.authorizingPrescription as vs make tgt.authorizingPrescription as vt
  "MedicationDispense.type" : for src.type as vs make tgt.type as vt
  "MedicationDispense.quantity" : for src.quantity as vs make tgt.quantity as vt
  "MedicationDispense.daysSupply" : for src.daysSupply as vs make tgt.daysSupply as vt
  "MedicationDispense.whenPrepared" : for src.whenPrepared as vs make tgt.whenPrepared as vt
  "MedicationDispense.whenHandedOver" : for src.whenHandedOver as vs make tgt.whenHandedOver as vt
  "MedicationDispense.destination" : for src.destination as vs make tgt.destination as vt
  "MedicationDispense.receiver" : for src.receiver as vs make tgt.receiver as vt
  "MedicationDispense.note" : for src.note as vs make tgt.note as vt
  "MedicationDispense.dosageInstruction" : for src.dosageInstruction as vs make tgt.dosageInstruction as vt
  "MedicationDispense.substitution" : for src.substitution as vs0 make tgt.substitution as vt0 then {
    "MedicationDispense.substitution.wasSubstituted" : for vs0.wasSubstituted as vs make vt0.wasSubstituted as vt
    "MedicationDispense.substitution.type" : for vs0.type as vs make vt0.type as vt
    "MedicationDispense.substitution.reason" : for vs0.reason as vs make vt0.reason as vt
    "MedicationDispense.substitution.responsibleParty" : for vs0.responsibleParty as vs make vt0.responsibleParty as vt
  }
  "MedicationDispense.detectedIssue" : for src.detectedIssue as vs make tgt.detectedIssue as vt
  "MedicationDispense.eventHistory" : for src.eventHistory as vs make tgt.eventHistory as vt

endgroup

group mddDosage extends Element // ? BackboneElement
  input src as source
  input tgt as target

  "MedicationDispense.dosage-text" : for src.text make tgt.text
  "MedicationDispense.dosage-additionalInstructions" : for src.additionalInstructions	make tgt.additionalInstruction
  "MedicationDispense.dosage-timing" : for src.timing make tgt.timing
  "MedicationDispense.dosage-asNeeded" : for src.asNeeded make tgt.asNeeded
  "MedicationDispense.dosage-site" : for src.site where $this is CodeableConcept make tgt.site  
  "MedicationDispense.dosage-route" : for src.route make tgt.route
  "MedicationDispense.dosage-method" : for src.method make tgt.method
  "MedicationDispense.dosage-dose" : for src.dose make tgt.dose
  "MedicationDispense.dosage-rate" : for src.rate make tgt.rate
  "MedicationDispense.dosage-maxDosePerPeriod" : for src.maxDosePerPeriod make tgt.maxDosePerPeriod
endgroup


map "http://hl7.org/fhir/StructureMap/MedicationDispense3to2" = "R3 to R2 Conversion for MedicationDispense"

uses "http://hl7.org/fhir/StructureDefinition/MedicationDispense" alias MedicationDispense as source
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/MedicationDispense" alias MedicationDispenseR2 as target

map "http://hl7.org/fhir/StructureMap/MedicationDispense4to3" = "R4 to R3 Conversion for MedicationDispense"


imports "http://hl7.org/fhir/StructureMap/*3to2"


group for type+types  MedicationDispense extends DomainResource
  input src : MedicationDispense as source
  input tgt : MedicationDispenseR2 as target

uses "http://hl7.org/fhir/StructureDefinition/MedicationDispense" alias MedicationDispense as source
uses "http://hl7.org/fhir/3.0/StructureDefinition/MedicationDispense" alias MedicationDispenseR3 as target


  "MedicationDispense-identifier" : for src.identifier make tgt.identifier
  "MedicationDispense-status" : for src.status make tgt.status
  "MedicationDispense-patient" : for src.subject make tgt.patient
  "MedicationDispense-dispenser" : for src.performer as vs0 then mddPerformer(vs0, tgt)
  "MedicationDispense-authorizingPrescription" : for src.authorizingPrescription make tgt.authorizingPrescription
  "MedicationDispense-type" : for src.type make tgt.type
  "MedicationDispense-quantity" : for src.quantity make tgt.quantity
  "MedicationDispense-daysSupply" : for src.daysSupply make tgt.daysSupply
  "MedicationDispense-medication" : for src.medication make tgt.medication 
  "MedicationDispense-whenPrepared" : for src.whenPrepared make tgt.whenPrepared
  "MedicationDispense-whenHandedOver" : for src.whenHandedOver make tgt.whenHandedOver
  "MedicationDispense-destination" : for src.destination make tgt.destination
  "MedicationDispense-receiver" : for src.receiver make tgt.receiver
  "MedicationDispense-note" : for src.note only_one make tgt.note
  
  "MedicationDispense-dosageInstruction" : for src.dosageInstruction as vs0 make tgt.dosageInstruction as vt0 then mddDosage(vs0, vt0)
  "MedicationDispense-substitution" : for src.substitution as vs0 make tgt.substitution as vt0 then mddSubstitution(vs0, vt0)
endgroup

imports "http://hl7.org/fhir/StructureMap/*4to3"


group mddPerformer extends BackboneElement
  input src as source
  input tgt as target


  "MedicationDispense.performer-actor" : for src.actor make tgt.dispenser
endgroup


group mddSubstitution extends BackboneElement
  input src as source
  input tgt as target

group MedicationDispense extends DomainResource
  input src : MedicationDispense as source
  input tgt : MedicationDispenseR3 as target


  "MedicationDispense.substitution-type" : for src.type make tgt.type
  "MedicationDispense.substitution-reason" : for src.reason make tgt.reason
  "MedicationDispense.substitution-responsibleParty" : for src.responsibleParty make tgt.responsibleParty

  "MedicationDispense.identifier" : for src.identifier as vs make tgt.identifier as vt
  "MedicationDispense.partOf" : for src.partOf as vs make tgt.partOf as vt
  "MedicationDispense.status" : for src.status as vs make tgt.status as vt
  "MedicationDispense.category" : for src.category as vs make tgt.category as vt
  "MedicationDispense.medication-CodeableConcept" : for src.medication  : CodeableConcept as vs make tgt.medication = create("CodeableConcept") as vt then CodeableConcept(vs,vt)
  "MedicationDispense.medication-Reference" : for src.medication  : Reference as vs make tgt.medication = create("Reference") as vt then Reference(vs,vt)
  "MedicationDispense.subject" : for src.subject as vs make tgt.subject as vt
  "MedicationDispense.context" : for src.context as vs make tgt.context as vt
  "MedicationDispense.supportingInformation" : for src.supportingInformation as vs make tgt.supportingInformation as vt
  "MedicationDispense.performer" : for src.performer as vs0 make tgt.performer as vt0 then {
    "MedicationDispense.performer.actor" : for vs0.actor as vs make vt0.actor as vt
  }
  "MedicationDispense.authorizingPrescription" : for src.authorizingPrescription as vs make tgt.authorizingPrescription as vt
  "MedicationDispense.type" : for src.type as vs make tgt.type as vt
  "MedicationDispense.quantity" : for src.quantity as vs make tgt.quantity as vt
  "MedicationDispense.daysSupply" : for src.daysSupply as vs make tgt.daysSupply as vt
  "MedicationDispense.whenPrepared" : for src.whenPrepared as vs make tgt.whenPrepared as vt
  "MedicationDispense.whenHandedOver" : for src.whenHandedOver as vs make tgt.whenHandedOver as vt
  "MedicationDispense.destination" : for src.destination as vs make tgt.destination as vt
  "MedicationDispense.receiver" : for src.receiver as vs make tgt.receiver as vt
  "MedicationDispense.note" : for src.note as vs make tgt.note as vt
  "MedicationDispense.dosageInstruction" : for src.dosageInstruction as vs make tgt.dosageInstruction as vt
  "MedicationDispense.substitution" : for src.substitution as vs0 make tgt.substitution as vt0 then {
    "MedicationDispense.substitution.wasSubstituted" : for vs0.wasSubstituted as vs make vt0.wasSubstituted as vt
    "MedicationDispense.substitution.type" : for vs0.type as vs make vt0.type as vt
    "MedicationDispense.substitution.reason" : for vs0.reason as vs make vt0.reason as vt
    "MedicationDispense.substitution.responsibleParty" : for vs0.responsibleParty as vs make vt0.responsibleParty as vt
  }
  "MedicationDispense.detectedIssue" : for src.detectedIssue as vs make tgt.detectedIssue as vt
  "MedicationDispense.eventHistory" : for src.eventHistory as vs make tgt.eventHistory as vt

endgroup

group mddDosage extends Element // ? BackboneElement
  input src as source
  input tgt as target

  "MedicationDispense.dosage-text" : for src.text make tgt.text
  "MedicationDispense.dosage-additionalInstructions" : for src.additionalInstruction	only_one make tgt.additionalInstructions
  "MedicationDispense.dosage-timing" : for src.timing make tgt.timing
  "MedicationDispense.dosage-asNeeded" : for src.asNeeded make tgt.asNeeded
  "MedicationDispense.dosage-site" : for src.site make tgt.site  
  "MedicationDispense.dosage-route" : for src.route make tgt.route
  "MedicationDispense.dosage-method" : for src.method make tgt.method
  "MedicationDispense.dosage-dose" : for src.dose make tgt.dose
  "MedicationDispense.dosage-rate" : for src.rate make tgt.rate
  "MedicationDispense.dosage-maxDosePerPeriod" : for src.maxDosePerPeriod make tgt.maxDosePerPeriod
endgroup


medicationdispense-example ERROR @ MedicationDispense.dosageInstruction.extension[2][url='http://hl7.org/fhir/StructureDefinition/pharmacy-core-infuseOver']: The Extension 'http://hl7.org/fhir/StructureDefinition/pharmacy-core-infuseOver' definition allows for the types [Duration] but found type Quantity (src = InstanceValidator) INFORMATION @ MedicationDispense.dosageInstruction.extension[2].valueQuantity: Could not verify slice for profile http://hl7.org/fhir/StructureDefinition/pharmacy-core-infuseOver (src = InstanceValidator)