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
Official URL: http://hl7.org/fhir/StructureMap/MedicationStatement4to3 | Version: 0.1.0 | |||
Standards status: Draft | Maturity Level: 1 | Computable Name: MedicationStatement4to3 |
MedicationStatementTransformsR4toR3
/// url = 'http://hl7.org/fhir/StructureMap/MedicationStatement4to3' /// name = 'MedicationStatement4to3' /// title = 'MedicationStatement Transforms: R4 to R3' /// status = 'active' uses "http://hl7.org/fhir/4.0/MedicationStatement" alias MedicationStatement as source uses "http://hl7.org/fhir/3.0/MedicationStatement" alias MedicationStatementR3 as target imports "http://hl7.org/fhir/StructureMap/*4to3" group MedicationStatement(source src : MedicationStatement, target tgt : MedicationStatementR3) extends DomainResource <<type+>> { src.identifier -> tgt.identifier; src.basedOn -> tgt.basedOn; src.partOf -> tgt.partOf; src.context -> tgt.context; src where src.extension.where(url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-MedicationStatement.status').exists() then statusR3(src, tgt) "status1"; src where src.extension.where(url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-MedicationStatement.status').empty() then statusNR3(src, tgt) "status2"; src.category -> tgt.category; src.medication : CodeableConcept as vs -> tgt.medication = create('CodeableConcept') as vt then CodeableConcept(vs, vt); src.medication : Reference as vs -> tgt.medication = create('Reference') as vt then Reference(vs, vt); src.effective : dateTime as vs -> tgt.effective = create('dateTime') as vt then dateTime(vs, vt); src.effective : Period as vs -> tgt.effective = create('Period') as vt then Period(vs, vt); src.dateAsserted -> tgt.dateAsserted; src.informationSource -> tgt.informationSource; src.subject -> tgt.subject; src.derivedFrom -> tgt.derivedFrom; src.reasonCode where src.status = 'not-taken' -> tgt.reasonNotTaken; src.reasonCode where src.status != 'not-taken' -> tgt.reasonCode; src.reasonReference -> tgt.reasonReference; src.note -> tgt.note; src.dosage -> tgt.dosage; } group statusR3(source src, target tgt) { src.extension as e where url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-MedicationStatement.taken' then { e.value -> tgt.taken; }; src.extension as e where url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-MedicationStatement.status' then { e.value -> tgt.status; }; } group statusNR3(source src, target tgt) { src.status where (value in ('not-taken' | 'unknown')).not() -> tgt.status; src.status where value = 'not-taken' -> tgt.status = 'completed', tgt.taken = 'n'; src.status where value = 'unknown' -> tgt.status = 'completed', tgt.taken = 'unk'; }