Details
-
Change Request
-
Resolution: Persuasive with Modification
-
Medium
-
FHIR Core (FHIR)
-
R4
-
FHIR Infrastructure
-
Bundle
-
-
Grahame Grieve/Marten Smits: 18-0-0
-
Clarification
-
Non-substantive
-
R5
Description
The bulleted description in this section is confusing, and leads to frequent community questions! Here's a proposed update:
—
How to resolve a reference in a Bundle:
- Resolving absolute references. If the reference.value is an absolute URI (e.g., "https://fhir.example.org/base/Patient/123", "https://fhir.example.org/base/Patient/123/_history/a" , or "urn:uuid:9d1714da-b7e6-455b-bfd2-69ce0ff5fb12"):
- If the reference.value is a versionless (i.e., it does not match the RESTful URL regex, or it matches but has no "_history" path segment):
- Look for an entry with a fullUrl that matches the reference.value
- If found, the resolution succeeds (and ends) here
- If the reference.value matches the RESTful URL regex and includes a "_history" path segment, split the value into two parts: a versionless reference and a version id
- Look for an entry with a fullUrl that matches the versionless reference and a resource.meta.versionId that matches the reference's version id.
- If found, the resolution succeeds (and ends) here.
- Attempt to resolve the URI if possible (e.g, by issuing a FHIR "read" on an https URL).
- If found, the resolution succeeds (and ends) here.
- Otherwise, the resolution fails (and ends) here. The reference has no defined meaning within this specification.
- If the reference.value is a versionless (i.e., it does not match the RESTful URL regex, or it matches but has no "_history" path segment):
- Resolving relative references against a RESTful base. If the reference.value is of the form "[type]/[id]" (e.g., "Patient/123") and the Bundle entry containing the reference has a fullUrl matching the RESTful URL regex (e.g., "https://fhir.example.org/Observation/456"):
- Extract the [root] from the Bundle entry's fullUrl and append the relative reference to it (e.g., "https://fhir.example.org/" + "Patient/123" --> "https://fhir.example.org/Patient/123")
- Follow the steps for Resolving absolute references above
- Resolving conditional references. If the reference occurs in a transaction Bundle and the reference.value is a conditional reference
- Attempt to resolve the conditional reference.value and replace it with a non-conditional reference.value.
- If the replacement succeeds, the resolution succeeds (and ends) here.
- Otherwise the resolution fails (and ends) here.
- Resolving references by identifier. If the reference.identifier is populated:
- Evaluate all Bundle.entry.resource.identifier values for a match (i.e., an identifier whose system and value match the reference.identifier's system and value).
- If found, the resolution succeeds (and ends) here.
- Otherwise the resolution fails (and ends) here.
- Resolving other references. If the rules above do not apply, the resolution fails (and ends) here. The reference has no defined meaning within this specification.
Note that the rules for resolving references in contained resources are the same as those for resolving resources in the resource that contains the contained resource.
If multiple matches are found, it is ambiguous which is correct. Applications MAY return an error or take some other action as they deem appropriate.