﻿{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://hl7.org/fhir/json-schema/Goal",
  "$ref": "#/definitions/Goal",
  "description": "see http://hl7.org/fhir/json.html#schema for information about the FHIR Json Schemas",
  "definitions": {
    "Goal": {
      "allOf": [
        {
          "$ref": "DomainResource.schema.json/definitions/DomainResource"
        },
        {
          "description": "Describes the intended objective(s) for a patient, group or organization care, for example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.",
          "properties": {
            "resourceType": {
              "description": "This is a Goal resource",
              "type": "string",
              "enum": [
                "Goal"
              ]
            },
            "identifier": {
              "description": "This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).",
              "type": "array",
              "items": {
                "$ref": "Identifier.schema.json/definitions/Identifier"
              }
            },
            "subject": {
              "description": "Identifies the patient, group or organization for whom the goal is being established.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "startDate": {
              "description": "The date or event after which the goal should begin being pursued.",
              "pattern": "-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1]))?)?",
              "type": "string"
            },
            "startDate_": {
              "description": "Extensions for startDate",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "startCodeableConcept": {
              "description": "The date or event after which the goal should begin being pursued.",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "targetDate": {
              "description": "Indicates either the date or the duration after start by which the goal should be met.",
              "pattern": "-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1]))?)?",
              "type": "string"
            },
            "targetDate_": {
              "description": "Extensions for targetDate",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "targetDuration": {
              "description": "Indicates either the date or the duration after start by which the goal should be met.",
              "$ref": "Duration.schema.json/definitions/Duration"
            },
            "category": {
              "description": "Indicates a category the goal falls within.",
              "type": "array",
              "items": {
                "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
              }
            },
            "description": {
              "description": "Code and/or human-readable description of a specific desired objective of care.",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "status": {
              "description": "Indicates whether the goal has been reached and is still considered relevant.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "status_": {
              "description": "Extensions for status",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "statusDate": {
              "description": "Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.",
              "type": "string",
              "pattern": "-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1]))?)?"
            },
            "statusDate_": {
              "description": "Extensions for statusDate",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "statusReason": {
              "description": "Captures the reason for the current status.",
              "type": "array",
              "items": {
                "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
              }
            },
            "expressedBy": {
              "description": "Indicates whose goal this is - patient goal, practitioner goal, etc.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "priority": {
              "description": "Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "addresses": {
              "description": "The identified conditions and other health record elements that are intended to be addressed by the goal.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json/definitions/Reference"
              }
            },
            "note": {
              "description": "Any comments related to the goal.",
              "type": "array",
              "items": {
                "$ref": "Annotation.schema.json/definitions/Annotation"
              }
            },
            "outcome": {
              "description": "Identifies the change (or lack of change) at the point where the goal was deemed to be cancelled or achieved.",
              "type": "array",
              "items": {
                "$ref": "#/definitions/Goal.Outcome"
              }
            }
          },
          "required": [
            "description",
            "resourceType"
          ]
        }
      ]
    },
    "Goal.Outcome": {
      "allOf": [
        {
          "$ref": "BackboneElement.schema.json/definitions/BackboneElement"
        },
        {
          "description": "Describes the intended objective(s) for a patient, group or organization care, for example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.",
          "properties": {
            "resultCodeableConcept": {
              "description": "Details of what\u0027s changed (or not changed).",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "resultReference": {
              "description": "Details of what\u0027s changed (or not changed).",
              "$ref": "Reference.schema.json/definitions/Reference"
            }
          }
        }
      ]
    }
  }
}