﻿{
  "$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.schema.json/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 underlying questions.",
          "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": "Identifies the order, proposal or plan that is fulfilled in whole or in part by this Questionnaire.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json/definitions/Reference"
              }
            },
            "parent": {
              "description": "Identifies a procedure or observation that this questionnaire was performed as part of the execution of.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json/definitions/Reference"
              }
            },
            "questionnaire": {
              "description": "Indicates the Questionnaire resource that defines the form for which answers are being provided.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "status": {
              "description": "The lifecycle status of the questionnaire response as a whole.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "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.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "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"
            },
            "authored": {
              "description": "The date and/or time that this version of the questionnaire response was authored.",
              "type": "string",
              "pattern": "-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[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"
            },
            "source": {
              "description": "The person who answered the questions about the subject.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "item": {
              "description": "Corresponds to a group or question item from the original questionnaire.",
              "type": "array",
              "items": {
                "$ref": "#/definitions/QuestionnaireResponse.Item"
              }
            }
          },
          "required": [
            "resourceType"
          ]
        }
      ]
    },
    "QuestionnaireResponse.Item": {
      "allOf": [
        {
          "$ref": "BackboneElement.schema.json/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 underlying questions.",
          "properties": {
            "linkId": {
              "description": "Identifies 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"
            },
            "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.schema.json/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 underlying questions.",
          "properties": {
            "valueBoolean": {
              "description": "The answer (or one of the answers) provided by the respondent to the question.",
              "type": "true | false"
            },
            "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]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[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"
            },
            "valueInstant": {
              "description": "The answer (or one of the answers) provided by the respondent to the question.",
              "type": "string"
            },
            "valueInstant_": {
              "description": "Extensions for valueInstant",
              "$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"
              }
            }
          }
        }
      ]
    }
  }
}