FHIR’s Media and DocumentReference resources

The Media resource type in FHIR R4 was removed in R5, replaced by the existing DocumentReference resource type.

This raises a question about what to do if you’re using R4 and are considering the Media resource for a particular use case.

Should you abandon it completely, knowing there will be a migration price to pay if you move to R5 or R6 in the future and use DocumentReference instead? Or should you stick with the Media as it might be the most suitable resource type available to you?

It’s not an easy question to answer as it very much depends on your use case.

Here are two examples.

In example one you want to attach an image to an Observation resource using the Observation.derivedFrom element. This allows for a selection of different resource types to be used, both Media and DocumentReference among them.

In this case the choice should be clear. Use the DocumentReference, and save yourself the future pain.

In example two you’re constructing a DiagnosticReport resource and linking a set of Observations and images to it. The images are referenced using the DiagnosticReport.media.link element, which in R4 ONLY allows for a Media resource type.

You cannot use a DocumentReference resource here even if you wanted to as doing so would lead to a non-conforming DiagnosticReport resource that failed FHIR validation.

In this case you have no choice but to use the Media resource.

In FHIR R5 the DiagnosticReport.media.link element has been changed to accept a DocumentReference resource.

This situation perfectly illustrates now immature FHIR is as a standard.

For projects making use of the DiagnosticReport resource in FHIR R4, it doesn’t matter how forward thinking you are, there is simply no choice but to use the Media resource type — which has a very low maturity rating.

The lesson here — if there is one — is to be aware of the changes between FHIR versions and where possible adjust your resource use accordingly.

But don’t expect to always be able to do so.

Media resource type: https://hl7.org/fhir/R4/media.html
DocumentReference resource type: https://hl7.org/fhir/R4/documentreference.html
DiagnosticReport resource type: https://hl7.org/fhir/R4/diagnosticreport.html

---

Ways to Work With Me

Discover more from Darren Devitt

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

Continue reading