FHIR Release 3 (STU) R4 Ballot #2 (Mixed Normative/Trial use)

This page is part of the FHIR Specification (v3.0.2: STU 3). (v3.5.0: R4 Ballot #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 , RelatedPerson

R2 : R3 Converson : R4 Conversion maps for MedicationStatement.

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

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

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


uses "http://hl7.org/fhir/DSTU2/StructureDefinition/MedicationStatement" alias MedicationStatementR2 as source
uses "http://hl7.org/fhir/StructureDefinition/MedicationStatement" alias MedicationStatement as target


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

uses "http://hl7.org/fhir/3.0/StructureDefinition/MedicationStatement" alias MedicationStatementR3 as source
uses "http://hl7.org/fhir/StructureDefinition/MedicationStatement" alias MedicationStatement as target


group for type+types  MedicationStatement extends DomainResource
  input src : MedicationStatementR2 as source
  input tgt : MedicationStatement as target

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


  "MedicationStatement-identifier" : for src.identifier make tgt.identifier
  "MedicationStatement-subject" : for src.patient make tgt.subject
  "MedicationStatement-informationSource" : for src.informationSource make tgt.informationSource
  "MedicationStatement-dateAsserted" : for src.dateAsserted make tgt.dateAsserted
  "MedicationStatement-status" : for src.status make tgt.status
  "MedicationStatement-wasNotTaken" : for src.wasNotTaken as vt where $this = true make tgt.taken = "n"
  "MedicationStatement-wasNotTaken" : for src.wasNotTaken as vt where $this = false make tgt.taken = "y"
  "MedicationStatement-reasonNotTaken" : for src.reasonNotTaken make tgt.reasonNotTaken
  "MedicationStatement-reasonForUse" : for src.reasonForUse where $this is CodeableConcept make tgt.reasonCode
  "MedicationStatement-reasonForUse" : for src.reasonForUse where $this is Reference make tgt.reasonReference
  "MedicationStatement-effective" : for src.effective make tgt.effective
  "MedicationStatement-note" : for src.note make tgt.note
  "MedicationStatement-supportingInformation" : for src.supportingInformation make tgt.derivedFrom
  "MedicationStatement-medication" : for src.medication make tgt.medication
  
  "MedicationStatement-dosage" : for src.dosage as vs0 make tgt.dosage as vt0 then mstDosage(vs0, vt0)
endgroup


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


  "DosageInstruction-text" : for src.text make tgt.text
  "DosageInstruction-timing" : for src.timing make tgt.timing
  "DosageInstruction-asNeeded" : for src.asNeeded make tgt.asNeeded 
  "DosageInstruction-site" : for src.site where $this is CodeableConcept make tgt.site // todo: handle Reference?
  "DosageInstruction-route" : for src.route make tgt.route
  "DosageInstruction-method" : for src.method make tgt.method
  "DosageInstruction-quantity" : for src.quantity make tgt.dose
  "DosageInstruction-rate" : for src.rate make tgt.rate 
  "DosageInstruction-maxDosePerPeriod" : for src.maxDosePerPeriod make tgt.maxDosePerPeriod

group MedicationStatement extends DomainResource
  input src : MedicationStatementR3 as source
  input tgt : MedicationStatement as target

  "MedicationStatement.identifier" : for src.identifier as vs make tgt.identifier as vt
  "MedicationStatement.basedOn" : for src.basedOn as vs make tgt.basedOn as vt
  "MedicationStatement.partOf" : for src.partOf as vs make tgt.partOf as vt
  "MedicationStatement.context" : for src.context as vs make tgt.context as vt
  "MedicationStatement.status" : for src.status as vs make tgt.status as vt
  "MedicationStatement.category" : for src.category as vs make tgt.category as vt
  "MedicationStatement.medication-CodeableConcept" : for src.medication  : CodeableConcept as vs make tgt.medication = create("CodeableConcept") as vt then CodeableConcept(vs,vt)
  "MedicationStatement.medication-Reference" : for src.medication  : Reference as vs make tgt.medication = create("Reference") as vt then Reference(vs,vt)
  "MedicationStatement.effective-dateTime" : for src.effective  : dateTime as vs make tgt.effective = create("dateTime") as vt then dateTime(vs,vt)
  "MedicationStatement.effective-Period" : for src.effective  : Period as vs make tgt.effective = create("Period") as vt then Period(vs,vt)
  "MedicationStatement.dateAsserted" : for src.dateAsserted as vs make tgt.dateAsserted as vt
  "MedicationStatement.informationSource" : for src.informationSource as vs make tgt.informationSource as vt
  "MedicationStatement.subject" : for src.subject as vs make tgt.subject as vt
  "MedicationStatement.derivedFrom" : for src.derivedFrom as vs make tgt.derivedFrom as vt
  "MedicationStatement.reasonCode" : for src.reasonCode as vs make tgt.reasonCode as vt
  "MedicationStatement.reasonReference" : for src.reasonReference as vs make tgt.reasonReference as vt
  "MedicationStatement.note" : for src.note as vs make tgt.note as vt
  "MedicationStatement.dosage" : for src.dosage as vs make tgt.dosage as vt

endgroup



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

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


uses "http://hl7.org/fhir/StructureDefinition/MedicationStatement" alias MedicationStatement as source
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/MedicationStatement" alias MedicationStatementR2 as target


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

uses "http://hl7.org/fhir/StructureDefinition/MedicationStatement" alias MedicationStatement as source
uses "http://hl7.org/fhir/3.0/StructureDefinition/MedicationStatement" alias MedicationStatementR3 as target


group for type+types  MedicationStatement extends DomainResource
  input src : MedicationStatement as source
  input tgt : MedicationStatementR2 as target

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


  "MedicationStatement-identifier" : for src.identifier make tgt.identifier
  "MedicationStatement-subject" : for src.subject make tgt.patient
  "MedicationStatement-informationSource" : for src.informationSource make tgt.informationSource
  "MedicationStatement-dateAsserted" : for src.dateAsserted make tgt.dateAsserted
  "MedicationStatement-status" : for src.status check src.status != 'stopped' and status != 'on-hold' make tgt.status
  "MedicationStatement-wasNotTaken" : for src.taken as vt where $this = 'n' make tgt.wasNotTaken = true
  "MedicationStatement-wasNotTaken" : for src.taken as vt where $this = 'y' make tgt.wasNotTaken = false
  "MedicationStatement-reasonNotTaken" : for src.reasonNotTaken make tgt.reasonNotTaken
  "MedicationStatement-reasonForUse1" : for src.reasonCode make tgt.reasonForUse
  "MedicationStatement-reasonForUse2" : for src.reasonReference make tgt.reasonForUse
  "MedicationStatement-effective" : for src.effective make tgt.effective
  "MedicationStatement-note" : for src.note make tgt.note
  "MedicationStatement-supportingInformation" : for src.derivedFrom make tgt.supportingInformation
  "MedicationStatement-medication" : for src.medication make tgt.medication
  
  "MedicationStatement-dosage" : for src.dosage as vs0 make tgt.dosage as vt0 then mstDosage(vs0, vt0)
endgroup


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


  "DosageInstruction-text" : for src.text make tgt.text
  "DosageInstruction-timing" : for src.timing make tgt.timing
  "DosageInstruction-asNeeded" : for src.asNeeded make tgt.asNeeded 
  "DosageInstruction-site" : for src.site make tgt.site // todo: handle Reference?
  "DosageInstruction-route" : for src.route make tgt.route
  "DosageInstruction-method" : for src.method make tgt.method
  "DosageInstruction-quantity" : for src.dose make tgt.quantity
  "DosageInstruction-rate" : for src.rate make tgt.rate 
  "DosageInstruction-maxDosePerPeriod" : for src.maxDosePerPeriod make tgt.maxDosePerPeriod

group MedicationStatement extends DomainResource
  input src : MedicationStatement as source
  input tgt : MedicationStatementR3 as target

  "MedicationStatement.identifier" : for src.identifier as vs make tgt.identifier as vt
  "MedicationStatement.basedOn" : for src.basedOn as vs make tgt.basedOn as vt
  "MedicationStatement.partOf" : for src.partOf as vs make tgt.partOf as vt
  "MedicationStatement.context" : for src.context as vs make tgt.context as vt
  "MedicationStatement.status" : for src.status as vs make tgt.status as vt
  "MedicationStatement.category" : for src.category as vs make tgt.category as vt
  "MedicationStatement.medication-CodeableConcept" : for src.medication  : CodeableConcept as vs make tgt.medication = create("CodeableConcept") as vt then CodeableConcept(vs,vt)
  "MedicationStatement.medication-Reference" : for src.medication  : Reference as vs make tgt.medication = create("Reference") as vt then Reference(vs,vt)
  "MedicationStatement.effective-dateTime" : for src.effective  : dateTime as vs make tgt.effective = create("dateTime") as vt then dateTime(vs,vt)
  "MedicationStatement.effective-Period" : for src.effective  : Period as vs make tgt.effective = create("Period") as vt then Period(vs,vt)
  "MedicationStatement.dateAsserted" : for src.dateAsserted as vs make tgt.dateAsserted as vt
  "MedicationStatement.informationSource" : for src.informationSource as vs make tgt.informationSource as vt
  "MedicationStatement.subject" : for src.subject as vs make tgt.subject as vt
  "MedicationStatement.derivedFrom" : for src.derivedFrom as vs make tgt.derivedFrom as vt
  "MedicationStatement.reasonCode" : for src.reasonCode as vs make tgt.reasonCode as vt
  "MedicationStatement.reasonReference" : for src.reasonReference as vs make tgt.reasonReference as vt
  "MedicationStatement.note" : for src.note as vs make tgt.note as vt
  "MedicationStatement.dosage" : for src.dosage as vs make tgt.dosage as vt

endgroup



medicationstatement-example ERROR @ MedicationStatement: Profile http://hl7.org/fhir/StructureDefinition/MedicationStatement, Element 'MedicationStatement.taken': minimum required = 1, but only found 0 (src = InstanceValidator)