Release 4B

This page is part of the FHIR Specification (v4.3.0: R4B - STU). 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

Orders and Observations Work GroupMaturity Level: N/AStandards Status: InformativeSecurity Category: Patient Compartments: Device, Encounter, Patient, Practitioner, RelatedPerson

R3 : R4 Conversion maps for Observation.

Functional status for this map: 48 tests that all execute ok. All tests pass round-trip testing and 23 r3 resources are invalid (0 errors). (see documentation)

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

uses "http://hl7.org/fhir/3.0/StructureDefinition/Observation" alias ObservationR3 as source
uses "http://hl7.org/fhir/StructureDefinition/Observation" alias Observation as target

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

group Observation(source src : ObservationR3, target tgt : Observation) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.basedOn -> tgt.basedOn;
  src.status -> tgt.status;
  src.category -> tgt.category;
  src.code -> tgt.code;
  src.subject -> tgt.subject;
  src.context -> tgt.encounter;
  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.issued -> tgt.issued;
  src.performer -> tgt.performer;
  src.value : Quantity as vs -> tgt.value = create('Quantity') as vt then Quantity(vs, vt);
  src.value : CodeableConcept as vs -> tgt.value = create('CodeableConcept') as vt then CodeableConcept(vs, vt);
  src.value : string as vs -> tgt.value = create('string') as vt then string(vs, vt);
  src.value : boolean as vs -> tgt.value = create('boolean') as vt then boolean(vs, vt);
  src.value : Range as vs -> tgt.value = create('Range') as vt then Range(vs, vt);
  src.value : Ratio as vs -> tgt.value = create('Ratio') as vt then Ratio(vs, vt);
  src.value : SampledData as vs -> tgt.value = create('SampledData') as vt then SampledData(vs, vt);
  src.value : time as vs -> tgt.value = create('time') as vt then time(vs, vt);
  src.value : dateTime as vs -> tgt.value = create('dateTime') as vt then dateTime(vs, vt);
  src.value : Period as vs -> tgt.value = create('Period') as vt then Period(vs, vt);
  src.dataAbsentReason -> tgt.dataAbsentReason;
  src.interpretation -> tgt.interpretation;
  src.comment as vs0 -> tgt.note as vt0 then string2Annotation(vs0, vt0);
  src.bodySite -> tgt.bodySite;
  src.method -> tgt.method;
  src.specimen -> tgt.specimen;
  src.device -> tgt.device;
  src.referenceRange as vs0 -> tgt.referenceRange as vt0 then referenceRange(vs0, vt0);
  src.related as vs0 where type = 'has-member' -> tgt.hasMember as vt0 then related(vs0, vt0) "related1";
  src.related as vs0 where type = 'derived-from' -> tgt.derivedFrom as vt0 then related(vs0, vt0) "related2";
  src.related as vs0 where type = 'sequel-to' ->  tgt.extension as ext,  ext.url = 'http://hl7.org/fhir/3.0/StructureDefinition/Observation.sequelTo',  ext.value = create('Reference') as vt0 then related(vs0, vt0) "related3";
  src.related as vs0 where type = 'replaces' ->  tgt.extension as ext,  ext.url = 'http://hl7.org/fhir/3.0/StructureDefinition/Observation.replaces',  ext.value = create('Reference') as vt0 then related(vs0, vt0) "related4";
  src.related as vs0 where type = 'qualified-by' ->  tgt.extension as ext,  ext.url = 'http://hl7.org/fhir/3.0/StructureDefinition/Observation.qualifiedBy',  ext.value = create('Reference') as vt0 then related(vs0, vt0) "related5";
  src.related as vs0 where type = 'interfered-by' ->  tgt.extension as ext,  ext.url = 'http://hl7.org/fhir/3.0/StructureDefinition/Observation.interferedBy',  ext.value = create('Reference') as vt0 then related(vs0, vt0) "related6";
  src.component as vs0 -> tgt.component as vt0 then component(vs0, vt0);
}

group referenceRange(source src, target tgt) extends BackboneElement {
  src.low -> tgt.low;
  src.high -> tgt.high;
  src.type -> tgt.type;
  src.appliesTo -> tgt.appliesTo;
  src.age -> tgt.age;
  src.text -> tgt.text;
}

group related(source src, target tgt) extends BackboneElement {
  src.target as vs0 then Reference(vs0, tgt);
}

group component(source src, target tgt) extends BackboneElement {
  src.code -> tgt.code;
  src.value : Quantity as vs -> tgt.value = create('Quantity') as vt then Quantity(vs, vt);
  src.value : CodeableConcept as vs -> tgt.value = create('CodeableConcept') as vt then CodeableConcept(vs, vt);
  src.value : string as vs -> tgt.value = create('string') as vt then string(vs, vt);
  src.value : Range as vs -> tgt.value = create('Range') as vt then Range(vs, vt);
  src.value : Ratio as vs -> tgt.value = create('Ratio') as vt then Ratio(vs, vt);
  src.value : SampledData as vs -> tgt.value = create('SampledData') as vt then SampledData(vs, vt);
  src.value : time as vs -> tgt.value = create('time') as vt then time(vs, vt);
  src.value : dateTime as vs -> tgt.value = create('dateTime') as vt then dateTime(vs, vt);
  src.value : Period as vs -> tgt.value = create('Period') as vt then Period(vs, vt);
  src.dataAbsentReason -> tgt.dataAbsentReason;
  src.interpretation -> tgt.interpretation;
  src.referenceRange as vs0 -> tgt.referenceRange as vt0 then referenceRange(vs0, vt0);
}


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

uses "http://hl7.org/fhir/StructureDefinition/Observation" alias Observation as source
uses "http://hl7.org/fhir/3.0/StructureDefinition/Observation" alias ObservationR3 as target

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

group Observation(source src : Observation, target tgt : ObservationR3) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.basedOn -> tgt.basedOn;
  src.status -> tgt.status;
  src.category -> tgt.category;
  src.code -> tgt.code;
  src.subject -> tgt.subject;
  src.encounter -> tgt.context;
  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.issued -> tgt.issued;
  src.performer -> tgt.performer;
  src.value : Quantity as vs -> tgt.value = create('Quantity') as vt then Quantity(vs, vt);
  src.value : CodeableConcept as vs -> tgt.value = create('CodeableConcept') as vt then CodeableConcept(vs, vt);
  src.value : string as vs -> tgt.value = create('string') as vt then string(vs, vt);
  src.value : boolean as vs -> tgt.value = create('boolean') as vt then boolean(vs, vt);
  src.value : Range as vs -> tgt.value = create('Range') as vt then Range(vs, vt);
  src.value : Ratio as vs -> tgt.value = create('Ratio') as vt then Ratio(vs, vt);
  src.value : SampledData as vs -> tgt.value = create('SampledData') as vt then SampledData(vs, vt);
  src.value : time as vs -> tgt.value = create('time') as vt then time(vs, vt);
  src.value : dateTime as vs -> tgt.value = create('dateTime') as vt then dateTime(vs, vt);
  src.value : Period as vs -> tgt.value = create('Period') as vt then Period(vs, vt);
  src.dataAbsentReason -> tgt.dataAbsentReason;
  src.interpretation -> tgt.interpretation;
  src.note first as vs0 -> tgt.comment as vt0 then Annotation2string(vs0, vt0);
  src.bodySite -> tgt.bodySite;
  src.method -> tgt.method;
  src.specimen -> tgt.specimen;
  src.device -> tgt.device;
  src.referenceRange as vs0 -> tgt.referenceRange as vt0 then referenceRange(vs0, vt0);
  src.hasMember as vs0 ->  tgt.related as vt0,  vt0.type = 'has-member',  vt0.target as vt2 then Reference(vs0, vt2);
  src.derivedFrom as vs0 ->  tgt.related as vt0,  vt0.type = 'derived-from',  vt0.target as vt2 then Reference(vs0, vt2);
  src.extension as vs0 where url = 'http://hl7.org/fhir/3.0/StructureDefinition/Observation.sequelTo' ->  tgt.related as rel,  rel.type = 'sequel-to',  rel.target as vt0 then relatedExt(vs0, vt0) "related3";
  src.extension as vs0 where url = 'http://hl7.org/fhir/3.0/StructureDefinition/Observation.replaces' ->  tgt.related as rel,  rel.type = 'replaces',  rel.target as vt0 then relatedExt(vs0, vt0) "related4";
  src.extension as vs0 where url = 'http://hl7.org/fhir/3.0/StructureDefinition/Observation.qualifiedBy' ->  tgt.related as rel,  rel.type = 'qualifiedBy',  rel.target as vt0 then relatedExt(vs0, vt0) "related5";
  src.extension as vs0 where url = 'http://hl7.org/fhir/3.0/StructureDefinition/Observation.interferedBy' ->  tgt.related as rel,  rel.type = 'interfered-by',  rel.target as vt0 then relatedExt(vs0, vt0) "related6";
  src.component as vs0 -> tgt.component as vt0 then component(vs0, vt0);
}

group relatedExt(source src, target tgt) {
  src.value : Reference as vs0 then Reference(vs0, tgt);
}

group referenceRange(source src, target tgt) extends BackboneElement {
  src.low -> tgt.low;
  src.high -> tgt.high;
  src.type -> tgt.type;
  src.appliesTo -> tgt.appliesTo;
  src.age -> tgt.age;
  src.text -> tgt.text;
}

group component(source src, target tgt) extends BackboneElement {
  src.code -> tgt.code;
  src.value : Quantity as vs -> tgt.value = create('Quantity') as vt then Quantity(vs, vt);
  src.value : CodeableConcept as vs -> tgt.value = create('CodeableConcept') as vt then CodeableConcept(vs, vt);
  src.value : string as vs -> tgt.value = create('string') as vt then string(vs, vt);
  src.value : Range as vs -> tgt.value = create('Range') as vt then Range(vs, vt);
  src.value : Ratio as vs -> tgt.value = create('Ratio') as vt then Ratio(vs, vt);
  src.value : SampledData as vs -> tgt.value = create('SampledData') as vt then SampledData(vs, vt);
  src.value : time as vs -> tgt.value = create('time') as vt then time(vs, vt);
  src.value : dateTime as vs -> tgt.value = create('dateTime') as vt then dateTime(vs, vt);
  src.value : Period as vs -> tgt.value = create('Period') as vt then Period(vs, vt);
  src.dataAbsentReason -> tgt.dataAbsentReason;
  src.interpretation -> tgt.interpretation;
  src.referenceRange as vs0 -> tgt.referenceRange as vt0 then referenceRange(vs0, vt0);
}


<p>No validation errors - all conversions are clean</p>