hl7-fhirhapi-fhirsmart-on-fhir

Personalizing question text in a FHIR Questionnaire


Generally I would expect a FHIR Questionnaire's questions' text to be static (i.e. a PHQ-9 Questionnaire). However for non-standardized forms, such as an intake specific to one clinic, there could be questions where the text should be personalized for user experience.

A scenario would be a parent / guardian filling out an intake for their pediatric dependent. For a more personal touch, the question text could be something like "Please tell us John's height".

There's two approaches I can think of to make this work with FHIR Questionnaires:

  1. Create pseudo-templating business logic within a Questionnaire. This would require any consumer of this resource though to understand the templating. For example:

    • Questionnaire.item[x].text: "Please tell us {dependent_name}'s height."
    • Questionnaire.item[x].extension[] -> A new extension mapping the template variable "dependent_name" to an enum or identifier "DEPENDENT_NAME". Consumers need to know when they see this, go figure out the name.
  2. Generate personalized FHIR Questionnaires off of a reference / static Questionnaire. This Questionnaire would still include something in the text indicating it needs to be replaced, but each intake would generate a copy of that reference Questionnaire, populating the text as needed, and serving this personalized copy to the patient.

    • Reference Questionnaire.item[x].text: "Please tell us {dependent_name}'s height."
    • Personalized Questionnaire.item[x].text: "Please tell us John's height."
    • Personalized Questionnaire.derivedFrom: canonical reference to the reference Questionnaire.

Are there any other options for these types of scenarios?


Solution

  • There's a standard extension for doing what you want to do. If you look at the SDC Advanced Rendering profile, you'll see there's a cqf-expression extension on the item.text element. That allows you to specify a FHIRPath or CQL expression that determines what the rendered text ought to be. (You can do the same thing for a bunch of other element on the Advanced Behavior profile.)

    Also take a look at the SDC section on expressions which will give guidance on how to set some of those variables using things like the launch-context extension.