Snapshot 3: Connectathon 32 Base

This page is part of the FHIR Specification (v5.0.0-snapshot3: R5 Snapshot #3, to support Connectathon 32). 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

Public Health and Emergency Response icon Work GroupMaturity Level: N/AStandards Status: InformativeSecurity Category: Patient Compartments: Patient, Practitioner

R4 : R5 Conversion maps for Immunization.

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

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

uses "http://hl7.org/fhir/3.0/StructureDefinition/Immunization" alias ImmunizationR3 as source
uses "http://hl7.org/fhir/StructureDefinition/Immunization" alias Immunization as target

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

group Immunization(source src : ImmunizationR3, target tgt : Immunization) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.status -> tgt.status;
  src.notGiven where value = true -> tgt.status = 'not-done';
  src.notGiven as v ->  tgt.extension as vt,  vt.url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-Immunization.notGiven',  vt.value = v;
  src.vaccineCode -> tgt.vaccineCode;
  src.patient -> tgt.patient;
  src.encounter -> tgt.encounter;
  src.date as vs -> tgt.occurrence = create('dateTime') as vt then dateTime(vs, vt);
  src.primarySource -> tgt.primarySource;
  src.reportOrigin -> tgt.reportOrigin;
  src.location -> tgt.location;
  src.manufacturer -> tgt.manufacturer;
  src.lotNumber -> tgt.lotNumber;
  src.expirationDate -> tgt.expirationDate;
  src.site -> tgt.site;
  src.route -> tgt.route;
  src.doseQuantity -> tgt.doseQuantity;
  src.practitioner as vs -> tgt.performer as vt then practitioner(vs, vt);
  src.note -> tgt.note;
  src.explanation as s then {
    s.reason -> tgt.reasonCode;
    s.reasonNotGiven -> tgt.reasonCode;
  };
  src.reaction as vs -> tgt.reaction as vt then reaction(vs, vt);
  src.vaccinationProtocol as vs -> tgt.protocolApplied as vt then protocol(vs, vt);
}

group practitioner(source src, target tgt) extends BackboneElement {
  src.role -> tgt.function;
  src.actor -> tgt.actor;
}

group reaction(source src, target tgt) extends BackboneElement {
  src.date -> tgt.date;
  src.detail -> tgt.detail;
  src.reported -> tgt.reported;
}

group protocol(source src, target tgt) extends BackboneElement {
  src.doseSequence as vs -> tgt.doseNumber = create('positiveInt') as vt then positiveInt(vs, vt);
  src.description as v ->  tgt.extension as vt,  vt.url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-Immunization.vaccinationProtocol.description',  vt.value = v;
  src.authority -> tgt.authority;
  src.series -> tgt.series;
  src.seriesDoses as vs -> tgt.seriesDoses = create('positiveInt') as vt then positiveInt(vs, vt);
  src.targetDisease -> tgt.targetDisease;
  src.doseStatus as v ->  tgt.extension as vt,  vt.url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-Immunization.vaccinationProtocol.doseStatus',  vt.value = v;
  src.doseStatusReason as v ->  tgt.extension as vt,  vt.url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-Immunization.vaccinationProtocol.doseStatusReason',  vt.value = v;
}


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

uses "http://hl7.org/fhir/StructureDefinition/Immunization" alias Immunization as source
uses "http://hl7.org/fhir/3.0/StructureDefinition/Immunization" alias ImmunizationR3 as target

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

group Immunization(source src : Immunization, target tgt : ImmunizationR3) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.status where value != 'not-done' -> tgt.status;
  src.status where value = 'not-done' ->  tgt.status = 'completed',  tgt.notGiven = true;
  src.extension as e where url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-Immunization.notGiven' then {
    e.value -> tgt.notGiven;
  };
  src.vaccineCode -> tgt.vaccineCode;
  src.patient -> tgt.patient;
  src.encounter -> tgt.encounter;
  src.occurrence : dateTime as vs -> tgt.date as vt then dateTime(vs, vt);
  src.primarySource -> tgt.primarySource;
  src.reportOrigin -> tgt.reportOrigin;
  src.location -> tgt.location;
  src.manufacturer -> tgt.manufacturer;
  src.lotNumber -> tgt.lotNumber;
  src.expirationDate -> tgt.expirationDate;
  src.site -> tgt.site;
  src.route -> tgt.route;
  src.doseQuantity -> tgt.doseQuantity;
  src.performer as vs -> tgt.practitioner as vt then practitioner(vs, vt);
  src.note -> tgt.note;
  src.reasonCode as vs where src.status != 'not-done' ->  tgt.explanation as t,  t.reason = vs;
  src.reasonCode as vs where src.status = 'not-done' ->  tgt.explanation as t,  t.reasonNotGiven = vs;
  src.reaction as vs -> tgt.reaction as vt then reaction(vs, vt);
  src.protocolApplied as vs -> tgt.vaccinationProtocol as vt then protocol(vs, vt);
}

group practitioner(source src, target tgt) extends BackboneElement {
  src.function -> tgt.role;
  src.actor -> tgt.actor;
}

group reaction(source src, target tgt) extends BackboneElement {
  src.date -> tgt.date;
  src.detail -> tgt.detail;
  src.reported -> tgt.reported;
}

group protocol(source src, target tgt) extends BackboneElement {
  src.doseNumber : positiveInt as vs -> tgt.doseSequence as vt then positiveInt(vs, vt);
  src.extension as e where url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-Immunization.vaccinationProtocol.description' then {
    e.value -> tgt.description;
  };
  src.authority -> tgt.authority;
  src.series -> tgt.series;
  src.seriesDoses : positiveInt as vs -> tgt.seriesDoses as vt then positiveInt(vs, vt);
  src.targetDisease -> tgt.targetDisease;
  src.extension as e where url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-Immunization.vaccinationProtocol.doseStatus' then {
    e.value -> tgt.doseStatus;
  };
  src.extension as e where url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-Immunization.vaccinationProtocol.doseStatusReason' then {
    e.value -> tgt.doseStatusReason;
  };
}


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