Implement _revinclude on Search API #1947
Labels
effort:medium
Medium effort - 3 to 5 days
P1
High priority issue
type:enhancement
New feature or request
Milestone
Is your feature request related to a problem? Please describe.
Implement
_revinclude
on the client Search API. This should cause the search response to include resources (that have a relationship to the primary resources) in the returned result.Describe the solution you'd like
Implement a new function (
Search#include
) like theSearch#has
function in the search DSL that should cause the search response to include resources that have a relationship with the primary resource in the returned search result.Describe alternatives you've considered
None that is related to using existing functionality on the search DSL. I however contemplated running two queries i.e. run a query to fetch the primary resources, then run a custom SQL query (not supported) that uses SQL UNION against the
ReferenceIndexEntity
table to fetch the accompanying resources for each of the primary resource. The example below fetches accompanying resources (Tasks, Conditions and CarePlan) for the Patient referenced with idPatient/fee261ad-4e90-4054-9cd3-906a60362c59
.Additional context
The implementation for this function should be close to
Search#has
for instance in this example:Fetch all Patients with Condition Diabetes,
Search#has
would return just the Patient resources with the Condition, whereas the new function should also include theConditions
in the result.See Search parameter's _revinclude
The text was updated successfully, but these errors were encountered: