Skip to main content

Questionnaires

A Questionnaire is a resource that defines a structured set of questions intended to gather information from a user or a system.

  • Usage of Profiles in Questionnaires: Questionnaires themselves can be constrained by profiles to ensure they meet specific requirements. However, the concept of inheriting a profile directly by a Questionnaire is less common. Instead, a Questionnaire can reference profiles to specify the structure of data it collects or to ensure that responses conform to certain profiles.

Example:

{
"resourceType": "Questionnaire",
"status": "active",
"date": "2024-06-04",
"item": [
{
"linkId": "1",
"text": "What is your name?",
"type": "string"
},
{
"linkId": "2",
"text": "What is your birth date?",
"type": "date"
}
]
}

This Questionnaire might be designed to collect information that conforms to a specific Patient profile, but it does not "inherit" the profile directly. Instead, a QuestionnaireResponse might be validated against a profile to ensure data collected aligns with the profile's constraints.

Summary

  • CapabilityStatements use profiles to declare which resource profiles are supported by the FHIR server.

  • Questionnaires do not inherit profiles directly but can be designed to collect data that conforms to specific profiles and ensure that QuestionnaireResponses align with those profiles.

In conclusion, while both CapabilityStatements and Questionnaires utilize profiles, they do so in different ways aligned with their respective purposes within the FHIR framework.

Profile is not supported as a resource

Begin with a minimum Questionnaire, unlike FHIR Examples and FHIR Capabilities, there is no reference to the FHIR Profiles.

Instance: DisabilityAssistanceQuestionnaire
InstanceOf: Questionnaire
Usage: #definition
* url = "https://build.fhir.org/ig/tewhatuora/cinc-fhir-ig/Questionnaire/DisabilityAssistanceQuestionnaire"
* identifier[0].use = #official
* identifier[=].value = "DisabilityAssistanceQuestionnaire"
* identifier[=].period.start = "2023-07-19"
* version = "0.2.2"
* name = "DisabilityAssistanceQuestionnaire"
* title = "Assistance Required based on Disability Condition"
* status = #draft

Wireframe

You can import your questionnaire to https://lhcformbuilder.nlm.nih.gov/, or use a query parameter to automatically load your questionnaire https://lhncbc.github.io/questionnaire-viewer/?q=https://ig.opennz.org/Questionnaire-AssistanceNeedsQuestionnaire.json.

The guide to install for yourself, either server or client side https://lhncbc.github.io/lforms/, this has been implemented in [FSH] FHIR Shorthand Implementation Guide.

a completed example, using an Code System

Alias: $questionnaire-item-control = http://hl7.org/fhir/questionnaire-item-control

Instance: AssistanceNeedsQuestionnaire
InstanceOf: Questionnaire
Description: "Assistance Requirements selection from terminology server"
Usage: #definition

* identifier[0].use = #official
* identifier[=].value = "assistance-needs-questionnaire"
* identifier[=].period.start = "2023-07-19"
* version = "0.2.2"
* name = "AssistanceNeedsQuestionnaire"
* title = "Assistance Needs Questionnaire"
* status = #draft
* subjectType = #Patient
* publisher = "Te Whatu Ora"
* contact.name = "Te Whatu Ora"
* contact.telecom.system = #url
* contact.telecom.value = "https://www.tewhatuora.govt.nz/"

* item[0].linkId = "disclaimer"
* item[=].prefix = "Introduction:"
* item[=].type = #boolean
* item[=].text = "Please confirm that this assistance preference is for an individual in need."
* item[=].required = true

* item[+].linkId = "needs"
* item[=].prefix = "Individual Need:"
* item[=].type = #group
* item[=].text = "Assistance"
* item[=].enableWhen.question = "disclaimer"
* item[=].enableWhen.operator = #=
* item[=].enableWhen.answerBoolean = true

* item[=].item[+].linkId = "needs-assistance"
* item[=].item[=].type = #open-choice
* item[=].item[=].repeats = true
* item[=].item[=].text = "What type of assistance to you require?"
* item[=].item[=].answerValueSet = Canonical(AssistanceNeedsValueSet)
* item[=].item[=].extension.url = "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl"
* item[=].item[=].extension.valueCodeableConcept = $questionnaire-item-control#drop-down "Drop down"
* item[=].item[=].extension.valueCodeableConcept.text = "Drop down"

To use a hard-coded choice list

* item[=].item[+].linkId = "needs-assistance"
* item[=].item[=].text = "What type of assistance to you require?"
* item[=].item[=].type = #choice
* item[=].item[=].answerOption[0].valueCoding.code = #171671000210109
* item[=].item[=].answerOption[=].valueCoding.display = "A New Zealand Sign Language interpreter"
* item[=].item[=].answerOption[+].valueCoding.code = #133920001
* item[=].item[=].answerOption[=].valueCoding.display = "Support to make decisions"
* item[=].item[=].answerOption[+].valueCoding.code = #amr
* item[=].item[=].answerOption[=].valueCoding.display = "Assistance to move around"
* item[=].item[=].answerOption[+].valueCoding.code = #lat
* item[=].item[=].answerOption[=].valueCoding.display = "A longer appointment time"
* item[=].item[=].answerOption[+].valueCoding.code = #qse
* item[=].item[=].answerOption[=].valueCoding.display = "A quiet or low sensory environment"
* item[=].item[=].answerOption[+].valueCoding.code = #msm
* item[=].item[=].answerOption[=].valueCoding.display = "More space to move around"
* item[=].item[=].extension.url = "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl"
* item[=].item[=].extension.valueCodeableConcept = $questionnaire-item-control#drop-down "Drop down"
* item[=].item[=].extension.valueCodeableConcept.text = "Drop down"

to set a hardcoded, hidden code

// Hidden fields to set hard-coded Category and SNOMED Code for "Level of dependence", "Assisted"
* item[=].item[0].linkId = "category"
* item[=].item[=].type = #choice
* item[=].item[=].initial[0].valueCoding.code = #717831006
* item[=].item[=].answerOption[0].valueCoding.code = #717831006
* item[=].item[=].extension[0].url = "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden"
* item[=].item[=].extension[=].valueBoolean = true

FHIR QuestionnaireResponse

This reflects the results of a completed Questionnaire. To assist in the reverse engineering of a response in FSH notation, use the LHC-Forms Questionnaire App

Instance: NeedsAssistanceResponse
InstanceOf: QuestionnaireResponse
Description: "Example response for NZ Sign Language Assistance"
Usage: #example
* status = #completed
* questionnaire = Canonical(AssistanceNeedsQuestionnaire)
* authored = "2024-06-17T12:00:00Z"
* item[0].linkId = "disclaimer"
* item[=].text = "Please confirm that this assistance preference is for an individual in need."
* item[=].answer[0].valueBoolean = true
* item[+].linkId = "needs"
* item[=].text = "Assistance"
* item[=].item[0].linkId = "category"
* item[=].item[=].answer[0].valueCoding.code = #717831006
* item[=].item[+].linkId = "code"
* item[=].item[=].answer[0].valueCoding.code = #371152001
* item[=].item[+].linkId = "needs-assistance"
* item[=].item[=].text = "What type of assistance to you require?"
* item[=].item[=].answer[0].valueCoding.code = #171671000210109
* item[=].item[=].answer[0].valueCoding.display = "A New Zealand Sign Language interpreter"