FHIR Chat · Combining Search not working as expected -- _list and · hapi

Stream: hapi

Topic: Combining Search not working as expected -- _list and


view this post on Zulip Saul Kravitz (May 21 2019 at 20:34):

Reference: https://www.hl7.org/fhir/search.html#combining

We are working on an IG for a medical formulary. Roughly the CoveragePlan is a List (with some extra stuff) and the Drugs in the Plan are MedicationKnowledge instances. The List refers to the MedicationKnowledge items.

Example CoveragePlan is: SaulExperimentCP2
https://api-v8-r4.hspconsortium.org/DrugFormulary1/open/List/SaulExperimentCP2
Example FormularyDrug is:
SaulExperimentFD2
https://api-v8-r4.hspconsortium.org/DrugFormulary1/open/MedicationKnowledge/SaulExperimentFD2

I'm trying to exercise FHIR-based search on this data, and things are not working as expected when I combine searches as per the documentation.
Here is what works, and what doesn't work. Basically I can search for (classification=A) and (classification=B) successfully, but searching for (classification=A)AND(classification=B) fails.

- this **works**:       https://api-v8-r4.hspconsortium.org/DrugFormulary1/open/MedicationKnowledge?classification=https://api-v8-r4.hspconsortium.org/DrugFormulary1/open/CodeSystem/usdrugformulary-DrugTierCS%7CBRAND

- this works: https://api-v8-r4.hspconsortium.org/DrugFormulary1/open/MedicationKnowledge?_list=SaulExperimentCP2&classification=BRAND
- this works search by DrugTier https://api-v8-r4.hspconsortium.org/DrugFormulary1/open/MedicationKnowledge?classification=https://api-v8-r4.hspconsortium.org/DrugFormulary1/open/CodeSystem/usdrugformulary-DrugTierCS%7CBRAND
- this fails: search by DrugTier AND planID with system https://api-v8-r4.hspconsortium.org/DrugFormulary1/open/MedicationKnowledge?classification=https://api-v8-r4.hspconsortium.org/DrugFormulary1/open/CodeSystem/usdrugformulary-DrugTierCS%7CBRAND&classification=https://api-v8-r4.hspconsortium.org/DrugFormulary1/open/CodeSystem/usdrugformulary-PlanIDCS|12345XX9876543
- this fails search by DrugTier and PlanID without system https://api-v8-r4.hspconsortium.org/DrugFormulary1/open/MedicationKnowledge?classification=12345XX9876543&classification=BRAND&_profile=https://api-v8-r4.hspconsortium.org/DrugFormulary1/open/StructureDefinition/usdrugformulary-FormularyDrug

The same failure modes are present if I use the _list to constrain the search to members of the list.

view this post on Zulip James Agnew (May 21 2019 at 21:00):

The _list search parameter is not yet implemented in HAPI FHIR unfortunately.

view this post on Zulip Saul Kravitz (May 21 2019 at 21:06):

Thanks for the quick response.

Is the failure searching for (classification=A)AND(classification=B) also expected.

view this post on Zulip James Agnew (May 22 2019 at 12:38):

No, that one should work.

The error message there doesn't look like it's coming from HAPI though... A good first step would probably be to see if you can reproduce this on hapi.fhir.org .. If not, this is probably a question for the HSPC developers.

view this post on Zulip Chris Moesel (May 22 2019 at 14:22):

Saul's 2nd-to-last query (w/ systems) does fail with a 400 -- which is the error message I expect @James Agnew is referring to. But if we take the system out of the picture we have this:

Given that the first two queries are successful and return _the same object_, we expect the third should also be successful. No error is returned, but it has an empty set of results. Do you still think that has something to do w/ HSPC implementation?

view this post on Zulip James Agnew (May 22 2019 at 15:07):

Well, 400 errors coming out of HAPI should typically return an OperationOutcome. E.g.:

https://api-v8-r4.hspconsortium.org/DrugFormulary1/open/MedicationKnowledge?foo=bar

It's suspicious to me that this one doesn't. I'd need to see a stack trace though to be sure..

view this post on Zulip Chris Moesel (May 22 2019 at 15:15):

@James Agnew -- right, but can you comment on the results of my last message, which does not trigger the 400 error at all?

view this post on Zulip James Agnew (May 22 2019 at 15:28):

that does look like something that should work, i'd agree.

view this post on Zulip James Agnew (May 22 2019 at 15:29):

this isn't my server though, so my ability to troubleshoot is limited.. reproducing it on HAPI would be a requirement in order for me to be able to do anything about it

view this post on Zulip Chris Moesel (May 22 2019 at 19:35):

Got it, thanks! @Saul Kravitz -- I'll leave the rest to you if you wish to try to reproduce this on the HAPI server.

view this post on Zulip Saul Kravitz (May 22 2019 at 20:09):

Will do.

view this post on Zulip Saul Kravitz (May 22 2019 at 20:55):

Short version: everything works fine on http://hapi.fhir.org/baseR4
Inserted two MedicationKnowledge objects -- http://hapi.fhir.org/baseR4/MedicationKnowledge/?
http://hapi.fhir.org/baseR4/MedicationKnowledge/SaulExperimentMK1
http://hapi.fhir.org/baseR4/MedicationKnowledge/SaulExperimentMK2

http://hapi.fhir.org/baseR4/MedicationKnowledge/?classification=BRAND returns both objects, as expected.
http://hapi.fhir.org/baseR4/MedicationKnowledge/?classification=BRAND &classification=12345XX9876544 returns one object, as expected.
http://hapi.fhir.org/baseR4/MedicationKnowledge/?classification=BRAND &classification=12345XX9876543 returns one object as expected
http://hapi.fhir.org/baseR4/MedicationKnowledge/?classification=12345XX9876544,12345XX9876543 returns two objects as expected.

In short, works as advertised...sigh....

Thoughts on how to debug the HSPC server?
I loaded the same two objects (MedicationKNowledge sans our extensions) into the HSPC server, and the 'AND' queries fail.

view this post on Zulip James Agnew (May 23 2019 at 01:17):

Hmm, wonder if this is a bug that's already fixed in 3.8.0. Might be worth waiting for the release (happening this coming tuesday) to see if that resolves things on the HSPC side.

view this post on Zulip Saul Kravitz (May 23 2019 at 14:41):

My test also fails on our own build of HAPI 3.7.
Look forward to 3.8 release....


Last updated: Apr 12 2022 at 19:14 UTC