Proper ways to construct a FHIR reference

Often, within a FHIR resource, there are references to other resources within.
An example would be the ‘managingOrganization’ of a Patient.
On the FHIR site, we see (when using JSON) :
“managingOrganization”: { Reference(Organization) }
Which, to my understanding, we should always see a nested object, looking along the lines of:
{
“reference”: “string reference”,
“type”: “uri”,
“identifier”: { An Identifier Object },
“display”: "A display string
}

or – put simply, in one of the Patient examples, we see something like:
“managingOrganization”: {
“reference”: “Organization/1”
}

I have seen FHIR references constructed as what seems to be a nested resource, rather than a “reference”.
An example of this as a “managingOrganization”:

“managingOrganization”: {
“id”: “a-unique-identifier”,
“identifier”: [{
“use”: “official”,
“type”: {
“coding”: [{
“system”: “http://link/to/system”,
“code”: “CODE”
}],
“text”: “EHR Facility”
}
}],
“active”: true,
“name”: “EHR Facility”,
“resourceType”: “Organization”
}

This does not seem valid to me, as it does not follow the ‘reference’ schema I detailed above, but I want to verify that I have not missed anything in the ‘reference’ section of the FHIR page.

References are not to ‘nested’ resources. Any system that sends a nested resource is not conformant to the FHIR specification. Reference is a data type. It behaves somewhat like a hyperlink - you can specify the URL of the target resource via Reference.reference. You can specify the display value of the link (Reference.display) and, to handle some edge cases where the referenced resource isn’t available from a RESTful endpoint, you can specify Reference.identifier and Reference.type to perform a ‘logical’ reference. The Reference.reference might be a local link to a ‘contained’ resource (using DomainResource.contained), but that’s only used when the referenced resource has no independent identity and can’t exist outside the containing resource (e.g. a Medication resource containing a drug recipe that is maintained and lives solely within the referencing MedicationRequest). In all other cases, the referenced resource lives outside the referencing resource - either on a RESTful endpoint or, in the case of a message, document, transaction or other Bundle, sometimes as a sibling Bundle.entry.

1 Like