Stream: questionnaire
Topic: selectable options in a question
Sebastiaan Raap (Dec 07 2021 at 16:27):
Hi, I'm trying to add this question into a Questionnaire: How many minutes do you exercise per day/week/month? answer is an Int, but I want the user to be able to select [day/week/month]. Is there a way to do this in fhir? thanks!
Paul Lynch (Dec 07 2021 at 17:01):
Type "quantity"?
Lloyd McKenzie (Dec 07 2021 at 17:57):
That or a child question or separate question
Sebastiaan Raap (Dec 07 2021 at 18:32):
hmm yes child question could work, thank you! Quantity is hard because we're using a slider.
Sebastiaan Raap (Dec 08 2021 at 10:18):
I've tried child questions but it doesn't solve my use case unfortunately. I need to be able to add options to the question. I thinking about extending the questionnaire.item.text something like:
{
"item": [
{
"type": "integer",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
"valueCoding": {
"code": "min",
"display": "minutes"
}
},
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept":
{
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "slider",
"display": "Slider"
}
],
"text": "Slider"
}
},
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-sliderStepValue",
"valueInteger": 10
},
{
"url": "http://hl7.org/fhir/StructureDefinition/minValue",
"valueInteger": 0
},
{
"url": "http://hl7.org/fhir/StructureDefinition/maxValue",
"valueInteger": 300
}
],
"required": false,
"linkId": "medicalprofile.lifestyle.exercise",
"text": "How many minutes per day do you exercise?",
"_text": {
"extension": [
{
"url": "https://somemedicaltechcompany.world/fhir/extensions/questionnaire-valuePerX",
"extension": [
{
"url": "text",
"valueString": "How many minutes per {{valuePerX}} do you exercise?"
},
{
"url": "options",
"valueCodeableConcept": {
"coding": [
{
"code": "d",
"display": "day"
},
{
"code": "w",
"display": "week"
},
{
"code": "m",
"display": "month"
}
]
}
}
]
}
]
}
}
]
}
But I'm searching for a more generic option, your help is appreciated!
Brian Postlethwaite (Dec 08 2021 at 14:03):
Does slider not work with quantity?
As with that you already have the units extension.
Lloyd McKenzie (Dec 08 2021 at 14:10):
Can you explain why child questions don't work? Because your extension isn't going to give you an ability to capture an additional answer in the QuestionnaireResponse...
Sebastiaan Raap (Dec 08 2021 at 15:21):
Our gui shows a question like this: "How many minutes per [day/week/month] do you exercise?" user is able to choose from a dropdown between day/week/month within the question. So the user can adjust the question to: "How many minutes per day do you exercise? or "How many minutes per month do you exercise?" In the child question there would be the slider with minutes, that would work.
I think my question is more clear like this: Can I somehow incorporate a dropdown inside the question (normally in item.text) so that the user can manipulate what question it is answering (in the child question)?
Lloyd McKenzie (Dec 08 2021 at 15:26):
Not really. Everything the user selects needs to be a separate question so it can have a distinct answer in the QuestionnaireResponse. The meaning of a question needs to be the same for all QuestionnaireResponses
Lloyd McKenzie (Dec 08 2021 at 15:27):
You can't have a single question that in one response means "how many hours" and ad in a different response means "how many days" unless the hours/days aspect is captured in the answer to a separate question in the response.
Lloyd McKenzie (Dec 08 2021 at 15:30):
You can say "We're going to capture some information about how much you exercise. 1. Would you prefer to capture that information per day, per week or per month? 2. How many minutes to you exercise each [period]?"
Lloyd McKenzie (Dec 08 2021 at 15:30):
And that would result in two answers - "per day", "35 min"
Tilo Christ (Dec 08 2021 at 17:46):
(putting the aspect of whether a filler supporting this already exists aside...): Shouldn't it be possible to do a question of type "quantity", with the "http://build.fhir.org/ig/HL7/sdc/behavior.html#unitOption" extension to allow a choice of "day/month/week" for the unit selection, and an itemControl of type "slider" to visualise it as a slider?
Lloyd McKenzie (Dec 08 2021 at 18:12):
In theory, maybe. I doubt you'd find many form fillers who knew how to do that gracefully.
Tilo Christ (Dec 08 2021 at 18:40):
I had a few minutes, so one exists now :tada:
image.png
Paul Lynch (Dec 08 2021 at 23:01):
itemControl of type "slider" would apply to the question's value, not the unit, wouldn't it?
Tilo Christ (Dec 08 2021 at 23:08):
Here's the item in my questionnaire that corresponds to the above screenshot.
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "slider",
"display": "Slider"
}
],
"text": "A control where an axis is displayed between the high and low values and the control can be visually manipulated to select a value anywhere on the axis."
}
},
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unitValueSet",
"valueCanonical": "http://hl7.org/fhir/ValueSet/ucum-bodyweight"
},
{
"url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-minQuantity",
"valueQuantity": {
"value": 10,
"system": "http://unitsofmeasure.org",
"code": "kg"
}
},
{
"url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-maxQuantity",
"valueQuantity": {
"value": 100,
"system": "http://unitsofmeasure.org",
"code": "kg"
}
}
],
"linkId": "2.8.b-weight-quantity",
"text": "Body Weight",
"type": "quantity"
},
Last updated: Apr 12 2022 at 19:14 UTC