Skip to content

Reference source · 0.1.0-dev.11

clinical.schema.json

schemas/clinical.schema.json · Download original file

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:oprp:experimental:0.1:clinical",
  "title": "OPRP experimental expanded FHIR requests",
  "$defs": {
    "read_resource": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "operation",
        "patient",
        "access_token",
        "resource_type",
        "resource_id",
        "version"
      ],
      "properties": {
        "operation": {
          "const": "read_resource"
        },
        "patient": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "access_token": {
          "type": "string",
          "maxLength": 14000
        },
        "resource_type": {
          "enum": [
            "Condition",
            "AllergyIntolerance",
            "MedicationStatement",
            "Encounter",
            "Procedure",
            "Immunization"
          ]
        },
        "resource_id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9.-]{1,64}$"
        },
        "version": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1
        }
      }
    },
    "search_resources": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "operation",
        "patient",
        "access_token",
        "resource_type"
      ],
      "properties": {
        "operation": {
          "const": "search_resources"
        },
        "patient": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "access_token": {
          "type": "string",
          "maxLength": 14000
        },
        "resource_type": {
          "enum": [
            "Condition",
            "AllergyIntolerance",
            "MedicationStatement",
            "Encounter",
            "Procedure",
            "Immunization"
          ]
        },
        "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        },
        "page_cursor": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 12000
        }
      }
    },
    "resource_history": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "operation",
        "patient",
        "access_token",
        "resource_type",
        "resource_id"
      ],
      "properties": {
        "operation": {
          "const": "resource_history"
        },
        "patient": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "access_token": {
          "type": "string",
          "maxLength": 14000
        },
        "resource_type": {
          "enum": [
            "Condition",
            "AllergyIntolerance",
            "MedicationStatement",
            "Encounter",
            "Procedure",
            "Immunization"
          ]
        },
        "resource_id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9.-]{1,64}$"
        },
        "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        },
        "page_cursor": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 12000
        }
      }
    },
    "create_resource": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "operation",
        "patient",
        "access_token",
        "resource_type",
        "resource",
        "operation_id"
      ],
      "properties": {
        "operation": {
          "const": "create_resource"
        },
        "patient": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "access_token": {
          "type": "string",
          "maxLength": 14000
        },
        "resource_type": {
          "enum": [
            "Condition",
            "AllergyIntolerance",
            "MedicationStatement",
            "Encounter",
            "Procedure",
            "Immunization"
          ]
        },
        "resource": {
          "$ref": "clinical-resource.schema.json"
        },
        "operation_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      }
    },
    "update_resource": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "operation",
        "patient",
        "access_token",
        "resource_type",
        "resource_id",
        "resource",
        "base_version",
        "operation_id"
      ],
      "properties": {
        "operation": {
          "const": "update_resource"
        },
        "patient": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "access_token": {
          "type": "string",
          "maxLength": 14000
        },
        "resource_type": {
          "enum": [
            "Condition",
            "AllergyIntolerance",
            "MedicationStatement",
            "Encounter",
            "Procedure",
            "Immunization"
          ]
        },
        "resource_id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9.-]{1,64}$"
        },
        "resource": {
          "$ref": "clinical-resource.schema.json"
        },
        "base_version": {
          "type": "integer",
          "minimum": 0
        },
        "operation_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      }
    },
    "delete_resource": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "operation",
        "patient",
        "access_token",
        "resource_type",
        "resource_id",
        "base_version",
        "operation_id"
      ],
      "properties": {
        "operation": {
          "const": "delete_resource"
        },
        "patient": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "access_token": {
          "type": "string",
          "maxLength": 14000
        },
        "resource_type": {
          "enum": [
            "Condition",
            "AllergyIntolerance",
            "MedicationStatement",
            "Encounter",
            "Procedure",
            "Immunization"
          ]
        },
        "resource_id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9.-]{1,64}$"
        },
        "base_version": {
          "type": "integer",
          "minimum": 0
        },
        "operation_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      }
    },
    "capabilities": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "operation"
      ],
      "properties": {
        "operation": {
          "const": "capabilities"
        }
      }
    }
  },
  "oneOf": [
    {
      "$ref": "#/$defs/read_resource"
    },
    {
      "$ref": "#/$defs/search_resources"
    },
    {
      "$ref": "#/$defs/resource_history"
    },
    {
      "$ref": "#/$defs/create_resource"
    },
    {
      "$ref": "#/$defs/update_resource"
    },
    {
      "$ref": "#/$defs/delete_resource"
    },
    {
      "$ref": "#/$defs/capabilities"
    }
  ]
}