FHIR Release 3 (STU) 4

This page is part of the FHIR Specification (v3.0.2: (v4.0.1: R4 - Mixed Normative and STU 3). ) in it's permanent home (it will always be available at this URL). 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 R4 R3

Patient Administration Work Group Maturity Level : N/A Ballot Standards Status : Informative Security Category : Patient Compartments : Encounter , Patient , Practitioner , RelatedPerson

R2 : R3 Converson : R4 Conversion maps for Encounter.

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

map "http://hl7.org/fhir/StructureMap/Encounter2to3" = "R2 to R3 Conversions for Encounter"

conceptmap "ActEncounterCode" {
  prefix s = "http://hl7.org/fhir/encounter-class"
  prefix t = "http://hl7.org/fhir/v3/ActCode"

  s:inpatient	= t:IMP
  s:outpatient	= t:AMB
  s:ambulatory	= t:AMB
  s:emergency	= t:EMER
  s:home	= t:HH
  s:field	= t:FLD
  s:daytime	= t:SS
  s:virtual	= t:VR
  s:other	= s:other
}


uses "http://hl7.org/fhir/DSTU2/StructureDefinition/Encounter" alias EncounterR2 as source
uses "http://hl7.org/fhir/StructureDefinition/Encounter" alias Encounter as target

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

group for type+types  Encounter extends DomainResource
  input src : EncounterR2 as source
  input tgt : Encounter as target

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


  "Encounter-identifier" : for src.identifier make tgt.identifier
  "Encounter-status" : for src.status make tgt.status
  "Encounter-statusHistory" : for src.statusHistory as vs0 make tgt.statusHistory as vt0 then encStatusHistory(vs0, vt0) 
  "Encounter-class" : for src.class as v make tgt.class = translate(v, "#ActEncounterCode", "Coding")
  "Encounter-type" : for src.type make tgt.type
  "Encounter-priority" : for src.priority make tgt.priority
  "Encounter-patient" : for src.patient make tgt.subject
  "Encounter-episodeOfCare" : for src.episodeOfCare make tgt.episodeOfCare
  "Encounter-incomingReferral" : for src.incomingReferral make tgt.incomingReferral
  "Encounter-participant" : for src.participant as vs0 make tgt.participant as vt0 then encParticipant(vs0, vt0)
  "Encounter-appointment" : for src.appointment make tgt.appointment
  "Encounter-period" : for src.period make tgt.period
  "Encounter-length" : for src.length as vs make tgt.length as vt then QuantityToDuration(vs, vt)
  "Encounter-reason" : for src.reason make tgt.reason
  "Encounter-indication" : for src.indication as v make tgt.diagnosis as d, d.condition = v
  "Encounter-hospitalization" : for src.hospitalization as vs0 make tgt.hospitalization as vt0 then encHospitaization(vs0, vt0, tgt) 
  "Encounter-location" : for src.location as vs0 make tgt.location as vt0 then encLocation(vs0, vt0)
  "Encounter-serviceProvider" : for src.serviceProvider make tgt.serviceProvider
  "Encounter-partOf" : for src.partOf make tgt.partOf
endgroup

uses "http://hl7.org/fhir/3.0/StructureDefinition/Encounter" alias EncounterR3 as source
uses "http://hl7.org/fhir/StructureDefinition/Encounter" alias Encounter as target


group encStatusHistory extends BackboneElement
  input src as source
  input tgt as target

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


  "Encounter.statusHistory-status" : for src.status make tgt.status
  "Encounter.statusHistory-period" : for src.period make tgt.period
endgroup

group Encounter(source src : EncounterR3, target tgt : Encounter) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.status -> tgt.status;
  src.statusHistory as vs0 -> tgt.statusHistory as vt0 then statusHistory(vs0, vt0);
  src.class -> tgt.class;
  src.classHistory as vs0 -> tgt.classHistory as vt0 then classHistory(vs0, vt0);
  src.type -> tgt.type;
  src.priority -> tgt.priority;
  src.subject -> tgt.subject;
  src.episodeOfCare -> tgt.episodeOfCare;
  src.incomingReferral -> tgt.basedOn;
  src.participant as vs0 -> tgt.participant as vt0 then participant(vs0, vt0);
  src.appointment -> tgt.appointment;
  src.period -> tgt.period;
  src.length -> tgt.length;
  src.reason -> tgt.reasonCode;
  src.diagnosis as vs0 -> tgt.diagnosis as vt0 then diagnosis(vs0, vt0);
  src.account -> tgt.account;
  src.hospitalization as vs0 -> tgt.hospitalization as vt0 then hospitalization(vs0, vt0);
  src.location as vs0 -> tgt.location as vt0 then location(vs0, vt0);
  src.serviceProvider -> tgt.serviceProvider;
  src.partOf -> tgt.partOf;
}


group encParticipant extends BackboneElement
  input src as source
  input tgt as target

group statusHistory(source src, target tgt) extends BackboneElement {
  src.status -> tgt.status;
  src.period -> tgt.period;
}


  "Encounter.participant-type" : for src.type make tgt.type
  "Encounter.participant-period" : for src.period make tgt.period
  "Encounter.participant-individual" : for src.individual make tgt.individual
endgroup

group classHistory(source src, target tgt) extends BackboneElement {
  src.class -> tgt.class;
  src.period -> tgt.period;
}


group encHospitaization extends BackboneElement
  input src as source
  input tgt as target
  input res as target

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


  "Encounter.hospitalization-preAdmissionIdentifier" : for src.preAdmissionIdentifier make tgt.preAdmissionIdentifier
  "Encounter.hospitalization-origin" : for src.origin make tgt.origin
  "Encounter.hospitalization-admitSource" : for src.admitSource make tgt.admitSource
  "Encounter.hospitalization-admittingDiagnosis" : for src.admittingDiagnosis as v make tgt.diagnosis as d, d.role = cc("http://hl7.org/fhir/diagnosis-role", "AD"), d.condition = v
  "Encounter.hospitalization-reAdmission" : for src.reAdmission make tgt.reAdmission
  "Encounter.hospitalization-dietPreference" : for src.dietPreference make tgt.dietPreference
  "Encounter.hospitalization-specialCourtesy" : for src.specialCourtesy make tgt.specialCourtesy
  "Encounter.hospitalization-specialArrangement" : for src.specialArrangement make tgt.specialArrangement
  "Encounter.hospitalization-destination" : for src.destination make tgt.destination
  "Encounter.hospitalization-dischargeDisposition" : for src.dischargeDisposition make tgt.dischargeDisposition
  "Encounter.hospitalization-dischargeDiagnosis" : for src.dischargeDiagnosis as v make tgt.diagnosis as d, d.role = cc("http://hl7.org/fhir/diagnosis-role", "DD"), d.condition = v

group diagnosis(source src, target tgt) extends BackboneElement {
  src.condition -> tgt.condition;
  src.role -> tgt.use;
  src.rank -> tgt.rank;
}


endgroup

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


group encLocation extends BackboneElement
  input src as source
  input tgt as target

group location(source src, target tgt) extends BackboneElement {
  src.location -> tgt.location;
  src.status -> tgt.status;
  src.period -> tgt.period;
}


  "Encounter.location-location" : for src.location make tgt.location
  "Encounter.location-status" : for src.status make tgt.status
  "Encounter.location-period" : for src.period make tgt.period
endgroup


map "http://hl7.org/fhir/StructureMap/Encounter3to2" = "R3 to R2 Conversion for Encounter"

conceptmap "ActEncounterCode" {
  prefix s = "http://hl7.org/fhir/encounter-class"
  prefix t = "http://hl7.org/fhir/v3/ActCode"

  t:IMP	= s:inpatient
  t:AMB	= s:outpatient
  t:AMB	= s:ambulatory
  t:EMER	= s:emergency
  t:HH	= s:home
  t:FLD	= s:field
  t:SS	= s:daytime
  t:VR	= s:virtual
}


uses "http://hl7.org/fhir/StructureDefinition/Encounter" alias Encounter as source
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/Encounter" alias EncounterR2 as target

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

group for type+types  Encounter extends DomainResource
  input src : Encounter as source
  input tgt : EncounterR2 as target

  "Encounter-identifier" : for src.identifier make tgt.identifier
  "Encounter-status" : for src.status check status != 'entered-in-error' make tgt.status
  "Encounter-statusHistory" : for src.statusHistory as vs0 make tgt.statusHistory as vt0 then encStatusHistory(vs0, vt0) 
  "Encounter-class" : for src.class as v make tgt.class = translate(v, "#ActEncounterCode", "code")
  "Encounter-type" : for src.type make tgt.type
  "Encounter-priority" : for src.priority make tgt.priority
  "Encounter-patient" : for src.subject make tgt.patient
  "Encounter-episodeOfCare" : for src.episodeOfCare make tgt.episodeOfCare
  "Encounter-incomingReferral" : for src.incomingReferral make tgt.incomingReferral
  "Encounter-participant" : for src.participant as vs0 make tgt.participant as vt0 then encParticipant(vs0, vt0)
  "Encounter-appointment" : for src.appointment make tgt.appointment
  "Encounter-period" : for src.period make tgt.period
  "Encounter-length" : for src.length as vs make tgt.length as vt then DurationToQuantity(vs, vt)
  "Encounter-reason" : for src.reason make tgt.reason
  "Encounter-indication" : for src.diagnosis as d then encDiagnosis(d, tgt)
  "Encounter-hospitalization" : for src.hospitalization as vs0 make tgt.hospitalization as vt0 then encHospitaization(vs0, vt0) 
  "Encounter-location" : for src.location as vs0 make tgt.location as vt0 then encLocation(vs0, vt0)
  "Encounter-serviceProvider" : for src.serviceProvider make tgt.serviceProvider
  "Encounter-partOf" : for src.partOf make tgt.partOf
endgroup

group encDiagnosis extends BackboneElement
  input src as source
  input tgt as target

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


  "Encounter.indication-condition1" : for src.condition as v where src.role.coding.code.contains("AD").not() and role.coding.code.contains("DD").not() make tgt.indication = v
  "Encounter.indication-condition2" : for src.condition as v where src.role.coding.code.contains("AD") make tgt.hospitalization as h, h.admittingDiagnosis = v
  "Encounter.indication-condition3" : for src.condition as v where src.role.coding.code.contains("DD") make tgt.hospitalization as h, h.dischargeDiagnosis = v
endgroup

uses "http://hl7.org/fhir/StructureDefinition/Encounter" alias Encounter as source
uses "http://hl7.org/fhir/3.0/StructureDefinition/Encounter" alias EncounterR3 as target


group encStatusHistory extends BackboneElement
  input src as source
  input tgt as target

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


  "Encounter.statusHistory-status" : for src.status make tgt.status
  "Encounter.statusHistory-period" : for src.period make tgt.period
endgroup

group Encounter(source src : Encounter, target tgt : EncounterR3) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.status -> tgt.status;
  src.statusHistory as vs0 -> tgt.statusHistory as vt0 then statusHistory(vs0, vt0);
  src.class -> tgt.class;
  src.classHistory as vs0 -> tgt.classHistory as vt0 then classHistory(vs0, vt0);
  src.type -> tgt.type;
  src.priority -> tgt.priority;
  src.subject -> tgt.subject;
  src.episodeOfCare -> tgt.episodeOfCare;
  src.basedOn -> tgt.incomingReferral;
  src.participant as vs0 -> tgt.participant as vt0 then participant(vs0, vt0);
  src.appointment -> tgt.appointment;
  src.period -> tgt.period;
  src.length -> tgt.length;
  src.reasonCode -> tgt.reason;
  src.diagnosis as vs0 -> tgt.diagnosis as vt0 then diagnosis(vs0, vt0);
  src.account -> tgt.account;
  src.hospitalization as vs0 -> tgt.hospitalization as vt0 then hospitalization(vs0, vt0);
  src.location as vs0 -> tgt.location as vt0 then location(vs0, vt0);
  src.serviceProvider -> tgt.serviceProvider;
  src.partOf -> tgt.partOf;
}


group encParticipant extends BackboneElement
  input src as source
  input tgt as target

group statusHistory(source src, target tgt) extends BackboneElement {
  src.status -> tgt.status;
  src.period -> tgt.period;
}


  "Encounter.participant-type" : for src.type make tgt.type
  "Encounter.participant-period" : for src.period make tgt.period
  "Encounter.participant-individual" : for src.individual make tgt.individual
endgroup

group classHistory(source src, target tgt) extends BackboneElement {
  src.class -> tgt.class;
  src.period -> tgt.period;
}


group encHospitaization extends BackboneElement
  input src as source
  input tgt as target

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


  "Encounter.hospitalization-preAdmissionIdentifier" : for src.preAdmissionIdentifier make tgt.preAdmissionIdentifier
  "Encounter.hospitalization-origin" : for src.origin make tgt.origin
  "Encounter.hospitalization-admitSource" : for src.admitSource make tgt.admitSource
  "Encounter.hospitalization-reAdmission" : for src.reAdmission make tgt.reAdmission
  "Encounter.hospitalization-dietPreference" : for src.dietPreference make tgt.dietPreference
  "Encounter.hospitalization-specialCourtesy" : for src.specialCourtesy make tgt.specialCourtesy
  "Encounter.hospitalization-specialArrangement" : for src.specialArrangement make tgt.specialArrangement
  "Encounter.hospitalization-destination" : for src.destination make tgt.destination
  "Encounter.hospitalization-dischargeDisposition" : for src.dischargeDisposition make tgt.dischargeDisposition

group diagnosis(source src, target tgt) extends BackboneElement {
  src.condition -> tgt.condition;
  src.use -> tgt.role;
  src.rank -> tgt.rank;
}


endgroup

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


group encLocation extends BackboneElement
  input src as source
  input tgt as target

group location(source src, target tgt) extends BackboneElement {
  src.location -> tgt.location;
  src.status -> tgt.status;
  src.period -> tgt.period;
}


  "Encounter.location-location" : for src.location make tgt.location
  "Encounter.location-status" : for src.status make tgt.status
  "Encounter.location-period" : for src.period make tgt.period
endgroup


encounter-example ERROR @ Encounter.extension: The extension http://hl7.org/fhir/StructureDefinition/encounter-relatedCondition is unknown, and not allowed here (src = InstanceValidator) f202 ERROR @ Encounter.length: There SHALL be a code if there is a value and it SHALL be an expression of time. If system is present, it SHALL be UCUM. [code.exists() implies ((system = %ucum) and value.exists())] (src = InstanceValidator) <p>No validation errors - all conversions are clean</p>