FHIR Chat · Score sum example? · questionnaire

Stream: questionnaire

Topic: Score sum example?


view this post on Zulip Paul Lynch (May 21 2019 at 22:20):

Does anyone have an example of using FHIRPath to sum the scores (ordinalValue) for the answers of a QuestionnaireResponse? I can write FHIRPath that finds individual scores and explicitly add each one, but I am having trouble coming up with an expression that would work with FHIRPath's aggregate function without making simplifying assumptions.

view this post on Zulip Paul Lynch (May 22 2019 at 22:11):

Here is the FHIRPath I wrote to retrieve the score associated with just one of answers in a PHQ-9 form:

%questionnaire.item.where(linkId = '/44260-8').answerOption.where(valueCoding.code=%resource.item.where(linkId = '/44260-8').answer.valueCoding.code).extension.where(url=%scoreExt).valueDecimal

I had to write nine of those, and ended up putting them in variables, because sometimes the value was empty, and so I needed to wrap each value inside "iif" before adding them together.
Is there a simpler approach?

view this post on Zulip Lloyd McKenzie (May 22 2019 at 23:31):

@Bryn Rhodes @Grahame Grieve ?

view this post on Zulip Brian Postlethwaite (May 23 2019 at 23:44):

Got a reference to that whole form @Paul Lynch?

view this post on Zulip Paul Lynch (May 24 2019 at 02:37):

https://raw.githubusercontent.com/lhncbc/lforms-fhir-app/observation-extract/e2e-tests/data/R4/phq9.json


Last updated: Apr 12 2022 at 19:14 UTC