Stream: implementers
Topic: Provenance Query For Resource
Nihar (Jul 19 2021 at 07:30):
Hello, We have the following queries related to the implementation of Provenance as query (Provenance:target) vs. Provenance as the Resource (read)
-
When we are using the query for _revIncludes: Provenance:target for the particular resources then why the entire bundle that was retrieved under the search query needs to be repeated along with the targeted reference data? Please guide.
e.g. https://ResourceServer/r4/Observation?_revinclude=Provenance:target&code=72166-2&patient=123
This query first gives all the data of Smoking Status same as the search interaction ( https://ResournceServer/r4/Observation?code=72166-2&patient=123) and it mentions about the target data with reference. -
When we are querying the provenance for the resources then it should contain only those reference which are referenced under that particular resource or it should be same as read interaction under the provenance as the resources?
e.g. https://ResourceServer/r4/Observation?_revinclude=Provenance:target&code=72166-2&patient=123
This target data with reference under this query should
-
Contain only those targeted reference which are referenced under the Smoking Status data
OR -
Contain exactly the same data that is available as target data with reference under the Provenance profile read interactions. (https://ResournceServer/r4/Provenance/321).
Please suggest.Thanks in advance.
Lloyd McKenzie (Jul 19 2021 at 12:57):
- "include" means exactly that. You will always get the primary resource you're searching on. _include and _revinclude retrieve additional data for each record found in the main result set. This means that you need to be cautious about what you choose to include. If you were to query on Patient and do a _revinclude on Observation, if you set the page size to 50 records, your first page could include hundreds of thousands of resources because each patient might have hundreds of thousands of Observations
- When you do an _include, think of it as executing in two steps. First, the base search is done and the search set Bundle is prepared. Then, you go through the search set Bundle and for each element referenced in an _include, you perform a read on that element and add it as an additional entry to the Bundle (with a search.mode of 'include'). For each element referenced by a _revinclude, you perform a search on that resource checking for references to any of the ids found in the main searchset and copy those entries, adjusting their search.mode to 'include' too. If any of the includes were set to "iterate", then you run the process again and again until the search set stops changing.
Lloyd McKenzie (Jul 19 2021 at 13:00):
Note that there are no rules in terms of order of the included entries - they might appear at the end, intermingled with the main results or even theoretically all at the beginning.
Nihar (Jul 22 2021 at 08:41):
@Lloyd McKenzie Thank you so much for the detailed clarity.
Last updated: Apr 12 2022 at 19:14 UTC