R4 Ballot #1 #2 (Mixed Normative/Trial use)

This page is part of the FHIR Specification (v3.3.0: (v3.5.0: R4 Ballot 2). #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

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

R2 : R3 : R4 Conversion maps for Provenance.

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

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

map "http://hl7.org/fhir/StructureMap/Provenance3to4" = "R3 to R4 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

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/*2to3"

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



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


  "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 Provenance extends DomainResource
  input src : ProvenanceR3 as source
  input tgt : Provenance as target


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)

  "Provenance.target" : for src.target as vs make tgt.target as vt
  "Provenance.occurred" : for src.period as vs make tgt.occurred as vt
  "Provenance.recorded" : for src.recorded as vs make tgt.recorded as vt
  "Provenance.policy" : for src.policy as vs make tgt.policy as vt
  "Provenance.location" : for src.location as vs make tgt.location as vt
  "Provenance.agent" : for src.agent as vs0 make tgt.agent as vt0 then {
    "Provenance.agent.role" : for vs0.role as vs make vt0.role as vt

  }
  // related agent ??

  "Provenance.entity" : for src.entity as vs0 make tgt.entity as vt0 then {
    "Provenance.entity.role" : for vs0.role as vs make vt0.role as vt
  }
  "Provenance.signature" : for src.signature as vs make tgt.signature as vt

endgroup

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/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


  "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 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

group Provenance extends DomainResource
  input src : Provenance as source
  input tgt : ProvenanceR3 as target

  "Provenance.target" : for src.target as vs make tgt.target as vt
  "Provenance.period" : for src.occurredPeriod as vs make tgt.period as vt
  "Provenance.recorded" : for src.recorded as vs make tgt.recorded as vt
  "Provenance.policy" : for src.policy as vs make tgt.policy as vt
  "Provenance.location" : for src.location as vs make tgt.location as vt
  "Provenance.activity" : for src.activity as vs make tgt.activity as vt
  "Provenance.agent" : for src.agent as vs0 make tgt.agent as vt0 then {
    "Provenance.agent.role" : for vs0.role as vs make vt0.role as vt
    "Provenance.agent.who-Reference" : for vs0.who  : Reference as vs make vt0.who = create("Reference") as vt then Reference(vs,vt)
    "Provenance.agent.onBehalfOf-Reference" : for vs0.onBehalfOf  : Reference as vs make vt0.onBehalfOf = create("Reference") as vt then Reference(vs,vt)

  }
  // related agent ??

  "Provenance.entity" : for src.entity as vs0 make tgt.entity as vt0 then {
    "Provenance.entity.role" : for vs0.role as vs make vt0.role as vt
    "Provenance.entity.what-Reference" : for vs0.what  : Reference as vs make vt0.what = create("Reference") as vt then Reference(vs,vt)
  }
  "Provenance.signature" : for src.signature as vs make tgt.signature as vt

endgroup

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)