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: Medication Transforms: R3 to R2

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

MedicationTransformsR3toR2

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

uses "http://hl7.org/fhir/3.0/Medication" alias Medication as source
uses "http://hl7.org/fhir/1.0/Medication" alias MedicationR2 as target

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

group Medication(source src : Medication, target tgt : MedicationR2) extends DomainResource <<type+>> {
  src.code -> tgt.code "Medication-code";
  src.isBrand -> tgt.isBrand "Medication-isBrand";
  src.manufacturer -> tgt.manufacturer "Medication-manufacturer";
  src.form as v ->  tgt.product as vt0,  vt0.form as v "product-form";
  src.ingredient as vs0 ->  tgt.product as vt0,  vt0.ingredient as vt1 then medIngredient(vs0, vt1) "product-ingredient";
  src.package as vs0 -> tgt.package as vt0 then medPackage(vs0, vt0, tgt) "Medication-package";
}

group medProduct(source src, target tgt) extends BackboneElement {
  src.form -> tgt.form "product-form";
  src.ingredient as vs0 -> tgt.ingredient as vt0 then medIngredient(vs0, vt0) "product-ingredient";
}

group medIngredient(source src, target tgt) extends BackboneElement {
  src.item where $this is Reference -> tgt.item "batch-item";
  src.amount -> tgt.amount "batch-amount";
}

group medBatch(source src, target tgt) extends BackboneElement {
  src.lotNumber -> tgt.lotNumber "batch-lotNumber";
  src.expirationDate -> tgt.expirationDate "batch-expirationDate";
}

group medPackage(source src, target tgt, target res) extends BackboneElement {
  src.container -> tgt.container "package-container";
  src.content as vs0 -> tgt.content as vt0 then medContent(vs0, vt0) "package-content";
  src.batch as vs0 ->  res.product as vt1,  vt1.batch as vt0 then medBatch(vs0, vt0) "product-batch";
}

group medContent(source src, target tgt) extends BackboneElement {
  src.item where $this is Reference -> tgt.item "content-item";
  src.amount -> tgt.amount "content-amount";
}