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

Security Work GroupMaturity Level: N/ABallot Status: Informative Compartments: Device, Patient, Practitioner, RelatedPerson

R2 : R3 Conversion maps for Provenance.

Functional status for this map: 2 tests that all execute ok. 1 fail round-trip testing and 1 r3 resources are invalid (1 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

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


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

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

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

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
  }
  // related agent ??
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)