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 Care Work Group Maturity Level : N/A Ballot Standards Status : Informative Security Category : Patient Compartments : Patient

R2 : R3 Converson : R4 Conversion maps for Goal.

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

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

uses "http://hl7.org/fhir/DSTU2/StructureDefinition/Goal" alias GoalR2 as source
uses "http://hl7.org/fhir/StructureDefinition/Goal" alias Goal as target

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


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

uses "http://hl7.org/fhir/3.0/StructureDefinition/Goal" alias GoalR3 as source
uses "http://hl7.org/fhir/StructureDefinition/Goal" alias Goal as target


group for type+types  Goal extends DomainResource
  input src : GoalR2 as source
  input tgt : Goal as target

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


  "Goal-identifier" : for src.identifier make tgt.identifier
  "Goal-subject" : for src.subject make tgt.subject
  "Goal-start" : for src.start make tgt.start 
  "Goal-target" : for src.target make tgt.target
  "Goal-category" : for src.category make tgt.category
  "Goal-description" : for src.description make tgt.description
  "Goal-status" : for src.status make tgt.status
  "Goal-statusDate" : for src.statusDate make tgt.statusDate
  "Goal-statusReason" : for src.statusReason make tgt.statusReason
  "Goal-author" : for src.author make tgt.expressedBy
  "Goal-priority" : for src.priority make tgt.priority
  "Goal-addresses" : for src.addresses make tgt.addresses
  "Goal-note" : for src.note make tgt.note
  "Goal-outcome" : for src.outcome as vs0 then goalOutcome(vs0, tgt)
endgroup

group Goal(source src : GoalR3, target tgt : Goal) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.status where value in ('proposed' | 'planned' | 'accepted' | 'on-hold' | 'cancelled' | 'entered-in-error' | 'rejected') -> tgt.lifecycleStatus;
  src.status where value = 'achieved' -> tgt.lifecycleStatus = 'completed';
  src.status as s where value in ('in-progress' | 'sustaining') ->  tgt.lifecycleStatus = 'active',  tgt.achievementStatus as cc,  cc.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/goal-achievement',  c.code = s;
  src.status where value = 'on-target' ->  tgt.lifecycleStatus = 'active',  tgt.achievementStatus as cc,  cc.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/goal-achievement',  c.code = 'sustaining';
  src.status where value = 'ahead-of-target' ->  tgt.lifecycleStatus = 'active',  tgt.achievementStatus as cc,  cc.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/goal-achievement',  c.code = 'improving';
  src.status where value = 'behind-target' ->  tgt.lifecycleStatus = 'active',  tgt.achievementStatus as cc,  cc.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/goal-achievement',  c.code = 'worsening';
  src.category -> tgt.category;
  src.priority -> tgt.priority;
  src.description -> tgt.description;
  src.subject -> tgt.subject;
  src.start : date as vs -> tgt.start = create('date') as vt then date(vs, vt);
  src.start : CodeableConcept as vs -> tgt.start = create('CodeableConcept') as vt then CodeableConcept(vs, vt);
  src.target as vs0 -> tgt.target as vt0 then target(vs0, vt0);
  src.statusDate -> tgt.statusDate;
  src.statusReason -> tgt.statusReason;
  src.expressedBy -> tgt.expressedBy;
  src.addresses -> tgt.addresses;
  src.note -> tgt.note;
  src.outcomeCode -> tgt.outcomeCode;
  src.outcomeReference -> tgt.outcomeReference;
}


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

group target(source src, target tgt) extends BackboneElement {
  src.measure -> tgt.measure;
  src.detail : Quantity as vs -> tgt.detail = create('Quantity') as vt then Quantity(vs, vt);
  src.detail : Range as vs -> tgt.detail = create('Range') as vt then Range(vs, vt);
  src.detail : CodeableConcept as vs -> tgt.detail = create('CodeableConcept') as vt then CodeableConcept(vs, vt);
  src.due : date as vs -> tgt.due = create('date') as vt then date(vs, vt);
  src.due : Duration as vs -> tgt.due = create('Duration') as vt then Duration(vs, vt);
}


  "Goal.outcome-result" : for src.result : CodeableConcept 0..1 make tgt.outcomeCode
  "Goal.outcome-result" : for src.result : Reference 0..1 make tgt.outcomeReference
endgroup


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

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


uses "http://hl7.org/fhir/StructureDefinition/Goal" alias Goal as source
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/Goal" alias GoalR2 as target

uses "http://hl7.org/fhir/StructureDefinition/Goal" alias Goal as source
uses "http://hl7.org/fhir/3.0/StructureDefinition/Goal" alias GoalR3 as target


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

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


group for type+types  Goal extends DomainResource
  input src : Goal as source
  input tgt : GoalR2 as target

group Goal(source src : Goal, target tgt : GoalR3) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.lifecycleStatus where value in ('proposed' | 'planned' | 'accepted' | 'on-hold' | 'cancelled' | 'entered-in-error' | 'rejected') -> tgt.status;
  src.lifecycleStatus where value = 'completed' -> tgt.status = 'achieved';
  src.achievementStatus where coding.where((system = 'http://terminology.hl7.org/CodeSystem/goal-achievement') and (code = 'in-progress')).exists() -> tgt.status = 'in-progress';
  src.achievementStatus where coding.where((system = 'http://terminology.hl7.org/CodeSystem/goal-achievement') and (code = 'sustaining')).exists() -> tgt.status = 'sustaining';
  src.achievementStatus where coding.where((system = 'http://terminology.hl7.org/CodeSystem/goal-achievement') and (code = 'sustaining')) -> tgt.status = 'on-target';
  src.achievementStatus where coding.where((system = 'http://terminology.hl7.org/CodeSystem/goal-achievement') and (code = 'improving')) -> tgt.status = 'ahead-of-target';
  src.achievementStatus where coding.where((system = 'http://terminology.hl7.org/CodeSystem/goal-achievement') and (code = 'worsening')) -> tgt.status = 'behind-target';
  src.category -> tgt.category;
  src.priority -> tgt.priority;
  src.description -> tgt.description;
  src.subject -> tgt.subject;
  src.start : date as vs -> tgt.start = create('date') as vt then date(vs, vt);
  src.start : CodeableConcept as vs -> tgt.start = create('CodeableConcept') as vt then CodeableConcept(vs, vt);
  src.target as vs0 -> tgt.target as vt0 then target(vs0, vt0);
  src.statusDate -> tgt.statusDate;
  src.statusReason -> tgt.statusReason;
  src.expressedBy -> tgt.expressedBy;
  src.addresses -> tgt.addresses;
  src.note -> tgt.note;
  src.outcomeCode -> tgt.outcomeCode;
  src.outcomeReference -> tgt.outcomeReference;
}


  "Goal-identifier" : for src.identifier make tgt.identifier
  "Goal-subject" : for src.subject make tgt.subject
  "Goal-start" : for src.start make tgt.start 
  "Goal-target" : for src.target make tgt.target
  "Goal-category" : for src.category make tgt.category
  "Goal-description" : for src.description make tgt.description
  "Goal-status" : for src.status make tgt.status
  "Goal-statusDate" : for src.statusDate make tgt.statusDate
  "Goal-statusReason" : for src.statusReason make tgt.statusReason
  "Goal-author" : for src.expressedBy make tgt.author
  "Goal-priority" : for src.priority make tgt.priority
  "Goal-addresses" : for src.addresses make tgt.addresses
  "Goal-note" : for src.note make tgt.note
  "Goal-outcome" : for src.outcomeCode as vs0 make tgt.outcome as vt0, vt0.result = vs0
  "Goal-outcome" : for src.outcomeReference as vs0 make tgt.outcome as vt0, vt0.result = vs0
endgroup

group target(source src, target tgt) extends BackboneElement {
  src.measure -> tgt.measure;
  src.detail : Quantity as vs -> tgt.detail = create('Quantity') as vt then Quantity(vs, vt);
  src.detail : Range as vs -> tgt.detail = create('Range') as vt then Range(vs, vt);
  src.detail : CodeableConcept as vs -> tgt.detail = create('CodeableConcept') as vt then CodeableConcept(vs, vt);
  src.due : date as vs -> tgt.due = create('date') as vt then date(vs, vt);
  src.due : Duration as vs -> tgt.due = create('Duration') as vt then Duration(vs, vt);
}



example ERROR @ Goal.extension: The extension http://hl7.org/fhir/StructureDefinition/goal-target is unknown, and not allowed here (src = InstanceValidator) goal-example ERROR @ Goal.extension[1]: The extension http://hl7.org/fhir/StructureDefinition/goal-target is unknown, and not allowed here (src = InstanceValidator) <p>No validation errors - all conversions are clean</p>