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

Security Work Group Maturity Level : N/A Ballot Standards Status : Informative Security Category : Not Classified Compartments : Device , Patient , Practitioner , RelatedPerson

R2 : R3 Converson : R4 Conversion maps for Provenance.

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

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


uses "http://hl7.org/fhir/DSTU2/StructureDefinition/Provenance" alias  ProvenanceR2 as source
uses "http://hl7.org/fhir/StructureDefinition/Provenance" alias  Provenance as target

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


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

uses "http://hl7.org/fhir/3.0/StructureDefinition/Provenance" alias ProvenanceR3 as source
uses "http://hl7.org/fhir/StructureDefinition/Provenance" alias Provenance as target


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


group for type+types  Provenance extends DomainResource
  input src : ProvenanceR2 as source
  input tgt : Provenance as target

group Provenance(source src : ProvenanceR3, target tgt : Provenance) extends DomainResource <<type+>> {
  src.target -> tgt.target;
  src.period as vs0 -> tgt.occurred = create('Period') as vt0 then Period(vs0, vt0);
  src.recorded -> tgt.recorded;
  src.policy -> tgt.policy;
  src.location -> tgt.location;
  src.reason -> tgt.reason;
  src.activity -> tgt.activity;
  src.agent as vs0 -> tgt.agent as vt0 then agent(vs0, vt0);
  src.entity as vs0 -> tgt.entity as vt0 then entity(vs0, vt0);
  src.signature -> tgt.signature;
}


  "Provenance-target" : for src.target make tgt.target
  "Provenance-period" : for src.period make tgt.period
  "Provenance-recorded" : for src.recorded make tgt.recorded
  "Provenance-activity" : for src.reason make tgt.reason
  "Provenance-activity" : for src.activity make tgt.activity
  "Provenance-location" : for src.location make tgt.location
  "Provenance-policy" : for src.policy make tgt.policy
  "Provenance-agent" : for src.agent as vs0 make tgt.agent as vt0 then prAgent(vs0, vt0) 
  "Provenance-entity" : for src.entity as vs0 make tgt.entity as vt0 then prEntity(vs0, vt0)
  "Provenance-signature" : for src.signature make tgt.signature
endgroup

group agent(source src : ProvenanceR3, target tgt : Provenance) extends BackboneElement {
  src.role -> tgt.role;
  src.who : uri as vs ->  tgt.who as ref,  ref.reference = vs,  ref.extension as ext,  ext.url = 'http://hl7.org/fhir/3.0/StructureDefinition/BaseType',  ext.value = 'uri';
  src.who : Reference as vs0 -> tgt.who as vt0 then Reference(vs0, vt0);
  src.onBehalfOf : uri as vs ->  tgt.onBehalfOf as ref,  ref.reference = vs,  ref.extension as ext,  ext.url = 'http://hl7.org/fhir/3.0/StructureDefinition/BaseType',  ext.value = 'uri';
  src.onBehalfOf : Reference as vs0 -> tgt.onBehalfOf as vt0 then reference(vs0, vt0);
  src.relatedAgentType -> tgt.type;
}


group prAgent extends BackboneElement
  input src as source
  input tgt as target
  
  "Provenance.agent-role" : for src.role make tgt.role 
  "Provenance.agent-who" : for src.actor make tgt.who 
  "Provenance.agent-userId" : for src.userId as su make tgt.who as tu then {
    "Provenance.agent-userId2" : for su make tu.identifier as tu then Identifier(su, tu)
  }
  // related agent ??
endgroup

group entity(source src : ProvenanceR3, target tgt : Provenance) extends BackboneElement {
  src.role -> tgt.role;
  src.what : uri as vs ->  tgt.what as ref,  ref.reference = vs,  ref.extension as ext,  ext.url = 'http://hl7.org/fhir/3.0/StructureDefinition/BaseType',  ext.value = 'uri';
  src.what : Reference as vs0 -> tgt.what as vt0 then Reference(vs0, vt0);
  src.what : Identifier as vs0 -> tgt.what as vt0 then Identifier2Reference(vs0, vt0);
  src.agent as vs0 -> tgt.agent as vt0 then agent(vs0, vt0);
}


group prEntity extends BackboneElement
  input src as source
  input tgt as target
  
  "Provenance.entity-role" : for src.role make tgt.role
  // "Provenance.entity-type" : for src.type make ...?
  // "Provenance.entity-role" : for src.reference make ...?
  // "Provenance.entity-role" : for src.display make ...?
  "Provenance.entity-agent" : for src.agent as vs0 make tgt.agent as vt0 then prAgent(vs0, vt0) 
endgroup


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

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


uses "http://hl7.org/fhir/StructureDefinition/Provenance" alias Provenance as source
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/Provenance" alias ProvenanceR2 as target

uses "http://hl7.org/fhir/StructureDefinition/Provenance" alias Provenance as source
uses "http://hl7.org/fhir/3.0/StructureDefinition/Provenance" alias ProvenanceR3 as target


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

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


group for type+types  Provenance extends DomainResource
  input src : Provenance as source
  input tgt : ProvenanceR2 as target

group Provenance(source src : Provenance, target tgt : ProvenanceR3) extends DomainResource <<type+>> {
  src.target -> tgt.target;
  src.occurred : Period as vs0 -> tgt.period as vt0 then Period(vs0, vt0) "period";
  src.occurred : dateTime as vs0 ->  tgt.period as vt0,  vt0.start = vs0,  vt0.end = vs0 "period";
  src.recorded -> tgt.recorded;
  src.policy -> tgt.policy;
  src.location -> tgt.location;
  src.reason -> tgt.reason;
  src.activity -> tgt.activity;
  src.agent as vs0 -> tgt.agent as vt0 then agent(vs0, vt0);
  src.entity as vs0 -> tgt.entity as vt0 then entity(vs0, vt0);
  src.signature -> tgt.signature;
}


  "Provenance-target" : for src.target make tgt.target
  "Provenance-period" : for src.period make tgt.period
  "Provenance-recorded" : for src.recorded make tgt.recorded
  "Provenance-activity" : for src.reason make tgt.reason
  "Provenance-activity" : for src.activity make tgt.activity
  "Provenance-location" : for src.location make tgt.location
  "Provenance-policy" : for src.policy make tgt.policy
  "Provenance-agent" : for src.agent as vs0 make tgt.agent as vt0 then prAgent(vs0, vt0) 
  "Provenance-entity" : for src.entity as vs0 make tgt.entity as vt0 then prEntity(vs0, vt0)
  "Provenance-signature" : for src.signature make tgt.signature
endgroup

group agent(source src : ProvenanceR3, target tgt : Provenance) extends BackboneElement {
  src.role -> tgt.role;
  src.who as vs0 where extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').empty() -> tgt.who = create('Reference') as vt0 then Reference(vs0, vt0);
  src.who as vs0 where extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').exists() -> tgt.who = create('uri') as vt0 then {
    vs0.reference as vs1 then uri(vs1, vt0);
  };
  src.onBehalfOf as vs0 where extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').empty() -> tgt.onBehalfOf = create('Reference') as vt0 then Reference(vs0, vt0);
  src.onBehalfOf as vs0 where extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').exists() -> tgt.onBehalfOf = create('uri') as vt0 then {
    vs0.reference as vs1 then uri(vs1, vt0);
  };
  src.type -> tgt.relatedAgentType;
}


group prAgent extends BackboneElement
  input src as source
  input tgt as target
  
  "Provenance.agent-role" : for src.role make tgt.role 
  "Provenance.agent-who" : for src.who where display.exists() or reference.exists() make tgt.actor
  "Provenance.agent-userId" : for src.who as su where identifier.exists() then {
    "Provenance.agent-userId2" : for su.identifier make tgt.userId
  }
  // related agent ??
endgroup

group entity(source src : ProvenanceR3, target tgt : Provenance) extends BackboneElement {
  src.role -> tgt.role;
  src.what as vs0 where extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').empty() and identifier.empty() -> tgt.what = create('Reference') as vt0 then Reference(vs0, vt0);
  src.what as vs0 where extension('http://hl7.org/fhir/3.0/StructureDefinition/BaseType').exists() -> tgt.what = create('uri') as vt0 then {
    vs0.reference as vs1 then uri(vs1, vt0);
  };
  src.what as vs0 where identifier.exists() -> tgt.what = create('Identifier') as vt0 then Reference2Identifier(vs0, vt0);
  src.agent as vs0 -> tgt.agent as vt0 then agent(vs0, vt0);
}


group prEntity extends BackboneElement
  input src as source
  input tgt as target
  
  "Provenance.entity-role" : for src.role make tgt.role
  // "Provenance.entity-type" : for src.type make ...?
  // "Provenance.entity-role" : for src.reference make ...?
  // "Provenance.entity-role" : for src.display make ...?
  "Provenance.entity-agent" : for src.agent as vs0 make tgt.agent as vt0 then prAgent(vs0, vt0) 
endgroup


example ERROR @ Provenance.entity: Profile http://hl7.org/fhir/StructureDefinition/Provenance, Element 'Provenance.entity.what[x]': minimum required = 1, but only found 0 (src = InstanceValidator) <p>No validation errors - all conversions are clean</p>