FHIR Extensions Pack
5.1.0-cibuild - Working Copy International flag

FHIR Extensions Pack, published by HL7 International / FHIR Infrastructure. This is not an authorized publication; it is the continuous build for version 5.1.0-cibuild). This version is based on the current content of https://github.com/HL7/fhir-extensions/ and changes regularly. See the Directory of published versions

StructureMap: FML Conversion for Encounter: R4B to R5

Official URL: http://hl7.org/fhir/StructureMap/Encounter4Bto5 Version: 5.1.0-cibuild
Standards status: Trial-use Maturity Level: 1 Computable Name: Encounter4Bto5

FMLConversionforEncounterR4BtoR5

/// url = 'http://hl7.org/fhir/StructureMap/Encounter4Bto5'
/// name = 'Encounter4Bto5'
/// title = 'FML Conversion for Encounter: R4B to R5'
/// status = 'active'

conceptmap "EncounterLocationStatus" {
  prefix s = "http://hl7.org/fhir/4.3/encounter-location-status"
  prefix t = "http://hl7.org/fhir/encounter-location-status"

  s:planned - t:planned
  s:active - t:active
  s:reserved - t:reserved
  s:completed - t:completed
}

conceptmap "EncounterStatus" {
  prefix s = "http://hl7.org/fhir/4.3/encounter-status"
  prefix t = "http://hl7.org/fhir/encounter-status"

  s:planned - t:planned
  s:arrived - t:planned
  s:triaged - t:"in-progress"
  s:"in-progress" - t:"in-progress"
  s:onleave - t:"on-hold"
  s:finished - t:completed
  s:cancelled - t:cancelled
  s:"entered-in-error" - t:"entered-in-error"
  s:unknown - t:unknown
}

uses "http://hl7.org/fhir/4.3/StructureDefinition/Encounter" alias EncounterR4B as source
uses "http://hl7.org/fhir/StructureDefinition/Encounter" alias EncounterR5 as target

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

group Encounter(source src : EncounterR4B, target tgt : EncounterR5) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.status as v -> tgt.status = translate(v, '#EncounterStatus', 'code');
  src.class as s ->  tgt.class = create('CodeableConcept') as t,  t.coding as tc then Coding(s, tc); // src.class as s -> tgt.class = create('CodeableConcept') as t, t.coding = create('Coding') as tc, tc.system = (s.system), tc.code = (s.code), tc.display = s.display;
  src.priority -> tgt.priority;
  src.type -> tgt.type;
  src.serviceType -> tgt.serviceType;
  src.subject -> tgt.subject;
  src.episodeOfCare -> tgt.episodeOfCare; // src.subjectStatus -> tgt.subjectStatus;
  src.basedOn -> tgt.basedOn;
  src.partOf -> tgt.partOf; // src.careTeam -> tgt.careTeam;
  src.serviceProvider -> tgt.serviceProvider;
  src.participant as s -> tgt.participant as t then EncounterParticipant(s, t);
  src.appointment -> tgt.appointment;
  src.period -> tgt.actualPeriod; // src.virtualService -> tgt.virtualService;
  src.length -> tgt.length; // src.plannedStartDate -> tgt.plannedStartDate;
  src.diagnosis as s -> tgt.diagnosis as t then EncounterDiagnosis(s, t); // src.reason as s -> tgt.reason as t then EncounterReason(s,t);
  src.account -> tgt.account;
  src.hospitalization as s -> tgt.admission as t then EncounterAdmission(s, t); // src.dietPreference -> tgt.dietPreference;
  src.location as s -> tgt.location as t then EncounterLocation(s, t);
}

group EncounterParticipant(source src, target tgt) extends BackboneElement {
  src.type -> tgt.type;
  src.period -> tgt.period;
  src.individual -> tgt.actor;
}

// group EncounterReason(source src, target tgt) extends BackboneElement {
// src.use -> tgt.use;
// src.value -> tgt.value;
// }
group EncounterDiagnosis(source src, target tgt) extends BackboneElement {
  src.condition -> tgt.condition;
  src.use -> tgt.use;
}

group EncounterAdmission(source src, target tgt) extends BackboneElement {
  src.preAdmissionIdentifier -> tgt.preAdmissionIdentifier;
  src.origin -> tgt.origin;
  src.admitSource -> tgt.admitSource;
  src.reAdmission -> tgt.reAdmission;
  src.destination -> tgt.destination;
  src.dischargeDisposition -> tgt.dischargeDisposition;
}

group EncounterLocation(source src, target tgt) extends BackboneElement {
  src.location -> tgt.location;
  src.status as v -> tgt.status = translate(v, '#EncounterLocationStatus', 'code');
  src.physicalType -> tgt.form;
  src.period -> tgt.period;
}