Referential Integrity #1221
codyebberson
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Referential Integrity
This document describes current state and future plans for "Referential Integrity" in Medplum FHIR Server. Referential integrity is an optional feature that enforces valid FHIR References.
Given the deeply nested structure of FHIR resources, this is a non-trivial problem to implement fully and within reasonable performance constraints.
What is Referential Integrity?
In the FHIR specification:
Why not enforce Referential Integrity?
Goals
The goal of the Medplum server is to provide the features necessary to power complex workflows and complex organizations. To that end, we want to provide optional referential integrity features as necessary for customers.
Features
We have identified the following sub projects on the path toward full implementation:
Enforce on Write
On all write operations (create, update, patch, etc), reference targets will be checked. For example, if a patient contains a reference to managing organization
Organization/FOO
butFOO
is not a valid ID for an organization on the server, then the operation will be blocked.Status: Deployed
Enforce on Delete
On delete operation, the server will check for any inbound references. Resources can only be deleted if there are no other resources with references to the candidate resource for deletion.
A distinction can be made between "all references" and "indexed references":
Our review of publicly available FHIR server documentation indicates that most other servers only check "Indexed references".
For example:
To implement this in a performant manner, additional preprocessing may be required at write-time. For example, an additional table for references indexed by target may be required.
Status: Not started
Rewrite Display Strings
FHIR Reference objects have an optional "display" property, which can be convenient in the UI layer. Ideally, the display property would automatically update to reflect changes in the target resource.
For example, if a ServiceRequest.subject refers to a Patient, and the Patient name changes, the ServiceRequest.subject.display property will not be updated to reflect the change.
This is unspecified behavior, and includes opinionated business logic (i.e., "what string should be used for the display?"). Medplum includes a "createReference()" utility which attempts to intelligently generate a display string, but advanced users may want to use their own logic.
Status: Not started
References:
Beta Was this translation helpful? Give feedback.
All reactions