FHIR Cross-Version Mapping Pack
0.1.0 - Ballot for Release 5.1.0 International flag

FHIR Cross-Version Mapping Pack, published by HL7 International / FHIR Infrastructure. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/fhir-cross-version/ and changes regularly. See the Directory of published versions

StructureMap: MedicationStatement Transforms: R2 to R3

Official URL: http://hl7.org/fhir/StructureMap/MedicationStatement2to3 Version: 0.1.0
Standards status: Draft Maturity Level: 1 Computable Name: MedicationStatement2to3

MedicationStatementTransformsR2toR3

/// url = 'http://hl7.org/fhir/StructureMap/MedicationStatement2to3'
/// name = 'MedicationStatement2to3'
/// title = 'MedicationStatement Transforms: R2 to R3'
/// status = 'active'

uses "http://hl7.org/fhir/1.0/MedicationStatement" alias MedicationStatementR2 as source
uses "http://hl7.org/fhir/3.0/MedicationStatement" alias MedicationStatement as target

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

group MedicationStatement(source src : MedicationStatementR2, target tgt : MedicationStatement) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier "MedicationStatement-identifier";
  src.patient -> tgt.subject "MedicationStatement-subject";
  src.informationSource -> tgt.informationSource "MedicationStatement-informationSource";
  src.dateAsserted -> tgt.dateAsserted "MedicationStatement-dateAsserted";
  src.status -> tgt.status "MedicationStatement-status";
  src.wasNotTaken as vt where $this = true -> tgt.taken = 'n' "MedicationStatement-wasNotTaken";
  src.wasNotTaken as vt where $this = false -> tgt.taken = 'y' "MedicationStatement-wasNotTaken";
  src.reasonNotTaken -> tgt.reasonNotTaken "MedicationStatement-reasonNotTaken";
  src.reasonForUse where $this is CodeableConcept -> tgt.reasonCode "MedicationStatement-reasonForUse";
  src.reasonForUse where $this is Reference -> tgt.reasonReference "MedicationStatement-reasonForUse";
  src.effective -> tgt.effective "MedicationStatement-effective";
  src.note -> tgt.note "MedicationStatement-note";
  src.supportingInformation -> tgt.derivedFrom "MedicationStatement-supportingInformation";
  src.medication -> tgt.medication "MedicationStatement-medication";
  src.dosage as vs0 -> tgt.dosage as vt0 then mstDosage(vs0, vt0) "MedicationStatement-dosage";
}

group mstDosage(source src, target tgt) extends Element {
  src.text -> tgt.text "DosageInstruction-text";
  src.timing -> tgt.timing "DosageInstruction-timing";
  src.asNeeded -> tgt.asNeeded "DosageInstruction-asNeeded";
  src.site where $this is CodeableConcept -> tgt.site "DosageInstruction-site";
  src.route -> tgt.route "DosageInstruction-route";
  src.method -> tgt.method "DosageInstruction-method";
  src.quantity -> tgt.dose "DosageInstruction-quantity";
  src.rate -> tgt.rate "DosageInstruction-rate";
  src.maxDosePerPeriod -> tgt.maxDosePerPeriod "DosageInstruction-maxDosePerPeriod";
}