FHIR Chat · Composite Search · implementers

Stream: implementers

Topic: Composite Search


view this post on Zulip Yunwei Wang (Jan 11 2021 at 20:01):

At http://build.fhir.org/search.html#combining, there is example of composite search with multiple parameters GET [base]/Group?characteristic-value=gender$mixed,owner$Eve. Is this returns gender=mixed OR owner=Eve or gender=mixed AND owner=Eve?

view this post on Zulip Yunwei Wang (Jan 11 2021 at 20:59):

Hmm, found an old post https://chat.fhir.org/#narrow/stream/179166-implementers/topic/Search.20with.20OR.20parameters which indicate this is OR logic.
I think for AND, I have to say

 [base]/Group?characteristic-value=gender$mixed&characteristic-value=owner$Eve

Is that correct?

view this post on Zulip Yunwei Wang (Jan 12 2021 at 15:08):

Thanks @René Spronk . Then the next question is how do I put that AND logic into chaining search. Ex, I would like to get all Conditions for a group that have both mixed gender AND owned by Eve?

GET [base]/Condition?subject:Group.characteristic-value=gender$mixed&subject:Group.characteristic-value=owner$Eve

Is this correct? Or that returns union of Conditions from two separate groups
I am little bit confused by the comments that

Note that chained parameters are applied independently to the target resource

view this post on Zulip René Spronk (Jan 12 2021 at 15:29):

You may have to test this - there are some edge cases where the logic works in unexpected ways. I'm unable to make a definite statement either way. @Lloyd McKenzie ?

view this post on Zulip Lloyd McKenzie (Jan 12 2021 at 17:09):

Each search criteria separated by & is evaluated independently. If you want multiple conditions to hold on a chained resource, you need one of the following approaches:

  • a composite search criteria on the target resource (e.g. code-value-x on Observation) or you need to look
  • use _filter or graphql
  • break it into multiple queries

view this post on Zulip Yunwei Wang (Jan 12 2021 at 17:21):

I am trying to figure out the logic behind this.
Patient?language=FR&language=EN is an INTERSECTION of two criteria (Patient speak both FR and EN)
Patient?general-practitioner.name=Joe&general-practitioner.address-state=MN is an UNION of the two critera
Why there is such difference?

view this post on Zulip Paul Church (Jan 12 2021 at 17:25):

Both criteria are 'and'. The difference is that the 'and' is outside the join, not inside, so the 'general-practitioner' is not necessarily matching the same one in both clauses.

view this post on Zulip Yunwei Wang (Jan 12 2021 at 17:31):

Thanks @Paul Church Can you explain a little bit more? That has confused me for a long time.

view this post on Zulip Paul Church (Jan 12 2021 at 17:32):

FHIR search doesn't have a way to express Patient?general-practitioner.(name=Joe&address-state=MN)

view this post on Zulip Paul Church (Jan 12 2021 at 17:33):

(leaving aside alternate query formats like _filter)

view this post on Zulip Paul Church (Jan 12 2021 at 17:33):

If general-practitioner had only one value, then it would be the same.

view this post on Zulip Lloyd McKenzie (Jan 12 2021 at 18:29):

The intersection is "Patients who have a GP with a name of Joe" and "Patients who have a GP with an address in Minnesota", not "Patients who have a GP whose name is Joe and address is in Minnesota"

view this post on Zulip Lloyd McKenzie (Jan 12 2021 at 18:30):

Because patients can have multiple GPs, the reality of that difference can have a significant impact on results

view this post on Zulip Yunwei Wang (Jan 12 2021 at 18:31):

What I am trying to understand is:
We know that Patient?language=FR&language=EN results {Patient?language=FR} INTERSECT {Patient?Language=EN}
then why Patient?general-practitioner.name=Joe&general-practitioner.address-state=MN does NOT result as {Patient?general-practitioner.name=Joe} INTERSECT {Patient?general-practitioner.address-state=MN}
Is there anything that I missed here?

view this post on Zulip Paul Church (Jan 12 2021 at 18:32):

it does result in that intersection

view this post on Zulip Yunwei Wang (Jan 12 2021 at 18:34):

Thanks @Lloyd McKenzie The last sentence is what I missed! A patient could have multiple GP.

view this post on Zulip Yunwei Wang (Jan 12 2021 at 18:47):

Though this does not address the problem on my hand. I need to find conditions for a certain group and each group has multiple characteristics, such as "gender=male, age in [21,30], location=Chicago". I need to find a way to do the search. Looks like I have to create an operation to do that.

view this post on Zulip Lloyd McKenzie (Jan 12 2021 at 20:05):

It's that or _filter or graphql or multiple queries

view this post on Zulip Yunwei Wang (Jan 12 2021 at 21:57):

Another question, the Group.characteristic search parameter is token type. How do I search CodeableConcept with only text, like

    "code":[
      "text": "gender"
    ]

view this post on Zulip Lloyd McKenzie (Jan 13 2021 at 04:39):

the 'text' qualifier is supported on token search parameters

view this post on Zulip Lloyd McKenzie (Jan 13 2021 at 04:39):

so foo:text=gender

view this post on Zulip Chetan Jain (Jun 30 2021 at 16:08):

@Lloyd McKenzie Could you provide some example or do we have any public server available which supports _filter and which we can explore? Thanks!!

view this post on Zulip Lloyd McKenzie (Jun 30 2021 at 18:25):

test.fhir.org supports _filter.

view this post on Zulip Chetan Jain (Jul 01 2021 at 08:44):

@Lloyd McKenzie test.fhir.org seems to be down.

view this post on Zulip René Spronk (Jul 01 2021 at 11:10):

Yup, it's down - see https://stats.uptimerobot.com/9DArDu1Jo for stats.

view this post on Zulip Lloyd McKenzie (Jul 01 2021 at 14:52):

@Mark Iantorno @Grahame Grieve

view this post on Zulip Mark Iantorno (Jul 01 2021 at 14:57):

on it

view this post on Zulip Mark Iantorno (Jul 01 2021 at 14:59):

it'

view this post on Zulip Mark Iantorno (Jul 01 2021 at 15:00):

it doesn't appear to be down for me

view this post on Zulip Mark Iantorno (Jul 01 2021 at 15:00):

http://test.fhir.org/

view this post on Zulip Mark Iantorno (Jul 01 2021 at 15:00):

@Lloyd McKenzie did you or someone else reset it?

view this post on Zulip Lloyd McKenzie (Jul 01 2021 at 19:45):

I didn't do anything

view this post on Zulip Grahame Grieve (Jul 01 2021 at 19:47):

I did


Last updated: Apr 12 2022 at 19:14 UTC