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

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

R4toR3ConversionforObservation

/// url = 'http://hl7.org/fhir/StructureMap/Observation4to3'
/// name = 'Observation4to3'
/// title = 'R4 to R3 Conversion for Observation'
/// status = 'active'

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