1

Using the bulk export ($export) functionality of FHIR, I am able to export all resources given a query. What I am unsure about is how to export data related to these resources.

For example, suppose I want to export all MedicationDispense resources of 2024:

{{fhirurl}}/$export?_type=MedicationDispense&_typeFilter=MedicationDispense?whenhandedover=2024

...how do I select all referenced Medication resources (through MedicationDispense > medicationReference)? The following code gives me all Medication resources, not only the ones referenced by the selected MedicationDispense resources.

{{fhirurl}}/$export?_type=MedicationDispense,Medication&_typeFilter=MedicationDispense?whenhandedover=2024

1 Answer 1

1

There isn't a great solution for this currently, as the typeFilter query parameter is explicitly defined to not support _include. The best approach would be to parse the returned MedicationDispense resources and then run a new export for the relevant Medications.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, this seems quite an odd decision. I would imagine this use case occurs in many business environments. I am considering containing dependent Medication resources in the MedicationDispense resource as a workaround.
It isn't entirely bizarre. Bulk FHIR produces NDJSON files per resource type; if typeFilter did support _include, you'd have to think about how that impacts the bulk request. Your type parameter might need to define the related resource types you want to export (Medication, in your example), but then that leads to some confusion as to whether you want on Medications linked MedicationDispenses or all Medications independently. My point being, supporting _include is not trivial.
If you feel there should be to the Bulk FHIR IG, however, you can use the "Propose a change" at the bottom of each page in the IG to submit a change request.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.