How to disable reference validation

279 views
Skip to first unread message

Alexander Gutjahr

unread,
Aug 10, 2022, 7:44:13 AM8/10/22
to HAPI FHIR
Hey everyone,

I've been dabbling with adding some conditions that contain a subject reference to a patient. I know the patient's ID so I can create the reference, but that patient is not yet added as a Patient resource.

Multiple data streams are feeding into the FHIR server, so I'd like the reference validation to be relaxed since all the resources will be there eventually.

Is there a dedicated configuration with which I can tune this behavior accordingly? Thanks!
Alex

James Agnew

unread,
Aug 10, 2022, 9:28:23 AM8/10/22
to Alexander Gutjahr, HAPI FHIR
You can disable referential integrity on writes if you want, using this flag: https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/application.yaml#L102

However, be aware that indexing happens when the resource is written and if the target doesn't exist it's not possible to index the reference. This means that if an Observation is created with "subect: Patient/123" and that patient doesn't exist, it won't be possible to search for Observarion?subject=Patient/123 later and find that resource.

Another strategy is to enable automatic creation of placeholders. This will create a stub resource for the target if needed, which allows indexing to proceed.

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/76dced5a-6549-4143-93a3-198a47f27e16n%40googlegroups.com.

Alexander Gutjahr

unread,
Aug 11, 2022, 5:21:11 AM8/11/22
to HAPI FHIR
Excellent, that did the trick! Thanks for the swift response, James!
Reply all
Reply to author
Forward
0 new messages