Stream: implementers
Topic: using _elements along with include
Anand Jahagirdar (Jan 08 2020 at 14:29):
Hi
I would like to use *_elements *along with *include *parameter to extract specific fields from the resource included along with Query.
example:
http://server/fhir/Patient?include =Observation&include =DiagnosticReport
Here,
I want to select only status, and couple of other fields from DiagnosticReport ( not complete content).
Michele Mottini (Jan 08 2020 at 14:29):
_elements apply only to the resource being searched
Yunwei Wang (Jan 08 2020 at 14:40):
FHIR 3.1.1.5.9: The list of elements does not apply to included resources.
Lloyd McKenzie (Jan 08 2020 at 16:11):
If you want _elements to be expanded to allow application to included resources, you'll have to submit a change request. (And given that there was previously a conscious decision to not allow it, provide a convincing reason for adding the capability.) Due to search now being normative, my guess is we'd have to introduce a new construct rather than using _elements as I don't think changing this constraint would be backward compatible.
Anand Jahagirdar (Jan 09 2020 at 01:14):
The main intention of requesting _elements with include is data transfer optimization. I would like to use single network call to get all related FHIR resources. But Diagnostic report has report content which causes huge data to be transferred. If I can combine resources but omit Diagnostic report content to be transferred then query would be very efficient.
Lloyd McKenzie (Jan 09 2020 at 01:56):
You could also look at GraphQL - it gives much more control over what comes back
nicola (RIO/SS) (Jan 09 2020 at 08:11):
In aidbox, we have an extension for elements - https://docs.aidbox.app/basic-concepts/search-1/_elements#elements-and-rev-includes
Chris Schultz (Jan 09 2020 at 15:03):
You could also look at GraphQL - it gives much more control over what comes back
Could you expand on the suggestion to use graphQL to solve this problem?
*Are you suggesting to configure graphQL as a ‘pass-through’ device that only modifies output of certain queries?
*Or are you suggesting to create a graphQL API that strips the unwanted data? ( ie. getRelatedResourcesExceptReportText )
Lloyd McKenzie (Jan 09 2020 at 15:08):
GraphQL only returns the elements you ask for. It doesn't return full-blown resources.
Vassil Peytchev (Jan 09 2020 at 15:37):
There is a standard $graphql operation - see http://hl7.org/implement/standards/fhir/graphql.html
Michele Mottini (Jan 09 2020 at 15:39):
Lots of server do not support includes or elements - so be prepared to have to do multiple requests and have to deal with full payloads every time
Last updated: Apr 12 2022 at 19:14 UTC