﻿{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://hl7.org/fhir/json-schema/GuidanceResponse",
  "$ref": "#/definitions/GuidanceResponse",
  "description": "see http://hl7.org/fhir/json.html#schema for information about the FHIR Json Schemas",
  "definitions": {
    "GuidanceResponse": {
      "allOf": [
        {
          "$ref": "DomainResource.schema.json/definitions/DomainResource"
        },
        {
          "description": "A guidance response is the formal response to a guidance request, including any output parameters returned by the evaluation, as well as the description of any proposed actions to be taken.",
          "properties": {
            "resourceType": {
              "description": "This is a GuidanceResponse resource",
              "type": "string",
              "enum": [
                "GuidanceResponse"
              ]
            },
            "requestId": {
              "description": "The id of the request associated with this response. If an id was given as part of the request, it will be reproduced here to enable the requester to more easily identify the response in a multi-request scenario.",
              "type": "string",
              "pattern": "[A-Za-z0-9\\-\\.]{1,64}"
            },
            "requestId_": {
              "description": "Extensions for requestId",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "identifier": {
              "description": "Allows a service to provide a unique, business identifier for the response.",
              "$ref": "Identifier.schema.json/definitions/Identifier"
            },
            "module": {
              "description": "A reference to the knowledge module that was invoked.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "status": {
              "description": "The status of the response. If the evaluation is completed successfully, the status will indicate success. However, in order to complete the evaluation, the engine may require more information. In this case, the status will be data-required, and the response will contain a description of the additional required information. If the evaluation completed successfully, but the engine determines that a potentially more accurate response could be provided if more data was available, the status will be data-requested, and the response will contain a description of the additional requested information.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "status_": {
              "description": "Extensions for status",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "subject": {
              "description": "The patient for which the request was processed.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "context": {
              "description": "Allows the context of the guidance response to be provided if available. In a service context, this would likely be unavailable.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "occurrenceDateTime": {
              "description": "Indicates when the guidance response was processed.",
              "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)))?)?)?"
            },
            "occurrenceDateTime_": {
              "description": "Extensions for occurrenceDateTime",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "performer": {
              "description": "Provides a reference to the device that performed the guidance.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "reasonCodeableConcept": {
              "description": "Indicates the reason the request was initiated. This is typically provided as a parameter to the evaluation and echoed by the service, although for some use cases, such as subscription- or event-based scenarios, it may provide an indication of the cause for the response.",
              "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
            },
            "reasonReference": {
              "description": "Indicates the reason the request was initiated. This is typically provided as a parameter to the evaluation and echoed by the service, although for some use cases, such as subscription- or event-based scenarios, it may provide an indication of the cause for the response.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "note": {
              "description": "Provides a mechanism to communicate additional information about the response.",
              "type": "array",
              "items": {
                "$ref": "Annotation.schema.json/definitions/Annotation"
              }
            },
            "evaluationMessage": {
              "description": "Messages resulting from the evaluation of the artifact or artifacts. As part of evaluating the request, the engine may produce informational or warning messages. These messages will be provided by this element.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json/definitions/Reference"
              }
            },
            "outputParameters": {
              "description": "The output parameters of the evaluation, if any. Many modules will result in the return of specific resources such as procedure or communication requests that are returned as part of the operation result. However, modules may define specific outputs that would be returned as the result of the evaluation, and these would be returned in this element.",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "action": {
              "description": "The actions, if any, produced by the evaluation of the artifact.",
              "type": "array",
              "items": {
                "$ref": "#/definitions/GuidanceResponse.Action"
              }
            },
            "dataRequirement": {
              "description": "If the evaluation could not be completed due to lack of information, or additional information would potentially result in a more accurate response, this element will a description of the data required in order to proceed with the evaluation. A subsequent request to the service should include this data.",
              "type": "array",
              "items": {
                "$ref": "DataRequirement.schema.json/definitions/DataRequirement"
              }
            }
          },
          "required": [
            "module",
            "resourceType"
          ]
        }
      ]
    },
    "GuidanceResponse.Action": {
      "allOf": [
        {
          "$ref": "BackboneElement.schema.json/definitions/BackboneElement"
        },
        {
          "description": "A guidance response is the formal response to a guidance request, including any output parameters returned by the evaluation, as well as the description of any proposed actions to be taken.",
          "properties": {
            "actionIdentifier": {
              "description": "A unique identifier for the action. The identifier SHALL be unique within the container in which it appears, and MAY be universally unique.",
              "$ref": "Identifier.schema.json/definitions/Identifier"
            },
            "label": {
              "description": "A user-visible label for the action.",
              "type": "string"
            },
            "label_": {
              "description": "Extensions for label",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "title": {
              "description": "The title of the action displayed to a user.",
              "type": "string"
            },
            "title_": {
              "description": "Extensions for title",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "description": {
              "description": "A short description of the action used to provide a summary to display to the user.",
              "type": "string"
            },
            "description_": {
              "description": "Extensions for description",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "textEquivalent": {
              "description": "A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically.",
              "type": "string"
            },
            "textEquivalent_": {
              "description": "Extensions for textEquivalent",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "concept": {
              "description": "The concept represented by this action or its sub-actions.",
              "type": "array",
              "items": {
                "$ref": "CodeableConcept.schema.json/definitions/CodeableConcept"
              }
            },
            "documentation": {
              "description": "Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.",
              "type": "array",
              "items": {
                "$ref": "RelatedResource.schema.json/definitions/RelatedResource"
              }
            },
            "relatedAction": {
              "description": "A relationship to another action such as \"before\" or \"30-60 minutes after start of\".",
              "$ref": "#/definitions/GuidanceResponse.RelatedAction"
            },
            "timingDateTime": {
              "description": "An optional value describing when the action should be performed.",
              "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"
            },
            "timingDateTime_": {
              "description": "Extensions for timingDateTime",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "timingPeriod": {
              "description": "An optional value describing when the action should be performed.",
              "$ref": "Period.schema.json/definitions/Period"
            },
            "timingDuration": {
              "description": "An optional value describing when the action should be performed.",
              "$ref": "Duration.schema.json/definitions/Duration"
            },
            "timingRange": {
              "description": "An optional value describing when the action should be performed.",
              "$ref": "Range.schema.json/definitions/Range"
            },
            "participant": {
              "description": "The participant in the action.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json/definitions/Reference"
              }
            },
            "type": {
              "description": "The type of action to perform (create, update, remove).",
              "$ref": "Coding.schema.json/definitions/Coding"
            },
            "groupingBehavior": {
              "description": "Defines the grouping behavior for the action and its children.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "groupingBehavior_": {
              "description": "Extensions for groupingBehavior",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "selectionBehavior": {
              "description": "Defines the selection behavior for the action and its children.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "selectionBehavior_": {
              "description": "Extensions for selectionBehavior",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "requiredBehavior": {
              "description": "Defines the requiredness behavior for the action.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "requiredBehavior_": {
              "description": "Extensions for requiredBehavior",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "precheckBehavior": {
              "description": "Defines whether the action should usually be preselected.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "precheckBehavior_": {
              "description": "Extensions for precheckBehavior",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "cardinalityBehavior": {
              "description": "Defines whether the action can be selected multiple times.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "cardinalityBehavior_": {
              "description": "Extensions for cardinalityBehavior",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "resource": {
              "description": "The resource that is the target of the action (e.g. CommunicationRequest).",
              "$ref": "Reference.schema.json/definitions/Reference"
            },
            "action": {
              "description": "Sub actions.",
              "type": "array",
              "items": {
                "$ref": "#/definitions/GuidanceResponse.Action"
              }
            }
          }
        }
      ]
    },
    "GuidanceResponse.RelatedAction": {
      "allOf": [
        {
          "$ref": "BackboneElement.schema.json/definitions/BackboneElement"
        },
        {
          "description": "A guidance response is the formal response to a guidance request, including any output parameters returned by the evaluation, as well as the description of any proposed actions to be taken.",
          "properties": {
            "actionIdentifier": {
              "description": "The unique identifier of the related action.",
              "$ref": "Identifier.schema.json/definitions/Identifier"
            },
            "relationship": {
              "description": "The relationship of this action to the related action.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "relationship_": {
              "description": "Extensions for relationship",
              "$ref": "Element.schema.json/definitions/Element"
            },
            "offsetDuration": {
              "description": "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.",
              "$ref": "Duration.schema.json/definitions/Duration"
            },
            "offsetRange": {
              "description": "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.",
              "$ref": "Range.schema.json/definitions/Range"
            },
            "anchor": {
              "description": "An optional indicator for how the relationship is anchored to the related action. For example \"before the start\" or \"before the end\" of the related action.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "anchor_": {
              "description": "Extensions for anchor",
              "$ref": "Element.schema.json/definitions/Element"
            }
          },
          "required": [
            "actionIdentifier"
          ]
        }
      ]
    }
  }
}