Stream: fhirpath.js
Topic: Context for `.union`
Josh Mandel (Mar 20 2022 at 22:47):
Is it expected that
name.select(use | given)
should return different results from
name.select(use.union(given))
? I would have expected these to be equivalent but union
appears to be operating at the root level even when it occurs inside a select
.
Josh Mandel (Mar 20 2022 at 22:50):
Ah, https://hl7.org/fhirpath/#unionother-collection explicitly states that these should be equivalent, so it looks like a bug in fhirpath.js unless I'm missing something.
Paul Lynch (Mar 21 2022 at 17:48):
It is not clear us whether the documentation means "a" and "b" are elements of the same node. For some functions, in a.someFunction(b), "b" is interpreted as being a child of the elements in "a", and I think that is how fhirpath.js is handling union.
Paul Lynch (Mar 21 2022 at 17:49):
Note that in https://hl7.org/fhirpath/#function-invocations, the full path is used.
Patient.telecom.where(use = 'official').union(Patient.contact.telecom.where(use = 'official')).exists().not()
(Though, that has "contact" in the path, so it not quite a counter-example.)
Paul Lynch (Mar 21 2022 at 17:49):
Maybe this should be discussed on the fhirpath stream?
Last updated: Apr 12 2022 at 19:14 UTC