R4 Ballot #1 (Mixed Normative/Trial use)

This page is part of the FHIR Specification (v3.3.0: R4 Ballot 2). 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 Care Work GroupMaturity Level: N/ABallot Status: Informative Compartments: Patient, Practitioner, RelatedPerson

R2 : R3 Conversion maps for CarePlan.

Functional status for this map: 10 tests that all execute ok. 8 fail round-trip testing and 10 r3 resources are invalid (33 errors). (see documentation)

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

uses "http://hl7.org/fhir/DSTU2/StructureDefinition/CarePlan" alias CarePlanR2 as source
uses "http://hl7.org/fhir/StructureDefinition/CarePlan" alias CarePlan as target

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

group for type+types  CarePlan extends DomainResource
  input src : CarePlanR2 as source
  input tgt : CarePlan as target

  "CarePlan-identifier" : for src.identifier make tgt.identifier
  "CarePlan-subject" : for src.subject make tgt.subject
  "CarePlan-status" : for src.status make tgt.status
  "CarePlan-context" : for src.context make tgt.context
  "CarePlan-period" : for src.period make tgt.period
  "CarePlan-author" : for src.author make tgt.author
  "CarePlan-modified" : for src.modified as v make tgt.extension as t, t.url = 'http://hl7.org/fhir/CarePlan-r2-modified', t.value = v
  "CarePlan-category" : for src.category make tgt.category
  "CarePlan-description" : for src.description make tgt.description
  "CarePlan-addresses" : for src.addresses make tgt.addresses
  "CarePlan-support" : for src.support make tgt.supportingInfo
  // "CarePlan-relatedPlan1" : for src.relatedPlan as vs0 where vs0.code = 'includes' make tgt.basedOn = (vs0.plan) this relationship is inverted to partOf, and that's beyond the scope of the transforms to do
  "CarePlan-relatedPlan2" : for src.relatedPlan as vs0 where vs0.code = 'replaces' make tgt.basedOn = (vs0.plan)
  "CarePlan-relatedPlan3" : for src.relatedPlan as vs0 where vs0.code = 'fulfills' make tgt.replaces = (vs0.plan)
  "CarePlan-participant" : for src where src.participant.exists() make create("CareTeam") as vt0 then plnParticipant(src, vt0, tgt)
  "CarePlan-goal" : for src.goal make tgt.goal
  "CarePlan-activity" : for src.activity as vs0 make tgt.activity as vt0 then plnActivity(vs0, vt0)
  "CarePlan-note" : for src.note make tgt.note
endgroup

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

  "CarePlan.relatedPlan-code" : for src.code make tgt.code
  "CarePlan.relatedPlan-plan" : for src.plan make tgt.plan
endgroup

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

  "CarePlan.activity-actionResulting" : for src.actionResulting make tgt.outcomeReference
  "CarePlan.activity-progress" : for src.progress make tgt.progress
  "CarePlan.activity-reference" : for src.reference make tgt.reference
  "CarePlan.activity-detail" : for src.detail as vs0 make tgt.detail as vt0 then plnDetail(vs0, vt0)
endgroup

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

  "CarePlan.activity.detail-category" : for src.category make tgt.category
  "CarePlan.activity.detail-code" : for src.code make tgt.code
  "CarePlan.activity.detail-reasonCode" : for src.reasonCode make tgt.reasonCode
  "CarePlan.activity.detail-reasonReference" : for src.reasonReference make tgt.reasonReference
  "CarePlan.activity.detail-goal" : for src.goal make tgt.goal
  "CarePlan.activity.detail-status" : for src.status make tgt.status
  "CarePlan.activity.detail-statusReason" : for src.statusReason make tgt.statusReason
  "CarePlan.activity.detail-prohibited" : for src.prohibited make tgt.prohibited
  "CarePlan.activity.detail-scheduled" : for src.scheduled make tgt.scheduled
  "CarePlan.activity.detail-location" : for src.location make tgt.location
  "CarePlan.activity.detail-performer" : for src.performer make tgt.performer
  "CarePlan.activity.detail-product" : for src.product make tgt.product
  "CarePlan.activity.detail-dailyAmount" : for src.dailyAmount make tgt.dailyAmount
  "CarePlan.activity.detail-quantity" : for src.quantity make tgt.quantity
  "CarePlan.activity.detail-description" : for src.description make tgt.description 
endgroup

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

  "CarePlan.participant-link" : for src make tgtE.careTeam = reference(tgt)
  "CarePlan.participant-member" : for src.participant as vs make tgt.participant as vt then plnParticipantMember(vs, vt)
endgroup

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

  "CarePlan.participant-role" : for src.role make tgt.role
  "CarePlan.participant-member" : for src.member make tgt.member
endgroup


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

uses "http://hl7.org/fhir/StructureDefinition/CarePlan" alias CarePlan as source
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/CarePlan" alias CarePlanR2 as target

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

group for type+types  CarePlan extends DomainResource
  input src : CarePlan as source
  input tgt : CarePlanR2 as target

  "CarePlan-identifier" : for src.identifier make tgt.identifier
  "CarePlan-subject" : for src.subject make tgt.subject
  "CarePlan-status" : for src.status make tgt.status
  "CarePlan-context" : for src.context make tgt.context
  "CarePlan-period" : for src.period make tgt.period
  "CarePlan-author" : for src.author make tgt.author
  "CarePlan-modified" : for src.extension as e where e.url = 'http://hl7.org/fhir/CarePlan-r2-modified' make tgt.modified = (e.value)
  "CarePlan-category" : for src.category make tgt.category
  "CarePlan-description" : for src.description make tgt.description
  "CarePlan-addresses" : for src.addresses make tgt.addresses
  "CarePlan-support" : for src.supportingInfo make tgt.support
  "CarePlan-relatedPlan2" : for src.basedOn as vs0 make tgt.relatedPlan as rp, rp.code = 'fulfills', rp.plan = v
  "CarePlan-relatedPlan3" : for src.replaces as vs0 make tgt.relatedPlan as rp, rp.code = 'replaces', rp.plan = v
  "CarePlan-participant" : for src.careTeam as vs where reference.resolve().exists() make (src.careTeam.reference.resolve()) as ct then plnParticipant(ct, tgt)
  "CarePlan-goal" : for src.goal make tgt.goal
  "CarePlan-activity" : for src.activity as vs0 make tgt.activity as vt0 then plnActivity(vs0, vt0)
  "CarePlan-note" : for src.note make tgt.note
endgroup

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

  "CarePlan.activity-actionResulting" : for src.outcomeReference make tgt.actionResulting
  "CarePlan.activity-progress" : for src.progress make tgt.progress
  "CarePlan.activity-reference" : for src.reference make tgt.reference
  "CarePlan.activity-detail" : for src.detail as vs0 make tgt.detail as vt0 then plnDetail(vs0, vt0)
endgroup

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

  "CarePlan.activity.detail-category" : for src.category make tgt.category
  "CarePlan.activity.detail-code" : for src.code make tgt.code
  "CarePlan.activity.detail-reasonCode" : for src.reasonCode make tgt.reasonCode
  "CarePlan.activity.detail-reasonReference" : for src.reasonReference make tgt.reasonReference
  "CarePlan.activity.detail-goal" : for src.goal make tgt.goal
  "CarePlan.activity.detail-status" : for src.status make tgt.status
  "CarePlan.activity.detail-statusReason" : for src.statusReason make tgt.statusReason
  "CarePlan.activity.detail-prohibited" : for src.prohibited make tgt.prohibited
  "CarePlan.activity.detail-scheduled" : for src.scheduled make tgt.scheduled
  "CarePlan.activity.detail-location" : for src.location make tgt.location
  "CarePlan.activity.detail-performer" : for src.performer make tgt.performer
  "CarePlan.activity.detail-product" : for src.product make tgt.product
  "CarePlan.activity.detail-dailyAmount" : for src.dailyAmount make tgt.dailyAmount
  "CarePlan.activity.detail-quantity" : for src.quantity make tgt.quantity
  "CarePlan.activity.detail-description" : for src.description make tgt.description 
endgroup


group plnParticipant 
  input src as source
  input tgt as target

  "CarePlan.participant-unlink" : for src.participant as vs make tgt.participant as vt then plnParticipantMember(vs, vt)
endgroup

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

  "CarePlan.participant-role" : for src.role make tgt.role
  "CarePlan.participant-member" : for src.member make tgt.member
endgroup


example
  • ERROR @ CarePlan: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource [contained.where(('#'+id in %resource.descendants().reference).not()).empty()] (src = InstanceValidator)
  • ERROR @ CarePlan: Profile http://hl7.org/fhir/StructureDefinition/CarePlan, Element 'CarePlan.intent': minimum required = 1, but only found 0 (src = InstanceValidator)
  • ERROR @ CarePlan.contained[1]: Condition.clinicalStatus SHALL be present if verificationStatus is not entered-in-error [verificationStatus='entered-in-error' or clinicalStatus.exists()] (src = InstanceValidator)
  • ERROR @ CarePlan.contained[3].extension: The extension http://hl7.org/fhir/StructureDefinition/goal-target is unknown, and not allowed here (src = InstanceValidator)
  • ERROR @ CarePlan.addresses.contained: Condition.clinicalStatus SHALL be present if verificationStatus is not entered-in-error [verificationStatus='entered-in-error' or clinicalStatus.exists()] (src = InstanceValidator)
  • ERROR @ CarePlan.goal.contained.extension: The extension http://hl7.org/fhir/StructureDefinition/goal-target is unknown, and not allowed here (src = InstanceValidator)
  • ERROR @ CarePlan.activity.detail: Profile http://hl7.org/fhir/StructureDefinition/CarePlan, Element 'CarePlan.activity.detail.status': minimum required = 1, but only found 0 (src = InstanceValidator)
gpvisit
  • ERROR @ CarePlan: Profile http://hl7.org/fhir/StructureDefinition/CarePlan, Element 'CarePlan.intent': minimum required = 1, but only found 0 (src = InstanceValidator)
  • ERROR @ CarePlan.contained[1]: Condition.clinicalStatus SHALL be present if verificationStatus is not entered-in-error [verificationStatus='entered-in-error' or clinicalStatus.exists()] (src = InstanceValidator)
  • ERROR @ CarePlan.addresses.contained: Condition.clinicalStatus SHALL be present if verificationStatus is not entered-in-error [verificationStatus='entered-in-error' or clinicalStatus.exists()] (src = InstanceValidator)
f001
  • ERROR @ CarePlan: Profile http://hl7.org/fhir/StructureDefinition/CarePlan, Element 'CarePlan.intent': minimum required = 1, but only found 0 (src = InstanceValidator)
  • ERROR @ CarePlan.extension: The extension http://hl7.org/fhir/CarePlan-r2-modified is unknown, and not allowed here (src = InstanceValidator)
f002
  • ERROR @ CarePlan: Profile http://hl7.org/fhir/StructureDefinition/CarePlan, Element 'CarePlan.intent': minimum required = 1, but only found 0 (src = InstanceValidator)
  • ERROR @ CarePlan.extension: The extension http://hl7.org/fhir/CarePlan-r2-modified is unknown, and not allowed here (src = InstanceValidator)
f003
  • ERROR @ CarePlan: Profile http://hl7.org/fhir/StructureDefinition/CarePlan, Element 'CarePlan.intent': minimum required = 1, but only found 0 (src = InstanceValidator)
  • ERROR @ CarePlan.extension: The extension http://hl7.org/fhir/CarePlan-r2-modified is unknown, and not allowed here (src = InstanceValidator)
f201
  • ERROR @ CarePlan: Profile http://hl7.org/fhir/StructureDefinition/CarePlan, Element 'CarePlan.intent': minimum required = 1, but only found 0 (src = InstanceValidator)
  • ERROR @ CarePlan.extension: The extension http://hl7.org/fhir/CarePlan-r2-modified is unknown, and not allowed here (src = InstanceValidator)
f202
  • ERROR @ CarePlan: Profile http://hl7.org/fhir/StructureDefinition/CarePlan, Element 'CarePlan.intent': minimum required = 1, but only found 0 (src = InstanceValidator)
f203
  • ERROR @ CarePlan: Profile http://hl7.org/fhir/StructureDefinition/CarePlan, Element 'CarePlan.intent': minimum required = 1, but only found 0 (src = InstanceValidator)
  • ERROR @ CarePlan.extension: The extension http://hl7.org/fhir/CarePlan-r2-modified is unknown, and not allowed here (src = InstanceValidator)
integrate
  • ERROR @ CarePlan: Profile http://hl7.org/fhir/StructureDefinition/CarePlan, Element 'CarePlan.intent': minimum required = 1, but only found 0 (src = InstanceValidator)
  • ERROR @ CarePlan.contained[1]: Condition.clinicalStatus SHALL be present if verificationStatus is not entered-in-error [verificationStatus='entered-in-error' or clinicalStatus.exists()] (src = InstanceValidator)
  • ERROR @ CarePlan.contained[2]: Condition.clinicalStatus SHALL be present if verificationStatus is not entered-in-error [verificationStatus='entered-in-error' or clinicalStatus.exists()] (src = InstanceValidator)
  • ERROR @ CarePlan.contained[3]: Condition.clinicalStatus SHALL be present if verificationStatus is not entered-in-error [verificationStatus='entered-in-error' or clinicalStatus.exists()] (src = InstanceValidator)
  • ERROR @ CarePlan.extension: The extension http://hl7.org/fhir/CarePlan-r2-modified is unknown, and not allowed here (src = InstanceValidator)
  • ERROR @ CarePlan.addresses[1].contained: Condition.clinicalStatus SHALL be present if verificationStatus is not entered-in-error [verificationStatus='entered-in-error' or clinicalStatus.exists()] (src = InstanceValidator)
  • ERROR @ CarePlan.addresses[2].contained: Condition.clinicalStatus SHALL be present if verificationStatus is not entered-in-error [verificationStatus='entered-in-error' or clinicalStatus.exists()] (src = InstanceValidator)
  • ERROR @ CarePlan.addresses[3].contained: Condition.clinicalStatus SHALL be present if verificationStatus is not entered-in-error [verificationStatus='entered-in-error' or clinicalStatus.exists()] (src = InstanceValidator)
preg
  • ERROR @ CarePlan: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource [contained.where(('#'+id in %resource.descendants().reference).not()).empty()] (src = InstanceValidator)
  • ERROR @ CarePlan: Profile http://hl7.org/fhir/StructureDefinition/CarePlan, Element 'CarePlan.intent': minimum required = 1, but only found 0 (src = InstanceValidator)
  • ERROR @ CarePlan.contained[1]: Condition.clinicalStatus SHALL be present if verificationStatus is not entered-in-error [verificationStatus='entered-in-error' or clinicalStatus.exists()] (src = InstanceValidator)
  • ERROR @ CarePlan.addresses.contained: Condition.clinicalStatus SHALL be present if verificationStatus is not entered-in-error [verificationStatus='entered-in-error' or clinicalStatus.exists()] (src = InstanceValidator)