FHIR Chat · FHIRPath node navigation · fhirpath

Stream: fhirpath

Topic: FHIRPath node navigation


view this post on Zulip David Fallas (May 10 2021 at 01:47):

I am using FHIRPath (C# libraries v3.2.0) to locate target node(s) in a somewhat deeply nested QuestionnaireResponse. When I have found an ITypedElement of interest (using Select(...)), I want to navigate to it's parent and sibling nodes. I haven't yet been able to figure out how to do this. I'd be grateful if someone could point me in the right direction.

view this post on Zulip Lloyd McKenzie (May 10 2021 at 02:45):

There's no ability to navigate to parents, ancestors or siblings in FHIRPath. What are you trying to do that requires that sort of navigation?

view this post on Zulip David Fallas (May 11 2021 at 21:50):

@Lloyd McKenzie thanks for the response and apologies for my tardy rejoinder. I have restructured the select string to retrieve the ancestor that I want by having a couple of and predicates.For posterity, the select is "item.descendants().where('{0}'.indexOf($this.linkId) >= 0 and $this.descendants().where('{1}'.indexOf($this.linkId) >= 0 and answer.value=true))" (the two place-holders are lists of Coagulation analytes).
Now that I have the item I want, I have run into problems with the ToPoco<>() call - it throws 'System.MissingMethodException : Cannot create an abstract class'. Any thoughts anyone?

view this post on Zulip David Fallas (May 12 2021 at 19:19):

OK - I get it, it is the QuestionnaireResponse.ItemComponent that cannot be instantiated. So now that I have the ITypedElement node of interest, it finally dawns on me that I must use the interface to explore the node's Children collection(s). For sure, previous experience with XPath was getting in the way, and I had unwarranted expectations of FHIRPath (put that down to a 'senior moment').

view this post on Zulip RP (May 12 2021 at 22:08):

(deleted)


Last updated: Apr 12 2022 at 19:14 UTC