Stream: implementers
Topic: Search result Resource Types
Ken Sinn (Jan 27 2020 at 20:15):
Hi all,
Quick sanity check.
When we perform a Search of "GET [base]/[type]?name=value&...{&_format=[mime-type]}}" (https://www.hl7.org/fhir/search.html#Introduction), are the Search results (bundle.entry) in the SearchSet bundle limited to resources of type "[type]"?
I know there are exceptions allowed for OperationOutcome, and use of _include/_revinclude. Aside from these two exceptions, could a search on "GET [base]/PractitionerRole?family=Jones" return a Bundle containing bundle.entries of PractitionerRole + Practitioner + Location resources? (not contained, each resource in its own bundle.entry).
I'm pretty sure this is not conformant, but I also do not see any explicit rules limiting the SearchSet bundle restricting it to resources of type "[type]", though it is quite implicit by the language on the http.html and search.html pages.
Lloyd McKenzie (Jan 27 2020 at 22:17):
It's totally fine for search results to contain resources other than the searched type. Each entry in the search result will have a search.mode that categorizes the entry as one of three things: result, include or outcome. All of the 'result' entries would need to have a type of PractitionerRole in your example. All of the Practitioner and Location resources would have a mode of 'include' (assuming that you used the necessary _include or _revinclude parameters in your search). If there were warnings about the execution of the query, those would be in an OperationOutcome flagged with a mode of 'outcome'.
Lloyd McKenzie (Jan 27 2020 at 22:17):
If you think further clarification would be helpful, feel free to submit a change request.
Ken Sinn (Jan 27 2020 at 22:31):
Thanks Lloyd, that was my understanding. Without the necessary _include or _revinclude parameters, only PractitionerRole resources should be returned as Bundle.entries, correct? Just wanted to make sure I wasn't overlooking any undocumented features.
Lloyd McKenzie (Jan 28 2020 at 00:26):
In theory, a server can change what query it executes. Normally this involves removing parameters it doesn't understand, but occasionally it might add an extra parameter (like a sort). Adding unrequested _include or _revinclude seems odd behavior, but we haven't said it's prohibited.
Ken Sinn (Jan 28 2020 at 00:36):
Interesting. So a server may decide that the Search request would be more useful with additional supplemental resources within the SearchSet bundle, and serve it up with Bundle.entry.search.mode="include", even if _include and _revinclude were not part of the search parameters. Are there plans to restrict this type of behaviour, or is FHIR planning to leave the specification as is?
Grahame Grieve (Jan 28 2020 at 00:49):
I don't think we'd want to prohibit that in the base spec, but it might be something useful for IGs to say something about
Lloyd McKenzie (Jan 28 2020 at 02:42):
One example that might be semi-reasonable is providing Provenance instances unrequested with data if the queried data is being returned from multiple sources and the source believes that difference is important - though of course merely pushing data out of the hose doesn't mean receiving systems can/will drink it.
Last updated: Apr 12 2022 at 19:14 UTC