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 a Product Strategist at Orion Health, Chair emeritus of HL7 New Zealand and co-Chair of the FHIR Management Group. I have a keen interest in health IT, especially health interoperability with HL7 and the new FHIR standard.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: