{
  "schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://hl7.erp.uno/schema/Procedure.schema.json",
  "$ref": "#/definitions/Procedure",
  "description": "see https://hl7.org/fhir/json.html for information about the FHIR Json Schemas",
  "definitions": {
    "Procedure": {
      "allOf": [
        {
          "$ref": "DomainResource.schema.json#/definitions/DomainResource"
        },
        {
          "description": "An action that is or was performed on a patient. This can be a physical intervention like an operation, or less invasive like counseling or hypnotherapy.",
          "properties": {
            "resourceType": {
              "description": "This is a Procedure resource",
              "type": "string",
              "enum": [
                "Procedure"
              ]
            },
            "identifier": {
              "description": "This records identifiers associated with this procedure 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"
              }
            },
            "definition": {
              "description": "A protocol, guideline, orderset or other definition that was adhered to in whole or in part by this procedure.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            },
            "basedOn": {
              "description": "A reference to a resource that contains details of the request for this procedure.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            },
            "partOf": {
              "description": "A larger event of which this particular procedure is a component or step.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            },
            "status": {
              "description": "A code specifying the state of the procedure. Generally this will be in-progress or completed state.",
              "type": "string",
              "pattern": "[^\\s]+([\\s]?[^\\s]+)*"
            },
            "_status": {
              "description": "Extensions for status",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "notDone": {
              "description": "Set this to true if the record is saying that the procedure was NOT performed.",
              "type": "boolean"
            },
            "_notDone": {
              "description": "Extensions for notDone",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "notDoneReason": {
              "description": "A code indicating why the procedure was not performed.",
              "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
            },
            "category": {
              "description": "A code that classifies the procedure for searching, sorting and display purposes (e.g. \"Surgical Procedure\").",
              "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
            },
            "code": {
              "description": "The specific procedure that is performed. Use text if the exact nature of the procedure cannot be coded (e.g. \"Laparoscopic Appendectomy\").",
              "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
            },
            "subject": {
              "description": "The person, animal or group on which the procedure was performed.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "context": {
              "description": "The encounter during which the procedure was performed.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "performedDateTime": {
              "description": "The date(time)/period over which the procedure was performed. Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.",
              "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"
            },
            "_performedDateTime": {
              "description": "Extensions for performedDateTime",
              "$ref": "Element.schema.json#/definitions/Element"
            },
            "performedPeriod": {
              "description": "The date(time)/period over which the procedure was performed. Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.",
              "$ref": "Period.schema.json#/definitions/Period"
            },
            "performer": {
              "description": "Limited to \u0027real\u0027 people rather than equipment.",
              "type": "array",
              "items": {
                "$ref": "#/definitions/Procedure_Performer"
              }
            },
            "location": {
              "description": "The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "reasonCode": {
              "description": "The coded reason why the procedure was performed. This may be coded entity of some type, or may simply be present as text.",
              "type": "array",
              "items": {
                "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
              }
            },
            "reasonReference": {
              "description": "The condition that is the reason why the procedure was performed.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            },
            "bodySite": {
              "description": "Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion.",
              "type": "array",
              "items": {
                "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
              }
            },
            "outcome": {
              "description": "The outcome of the procedure - did it resolve reasons for the procedure being performed?",
              "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
            },
            "report": {
              "description": "This could be a histology result, pathology report, surgical report, etc..",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            },
            "complication": {
              "description": "Any complications that occurred during the procedure, or in the immediate post-performance period. These are generally tracked separately from the notes, which will typically describe the procedure itself rather than any \u0027post procedure\u0027 issues.",
              "type": "array",
              "items": {
                "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
              }
            },
            "complicationDetail": {
              "description": "Any complications that occurred during the procedure, or in the immediate post-performance period.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            },
            "followUp": {
              "description": "If the procedure required specific follow up - e.g. removal of sutures. The followup may be represented as a simple note, or could potentially be more complex in which case the CarePlan resource can be used.",
              "type": "array",
              "items": {
                "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
              }
            },
            "note": {
              "description": "Any other notes about the procedure.  E.g. the operative notes.",
              "type": "array",
              "items": {
                "$ref": "Annotation.schema.json#/definitions/Annotation"
              }
            },
            "focalDevice": {
              "description": "A device that is implanted, removed or otherwise manipulated (calibration, battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as a focal portion of the Procedure.",
              "type": "array",
              "items": {
                "$ref": "#/definitions/Procedure_FocalDevice"
              }
            },
            "usedReference": {
              "description": "Identifies medications, devices and any other substance used as part of the procedure.",
              "type": "array",
              "items": {
                "$ref": "Reference.schema.json#/definitions/Reference"
              }
            },
            "usedCode": {
              "description": "Identifies coded items that were used as part of the procedure.",
              "type": "array",
              "items": {
                "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
              }
            }
          },
          "required": [
            "subject",
            "resourceType"
          ]
        }
      ]
    },
    "Procedure_Performer": {
      "allOf": [
        {
          "$ref": "BackboneElement.schema.json#/definitions/BackboneElement"
        },
        {
          "description": "An action that is or was performed on a patient. This can be a physical intervention like an operation, or less invasive like counseling or hypnotherapy.",
          "properties": {
            "role": {
              "description": "For example: surgeon, anaethetist, endoscopist.",
              "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
            },
            "actor": {
              "description": "The practitioner who was involved in the procedure.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            },
            "onBehalfOf": {
              "description": "The organization the device or practitioner was acting on behalf of.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            }
          },
          "required": [
            "actor"
          ]
        }
      ]
    },
    "Procedure_FocalDevice": {
      "allOf": [
        {
          "$ref": "BackboneElement.schema.json#/definitions/BackboneElement"
        },
        {
          "description": "An action that is or was performed on a patient. This can be a physical intervention like an operation, or less invasive like counseling or hypnotherapy.",
          "properties": {
            "action": {
              "description": "The kind of change that happened to the device during the procedure.",
              "$ref": "CodeableConcept.schema.json#/definitions/CodeableConcept"
            },
            "manipulated": {
              "description": "The device that was manipulated (changed) during the procedure.",
              "$ref": "Reference.schema.json#/definitions/Reference"
            }
          },
          "required": [
            "manipulated"
          ]
        }
      ]
    }
  }
}