This page is part of the FHIR Specification v6.0.0-ballot1: Release 6 Ballot (1st Draft) (see Ballot Notes). The current version is 5.0.0. For a full list of available versions, see the Directory of published versions 
Pharmacy Work Group | Maturity Level: N/A | Standards Status: Informative | Security Category: Patient | Compartments: Encounter, Patient, Practitioner, RelatedPerson |
R4 : R5 Conversion maps for MedicationStatement.
Functional status for this map: See Conversions Summary. (see documentation)
map "http://hl7.org/fhir/StructureMap/MedicationStatement3to4" = "R3 to R4 Conversions for MedicationStatement"
uses "http://hl7.org/fhir/3.0/StructureDefinition/MedicationStatement" alias MedicationStatementR3 as source
uses "http://hl7.org/fhir/StructureDefinition/MedicationStatement" alias MedicationStatement as target
imports "http://hl7.org/fhir/StructureMap/*3to4"
group MedicationStatement(source src : MedicationStatementR3, target tgt : MedicationStatement) extends DomainResource <<type+>> {
src.identifier -> tgt.identifier;
src.basedOn -> tgt.basedOn;
src.partOf -> tgt.partOf;
src.context -> tgt.context;
src.status as v -> tgt.extension as vt, vt.url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-MedicationStatement.status', vt.value = v;
src.taken as v -> tgt.extension as vt, vt.url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-MedicationStatement.taken', vt.value = v;
src.status where (src.taken in ('n' | 'unk')).not() -> tgt.status;
src.taken where value = 'n' -> tgt.status = 'not-taken';
src.taken where value = 'unk' -> tgt.status = 'unknown';
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.reasonNotTaken -> tgt.reasonCode;
src.reasonCode -> tgt.reasonCode;
src.reasonReference -> tgt.reasonReference;
src.note -> tgt.note;
src.dosage -> tgt.dosage;
}
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/3.0/StructureDefinition/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';
}
No validation errors - all conversions are clean