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: Observation Transforms: R3 to R4

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

ObservationTransformsR3toR4

/// url = 'http://hl7.org/fhir/StructureMap/Observation3to4'
/// name = 'Observation3to4'
/// title = 'Observation Transforms: R3 to R4'
/// status = 'active'

uses "http://hl7.org/fhir/3.0/Observation" alias ObservationR3 as source
uses "http://hl7.org/fhir/4.0/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);
}