POST an Observation with a subject of Patient/123 and you’d expect the FHIR server to check that Patient 123 exists. Not all servers do. Some will accept the Observation and return a 201 status, even if that Patient has never existed.
This is referential integrity, and not every FHIR server enforces it. A CapabilityStatement can say whether it does, through referencePolicy, but few people look. Some servers do not populate this element at all, and you have to work out the policy through trial and error.
I’ve worked with teams who never checked this, assuming referential integrity was the default when it wasn’t.
When the server doesn’t enforce it, the work falls to the implementation team. If they don’t manage it in code, invalid data can go into the server without any errors being thrown.
POST requests are the obvious risk, but PUT requests are just as exposed. A bug in an update can point a reference at a resource that does not exist or has been deleted, and the server accepts it.
DELETEs cause the same problem from the other direction. A Patient is deleted, and every Observation, Encounter and Condition that referenced it is left pointing at a resource that’s no longer there.
Let’s say a bug in an EHR creates two Encounters for the same hospital stay. For a day, nurses record Observations, MedicationAdministrations and Procedures against whichever Encounter their screen happens to display – different apps, different screens.
Someone spots the duplicate and deletes it, but the deletion process does not check for linked resources. The visit summary for the surviving Encounter is missing a day’s worth of care, and the discharge summary goes out incomplete. The missing records are still in the server, attached to an Encounter that no longer exists.
On servers that do not enforce referential integrity, the quality of the data degrades over time. Apps that rely on referenced resources crash or show blanks. Searches that rely on chained parameters or _include come back incomplete.
Cleanup gets harder too. Once the Patient is gone, chained searches and Patient/$everything calls that data retention processes depend on can no longer find resources left behind.
Signs to look for:
- A CapabilityStatement with no enforced value in referencePolicy or no referencePolicy element at all
- Referential integrity checks switched off to speed up bulk data ingestion
- Patients deleted with no check for resources that reference them
- References that return a 404 or 410 when resolved
- Retention processes that delete Patients before the resources that reference them
---
I work with teams on a project, retainer or fractional basis. Learn more →