{
  "resourceType": "Questionnaire",
  "id": "nested-items-example",
  "meta": {
    "profile": [
      "http://ontariohealth.ca/fhir/eforms/StructureDefinition/sdc-questionnaire"
    ]
  },
  "text": {
    "status": "generated",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h2>Nested Items Example</h2><h3>Referral details</h3><p>Requested priority: Routine or Urgent.</p><p>Reason for urgent triage: a required text question nested beneath the priority question, enabled only when Urgent is selected.</p></div>"
  },
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/artifact-versionAlgorithm",
      "valueCoding": {
        "system": "http://hl7.org/fhir/version-algorithm",
        "code": "semver"
      }
    },
    {
      "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-entryMode",
      "valueCode": "random"
    }
  ],
  "url": "http://ontariohealth.ca/fhir/eforms/Questionnaire/nested-items-example",
  "version": "1.2.0",
  "name": "NestedItemsExample",
  "title": "Nested Items Example",
  "status": "active",
  "experimental": true,
  "subjectType": [
    "Patient"
  ],
  "publisher": "Ontario Health",
  "description": "Demonstrates a question nested within a group and a conditional follow-up question nested within that question. The reason for urgent triage is enabled and required only when the requested priority is Urgent. The paired QuestionnaireResponse demonstrates the child question within the selected answer's item array.",
  "jurisdiction": [
    {
      "coding": [
        {
          "system": "urn:iso:std:iso:3166",
          "code": "CA"
        }
      ]
    }
  ],
  "item": [
    {
      "linkId": "referral-details",
      "text": "Referral details",
      "type": "group",
      "required": true,
      "repeats": false,
      "item": [
        {
          "linkId": "requested-priority",
          "text": "Requested priority",
          "type": "choice",
          "required": true,
          "repeats": false,
          "answerOption": [
            {
              "valueCoding": {
                "system": "http://hl7.org/fhir/request-priority",
                "code": "routine",
                "display": "Routine"
              }
            },
            {
              "valueCoding": {
                "system": "http://hl7.org/fhir/request-priority",
                "code": "urgent",
                "display": "Urgent"
              }
            }
          ],
          "item": [
            {
              "linkId": "urgent-reason",
              "text": "Reason for urgent triage",
              "type": "text",
              "enableWhen": [
                {
                  "question": "requested-priority",
                  "operator": "=",
                  "answerCoding": {
                    "system": "http://hl7.org/fhir/request-priority",
                    "code": "urgent",
                    "display": "Urgent"
                  }
                }
              ],
              "required": true,
              "repeats": false
            }
          ]
        }
      ]
    }
  ]
}