FHIR Chat · ways of returning additional resources using _include · implementers

Stream: implementers

Topic: ways of returning additional resources using _include


view this post on Zulip Vijay Chandra (Jan 06 2021 at 05:50):

I am exploring the ways to return additional resources in a search result bundle when parameter '_include' is used in the search query.

HAPI documentation states the below---


FHIR allows clients to request that specific linked resources be included as contained resources, which means that they will be "embedded" in a special container called "contained" within the parent resource.


Also in the documentation on resource references its mentioned as below---


Handling Includes (_include) in a Bundle
Your server code may also wish to add additional resource to a bundle being returned (e.g. because of an _include directive in the client's request).


Want to know if returning the additional resources as "contained" resources to searched parent resource is correct way to do.

view this post on Zulip Grahame Grieve (Jan 06 2021 at 06:35):

it's certainly not something described in the specification, and our strong recommendation is that you should never use contained resources unless you have no choice

view this post on Zulip Lloyd McKenzie (Jan 06 2021 at 16:18):

If 'contained' is used, it's used because the data source doesn't treat the resource as stand-alone. I.e. it's never independently retrievable and is always provided only within that specific containing resource. There's also an expectation (though not a requirement) that the data consumer will store the data the same way. Contained is not a handy packaging mechanism for transport. If your objective is to package multiple resources as part of a single mechanism, the solution is Bundle.

view this post on Zulip Vassil Peytchev (Jan 06 2021 at 18:50):

I think the main point here is that the following is incorrect:

FHIR allows clients to request that specific linked resources be included as contained resources, which means that they will be "embedded" in a special container called "contained" within the parent resource.

And by incorrect, I mean that a compliant FHIR server shall not allow "clients to request that specific linked resources be included as contained resources". My guess is that the above is left-over from a much earlier version of HAPI...

view this post on Zulip Lloyd McKenzie (Jan 07 2021 at 02:56):

I don't know that it's strictly non-compliant, but it's certainly extremely bad practice.

view this post on Zulip Lloyd McKenzie (Jan 07 2021 at 02:56):

@James Agnew ?

view this post on Zulip James Agnew (Jan 07 2021 at 14:12):

That documentation is definitely incorrect. Looks like a copy and paste mistake, or possibly just something carried over from an earlier time as Vassil suggests.

@Vijay Chandra HAPI's _include functionality works as the FHIR spec describes - it allows additional resources to be included in the returned bundle if the search target links to them, and has nothing to do with what FHIR calls "contained resources".

view this post on Zulip Vijay Chandra (Jan 08 2021 at 11:51):

Thanks all for the responses and clarifying the point. Thanks, Vijay


Last updated: Apr 12 2022 at 19:14 UTC