Stream: implementers
Topic: Boolean Search Logic when Chaining
Kevin O'Donnell (Feb 22 2019 at 22:04):
Can someone confirm the Boolean semantics on the search.html page for multiple parameters, e.g. for 2 terms
Resource?Parameter1=value1&Parameter2=value2
It seems to say that:
- if Parameter1 and Parameter2 are regular parameters, then it would return Resources where Parameter1=value1 AND Parameter2=value2
- if Parameter1 and Parameter2 are chained parameters, then it would return Resources where Parameter1=value1 OR Parameter2=value2 (see text about Joe from Montana)
It seems odd that the Boolean semantics would flip if you chain, but there’s a fair chance I misunderstood or overlooked something.
Lloyd McKenzie (Feb 22 2019 at 22:21):
It should be AND all the time. Where are you seeing an indication it's OR for chaining?
Kevin O'Donnell (Feb 22 2019 at 23:10):
https://www.hl7.org/fhir/search.html#chaining
says
GET Patient?general-practitioner.name=Joe&general-practitioner.address-state=MN
may return Patients cared for by Joe from CA and Jane from MN: no one practitioner need satisfy both conditions.
Seemed to be OR which seemed odd.
Michele Mottini (Feb 22 2019 at 23:19):
It is an AND: it is returning patients that have a general practitioner named Joe AND a general practitioner in Montana - that can be well be two different ones, because a patient has a list of them
Michele Mottini (Feb 22 2019 at 23:21):
what that note says is that the 'AND' is at the level of the resource being searched for (Patient), and not for the chained resource (Practitioner)
Kevin O'Donnell (Feb 22 2019 at 23:33):
OK. So if you wanted to get patients cared for by Joe from Montana?
Michele Mottini (Feb 22 2019 at 23:40):
You first search for that Practitioner and then search for Patient using the id(s) returned by the first search
Grahame Grieve (Feb 22 2019 at 23:53):
or use _filter which can mix ands and ors properly
Kevin O'Donnell (Feb 23 2019 at 00:06):
So the "ORish-ness" at the practitioner level only comes into play because a patient can have multiple practitioners.
If I was chaining for encounters based on patient details:
GET Encounter?subject.identifier=1234
would probably work as expected, and
GET Encounter?subject.name=John Smith&subject.birthdate=1967-07-01
would likely also work as expected unless there was an encounter with two subjects.
Michele Mottini (Feb 23 2019 at 00:09):
Correct
Kevin O'Donnell (Feb 23 2019 at 00:31):
Cool, thanks! Now I get it. (Some tweaks to the example on the search.html might help :slight_smile: )
Lloyd McKenzie (Feb 23 2019 at 00:48):
@Kevin O'Donnell If you have proposed wording that would add clarity, feel free to submit a change proposal
Kevin O'Donnell (Feb 27 2019 at 01:09):
@Lloyd McKenzie OK. Sent some proposed text to Elliot to feed in through II/WG20
Brian Postlethwaite (Jul 02 2019 at 10:08):
Did this get logged into a tracker?
(link at the bottom of the page)
Elliot Silver (Jul 08 2019 at 21:27):
I don't believe I submitted the issue, sorry.
Last updated: Apr 12 2022 at 19:14 UTC