Stream: argonaut
Topic: Conditions warning constraint bug
Nick George (Mar 03 2022 at 00:36):
Hello, I think there's a bug in the UsCoreCondition warning constraint:
where(category.memberOf('http://hl7.org/fhir/us/core/ValueSet/us-core-condition-category')).exists()
AFAIKT, memberOf is not defined for repeated fields.
Should this instead be
category.where(memberOf('http://hl7.org/fhir/us/core/ValueSet/us-core-condition-category')).exists()
?
Eric Haas (Mar 03 2022 at 15:57):
@GG ? or any other FHIR path wizards can you confirm?
Lee Surprenant (Mar 03 2022 at 20:49):
from https://hl7.org/fhirpath/#functions
With a few minor exceptions (e.g. the today() function), functions in FHIRPath always operate on a collection of values (referred to as the input collection) and produce another collection as output (referred to as the output collection), even though these may be collections of just a single item.
Lee Surprenant (Mar 03 2022 at 20:54):
but i'm not actually sure if that applies here or not. i've always been confused about when you need a .where and when you dont
Lee Surprenant (Mar 03 2022 at 21:15):
FWIW, I checked our implementation and our memberOf function wants a singleton input collection as well, so I think nick is right that category.where(memberOf('http://hl7.org/fhir/us/core/ValueSet/us-core-condition-category')).exists()
would be the better option.
would still be interested in hearing confirmation that this is "correct" though
Nick George (Mar 03 2022 at 21:31):
If we assume that category.memberOf
returns a collection, it would presumably be like {true, false, false}
.... I still think
where({true, false, false})
would be invalid? I.e., the arg to where should be a condition to evaluate per element, not a collection of bools, IIUC
Nick George (Mar 03 2022 at 23:51):
(deleted)
Nick George (Mar 07 2022 at 17:08):
Should I file this as an issue in Jira? pull request in github? sorry, haven't contributed much to US core yet...
Eric Haas (Mar 07 2022 at 17:39):
Jira tracker please
Lee Surprenant (Mar 16 2022 at 17:10):
@Nick George did you ever open an issue for this one? I re-raised it at https://chat.fhir.org/#narrow/stream/179266-fhirpath/topic/do.20all.20functions.20work.20on.20repeating.20fields.3F but didn't open anything yet (for either "what should functions do by default when its not specified what to do for an input collection" or for this particular expression)
Lee Surprenant (Mar 16 2022 at 17:11):
I was reminded of it because I found another US Core expression with a similar issue (provenance-1)...I did open an issue for that one
Eric Haas (Mar 17 2022 at 16:45):
please log a tracker
Lee Surprenant (Mar 17 2022 at 18:40):
FHIR-36328 is the one I had opened for that provenance-1 issue.
Now I submitted FHIR-36336 for this Condition one, but I accidentally hit submit before finishing the title. should be "Problematic fhirpath in Condition Profile constraint us-core-1"
Last updated: Apr 12 2022 at 19:14 UTC