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

Structured Documents Work GroupMaturity Level: N/ABallot Status: Informative Compartments: Device, Encounter, Patient, Practitioner, RelatedPerson

R2 : R3 Conversion maps for DocumentReference.

Functional status for this map: 1 test that all execute ok. 1 fail round-trip testing and all r3 resources are valid. (see documentation)

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

uses "http://hl7.org/fhir/DSTU2/StructureDefinition/DocumentReference" alias DocumentReferenceR2 as source
uses "http://hl7.org/fhir/StructureDefinition/DocumentReference" alias DocumentReference as target

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

group for type+types  DocumentReference extends DomainResource
  input src : DocumentReferenceR2 as source
  input tgt : DocumentReference as target

  "DocumentReference-masterIdentifier" : for src.masterIdentifier make tgt.masterIdentifier
  "DocumentReference-identifier" : for src.identifier make tgt.identifier
  "DocumentReference-subject" : for src.subject make tgt.subject
  "DocumentReference-type" : for src.type make tgt.type
  "DocumentReference-class" : for src.class make tgt.class
  "DocumentReference-author" : for src.author make tgt.author
  "DocumentReference-custodian" : for src.custodian make tgt.custodian
  "DocumentReference-authenticator" : for src.authenticator make tgt.authenticator
  "DocumentReference-created" : for src.created make tgt.created
  "DocumentReference-indexed" : for src.indexed make tgt.indexed
  "DocumentReference-status" : for src.status make tgt.status
  "DocumentReference-docStatus" : for src.docStatus as v then {
    "DocumentReference-docStatus-inner" : for v.coding as v1 where v1.system = 'http://hl7.org/fhir/composition-status' make tgt.docStatus = (v1.code)
  }
  "DocumentReference-relatesTo" : for src.relatesTo as vs0 make tgt.relatesTo as vt0 then drRelatesTo(vs0, vt0)
  "DocumentReference-description" : for src.description make tgt.description
  "DocumentReference-securityLabel" : for src.securityLabel make tgt.securityLabel
  "DocumentReference-content" : for src.content as vs0 make tgt.content as vt0 then drContent(vs0, vt0)
  "DocumentReference-context" : for src.context as vs0 make tgt.context as vt0 then drContext(vs0, vt0)

endgroup

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

  "DocumentReference.relatesTo-code" : for src.code make tgt.code
  "DocumentReference.relatesTo-target" : for src.target make tgt.target
endgroup

group drContent extends BackboneElement
  input src as source
  input tgt as target
  
  "DocumentReference.content-attachment" : for src.attachment make tgt.attachment
  "DocumentReference.content-format" : for src.format make tgt.format
endgroup

group drContext extends BackboneElement
  input src as source
  input tgt as target
  
  "DocumentReference.context-encounter" : for src.encounter make tgt.encounter
  "DocumentReference.context-event" : for src.event make tgt.event
  "DocumentReference.context-period" : for src.period make tgt.period
  "DocumentReference.context-facilityType" : for src.facilityType make tgt.facilityType
  "DocumentReference.context-practiceSetting" : for src.practiceSetting make tgt.practiceSetting
  "DocumentReference.context-sourcePatientInfo" : for src.sourcePatientInfo make tgt.sourcePatientInfo
  "DocumentReference.context-related" : for src.related as vs0 make tgt.related as vt0 then drrelated(vs0, vt0)
endgroup

group drrelated extends BackboneElement
  input src as source
  input tgt as target
  
  "DocumentReference.context.related-identifier" : for src.identifier make tgt.identifier
  "DocumentReference.context.related-ref" : for src.ref make tgt.ref
endgroup

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

uses "http://hl7.org/fhir/StructureDefinition/DocumentReference" alias DocumentReference as source
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/DocumentReference" alias DocumentReferenceR2 as target

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

group for type+types  DocumentReference extends DomainResource
  input src : DocumentReference as source
  input tgt : DocumentReferenceR2 as target

  "DocumentReference-masterIdentifier" : for src.masterIdentifier make tgt.masterIdentifier
  "DocumentReference-identifier" : for src.identifier make tgt.identifier
  "DocumentReference-subject" : for src.subject make tgt.subject
  "DocumentReference-type" : for src.type make tgt.type
  "DocumentReference-class" : for src.class make tgt.class
  "DocumentReference-author" : for src.author make tgt.author
  "DocumentReference-custodian" : for src.custodian make tgt.custodian
  "DocumentReference-authenticator" : for src.authenticator make tgt.authenticator
  "DocumentReference-created" : for src.created make tgt.created
  "DocumentReference-indexed" : for src.indexed make tgt.indexed
  "DocumentReference-status" : for src.status make tgt.status
  "DocumentReference-docStatus" : for src.docStatus as v make tgt.docStatus = cc("http://hl7.org/fhir/composition-status", c)
  "DocumentReference-relatesTo" : for src.relatesTo as vs0 make tgt.relatesTo as vt0 then drRelatesTo(vs0, vt0)
  "DocumentReference-description" : for src.description make tgt.description
  "DocumentReference-securityLabel" : for src.securityLabel make tgt.securityLabel
  "DocumentReference-content" : for src.content as vs0 make tgt.content as vt0 then drContent(vs0, vt0)
  "DocumentReference-context" : for src.context as vs0 make tgt.context as vt0 then drContext(vs0, vt0)


endgroup

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

  "DocumentReference.relatesTo-code" : for src.code make tgt.code
  "DocumentReference.relatesTo-target" : for src.target make tgt.target
endgroup

group drContent extends BackboneElement
  input src as source
  input tgt as target
  
  "DocumentReference.content-attachment" : for src.attachment make tgt.attachment
  "DocumentReference.content-format" : for src.format make tgt.format
endgroup

group drContext extends BackboneElement
  input src as source
  input tgt as target
  
  "DocumentReference.context-encounter" : for src.encounter make tgt.encounter
  "DocumentReference.context-event" : for src.event make tgt.event
  "DocumentReference.context-period" : for src.period make tgt.period
  "DocumentReference.context-facilityType" : for src.facilityType make tgt.facilityType
  "DocumentReference.context-practiceSetting" : for src.practiceSetting make tgt.practiceSetting
  "DocumentReference.context-sourcePatientInfo" : for src.sourcePatientInfo make tgt.sourcePatientInfo
  "DocumentReference.context-related" : for src.related as vs0 make tgt.related as vt0 then drrelated(vs0, vt0)
endgroup

group drrelated extends BackboneElement
  input src as source
  input tgt as target
  
  "DocumentReference.context.related-identifier" : for src.identifier make tgt.identifier
  "DocumentReference.context.related-ref" : for src.ref make tgt.ref
endgroup