FHIR Chat · implementation of in().not() · fhirpath.js

Stream: fhirpath.js

Topic: implementation of in().not()


view this post on Zulip Tim Harsch (Jun 11 2020 at 02:34):

Hi, I was trying the suggested fhirpath in fhirpath.js. Something like Bundle.entry.resource.where(resourceType in ('Observation' | 'AllergyIntolerance' | 'Procedure')).not() I fed it a bundle of only 'Conditions' and it returns to me an empty collection. I tried a few variations of grouping with parens, but nothing seemed to change the result. Any ideas?

view this post on Zulip Paul Lynch (Jun 11 2020 at 15:33):

The expression with not() needs to be inside the where(...). Otherwise you are applying not() to the result of the where().

view this post on Zulip Tim Harsch (Jun 11 2020 at 15:47):

I had thought that too so I tried these as well: Bundle.entry.resource.where((resourceType in ('Observation' | 'AllergyIntolerance' | 'Procedure')).not()) and Bundle.entry.resource.where(resourceType in ('Observation' | 'AllergyIntolerance' | 'Procedure').not()). The latter makes more sense to me, but not sure since all 3 forms return empty collection.

view this post on Zulip Paul Lynch (Jun 11 2020 at 15:50):

I tried the following with bundle of Observations you shared earlier, and got Observations back:
fhirpath --expression "Bundle.entry.resource.where((resourceType in ('AllergyIntolerance' | 'Procedure')).not())" --resourceFile DanielJohnson.Observations.json

view this post on Zulip Tim Harsch (Jun 11 2020 at 16:05):

hmmm. and you have the not() wrapping the expression.. I'm working with a different data file that contains only Conditions. let me try switching back to Observations with your expression and then working forward from there.

view this post on Zulip Tim Harsch (Jun 11 2020 at 19:32):

That worked well in my environment. thank you!


Last updated: Apr 12 2022 at 19:14 UTC