R4 Draft for Comment

This page is part of the FHIR Specification (v3.2.0: R4 Ballot 1). 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 GroupMaturity Level: N/ABallot Status: Informative Compartments: Patient, Practitioner

R2 : R3 Conversion maps for MedicationDispense.

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

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

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

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

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

  "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
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

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

group for type+types  MedicationDispense extends DomainResource
  input src : MedicationDispense as source
  input tgt : MedicationDispenseR2 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

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

  "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
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)