FHIR Extensions Pack
5.1.0-ballot1 - Ballot for Release 5.1.0 International flag

This page is part of the FHIR Core Extensions Registry (v5.1.0-ballot: Releases Ballot 4) based on FHIR (HL7® FHIR® Standard) v5.0.0. The current version which supersedes this version is 1.0.0. For a full list of available versions, see the Directory of published versions

StructureMap: FML Conversion for Encounter: R4 to R5

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

FMLConversionforEncounterR4toR5

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

conceptmap "EncounterLocationStatus" {
  prefix s = "http://hl7.org/fhir/4.0/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.0/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.0/StructureDefinition/Encounter" alias EncounterR4 as source
uses "http://hl7.org/fhir/StructureDefinition/Encounter" alias EncounterR5 as target

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

group Encounter(source src : EncounterR4, 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;
}