R4 Draft for Comment

This page is part of the FHIR Specification (v3.2.0: R4 Ballot 1). 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

Patient Administration Work GroupMaturity Level: N/ABallot Status: Informative Compartments: Patient, Practitioner

R2 : R3 Conversion maps for EpisodeOfCare.

Functional status for this map: 1 test that all execute ok. All tests pass round-trip testing and all r3 resources are valid. (see documentation)

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

uses "http://hl7.org/fhir/DSTU2/StructureDefinition/EpisodeOfCare" alias EpisodeOfCareR2 as source
uses "http://hl7.org/fhir/StructureDefinition/EpisodeOfCare" alias EpisodeOfCare as target

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

group for type+types  EpisodeOfCare extends DomainResource
  input src : EpisodeOfCareR2 as source
  input tgt : EpisodeOfCare as target

  "EpisodeOfCare-identifier" : for src.identifier make tgt.identifier
  "EpisodeOfCare-status" : for src.status make tgt.status
  "EpisodeOfCare-statusHistory" : for src.statusHistory as vs0 make tgt.statusHistory as vt0 then epcStatusHistory(vs0, vt0)
  "EpisodeOfCare-type" : for src.type make tgt.type
  "EpisodeOfCare-condition" : for src.condition as v make tgt.diagnosis as d, d.condition = v
  "EpisodeOfCare-patient" : for src.patient make tgt.patient
  "EpisodeOfCare-managingOrganization" : for src.managingOrganization make tgt.managingOrganization
  "EpisodeOfCare-period" : for src.period make tgt.period
  "EpisodeOfCare-referralRequest" : for src.referralRequest make tgt.referralRequest
  "EpisodeOfCare-careManager" : for src.careManager make tgt.careManager

  "EpisodeOfCare-careteam" : for src where src.careTeam.exists() make create("CareTeam") as vt0 then epiCareTeam(src, vt0, tgt)
endgroup

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

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

group epiCareTeam 
  input src as source
  input tgt as target
  input tgtE as target

  "EpisodeOfCare.careteam-link" : for src make tgtE.team = reference(tgt)
  "EpisodeOfCare.careteam-member" : for src.careTeam as vs make tgt.participant as vt then epiCareTeamMember(vs, vt)
endgroup

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

  "EpisodeOfCare.careteam-role" : for src.role make tgt.role
  "EpisodeOfCare.careteam-period" : for src.period make tgt.period
  "EpisodeOfCare.careteam-member" : for src.member make tgt.member
endgroup

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

uses "http://hl7.org/fhir/StructureDefinition/EpisodeOfCare" alias EpisodeOfCare as source
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/EpisodeOfCare" alias EpisodeOfCareR2 as target

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

group for type+types  EpisodeOfCare extends DomainResource
  input src : EpisodeOfCare as source
  input tgt : EpisodeOfCareR2 as target

  "EpisodeOfCare-identifier" : for src.identifier make tgt.identifier
  "EpisodeOfCare-status" : for src.status make tgt.status
  "EpisodeOfCare-statusHistory" : for src.statusHistory as vs0 make tgt.statusHistory as vt0 then epcStatusHistory(vs0, vt0)
  "EpisodeOfCare-type" : for src.type make tgt.type
  "EpisodeOfCare-condition" : for src.diagnosis as d then epcDiagnosis(d, tgt)
  "EpisodeOfCare-patient" : for src.patient make tgt.patient
  "EpisodeOfCare-managingOrganization" : for src.managingOrganization make tgt.managingOrganization
  "EpisodeOfCare-period" : for src.period make tgt.period
  "EpisodeOfCare-referralRequest" : for src.referralRequest make tgt.referralRequest
  "EpisodeOfCare-careManager" : for src.careManager make tgt.careManager
  "EpisodeOfCare-careTeam" : for src.team as vs where reference.resolve().exists() make (src.team.reference.resolve()) as ct then epiCareTeam(ct, tgt)

endgroup

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

  "EpisodeOfCare.indication-condition1" : for src.condition as v where src.role.coding.code.contains("AD").not() and role.coding.code.contains("DD").not() make tgt.condition = v
endgroup


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

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


group epiCareTeam 
  input src as source
  input tgt as target

  "EpisodeOfCare.careteam-member" : for src.participant as vs make tgt.careTeam as vt then epiCareTeamMember(vs, vt)
endgroup

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

  "EpisodeOfCare.careteam-role" : for src.role make tgt.role
  "EpisodeOfCare.careteam-period" : for src.period make tgt.period
  "EpisodeOfCare.careteam-member" : for src.member make tgt.member
endgroup