Stream: dotnet
Topic: R4 FhirPath Expressions
Angus Millar (Nov 09 2018 at 09:09):
Has anyone else run into this problem with quite a few R4 search FHIRPath expressions throwing this type of error when using the .NET FhirPath implementation.
`Invocation of 'binary.|' failed: Invocation of 'binary.as' failed: Cannot cast from 'collection' to 'any single value'
An example of this is the Observation search Parameter name: combo-value-concept which has the expression of:
`(Observation.value as CodeableConcept) | (Observation.component.value as CodeableConcept)'
It is actually the second part of the 'Or' that makes it fail, this part 'Observation.component.value as CodeableConcept' and
I think it is because 'Observation.component.value' returns many and many cannot be cast to 'CodeableConcept'.
A test case that shows this failing is to load this example resource from the spec into a server http://hl7.org/fhir/2018Sep/observation-example-1minute-apgar-score.xml.html as that example has many Observation components.
I tried loading that resource into Graham's Server http://test.fhir.org/r4, at first I got errors about extensions so I removed all of the extensions found in that resource, then I got a horrible exception. I can only assume due to the same problem I have, maybe.
What I am struggling with is what is the root problem, I feel like it is the expression its self, not the FHIRPath implementation.
Has anyone else seen commentary on this problem?
Ewout Kramer (Nov 19 2018 at 15:42):
Hi Angus - the .NET FhirPath library has not yet been updated to R4. However @Brian Postlethwaite has helped me out and will send me a PR for this soon.
Last updated: Apr 12 2022 at 19:14 UTC