More about contained resources

So this is going to be a really short post.

There was a question on the Implementers chat about the ability for contained resources to reference each other (ie where there are multiple contained resources within the same parent.

Here’s the question (slightly paraphrased):

The FHIR spec states that Contained resources can’t contain other resource (understandable). But I thought I had seen references from those contained resources to other contained resources within the same parent. Is that valid?

eg: a Medication resource is contained within a MedicationStatemement resource. The Medication references other Medication and Substance resources, also contained within the MedicationStatemement.

And Lloyd replied:

Contained resources can reference other contained resources so long as they’re all contained in the same “real” resource instance.

Containment doesn’t establish hierarchy, it just provides a packaging mechanism for resources that are unable to stand alone by placing them inside a resource that can stand on its own. Hierarchy is established by resolving references.

Containment isn’t a mechanism to address “single unit of work” – for that use either messaging or transaction.

 There are a number of important points here – about contained resources, hierarchy and ‘Unit of Work’ – so I thought I’d record them here for when I forget later 🙂

About David Hay
I'm an independent contractor working with a number of Organizations in the health IT space. I'm an HL7 Fellow, Chair Emeritus of HL7 New Zealand and a co-chair of the FHIR Management Group. I have a keen interest in health IT, especially health interoperability with HL7 and the FHIR standard. I'm the author of a FHIR training and design tool - clinFHIR - which is sponsored by InterSystems Ltd.

Leave a Reply

Discover more from Hay on FHIR

Subscribe now to keep reading and get access to the full archive.

Continue reading