FHIR Release 3 (STU)

This page is part of the FHIR Specification (v3.0.2: STU 3). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions

Patient Care Work GroupMaturity Level: N/ABallot Status: InformativeCompartments: Patient, Practitioner

R2 : R3 Converson maps for ReferralRequest.

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

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


conceptmap "status" {
  prefix s = "http://hl7.org/fhir/referralstatus"
  prefix t = "http://hl7.org/fhir/referralstatus"

  s:draft = t:draft
  s:requested = t:active
  s:active = t:active
  s:cancelled = t:cancelled
  s:accepted = t:active
  s:rejected = t:cancelled
  s:completed = t:completed
}
  
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/ReferralRequest" alias ReferralRequestR2 as source
uses "http://hl7.org/fhir/StructureDefinition/ReferralRequest" alias ReferralRequest as target

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

group for type+types  ReferralRequest extends DomainResource
  input src : ReferralRequestR2 as source
  input tgt : ReferralRequest as target

  "ReferralRequest-status" : for src.status as v make tgt.status = translate(v, "#status", "code")
  "ReferralRequest-identifier" : for src.identifier make tgt.identifier
  "ReferralRequest-date" : for src.date make tgt.authoredOn
  "ReferralRequest-type" : for src.type make tgt.type
  "ReferralRequest-specialty" : for src.specialty make tgt.specialty
  "ReferralRequest-priority" : for src.priority as v then {
    "test" : for v.coding as v1 where v1.system = 'http://hl7.org/fhir/diagnostic-order-priority' then { 
      "t2" : for v1.code make tgt.priority 
    }
  }
  "ReferralRequest-patient" : for src.patient make tgt.subject
  "ReferralRequest-requester" : for src.requester as v make tgt.requester as t, t.agent = v
  "ReferralRequest-recipient" : for src.recipient make tgt.recipient
  "ReferralRequest-encounter" : for src.encounter make tgt.context
  // drop dateSent
  "ReferralRequest-reason" : for src.reason make tgt.reasonCode
  "ReferralRequest-description" : for src.description make tgt.description
  "ReferralRequest-serviceRequested" : for src.serviceRequested make tgt.serviceRequested
  "ReferralRequest-supportingInformation" : for src.supportingInformation make tgt.supportingInfo
  "ReferralRequest-fulfillmentTime" : for src.fulfillmentTime make tgt.occurrence
endgroup

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

uses "http://hl7.org/fhir/StructureDefinition/ReferralRequest" alias ReferralRequest as source
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/ReferralRequest" alias ReferralRequestR2 as target

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

group for type+types  ReferralRequest extends DomainResource
  input src : ReferralRequest as source
  input tgt : ReferralRequestR2 as target

  "ReferralRequest-status" : for src.status check $this != 'entered-in-error' make tgt.status
  "ReferralRequest-identifier" : for src.identifier make tgt.identifier
  "ReferralRequest-date" : for src.authoredOn make tgt.date
  "ReferralRequest-type" : for src.type make tgt.type
  "ReferralRequest-specialty" : for src.specialty make tgt.specialty
  "ReferralRequest-priority" : for src.priority as v make tgt.priority = cc('http://hl7.org/fhir/diagnostic-order-priority', v)
  "ReferralRequest-patient" : for src.subject make tgt.patient
  "ReferralRequest-requester" : for src.requester as v then {
    "ReferralRequest-requester-inner" : for v.agent make tgt.requester
  }
  "ReferralRequest-recipient" : for src.recipient make tgt.recipient
  "ReferralRequest-encounter" : for src.context make tgt.encounter
  "ReferralRequest-reason" : for src.reasonCode make tgt.reason
  "ReferralRequest-description" : for src.description make tgt.description
  "ReferralRequest-serviceRequested" : for src.serviceRequested make tgt.serviceRequested
  "ReferralRequest-supportingInformation" : for src.supportingInfo make tgt.supportingInformation
  "ReferralRequest-fulfillmentTime" : for src.occurrence make tgt.fulfillmentTime
endgroup

example
  • ERROR @ ReferralRequest: Profile http://hl7.org/fhir/StructureDefinition/ReferralRequest, Element 'ReferralRequest.intent': minimum required = 1, but only found 0 (src = InstanceValidator)
referralrequest-example
  • ERROR @ ReferralRequest: Profile http://hl7.org/fhir/StructureDefinition/ReferralRequest, Element 'ReferralRequest.intent': minimum required = 1, but only found 0 (src = InstanceValidator)