Stream: implementers
Topic: FHIRPath Singleton Evaluation of Collections
Michael Calderero (Mar 30 2018 at 14:46):
I figured it would be best to branch of this specific topic from https://chat.fhir.org/#narrow/stream/implementers/topic/FHIRPath.20Specification.20Questions since that one kind of got taken to another direction.
I downloaded the latest definitions.xml from build.fhir.org and I still see a few invariants that I think will fail for this specific case.
1. invariant cnt-3 for Count type: it still uses '(code or value.empty())...'
2. invariant dis-1 for Distance type: it still uses '(code or value.empty())...'
3. invariant opd-2 for OperationDefinition resource: it uses 'searchType implies type...'
I presume these need to be updated to use code.exists() or searchType.exists() so that FHIRPath engines that follow the spec will not throw errors?
Michael Calderero (Mar 30 2018 at 15:05):
And speaking of FHIRPath engines that follow this spec (i.e. https://github.com/FHIR/fluentpath/blob/master/spec/index.adoc#singleton-evaluation-of-collections), I don't think any of the FHIRPath reference implementations follow it.
1. Pascal RI: https://github.com/grahamegrieve/fhirserver/blob/master/reference-platform/r4/FhirPath.pas (search for 'function TFHIRPathEngine.convertToBoolean(items: TFHIRSelectionList): boolean')
2. Java RI: https://gforge.hl7.org/gf/project/fhir/scmsvn/?action=browse&path=%2Ftrunk%2Fbuild%2Fimplementations%2Fjava%2Forg.hl7.fhir.r4%2Fsrc%2Forg%2Fhl7%2Ffhir%2Fr4%2Futils%2FFHIRPathEngine.java&view=markup&revision=13543 (search for 'public boolean convertToBoolean(List<Base> items) {')
3. .NET RI: https://github.com/ewoutkramer/fhir-net-api/blob/master/src/Hl7.FhirPath/FhirPath/Functions/CollectionOperators.cs (search for 'public static bool? BooleanEval(this IEnumerable<IElementNavigator> focus)')
Instead of 'raise error' they return true if the list is non-empty and non-Boolean. Perhaps it would be best to update these also?
Grahame Grieve (Mar 30 2018 at 20:19):
will look into this in 24hours
Grahame Grieve (Mar 31 2018 at 19:48):
personally, I think the spec is wrong on this point. It's a difference between editors, I guess. We will hve to reconcile this in the ballot due out next week
Grahame Grieve (Mar 31 2018 at 19:51):
but I fixed them for now, thanks
Christiaan Knaap (Apr 06 2018 at 16:03):
@Ewout Kramer ?
Grahame Grieve (Apr 06 2018 at 19:30):
so this should be sorted in the new version of FHIRPath being balloted now
Last updated: Apr 12 2022 at 19:14 UTC