FHIR Chat · ofType() for non choice elements · fhirpath

Stream: fhirpath

Topic: ofType() for non choice elements


view this post on Zulip David Winters (Oct 28 2021 at 12:46):

I understand that when specifying the path for a choice element we have the option to use isType() to specify the type. Can we also use this approach for non choice elements? This seems to work in the fhirpath.js demo, but wanted to get people's thoughts about using isType() to specify the path of an element.

view this post on Zulip Lloyd McKenzie (Oct 28 2021 at 15:13):

isType doesn't specify a path, it just filters what matches. I.e. if you say "Observation.value.isType(string), the "path" is Observation.value. You're then filtering to only include the Observation.value occurrences that happen to have a type of string. It's perfectly legitimate to say Patient.birthDate.isType(date). However, it's also perfectly useless :) I.e. you're not going to filter anything because - by definition - if you've got a birthDate, it's going to have a type of 'date'.

view this post on Zulip David Winters (Nov 04 2021 at 12:55):

I misspoke about isType(). Didn't mean using it to specify path. Meant it as a filter on non-choice types. Obviously the filter won't do anything on non-choice types, but it sounds like it is legal to do this.


Last updated: Apr 12 2022 at 19:14 UTC