FHIR Chat · type=choice and answerOption.valueInteger? · questionnaire

Stream: questionnaire

Topic: type=choice and answerOption.valueInteger?


view this post on Zulip Paul Lynch (Apr 03 2020 at 19:49):

In R4, how does one represent a question whose answer options are a list of integers?
The definition of answerOption is "One of the permitted answers for a "choice" or "open-choice" question." Does mean the type can only be choice or open-choice? Then that means the answerOptions have valueCoding, not valueInteger.

view this post on Zulip Lloyd McKenzie (Apr 03 2020 at 19:53):

We're relaxing that. valueInteger is allowed

view this post on Zulip Paul Lynch (Apr 03 2020 at 19:57):

I know that it will be allowed, because are moving "choice" and "open-choice" out of the type list. But, what about in R4? Is type=integer and answerOption.valueInteger an allowed combination in R4?

view this post on Zulip Lloyd McKenzie (Apr 03 2020 at 20:42):

Yes

view this post on Zulip Johannes Oehm (Jun 07 2021 at 07:31):

I want to ask this just for clarification: In R4, when I want the user to choose an item from a list of Integers, say [1,3,5], I would have to use item.type = "integer" and item.anwerOption = [{valueInteger: 1}, {valueInteger: 3}, {valueInteger: 5}] and not item.type = "choice" and item.anwerOption = [{valueInteger: 1}, {valueInteger: 3}, {valueInteger: 5}], because item.type = choice implies that answerOptions only contain codes. Am I right?

view this post on Zulip Morten Ernebjerg (Jun 07 2021 at 08:09):

I second this question, reading the docs I was also slightly confused. In the detailed description of the Questionnaire.item.answerOption element, it says

One of the permitted answers for a "choice" or "open-choice" question.

which seems to suggest it should always used with those two types. Yet that clashes with the Question-Types section of the documentation which says that choice/open-choice questions can only be answered with a Coding, although answerOption allows a range of types (as @Johannes Oehm points out).

view this post on Zulip Tilo Christ (Jun 07 2021 at 10:40):

If the 1, 3, 5 happen to be points for a score, a Coding with an ordinalValue extension might be a valid method as well? https://www.hl7.org/fhir/extension-ordinalvalue.html

view this post on Zulip Lloyd McKenzie (Jun 07 2021 at 14:25):

Correct. 'choice' means 'Coding'. In r5, we're dropping choice and open-choice and replacing with Coding and handling open vs. closed differently.

view this post on Zulip Lloyd McKenzie (Jun 07 2021 at 14:25):

And yes, ordinalValue is possible if you're really talking about a code with a numeric weight.

view this post on Zulip Morten Ernebjerg (Jun 07 2021 at 16:11):

I see the definition of answerOption I quoted above has also been changed in R5 to drop the reference to choice and just say "One of the permitted answers for the question." That makes it clearer.

view this post on Zulip Johannes Oehm (Jun 08 2021 at 07:41):

Thank you for your reply, Lloyd! We'll use item.type = "integer" with an answerOption-list!

view this post on Zulip Morten Ernebjerg (Jun 08 2021 at 08:34):

@Lloyd McKenzie One follow-up question: the Java validator does not give an error for a Questionnaire that gives a list of strings an answerOption in a "choice" questions. Likewise, not error is shown if such a choice question is answered with a string (valueString) (Both cases illustrated by minimal example below). Should it not show an error in both cases?

view this post on Zulip Lloyd McKenzie (Jun 08 2021 at 13:26):

It should. Can you submit a Git issue?

view this post on Zulip Morten Ernebjerg (Jun 08 2021 at 15:33):

Sure, will do.

view this post on Zulip Morten Ernebjerg (Jun 08 2021 at 16:15):

Here: org.hl7.fhir.core issue #534


Last updated: Apr 12 2022 at 19:14 UTC