{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://hl7.org/fhir/json-schema/QuestionnaireResponse",
  "$ref": "#/definitions/QuestionnaireResponse",
  "description": "see http://hl7.org/fhir/json.html#schema for information about the FHIR Json Schemas",
  "definitions": {
    "QuestionnaireResponse": {
      "allOf": [
        {
          "$ref": "DomainResource#/definitions/DomainResource"
        },
        {
          "description": "A structured set of questions and their answers. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the questionnaire being responded to.",
          "properties": {
            "resourceType": {
              "description": "This is a QuestionnaireResponse resource",
              "type": "string",
              "enum": [
                "QuestionnaireResponse"
              ]
            },
            "identifier": {
              "description": "A business identifier assigned to a particular completed (or partially completed) questionnaire.",
              "$ref": "Identifier.schema.json#/definitions/Identifier"
            },
            "basedOn": {
              "description": "The order, proposal or plan that is fulfilled in whole or in part by this QuestionnaireResponse.  For example, a ProcedureRequest seeking an intake assessment or a decision support recommendation to assess for post-partum depression.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            },
            "parent": {
              "description": "A procedure or observation that this questionnaire was performed as part of the execution of.  For example, the surgery a checklist was executed as part of.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            },
            "questionnaire": {
              "description": "The Questionnaire that defines and organizes the questions for which answers are being provided.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "status": {
              "description": "The position of the questionnaire response within its overall lifecycle.",
              "enum": [
                "in-progress",
                "completed",
                "amended",
                "entered-in-error",
                "stopped"
              ],
              "type": "string"
            },
            "_status": {
              "description": "Extensions for status",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "subject": {
              "description": "The subject of the questionnaire response.  This could be a patient, organization, practitioner, device, etc.  This is who/what the answers apply to, but is not necessarily the source of information.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "context": {
              "description": "The encounter or episode of care with primary association to the questionnaire response.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "authored": {
              "description": "The date and/or time that this set of answers were last changed.",
              "type": "string",
              "pattern": "-?([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?"
            },
            "_authored": {
              "description": "Extensions for authored",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "author": {
              "description": "Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "source": {
              "description": "The person who answered the questions about the subject.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "item": {
              "description": "A group or question item from the original questionnaire for which answers are provided.",
              "type": "array",
              "items": {
                "$ref": "#/definitions/QuestionnaireResponse_Item"
              }
            }
          },
          "required": [
            "resourceType"
          ]
        }
      ]
    },
    "QuestionnaireResponse_Item": {
      "allOf": [
        {
          "$ref": "BackboneElement#/definitions/BackboneElement"
        },
        {
          "description": "A structured set of questions and their answers. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the questionnaire being responded to.",
          "properties": {
            "linkId": {
              "description": "The item from the Questionnaire that corresponds to this item in the QuestionnaireResponse resource.",
              "type": "string"
            },
            "_linkId": {
              "description": "Extensions for linkId",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "definition": {
              "description": "A reference to an [[[ElementDefinition]]] that provides the details for the item.",
              "type": "string"
            },
            "_definition": {
              "description": "Extensions for definition",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "text": {
              "description": "Text that is displayed above the contents of the group or as the text of the question being answered.",
              "type": "string"
            },
            "_text": {
              "description": "Extensions for text",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "subject": {
              "description": "More specific subject this section\u0027s answers are about, details the subject given in QuestionnaireResponse.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "answer": {
              "description": "The respondent\u0027s answer(s) to the question.",
              "type": "array",
              "items": {
                "$ref": "#/definitions/QuestionnaireResponse_Answer"
              }
            },
            "item": {
              "description": "Questions or sub-groups nested beneath a question or group.",
              "type": "array",
              "items": {
                "$ref": "#/definitions/QuestionnaireResponse_Item"
              }
            }
          }
        }
      ]
    },
    "QuestionnaireResponse_Answer": {
      "allOf": [
        {
          "$ref": "BackboneElement#/definitions/BackboneElement"
        },
        {
          "description": "A structured set of questions and their answers. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the questionnaire being responded to.",
          "properties": {
            "valueBoolean": {
              "description": "The answer (or one of the answers) provided by the respondent to the question.",
              "type": "boolean"
            },
            "_valueBoolean": {
              "description": "Extensions for valueBoolean",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "valueDecimal": {
              "description": "The answer (or one of the answers) provided by the respondent to the question.",
              "pattern": "-?([0]|([1-9][0-9]*))(\\.[0-9]+)?",
              "type": "number"
            },
            "_valueDecimal": {
              "description": "Extensions for valueDecimal",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "valueInteger": {
              "description": "The answer (or one of the answers) provided by the respondent to the question.",
              "pattern": "-?([0]|([1-9][0-9]*))",
              "type": "number"
            },
            "_valueInteger": {
              "description": "Extensions for valueInteger",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "valueDate": {
              "description": "The answer (or one of the answers) provided by the respondent to the question.",
              "pattern": "-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1]))?)?",
              "type": "string"
            },
            "_valueDate": {
              "description": "Extensions for valueDate",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "valueDateTime": {
              "description": "The answer (or one of the answers) provided by the respondent to the question.",
              "pattern": "-?([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?",
              "type": "string"
            },
            "_valueDateTime": {
              "description": "Extensions for valueDateTime",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "valueTime": {
              "description": "The answer (or one of the answers) provided by the respondent to the question.",
              "pattern": "([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?",
              "type": "string"
            },
            "_valueTime": {
              "description": "Extensions for valueTime",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "valueString": {
              "description": "The answer (or one of the answers) provided by the respondent to the question.",
              "type": "string"
            },
            "_valueString": {
              "description": "Extensions for valueString",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "valueUri": {
              "description": "The answer (or one of the answers) provided by the respondent to the question.",
              "type": "string"
            },
            "_valueUri": {
              "description": "Extensions for valueUri",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "valueAttachment": {
              "description": "The answer (or one of the answers) provided by the respondent to the question.",
              "$ref": "Attachment.schema.json#/definitions/Attachment"
            },
            "valueCoding": {
              "description": "The answer (or one of the answers) provided by the respondent to the question.",
              "$ref": "Coding.schema.json#/definitions/Coding"
            },
            "valueQuantity": {
              "description": "The answer (or one of the answers) provided by the respondent to the question.",
              "$ref": "Quantity.schema.json#/definitions/Quantity"
            },
            "valueReference": {
              "description": "The answer (or one of the answers) provided by the respondent to the question.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "item": {
              "description": "Nested groups and/or questions found within this particular answer.",
              "type": "array",
              "items": {
                "$ref": "#/definitions/QuestionnaireResponse_Item"
              }
            }
          }
        }
      ]
    }
  }
}