Stream: implementers
Topic: GCP FHIR reverse chaining
Hue Nguyen (Mar 03 2021 at 07:40):
Hi all,
I'm working with GCP FHIR API and got some problems with reverse chaining.
I try to get resource ServiceRequest which has a relationship with Observation via Observation.basedOn
field.
The query will like:
POST <based URL>/ServiceRequest/_search?_has:Observation:based-on:status=final
My total Observation resource: 161 records. But Observation resources which have field based-on = ServiceRequest/{id}
is only 5.
That means if I search from ServiceRequest and reverse chaining to Observation, I'll get correct Observation data (5 records) without errors message.
Expect-result: 5 records
Actual result: error message:
{
"issue": [
{
"code": "value",
"details": {
"text": "invalid_query"
},
"diagnostics": "_has search failed: inner query on resource type 'Observation', search parameter 'status' returned too many results to expand (>100)",
"severity": "error"
}
],
"resourceType": "OperationOutcome"
}
Hue Nguyen (Mar 03 2021 at 08:33):
My image about the above query like this:
Fetch resource ServiceRequest that have an Observation where observation has a relationship with ServiceRequest (via based-on)[1] and have status=final [2]. [1] and [2] are AND condition
, that means result is 5.
But seem like [1] and [2] are not AND condition
, I think [2] is applied first and [1] is applied into [2] result. So, errors happen.
@Paul Church do you have any idea about this problem?
Paul Church (Mar 03 2021 at 22:25):
This is expected - the core limitation in our chain/reverse-chain implementation is that the inner query return <100 results. In this case the inner query is Observation?status=final which I assume has 161 results in this case.
Hue Nguyen (Mar 04 2021 at 09:01):
@Paul Church
My image about the above query like this:
Fetch resource ServiceRequest that have an Observation where observation has a relationship with ServiceRequest (via based-on)[1] and have status=final [2]. [1] and [2] are AND condition, that means the result is 5.
Is this correct imagination?
Paul Church (Mar 04 2021 at 18:45):
No, this is more like a join than an AND condition. It selects on status=final and then joins that result set against ServiceRequests using based-on.
Hue Nguyen (Mar 05 2021 at 02:12):
I see, Do you have any idea for me how to handle it? I asked the supporter of GCP, but they give me the solution is using BigQuery, but our customer doesn't want to use Bigquery.
Hue Nguyen (Mar 05 2021 at 02:14):
I try add more condition into query
POST <based URL>/ServiceRequest/_search?_has:Observation:based-on:status=final&_has:Observation:based-on:code=implement
But same error cause it's not AND condition. I wonder that can we do something like a composite field?
Last updated: Apr 12 2022 at 19:14 UTC