Structured Data Capture
4.0.0-ballot - STU 4 ballot International flag

Structured Data Capture, published by HL7 International / FHIR Infrastructure. This guide is not an authorized publication; it is the continuous build for version 4.0.0-ballot built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/sdc/ and changes regularly. See the Directory of published versions

Examples

Page standards status: Informative

Below are some examples that demonstrate how the elements and extensions in this implementation guide are intended to be used in a Questionnaire. Note: The rendering of the questions in the "Sample Question" tab are not functional (i.e. no validations after entry, perform actual computations, etc). They only provide a visual presentation of the questions and do not mimic how they will work in an actual questionnaire.




Text Appearance

Using rendering-style

To display a question text in green. (Example Questionnaire)

Enter your First Name

{
  "resourceType" : "BackboneElement",
  "linkId" : "1.1",
  "text" : "Enter your First Name",
  "_text" : {
    "extension" : [
      {
        "url" : "http://hl7.org/fhir/StructureDefinition/rendering-style",
        "valueString" : "color:green;"
      }
    ]
  },
  "type" : "string"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <linkId value="1.1"/>
  <text value="Enter your First Name">
    <extension url="http://hl7.org/fhir/StructureDefinition/rendering-style">
      <valueString value="color:green;"/>
    </extension>
  </text>
  <type value="string"/>
</BackboneElement>

Using rendering-xhtml

To allow different styles to different portions of a question text. (Example Questionnaire)

Please answer Yes or No to each of the following questions:

{
  "resourceType" : "BackboneElement",
  "linkId" : "1.2",
  "text" : "Please answer Yes or No to each of the following questions:",
  "_text" : {
    "extension" : [
      {
        "url" : "http://hl7.org/fhir/StructureDefinition/rendering-xhtml",
        "valueString" : "Please answer Yes or No to each of the following questions:"
      }
    ]
  },
  "type" : "display"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <linkId value="1.2"/>
  <text value="Please answer Yes or No to each of the following questions:">
    <extension url="http://hl7.org/fhir/StructureDefinition/rendering-xhtml">
      <valueString
                   value="Please answer Yes or No to each of the following questions:"/>
    </extension>
  </text>
  <type value="display"/>
</BackboneElement>

Using displayCategory

To indicate what kind of display item it is so that systems can apply differential formatting based on the purpose of the display element. (Example Questionnaire)

ALL QUESTIONS CONTAINED IN THIS QUESTIONNAIRE ARE OPTIONAL AND WILL BE KEPT STRICTLY CONFIDENTIAL.

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory",
      "valueCodeableConcept" : {
        "coding" : [
          {
            "system" : "http://hl7.org/fhir/questionnaire-display-category",
            "code" : "security",
            "display" : "Security"
          }
        ],
        "text" : "The text provides guidance on how the information will be handled from a security perspective."
      }
    }
  ],
  "linkId" : "1.3",
  "text" : "ALL QUESTIONS CONTAINED IN THIS QUESTIONNAIRE ARE OPTIONAL AND WILL BE KEPT STRICTLY CONFIDENTIAL.",
  "type" : "display"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory">
    <valueCodeableConcept>
      <coding>
        <system value="http://hl7.org/fhir/questionnaire-display-category"/>
        <code value="security"/>
        <display value="Security"/>
      </coding>
      <text
            value="The text provides guidance on how the information will be handled from a security perspective."/>
    </valueCodeableConcept>
  </extension>
  <linkId value="1.3"/>
  <text
        value="ALL QUESTIONS CONTAINED IN THIS QUESTIONNAIRE ARE OPTIONAL AND WILL BE KEPT STRICTLY CONFIDENTIAL."/>
  <type value="display"/>
</BackboneElement>

Using hidden

To hide an item to a user. This example has a question for Form ID that is not displayed. (Example Questionnaire)

Event ID

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden",
      "valueBoolean" : true
    }
  ],
  "linkId" : "1.4.1",
  "text" : "Form ID",
  "type" : "string"
}
ERROR Expanding Fragment

Control Appearance

Using itemControl

To display a text box where a user can type in their answer freely. (Example Questionnaire)

If you have any other medical problems or serious injuries, please describe them here:

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
      "valueCodeableConcept" : {
        "coding" : [
          {
            "system" : "http://hl7.org/fhir/questionnaire-item-control",
            "code" : "text-box",
            "display" : "Text Box"
          }
        ],
        "text" : "A control where a user can type in their answer freely."
      }
    }
  ],
  "linkId" : "2.1",
  "text" : "If you have any other medical problems or serious injuries, please describe them here:",
  "type" : "text"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl">
    <valueCodeableConcept>
      <coding>
        <system value="http://hl7.org/fhir/questionnaire-item-control"/>
        <code value="text-box"/>
        <display value="Text Box"/>
      </coding>
      <text value="A control where a user can type in their answer freely."/>
    </valueCodeableConcept>
  </extension>
  <linkId value="2.1"/>
  <text
        value="If you have any other medical problems or serious injuries, please describe them here:"/>
  <type value="text"/>
</BackboneElement>

Using choiceOrientation

To display choices horizontally. (Example Questionnaire)

Gender: Female   Male   Other   Unknown 

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation",
      "valueCode" : "horizontal"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
      "valueCodeableConcept" : {
        "coding" : [
          {
            "system" : "http://hl7.org/fhir/questionnaire-item-control",
            "code" : "radio-button",
            "display" : "Radio Button"
          }
        ],
        "text" : "A control where choices are listed with a button beside them. The button can be toggled to select or de-select a given choice. Selecting one item deselects all others."
      }
    }
  ],
  "linkId" : "2.2",
  "text" : "Gender:",
  "type" : "choice",
  "answerOption" : [
    {
      "valueCoding" : {
        "system" : "http://hl7.org/fhir/administrative-gender",
        "code" : "female",
        "display" : "Female"
      },
      "initialSelected" : true
    },
    {
      "valueCoding" : {
        "system" : "http://hl7.org/fhir/administrative-gender",
        "code" : "male",
        "display" : "Male"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://hl7.org/fhir/administrative-gender",
        "code" : "other",
        "display" : "Other"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://hl7.org/fhir/administrative-gender",
        "code" : "unknown",
        "display" : "Unknown"
      }
    }
  ]
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation">
    <valueCode value="horizontal"/>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl">
    <valueCodeableConcept>
      <coding>
        <system value="http://hl7.org/fhir/questionnaire-item-control"/>
        <code value="radio-button"/>
        <display value="Radio Button"/>
      </coding>
      <text
            value="A control where choices are listed with a button beside them. The button can be toggled to select or de-select a given choice. Selecting one item deselects all others."/>
    </valueCodeableConcept>
  </extension>
  <linkId value="2.2"/>
  <text value="Gender:"/>
  <type value="choice"/>
  <answerOption>
    <valueCoding>
      <system value="http://hl7.org/fhir/administrative-gender"/>
      <code value="female"/>
      <display value="Female"/>
    </valueCoding>
    <initialSelected value="true"/>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://hl7.org/fhir/administrative-gender"/>
      <code value="male"/>
      <display value="Male"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://hl7.org/fhir/administrative-gender"/>
      <code value="other"/>
      <display value="Other"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://hl7.org/fhir/administrative-gender"/>
      <code value="unknown"/>
      <display value="Unknown"/>
    </valueCoding>
  </answerOption>
</BackboneElement>

Using sliderStepValue

To indicate the increment of a slider itemControl. (Example Questionnaire)

Rate your doctor:

0
Completely
dissatisfied
100
Completely
satisfied
{
  "resourceType" : "BackboneElement",
  "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-sliderStepValue",
      "valueInteger" : 10
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/minValue",
      "valueInteger" : 0
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/maxValue",
      "valueInteger" : 100
    }
  ],
  "linkId" : "2.3",
  "text" : "Rate your doctor:",
  "type" : "integer",
  "initial" : [
    {
      "valueInteger" : 50
    }
  ],
  "item" : [
    {
      "extension" : [
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
          "valueCodeableConcept" : {
            "coding" : [
              {
                "system" : "http://hl7.org/fhir/questionnaire-item-control",
                "code" : "lower",
                "display" : "Lower-bound"
              }
            ]
          }
        }
      ],
      "linkId" : "2.3.1",
      "text" : "Completely dissatisfied",
      "type" : "display"
    },
    {
      "extension" : [
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
          "valueCodeableConcept" : {
            "coding" : [
              {
                "system" : "http://hl7.org/fhir/questionnaire-item-control",
                "code" : "upper",
                "display" : "Upper-bound"
              }
            ]
          }
        }
      ],
      "linkId" : "2.3.2",
      "text" : "Completely satisfied",
      "type" : "display"
    }
  ]
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl">
    <valueCodeableConcept>
      <coding>
        <system value="http://hl7.org/fhir/questionnaire-item-control"/>
        <code value="slider"/>
        <display value="Slider"/>
      </coding>
      <text
            value="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."/>
    </valueCodeableConcept>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-sliderStepValue">
    <valueInteger value="10"/>
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/minValue">
    <valueInteger value="0"/>
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/maxValue">
    <valueInteger value="100"/>
  </extension>
  <linkId value="2.3"/>
  <text value="Rate your doctor:"/>
  <type value="integer"/>
  <initial>
    <valueInteger value="50"/>
  </initial>
  <item>
    <extension
               url="http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl">
      <valueCodeableConcept>
        <coding>
          <system value="http://hl7.org/fhir/questionnaire-item-control"/>
          <code value="lower"/>
          <display value="Lower-bound"/>
        </coding>
      </valueCodeableConcept>
    </extension>
    <linkId value="2.3.1"/>
    <text value="Completely dissatisfied"/>
    <type value="display"/>
  </item>
  <item>
    <extension
               url="http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl">
      <valueCodeableConcept>
        <coding>
          <system value="http://hl7.org/fhir/questionnaire-item-control"/>
          <code value="upper"/>
          <display value="Upper-bound"/>
        </coding>
      </valueCodeableConcept>
    </extension>
    <linkId value="2.3.2"/>
    <text value="Completely satisfied"/>
    <type value="display"/>
  </item>
</BackboneElement>

Using width

To set the width of a column in a table. (Example Questionnaire)

Medical History

Diabetes Other Information
Type 1 Hypertension
Type 2 Smoker

ERROR Expanding Fragment
ERROR Expanding Fragment

Using collapsible

To display child items in collapsible form. (Example Questionnaire)

Relationship to patient
Name
Gender Female   Male   Other   Unknown

ERROR Expanding Fragment
ERROR Expanding Fragment

Using columnCount

To control the number of columns used for checkboxes or radio buttons. (Example Questionnaire)

Pick the time-slot that works best for you:

9-10am 11am-12pm 2-3pm
10-11am 1-2pm 3-4pm
{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-columnCount",
      "valuePositiveInt" : 3
    }
  ],
  "linkId" : "3.9",
  "text" : "Which of the following time-slots are you available for?",
  "type" : "string",
  "answerOption" : [
    {
      "valueString" : "9-10am"
    },
    {
      "valueString" : "10-11am"
    },
    {
      "valueString" : "11am-12pm"
    },
    {
      "valueString" : "1-2pm"
    },
    {
      "valueString" : "2-3pm"
    },
    {
      "valueString" : "3-4pm"
    }
  ]
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-columnCount">
    <valuePositiveInt value="3"/>
  </extension>
  <linkId value="3.9"/>
  <text value="Which of the following time-slots are you available for?"/>
  <type value="string"/>
  <answerOption>
    <valueString value="9-10am"/>
  </answerOption>
  <answerOption>
    <valueString value="10-11am"/>
  </answerOption>
  <answerOption>
    <valueString value="11am-12pm"/>
  </answerOption>
  <answerOption>
    <valueString value="1-2pm"/>
  </answerOption>
  <answerOption>
    <valueString value="2-3pm"/>
  </answerOption>
  <answerOption>
    <valueString value="3-4pm"/>
  </answerOption>
</BackboneElement>

Additional Display Content

Using supportLink

To add a a support link to a question that will provide more information to the user. (Example Questionnaire)

Have you traveled outside the country within the last 14 days?
Yes
No

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-supportLink",
      "valueUri" : "http://hl7.org/fhir/StructureDefinition/questionnaire-supportLink"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
      "valueCodeableConcept" : {
        "coding" : [
          {
            "system" : "http://hl7.org/fhir/questionnaire-item-control",
            "code" : "radio-button",
            "display" : "Radio Button"
          }
        ],
        "text" : "A control where choices are listed with a button beside them. The button can be toggled to select or de-select a given choice. Selecting one item deselects all others."
      }
    }
  ],
  "linkId" : "3.1",
  "text" : "Have you traveled outside the country within the last 14 days?",
  "type" : "choice",
  "answerOption" : [
    {
      "valueCoding" : {
        "system" : "http://terminology.hl7.org/CodeSystem/v2-0532",
        "code" : "Y",
        "display" : "Yes"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://terminology.hl7.org/CodeSystem/v2-0532",
        "code" : "N",
        "display" : "No"
      }
    }
  ]
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-supportLink">
    <valueUri
              value="http://hl7.org/fhir/StructureDefinition/questionnaire-supportLink"/>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl">
    <valueCodeableConcept>
      <coding>
        <system value="http://hl7.org/fhir/questionnaire-item-control"/>
        <code value="radio-button"/>
        <display value="Radio Button"/>
      </coding>
      <text
            value="A control where choices are listed with a button beside them. The button can be toggled to select or de-select a given choice. Selecting one item deselects all others."/>
    </valueCodeableConcept>
  </extension>
  <linkId value="3.1"/>
  <text
        value="Have you traveled outside the country within the last 14 days?"/>
  <type value="choice"/>
  <answerOption>
    <valueCoding>
      <system value="http://terminology.hl7.org/CodeSystem/v2-0532"/>
      <code value="Y"/>
      <display value="Yes"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://terminology.hl7.org/CodeSystem/v2-0532"/>
      <code value="N"/>
      <display value="No"/>
    </valueCoding>
  </answerOption>
</BackboneElement>

Using choiceColumn

To display choices with multiple columns. (Example Questionnaire)

Select Platelet:

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
      "valueCodeableConcept" : {
        "coding" : [
          {
            "system" : "http://hl7.org/fhir/questionnaire-item-control",
            "code" : "drop-down",
            "display" : "Drop down"
          }
        ]
      }
    },
    {
      "extension" : [
        {
          "url" : "path",
          "valueString" : "code"
        },
        {
          "url" : "label",
          "valueString" : "CODE"
        },
        {
          "url" : "width",
          "valueQuantity" : {
            "value" : 25,
            "system" : "http://unitsofmeasure.org",
            "code" : "%"
          }
        },
        {
          "url" : "forDisplay",
          "valueBoolean" : false
        }
      ],
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn"
    },
    {
      "extension" : [
        {
          "url" : "path",
          "valueString" : "display"
        },
        {
          "url" : "label",
          "valueString" : "DESCRIPTION"
        },
        {
          "url" : "width",
          "valueQuantity" : {
            "value" : 75,
            "system" : "http://unitsofmeasure.org",
            "code" : "%"
          }
        },
        {
          "url" : "forDisplay",
          "valueBoolean" : true
        }
      ],
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn"
    }
  ],
  "linkId" : "3.2",
  "text" : "Select Platelet:",
  "type" : "choice",
  "answerValueSet" : "http://loinc.org/vs/LL715-4"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl">
    <valueCodeableConcept>
      <coding>
        <system value="http://hl7.org/fhir/questionnaire-item-control"/>
        <code value="drop-down"/>
        <display value="Drop down"/>
      </coding>
    </valueCodeableConcept>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn">
    <extension url="path">
      <valueString value="code"/>
    </extension>
    <extension url="label">
      <valueString value="CODE"/>
    </extension>
    <extension url="width">
      <valueQuantity>
        <value value="25"/>
        <system value="http://unitsofmeasure.org"/>
        <code value="%"/>
      </valueQuantity>
    </extension>
    <extension url="forDisplay">
      <valueBoolean value="false"/>
    </extension>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn">
    <extension url="path">
      <valueString value="display"/>
    </extension>
    <extension url="label">
      <valueString value="DESCRIPTION"/>
    </extension>
    <extension url="width">
      <valueQuantity>
        <value value="75"/>
        <system value="http://unitsofmeasure.org"/>
        <code value="%"/>
      </valueQuantity>
    </extension>
    <extension url="forDisplay">
      <valueBoolean value="true"/>
    </extension>
  </extension>
  <linkId value="3.2"/>
  <text value="Select Platelet:"/>
  <type value="choice"/>
  <answerValueSet value="http://loinc.org/vs/LL715-4"/>
</BackboneElement>

Using optionPrefix

To add prefixes on answer options. (Example Questionnaire)

Gender:
(a) Female  
(b) Male  
(c) Other  
(d) Unknown 

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
      "valueCodeableConcept" : {
        "coding" : [
          {
            "system" : "http://hl7.org/fhir/questionnaire-item-control",
            "code" : "radio-button",
            "display" : "Radio Button"
          }
        ],
        "text" : "A control where choices are listed with a button beside them. The button can be toggled to select or de-select a given choice. Selecting one item deselects all others."
      }
    }
  ],
  "linkId" : "3.3",
  "text" : "Gender:",
  "type" : "choice",
  "answerOption" : [
    {
      "extension" : [
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-optionPrefix",
          "valueString" : "(a)"
        }
      ],
      "valueCoding" : {
        "system" : "http://hl7.org/fhir/administrative-gender",
        "code" : "female",
        "display" : "Female"
      },
      "initialSelected" : true
    },
    {
      "extension" : [
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-optionPrefix",
          "valueString" : "(b)"
        }
      ],
      "valueCoding" : {
        "system" : "http://hl7.org/fhir/administrative-gender",
        "code" : "male",
        "display" : "Male"
      }
    },
    {
      "extension" : [
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-optionPrefix",
          "valueString" : "(c)"
        }
      ],
      "valueCoding" : {
        "system" : "http://hl7.org/fhir/administrative-gender",
        "code" : "other",
        "display" : "Other"
      }
    },
    {
      "extension" : [
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-optionPrefix",
          "valueString" : "(d)"
        }
      ],
      "valueCoding" : {
        "system" : "http://hl7.org/fhir/administrative-gender",
        "code" : "unknown",
        "display" : "Unknown"
      }
    }
  ]
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl">
    <valueCodeableConcept>
      <coding>
        <system value="http://hl7.org/fhir/questionnaire-item-control"/>
        <code value="radio-button"/>
        <display value="Radio Button"/>
      </coding>
      <text
            value="A control where choices are listed with a button beside them. The button can be toggled to select or de-select a given choice. Selecting one item deselects all others."/>
    </valueCodeableConcept>
  </extension>
  <linkId value="3.3"/>
  <text value="Gender:"/>
  <type value="choice"/>
  <answerOption>
    <extension
               url="http://hl7.org/fhir/StructureDefinition/questionnaire-optionPrefix">
      <valueString value="(a)"/>
    </extension>
    <valueCoding>
      <system value="http://hl7.org/fhir/administrative-gender"/>
      <code value="female"/>
      <display value="Female"/>
    </valueCoding>
    <initialSelected value="true"/>
  </answerOption>
  <answerOption>
    <extension
               url="http://hl7.org/fhir/StructureDefinition/questionnaire-optionPrefix">
      <valueString value="(b)"/>
    </extension>
    <valueCoding>
      <system value="http://hl7.org/fhir/administrative-gender"/>
      <code value="male"/>
      <display value="Male"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <extension
               url="http://hl7.org/fhir/StructureDefinition/questionnaire-optionPrefix">
      <valueString value="(c)"/>
    </extension>
    <valueCoding>
      <system value="http://hl7.org/fhir/administrative-gender"/>
      <code value="other"/>
      <display value="Other"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <extension
               url="http://hl7.org/fhir/StructureDefinition/questionnaire-optionPrefix">
      <valueString value="(d)"/>
    </extension>
    <valueCoding>
      <system value="http://hl7.org/fhir/administrative-gender"/>
      <code value="unknown"/>
      <display value="Unknown"/>
    </valueCoding>
  </answerOption>
</BackboneElement>

Using valueset-label

To add prefixes on a value set. (Example Questionnaire)

Enter timing of harm assessment:
 A. Within 24 hours 
 B. After 24 hours but before 3 days 
 C. Three days or later 
 D. Unknown 

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation",
      "valueCode" : "vertical"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
      "valueCodeableConcept" : {
        "coding" : [
          {
            "system" : "http://hl7.org/fhir/questionnaire-item-control",
            "code" : "radio-button",
            "display" : "Radio Button"
          }
        ],
        "text" : "A control where choices are listed with a button beside them. The button can be toggled to select or de-select a given choice. Selecting one item deselects all others."
      }
    }
  ],
  "linkId" : "3.4",
  "text" : "Enter timing of harm assessment:",
  "type" : "choice",
  "answerValueSet" : "#LL2821-8"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation">
    <valueCode value="vertical"/>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl">
    <valueCodeableConcept>
      <coding>
        <system value="http://hl7.org/fhir/questionnaire-item-control"/>
        <code value="radio-button"/>
        <display value="Radio Button"/>
      </coding>
      <text
            value="A control where choices are listed with a button beside them. The button can be toggled to select or de-select a given choice. Selecting one item deselects all others."/>
    </valueCodeableConcept>
  </extension>
  <linkId value="3.4"/>
  <text value="Enter timing of harm assessment:"/>
  <type value="choice"/>
  <answerValueSet value="#LL2821-8"/>
</BackboneElement>

Using entryFormat

To add instructions for the user to guide their input. (Example Questionnaire)

Birth Date

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/entryFormat",
      "valueString" : "mm-dd-yyyy"
    }
  ],
  "linkId" : "3.5",
  "text" : "Birth Date",
  "type" : "date"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension url="http://hl7.org/fhir/StructureDefinition/entryFormat">
    <valueString value="mm-dd-yyyy"/>
  </extension>
  <linkId value="3.5"/>
  <text value="Birth Date"/>
  <type value="date"/>
</BackboneElement>

Using rendering-styleSensitive

To indicate that the style extensions on a resource is essential. (Example Questionnaire)

IMPORTANT: Please complete questionnaire.

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/rendering-styleSensitive",
      "valueBoolean" : true
    }
  ],
  "linkId" : "3.6",
  "text" : "IMPORTANT: Please complete questionnaire.",
  "_text" : {
    "extension" : [
      {
        "url" : "http://hl7.org/fhir/StructureDefinition/rendering-style",
        "valueString" : "color:red;"
      },
      {
        "url" : "http://hl7.org/fhir/StructureDefinition/rendering-xhtml",
        "valueString" : "IMPORTANT: Please complete questionnaire."
      }
    ]
  },
  "type" : "display"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/rendering-styleSensitive">
    <valueBoolean value="true"/>
  </extension>
  <linkId value="3.6"/>
  <text value="IMPORTANT: Please complete questionnaire.">
    <extension url="http://hl7.org/fhir/StructureDefinition/rendering-style">
      <valueString value="color:red;"/>
    </extension>
    <extension url="http://hl7.org/fhir/StructureDefinition/rendering-xhtml">
      <valueString value="IMPORTANT: Please complete questionnaire."/>
    </extension>
  </text>
  <type value="display"/>
</BackboneElement>

Using shortText

To display a shorter text for an item. (Example Questionnaire)

Annual family income

{
  "resourceType" : "BackboneElement",
  "linkId" : "1.2",
  "text" : "Please answer Yes or No to each of the following questions:",
  "_text" : {
    "extension" : [
      {
        "url" : "http://hl7.org/fhir/StructureDefinition/rendering-xhtml",
        "valueString" : "Please answer Yes or No to each of the following questions:"
      }
    ]
  },
  "type" : "display"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <linkId value="1.2"/>
  <text value="Please answer Yes or No to each of the following questions:">
    <extension url="http://hl7.org/fhir/StructureDefinition/rendering-xhtml">
      <valueString
                   value="Please answer Yes or No to each of the following questions:"/>
    </extension>
  </text>
  <type value="display"/>
</BackboneElement>

Value constraints

Using maxLength

To restrict an answer to only have 50 characters. (Example Questionnaire)

Enter your First Name

{
  "resourceType" : "BackboneElement",
  "linkId" : "1.1",
  "text" : "First Name",
  "type" : "string",
  "maxLength" : 50
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <linkId value="1.1"/>
  <text value="First Name"/>
  <type value="string"/>
  <maxLength value="50"/>
</BackboneElement>

Using minLength

To restrict an answer to have at least 2 characters. (Example Questionnaire)

Enter your Last Name

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/minLength",
      "valueInteger" : 2
    }
  ],
  "linkId" : "1.2",
  "text" : "Last Name",
  "type" : "string"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension url="http://hl7.org/fhir/StructureDefinition/minLength">
    <valueInteger value="2"/>
  </extension>
  <linkId value="1.2"/>
  <text value="Last Name"/>
  <type value="string"/>
</BackboneElement>

Using minValue, maxValue, and maxDecimalPlaces

To restrict an answer to range from 1 to 100, up to 2 decimal places (Example Questionnaire)

Enter your weight in kg

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/minValue",
      "valueDecimal" : 1
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/maxValue",
      "valueDecimal" : 100
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/maxDecimalPlaces",
      "valueInteger" : 2
    }
  ],
  "linkId" : "1.4",
  "text" : "Enter your weight in kg",
  "type" : "decimal"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension url="http://hl7.org/fhir/StructureDefinition/minValue">
    <valueDecimal value="1"/>
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/maxValue">
    <valueDecimal value="100"/>
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/maxDecimalPlaces">
    <valueInteger value="2"/>
  </extension>
  <linkId value="1.4"/>
  <text value="Enter your weight in kg"/>
  <type value="decimal"/>
</BackboneElement>

Using minQuantity and maxQuantity

To restrict the answer to range from 10 to 100 kilograms. (Example Questionnaire)

Body Weight

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "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" : "1.5",
  "text" : "Body Weight",
  "type" : "quantity"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-unitValueSet">
    <valueCanonical value="http://hl7.org/fhir/ValueSet/ucum-bodyweight"/>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-minQuantity">
    <valueQuantity>
      <value value="10"/>
      <system value="http://unitsofmeasure.org"/>
      <code value="kg"/>
    </valueQuantity>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-maxQuantity">
    <valueQuantity>
      <value value="100"/>
      <system value="http://unitsofmeasure.org"/>
      <code value="kg"/>
    </valueQuantity>
  </extension>
  <linkId value="1.5"/>
  <text value="Body Weight"/>
  <type value="quantity"/>
</BackboneElement>

Using mimeType and maxSize

To only allow a JPG or PDF attachment, up to 1,048,576 bytes. (Example Questionnaire)

Attach Proof of Citizenship

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/mimeType",
      "valueCode" : "image/jpeg"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/mimeType",
      "valueCode" : "application/pdf"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/maxSize",
      "valueDecimal" : 1048576
    }
  ],
  "linkId" : "1.6",
  "text" : "Attach Proof of Citizenship",
  "type" : "attachment"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension url="http://hl7.org/fhir/StructureDefinition/mimeType">
    <valueCode value="image/jpeg"/>
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/mimeType">
    <valueCode value="application/pdf"/>
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/maxSize">
    <valueDecimal value="1048576"/>
  </extension>
  <linkId value="1.6"/>
  <text value="Attach Proof of Citizenship"/>
  <type value="attachment"/>
</BackboneElement>

Choice Restriction

Using answerOption

To restrict choices from a fixed list. (Example Questionnaire)

(I/We) worried whether (my/our) food would run out before (I/we) got money to buy more.

{
  "resourceType" : "BackboneElement",
  "linkId" : "2.1",
  "text" : "(I/We) worried whether (my/our) food would run out before (I/we) got money to buy more.",
  "type" : "choice",
  "answerOption" : [
    {
      "valueCoding" : {
        "system" : "http://loinc.org",
        "code" : "LA28397-0",
        "display" : "Often true"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://loinc.org",
        "code" : "LA6729-3",
        "display" : "Sometimes true"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://loinc.org",
        "code" : "LA28398-8",
        "display" : "Never true"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://loinc.org",
        "code" : "LA15775-2",
        "display" : "Don't know/refused"
      }
    }
  ]
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <linkId value="2.1"/>
  <text
        value="(I/We) worried whether (my/our) food would run out before (I/we) got money to buy more."/>
  <type value="choice"/>
  <answerOption>
    <valueCoding>
      <system value="http://loinc.org"/>
      <code value="LA28397-0"/>
      <display value="Often true"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://loinc.org"/>
      <code value="LA6729-3"/>
      <display value="Sometimes true"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://loinc.org"/>
      <code value="LA28398-8"/>
      <display value="Never true"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://loinc.org"/>
      <code value="LA15775-2"/>
      <display value="Don't know/refused"/>
    </valueCoding>
  </answerOption>
</BackboneElement>

Using answerOption and rendering-xhtml

To display answer options as images using the rendering-xhtml extension.
Example shows two ways to use <img> tags to display images: (1) with embedded data and (2) using contained Binary resources. (Example Questionnaire)

How are you feeling today?
Sad Image OK Image Happy Image

ERROR Expanding Fragment
ERROR Expanding Fragment

Using answerValueSet

To restrict choices from a value set. (Example Questionnaire)

Activity Level

{
  "resourceType" : "BackboneElement",
  "linkId" : "2.3",
  "text" : "Activity Level",
  "type" : "choice",
  "answerValueSet" : "http://loinc.org/vs/LL4882-8"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <linkId value="2.3"/>
  <text value="Activity Level"/>
  <type value="choice"/>
  <answerValueSet value="http://loinc.org/vs/LL4882-8"/>
</BackboneElement>

Using answerValueSet with expressions

To restrict choices to distinct value sets based on context.

NOTE: This example makes assumptions about the correlation between declared gender and health conditions that are not necessarily safe/clinically appropriate, so treat this as a technical example, not as an appropriate mechanism for data capture.

Applicable health conditions :

ERROR Expanding Fragment
ERROR Expanding Fragment

Using answerOptionToggleExpression

To restrict control which choices are enabled based on context. (Example Questionnaire)

NOTE: This example makes assumptions about the correlation between declared gender and health conditions that are not necessarily safe/clinically appropriate, so treat this as a technical example, not as an appropriate mechanism for data capture.

Applicable health conditions :

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "extension" : [
        {
          "url" : "option",
          "valueCoding" : {
            "system" : "http://example.org/CodeSystem/conditions",
            "code" : "3"
          }
        },
        {
          "url" : "expression",
          "valueExpression" : {
            "language" : "text/fhirpath",
            "expression" : "%patient.gender!='male'"
          }
        }
      ],
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-answerOptionsToggleExpression"
    },
    {
      "extension" : [
        {
          "url" : "option",
          "valueCoding" : {
            "system" : "http://example.org/CodeSystem/conditions",
            "code" : "4"
          }
        },
        {
          "url" : "expression",
          "valueExpression" : {
            "language" : "text/fhirpath",
            "expression" : "%patient.gender!='female'"
          }
        }
      ],
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-answerOptionsToggleExpression"
    }
  ],
  "linkId" : "2.5",
  "text" : "Applicable health conditions",
  "type" : "choice",
  "repeats" : true,
  "answerValueSet" : "#vsConditionsAll"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-answerOptionsToggleExpression">
    <extension url="option">
      <valueCoding>
        <system value="http://example.org/CodeSystem/conditions"/>
        <code value="3"/>
      </valueCoding>
    </extension>
    <extension url="expression">
      <valueExpression>
        <language value="text/fhirpath"/>
        <expression value="%patient.gender!='male'"/>
      </valueExpression>
    </extension>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-answerOptionsToggleExpression">
    <extension url="option">
      <valueCoding>
        <system value="http://example.org/CodeSystem/conditions"/>
        <code value="4"/>
      </valueCoding>
    </extension>
    <extension url="expression">
      <valueExpression>
        <language value="text/fhirpath"/>
        <expression value="%patient.gender!='female'"/>
      </valueExpression>
    </extension>
  </extension>
  <linkId value="2.5"/>
  <text value="Applicable health conditions"/>
  <type value="choice"/>
  <repeats value="true"/>
  <answerValueSet value="#vsConditionsAll"/>
</BackboneElement>

Using required

To require an answer. (Example Questionnaire)

Email*

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-keyboard",
      "valueCoding" : {
        "system" : "http://hl7.org/fhir/uv/sdc/CodeSystem/keyboardType",
        "code" : "email",
        "display" : "email"
      }
    }
  ],
  "linkId" : "2.6",
  "text" : "Email*",
  "type" : "string",
  "required" : true
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-keyboard">
    <valueCoding>
      <system value="http://hl7.org/fhir/uv/sdc/CodeSystem/keyboardType"/>
      <code value="email"/>
      <display value="email"/>
    </valueCoding>
  </extension>
  <linkId value="2.6"/>
  <text value="Email*"/>
  <type value="string"/>
  <required value="true"/>
</BackboneElement>

Using readOnly

To only display a populated answer and make it non-editable. (Example Questionnaire)

Current Date:

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression",
      "valueExpression" : {
        "description" : "current date",
        "language" : "text/fhirpath",
        "expression" : "today()"
      }
    }
  ],
  "linkId" : "2.7",
  "text" : "Current Date:",
  "type" : "date",
  "readOnly" : true
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression">
    <valueExpression>
      <description value="current date"/>
      <language value="text/fhirpath"/>
      <expression value="today()"/>
    </valueExpression>
  </extension>
  <linkId value="2.7"/>
  <text value="Current Date:"/>
  <type value="date"/>
  <readOnly value="true"/>
</BackboneElement>

Using repeats, openLabel

To allow multiple answers, no limit and to specify label for alternate answer choices. (Example Questionnaire)

Heart History (check all that applies):
Heart attack
Heart surgery
Cardiac catheterization
Coronary angioplasty (PTCA)
Cardiac pacemaker
Other event (specify):

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-openLabel",
      "valueString" : "Other event (specify)"
    }
  ],
  "linkId" : "2.8",
  "text" : "Heart History (check all that applies)",
  "type" : "open-choice",
  "repeats" : true,
  "answerOption" : [
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/procedures",
        "code" : "U1",
        "display" : "Heart attack"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/procedures",
        "code" : "U2",
        "display" : "Heart surgery"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/procedures",
        "code" : "U3",
        "display" : "Cardiac catheterization"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/procedures",
        "code" : "U4",
        "display" : "Coronary angioplasty (PTCA)"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/procedures",
        "code" : "U5",
        "display" : "Cardiac pacemaker"
      }
    }
  ]
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-openLabel">
    <valueString value="Other event (specify)"/>
  </extension>
  <linkId value="2.8"/>
  <text value="Heart History (check all that applies)"/>
  <type value="open-choice"/>
  <repeats value="true"/>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/procedures"/>
      <code value="U1"/>
      <display value="Heart attack"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/procedures"/>
      <code value="U2"/>
      <display value="Heart surgery"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/procedures"/>
      <code value="U3"/>
      <display value="Cardiac catheterization"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/procedures"/>
      <code value="U4"/>
      <display value="Coronary angioplasty (PTCA)"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/procedures"/>
      <code value="U5"/>
      <display value="Cardiac pacemaker"/>
    </valueCoding>
  </answerOption>
</BackboneElement>

Using minOccurs

Must have at least to 2 answers. (Example Questionnaire)

Heart History (check at least 2):
Heart attack
Heart surgery
Cardiac catheterization
Coronary angioplasty (PTCA)
Cardiac pacemaker

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-minOccurs",
      "valueInteger" : 2
    }
  ],
  "linkId" : "2.9",
  "text" : "Heart History (check at least 2):",
  "type" : "choice",
  "required" : true,
  "repeats" : true,
  "answerOption" : [
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/procedures",
        "code" : "U1",
        "display" : "Heart attack"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/procedures",
        "code" : "U2",
        "display" : "Heart surgery"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/procedures",
        "code" : "U3",
        "display" : "Cardiac catheterization"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/procedures",
        "code" : "U4",
        "display" : "Coronary angioplasty (PTCA)"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/procedures",
        "code" : "U5",
        "display" : "Cardiac pacemaker"
      }
    }
  ]
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-minOccurs">
    <valueInteger value="2"/>
  </extension>
  <linkId value="2.9"/>
  <text value="Heart History (check at least 2):"/>
  <type value="choice"/>
  <required value="true"/>
  <repeats value="true"/>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/procedures"/>
      <code value="U1"/>
      <display value="Heart attack"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/procedures"/>
      <code value="U2"/>
      <display value="Heart surgery"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/procedures"/>
      <code value="U3"/>
      <display value="Cardiac catheterization"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/procedures"/>
      <code value="U4"/>
      <display value="Coronary angioplasty (PTCA)"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/procedures"/>
      <code value="U5"/>
      <display value="Cardiac pacemaker"/>
    </valueCoding>
  </answerOption>
</BackboneElement>

Using maxOccurs

Can only have up to 3 answers. (Example Questionnaire)

Heart History (check no more than 3):
Heart attack
Heart surgery
Cardiac catheterization
Coronary angioplasty (PTCA)
Cardiac pacemaker

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-maxOccurs",
      "valueInteger" : 3
    }
  ],
  "linkId" : "2.10",
  "text" : "Heart History (check no more than 3):",
  "type" : "choice",
  "required" : true,
  "repeats" : true,
  "answerOption" : [
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/procedures",
        "code" : "U1",
        "display" : "Heart attack"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/procedures",
        "code" : "U2",
        "display" : "Heart surgery"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/procedures",
        "code" : "U3",
        "display" : "Cardiac catheterization"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/procedures",
        "code" : "U4",
        "display" : "Coronary angioplasty (PTCA)"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/procedures",
        "code" : "U5",
        "display" : "Cardiac pacemaker"
      }
    }
  ]
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-maxOccurs">
    <valueInteger value="3"/>
  </extension>
  <linkId value="2.10"/>
  <text value="Heart History (check no more than 3):"/>
  <type value="choice"/>
  <required value="true"/>
  <repeats value="true"/>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/procedures"/>
      <code value="U1"/>
      <display value="Heart attack"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/procedures"/>
      <code value="U2"/>
      <display value="Heart surgery"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/procedures"/>
      <code value="U3"/>
      <display value="Cardiac catheterization"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/procedures"/>
      <code value="U4"/>
      <display value="Coronary angioplasty (PTCA)"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/procedures"/>
      <code value="U5"/>
      <display value="Cardiac pacemaker"/>
    </valueCoding>
  </answerOption>
</BackboneElement>

Using optionExclusive

To restrict other answers from being selected when an exclusive answer (like "None of the above") has been selected. (Example Questionnaire)

What treatments do you now have for heart disease? (select all that applies)
No treatment
Aspirin
Other medicines, tablets, or pills
Diet
Exercise
None of the above

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
      "valueCodeableConcept" : {
        "coding" : [
          {
            "system" : "http://hl7.org/fhir/questionnaire-item-control",
            "code" : "check-box",
            "display" : "Check-box"
          }
        ]
      }
    }
  ],
  "linkId" : "2.11",
  "text" : "What treatments do you now have for heart disease? (select all that applies)",
  "type" : "choice",
  "repeats" : true,
  "answerOption" : [
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/treatments",
        "code" : "noTreatment",
        "display" : "NoTreatment"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/treatments",
        "code" : "aspirin",
        "display" : "Aspirin"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/treatments",
        "code" : "otherMeds",
        "display" : "Other medicines, tablets, or pills"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/treatments",
        "code" : "diet",
        "display" : "Diet"
      }
    },
    {
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/treatments",
        "code" : "exercise",
        "display" : "Exercise"
      }
    },
    {
      "extension" : [
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-optionExclusive",
          "valueBoolean" : true
        }
      ],
      "valueCoding" : {
        "system" : "http://example.org/CodeSystem/treatments",
        "code" : "none",
        "display" : "None of the above"
      }
    }
  ]
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl">
    <valueCodeableConcept>
      <coding>
        <system value="http://hl7.org/fhir/questionnaire-item-control"/>
        <code value="check-box"/>
        <display value="Check-box"/>
      </coding>
    </valueCodeableConcept>
  </extension>
  <linkId value="2.11"/>
  <text
        value="What treatments do you now have for heart disease? (select all that applies)"/>
  <type value="choice"/>
  <repeats value="true"/>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/treatments"/>
      <code value="noTreatment"/>
      <display value="NoTreatment"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/treatments"/>
      <code value="aspirin"/>
      <display value="Aspirin"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/treatments"/>
      <code value="otherMeds"/>
      <display value="Other medicines, tablets, or pills"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/treatments"/>
      <code value="diet"/>
      <display value="Diet"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <valueCoding>
      <system value="http://example.org/CodeSystem/treatments"/>
      <code value="exercise"/>
      <display value="Exercise"/>
    </valueCoding>
  </answerOption>
  <answerOption>
    <extension
               url="http://hl7.org/fhir/StructureDefinition/questionnaire-optionExclusive">
      <valueBoolean value="true"/>
    </extension>
    <valueCoding>
      <system value="http://example.org/CodeSystem/treatments"/>
      <code value="none"/>
      <display value="None of the above"/>
    </valueCoding>
  </answerOption>
</BackboneElement>

Using unitOption, unitOpen and unitSupplementalSystem

Restrict unit choices using unit options with control over how strict and other options. (Example Questionnaire)

Dosage

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
      "valueCoding" : {
        "system" : "http://unitsofmeasure.org",
        "code" : "mL",
        "display" : "mL"
      }
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
      "valueCoding" : {
        "system" : "http://unitsofmeasure.org",
        "code" : "L",
        "display" : "L"
      }
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
      "valueCoding" : {
        "system" : "http://unitsofmeasure.org",
        "code" : "g",
        "display" : "g"
      }
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
      "valueCoding" : {
        "system" : "http://unitsofmeasure.org",
        "code" : "mg",
        "display" : "mg"
      }
    },
    {
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-unitOpen",
      "valueCode" : "optionsOrType"
    },
    {
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-unitSupplementalSystem",
      "valueCanonical" : "http://example.org/SomeUnitCodeSystem"
    }
  ],
  "linkId" : "2.12",
  "text" : "Dosage",
  "type" : "quantity"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption">
    <valueCoding>
      <system value="http://unitsofmeasure.org"/>
      <code value="mL"/>
      <display value="mL"/>
    </valueCoding>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption">
    <valueCoding>
      <system value="http://unitsofmeasure.org"/>
      <code value="L"/>
      <display value="L"/>
    </valueCoding>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption">
    <valueCoding>
      <system value="http://unitsofmeasure.org"/>
      <code value="g"/>
      <display value="g"/>
    </valueCoding>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption">
    <valueCoding>
      <system value="http://unitsofmeasure.org"/>
      <code value="mg"/>
      <display value="mg"/>
    </valueCoding>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-unitOpen">
    <valueCode value="optionsOrType"/>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-unitSupplementalSystem">
    <valueCanonical value="http://example.org/SomeUnitCodeSystem"/>
  </extension>
  <linkId value="2.12"/>
  <text value="Dosage"/>
  <type value="quantity"/>
</BackboneElement>

Using unitValueSet

Restrict unit choices from a value set. (Example Questionnaire)

Specify age:

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-unitValueSet",
      "valueCanonical" : "http://hl7.org/fhir/ValueSet/age-units"
    }
  ],
  "linkId" : "2.13",
  "text" : "Specify age:",
  "type" : "quantity"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-unitValueSet">
    <valueCanonical value="http://hl7.org/fhir/ValueSet/age-units"/>
  </extension>
  <linkId value="2.13"/>
  <text value="Specify age:"/>
  <type value="quantity"/>
</BackboneElement>

Using answerExpression, referenceResource, referenceProfile and lookupQuestionnaire

Restrict an answer to a specific resource or profile.

Select your preferred practitioner:

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource",
      "valueCode" : "Practitioner"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-referenceProfile",
      "valueCanonical" : "http://example.org/fhir/StructureDefinition/my-practitioner"
    },
    {
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-lookupQuestionnaire",
      "valueCanonical" : "http://example.org/Questionnaire/1234"
    },
    {
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-answerExpression",
      "valueExpression" : {
        "description" : "all active practitioners",
        "language" : "application/x-fhir-query",
        "expression" : "Practitioner?active=true&_sort=family,given"
      }
    },
    {
      "extension" : [
        {
          "url" : "path",
          "valueString" : "name.where(use='official').family + ', ' + name.where(use='official').given.first()"
        },
        {
          "url" : "forDisplay",
          "valueBoolean" : true
        }
      ],
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn"
    }
  ],
  "linkId" : "2.14",
  "text" : "Select your preferred practitioner:",
  "type" : "reference"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource">
    <valueCode value="Practitioner"/>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-referenceProfile">
    <valueCanonical
                    value="http://example.org/fhir/StructureDefinition/my-practitioner"/>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-lookupQuestionnaire">
    <valueCanonical value="http://example.org/Questionnaire/1234"/>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-answerExpression">
    <valueExpression>
      <description value="all active practitioners"/>
      <language value="application/x-fhir-query"/>
      <expression value="Practitioner?active=true&amp;_sort=family,given"/>
    </valueExpression>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn">
    <extension url="path">
      <valueString
                   value="name.where(use='official').family + ', ' + name.where(use='official').given.first()"/>
    </extension>
    <extension url="forDisplay">
      <valueBoolean value="true"/>
    </extension>
  </extension>
  <linkId value="2.14"/>
  <text value="Select your preferred practitioner:"/>
  <type value="reference"/>
</BackboneElement>

Calculation

Using initialExpression

Example with an initial expression. (Example Questionnaire)

Deadline for submission (7 days from now)

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression",
      "valueExpression" : {
        "description" : "deadline for submission",
        "language" : "text/fhirpath",
        "expression" : "today() + 7 days"
      }
    }
  ],
  "linkId" : "3.1",
  "text" : "Deadline for submission (7 days from now)",
  "type" : "date",
  "readOnly" : true
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression">
    <valueExpression>
      <description value="deadline for submission"/>
      <language value="text/fhirpath"/>
      <expression value="today() + 7 days"/>
    </valueExpression>
  </extension>
  <linkId value="3.1"/>
  <text value="Deadline for submission (7 days from now)"/>
  <type value="date"/>
  <readOnly value="true"/>
</BackboneElement>

Using launchContext

To set resources that provide context for form processing logic. (Example Questionnaire)

Last Name: Hamilton
First Name: William
Gender: male

ERROR Expanding Fragment
ERROR Expanding Fragment

Using calculatedExpression and variable

Example with a calculated expression. (Example Questionnaire)
Note: The questions below are not functional. The BMI will not calculated and displayed after input.

Weight (kg)
Body Height (inches)
Your Body Mass Index (BMI) is

ERROR Expanding Fragment
ERROR Expanding Fragment

Using cqf-calculatedValue, cqf-library and cqf-expression

Example question with a cqf-calculatedValue for minimum and maximum weight allowed and a question using a cqf-expression to determine if a question is required based on Patient data. (Example Questionnaire)

Enter weight in kg

Enter email address

ERROR Expanding Fragment
ERROR Expanding Fragment

Using text and cqf-Expression

Text example with cqf-expression. (Example Questionnaire)

Your last immunization was on 2021-01-05.

{
  "resourceType" : "BackboneElement",
  "linkId" : "3.5",
  "_text" : {
    "extension" : [
      {
        "url" : "http://hl7.org/fhir/StructureDefinition/cqf-expression",
        "valueExpression" : {
          "description" : "last immunization date",
          "language" : "text/fhirpath",
          "expression" : "'Your last immunization was on '+ %Immunization.occurrenceDateTime.substring(0,10) + '.'"
        }
      }
    ]
  },
  "type" : "display"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <linkId value="3.5"/>
  <text>
    <extension url="http://hl7.org/fhir/StructureDefinition/cqf-expression">
      <valueExpression>
        <description value="last immunization date"/>
        <language value="text/fhirpath"/>
        <expression
                    value="'Your last immunization was on '+ %Immunization.occurrenceDateTime.substring(0,10) + '.'"/>
      </valueExpression>
    </extension>
  </text>
  <type value="display"/>
</BackboneElement>

Other Controls

Using initial

Example of options with initial value. (Example Questionnaire)

Marital Status

{
  "resourceType" : "BackboneElement",
  "linkId" : "4.1",
  "text" : "Marital Status",
  "type" : "choice",
  "answerValueSet" : "http://hl7.org/fhir/ValueSet/marital-status",
  "initial" : [
    {
      "valueCoding" : {
        "system" : "http://terminology.hl7.org/CodeSystem/v3-MaritalStatus",
        "code" : "D",
        "display" : "Divorced"
      }
    }
  ]
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <linkId value="4.1"/>
  <text value="Marital Status"/>
  <type value="choice"/>
  <answerValueSet value="http://hl7.org/fhir/ValueSet/marital-status"/>
  <initial>
    <valueCoding>
      <system value="http://terminology.hl7.org/CodeSystem/v3-MaritalStatus"/>
      <code value="D"/>
      <display value="Divorced"/>
    </valueCoding>
  </initial>
</BackboneElement>

Using enableWhen, enableBehavior, enableWhenExpression and disabledDisplay

Example of enabling behaviors. (Example Questionnaire)

Choose Gender

Are you pregnant? (enableWhen gender = Female, disableDisplay=protected)
Yes No Don't know

Have you been diagnosed with Gestational Diabetes? (enableBehavior = only when pregnant and diabetic, disableDisplay=protected)
Yes No Don't know

Enter your birthdate (YYYY/MM/DD)

Have you had mammogram before?(enableWhenExpression = only when gender is female and age > 40, disableDisplay=protected)
Yes No Don't know

ERROR Expanding Fragment
ERROR Expanding Fragment

Using itemWeight and constraint

Example involving item weight and contraints. (Example Questionnaire)
Note: The questions below are not functional. The total score will not be calculated and displayed after input.

You should answer at least three questions.

Over the last 2 weeks, how often have you been bothered by any of the following problems?

1. Little interest or pleasure in doing things
Not at all (0) Several Days (1) More than half the days (2) Nearly every day (3)

2. Feeling down, depressed, or hopeless
Not at all (0) Several Days (1) More than half the days (2) Nearly every day (3)

3. Trouble falling or staying asleep, or sleeping too much
Not at all (0) Several Days (1) More than half the days (2) Nearly every day (3)

4. Feeling tired or having little energy
Not at all (0) Several Days (1) More than half the days (2) Nearly every day (3)

Total Score: 0

ERROR Expanding Fragment
ERROR Expanding Fragment

Using constraints for regular expressions

To restrict an answer to be in this format: A1A 1A1 (Example Questionnaire)

Postal Code (A1A 1A1)

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "extension" : [
        {
          "url" : "key",
          "valueId" : "contraint-regex1"
        },
        {
          "url" : "severity",
          "valueCode" : "error"
        },
        {
          "url" : "expression",
          "valueExpression" : {
            "language" : "text/fhirpath",
            "expression" : "%resource.repeat(item).where(linkId='1.3').answer.all(value.matches('[A-Z][0-9][A-Z] [0-9][A-Z][0-9]'))"
          }
        },
        {
          "url" : "human",
          "valueString" : "Postal code must match syntax A1A 1A1."
        }
      ],
      "url" : "http://hl7.org/fhir/StructureDefinition/targetConstraint"
    }
  ],
  "linkId" : "1.3",
  "text" : "Postal Code (A1A 1A1)",
  "type" : "string"
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension url="http://hl7.org/fhir/StructureDefinition/targetConstraint">
    <extension url="key">
      <valueId value="contraint-regex1"/>
    </extension>
    <extension url="severity">
      <valueCode value="error"/>
    </extension>
    <extension url="expression">
      <valueExpression>
        <language value="text/fhirpath"/>
        <expression
                    value="%resource.repeat(item).where(linkId='1.3').answer.all(value.matches('[A-Z][0-9][A-Z] [0-9][A-Z][0-9]'))"/>
      </valueExpression>
    </extension>
    <extension url="human">
      <valueString value="Postal code must match syntax A1A 1A1."/>
    </extension>
  </extension>
  <linkId value="1.3"/>
  <text value="Postal Code (A1A 1A1)"/>
  <type value="string"/>
</BackboneElement>

Using signatureRequired and usageMode

Example of a questionnaire requiring a signature. (Example Questionnaire)

Signature of Patient: [only show signature pad when capturing data]

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-signatureRequired",
      "valueCodeableConcept" : {
        "coding" : [
          {
            "system" : "urn:iso-astm:E1762-95:2013",
            "code" : "1.2.840.10065.1.12.1.8",
            "display" : "Signature Witness Signature"
          }
        ],
        "text" : "the signature of a witness to any other signature."
      }
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/questionnaire-usageMode",
      "valueCode" : "capture"
    }
  ],
  "linkId" : "4.4",
  "text" : "Signature of Patient",
  "type" : "attachment",
  "required" : true
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-signatureRequired">
    <valueCodeableConcept>
      <coding>
        <system value="urn:iso-astm:E1762-95:2013"/>
        <code value="1.2.840.10065.1.12.1.8"/>
        <display value="Signature Witness Signature"/>
      </coding>
      <text value="the signature of a witness to any other signature."/>
    </valueCodeableConcept>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/questionnaire-usageMode">
    <valueCode value="capture"/>
  </extension>
  <linkId value="4.4"/>
  <text value="Signature of Patient"/>
  <type value="attachment"/>
  <required value="true"/>
</BackboneElement>

Using endpoint

To set an endpoint URL for the Form Receiver when the Questionnaire is completed. (Example Questionnaire)

[Not applicable to a question item - this extension is part of a base Questionnaire's metadata]

Using entryMode

To display questions one at a time. (Example Questionnaire)

[Not applicable to a question item - this extension is part of a base Questionnaire's metadata]

Using candidateExpression

To provide a list of candidate answers for the question item. (Example Questionnaire)

All the practitioners below can speak your language. Choose all preferred practioners:

Last Name First Name Gender
Smith John Male
Moseley Henry Male
Upton Isaac Male
Williams Amy Female

{
  "resourceType" : "BackboneElement",
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-candidateExpression",
      "valueExpression" : {
        "description" : "active practitioners that speak at least one of the patient's language",
        "language" : "application/x-fhir-query",
        "expression" : "Practitioner?communication=&active=true"
      }
    },
    {
      "extension" : [
        {
          "url" : "path",
          "valueString" : "name.first().family"
        },
        {
          "url" : "label",
          "valueString" : "LAST NAME"
        },
        {
          "url" : "width",
          "valueQuantity" : {
            "value" : 40,
            "system" : "http://unitsofmeasure.org",
            "code" : "%"
          }
        },
        {
          "url" : "forDisplay",
          "valueBoolean" : true
        }
      ],
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn"
    },
    {
      "extension" : [
        {
          "url" : "path",
          "valueString" : "name.first().given.first()"
        },
        {
          "url" : "label",
          "valueString" : "FIRST NAME"
        },
        {
          "url" : "width",
          "valueQuantity" : {
            "value" : 40,
            "system" : "http://unitsofmeasure.org",
            "code" : "%"
          }
        },
        {
          "url" : "forDisplay",
          "valueBoolean" : true
        }
      ],
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn"
    },
    {
      "extension" : [
        {
          "url" : "path",
          "valueString" : "gender"
        },
        {
          "url" : "label",
          "valueString" : "GENDER"
        },
        {
          "url" : "width",
          "valueQuantity" : {
            "value" : 20,
            "system" : "http://unitsofmeasure.org",
            "code" : "%"
          }
        },
        {
          "url" : "forDisplay",
          "valueBoolean" : false
        }
      ],
      "url" : "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn"
    }
  ],
  "linkId" : "4.5",
  "text" : "All the practitioners below can speak the patient's language. Choose all preferred practioners:",
  "type" : "reference",
  "repeats" : true
}

<BackboneElement xmlns="http://hl7.org/fhir">
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-candidateExpression">
    <valueExpression>
      <description
                   value="active practitioners that speak at least one of the patient's language"/>
      <language value="application/x-fhir-query"/>
      <expression value="Practitioner?communication=&amp;active=true"/>
    </valueExpression>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn">
    <extension url="path">
      <valueString value="name.first().family"/>
    </extension>
    <extension url="label">
      <valueString value="LAST NAME"/>
    </extension>
    <extension url="width">
      <valueQuantity>
        <value value="40"/>
        <system value="http://unitsofmeasure.org"/>
        <code value="%"/>
      </valueQuantity>
    </extension>
    <extension url="forDisplay">
      <valueBoolean value="true"/>
    </extension>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn">
    <extension url="path">
      <valueString value="name.first().given.first()"/>
    </extension>
    <extension url="label">
      <valueString value="FIRST NAME"/>
    </extension>
    <extension url="width">
      <valueQuantity>
        <value value="40"/>
        <system value="http://unitsofmeasure.org"/>
        <code value="%"/>
      </valueQuantity>
    </extension>
    <extension url="forDisplay">
      <valueBoolean value="true"/>
    </extension>
  </extension>
  <extension
             url="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn">
    <extension url="path">
      <valueString value="gender"/>
    </extension>
    <extension url="label">
      <valueString value="GENDER"/>
    </extension>
    <extension url="width">
      <valueQuantity>
        <value value="20"/>
        <system value="http://unitsofmeasure.org"/>
        <code value="%"/>
      </valueQuantity>
    </extension>
    <extension url="forDisplay">
      <valueBoolean value="false"/>
    </extension>
  </extension>
  <linkId value="4.5"/>
  <text
        value="All the practitioners below can speak the patient's language. Choose all preferred practioners:"/>
  <type value="reference"/>
  <repeats value="true"/>
</BackboneElement>

Using contextExpression

To indicate the resources to make available for display to the user to aid in answering the question. (Example Questionnaire)

Instruction: Click on "Review Previous Visits" button to view all the visits of this patient in the past year.

Has the patient been admitted for this issue on any visits in the past year?
Yes 
No 
Don't know 

ERROR Expanding Fragment
ERROR Expanding Fragment

Using itemPopulationContext and itemExtractionContext

To specify the resources to populate and extract a questionnaire. (Example Questionnaire)

Home Address
Address:
City:
Province:
Postal Code:

ERROR Expanding Fragment
ERROR Expanding Fragment