Skip to content

Reference source · 0.1.0-dev.11

clinical-resource.schema.json

schemas/clinical-resource.schema.json · Download original file

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:oprp:experimental:0.1:clinical-resource",
  "title": "OPRP R4 clinical 2 structural subset",
  "$defs": {
    "coding": {
      "type": "object",
      "properties": {
        "system": {
          "type": "string",
          "minLength": 1
        },
        "code": {
          "type": "string",
          "minLength": 1
        },
        "display": {
          "type": "string",
          "minLength": 1
        },
        "version": {
          "type": "string",
          "minLength": 1
        },
        "userSelected": {
          "type": "boolean"
        }
      },
      "required": [],
      "additionalProperties": true
    },
    "concept": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "minLength": 1
        },
        "coding": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/coding"
          }
        }
      },
      "required": [],
      "additionalProperties": true,
      "anyOf": [
        {
          "required": [
            "text"
          ]
        },
        {
          "required": [
            "coding"
          ]
        }
      ]
    },
    "reference": {
      "type": "object",
      "properties": {
        "reference": {
          "type": "string",
          "minLength": 1
        },
        "display": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "reference"
      ],
      "additionalProperties": true
    },
    "extension": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "minLength": 1
        },
        "extension": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/extension"
          }
        }
      },
      "required": [
        "url"
      ],
      "additionalProperties": true
    },
    "period": {
      "type": "object",
      "properties": {
        "start": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
        },
        "end": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
        }
      },
      "required": [],
      "additionalProperties": true,
      "anyOf": [
        {
          "required": [
            "start"
          ]
        },
        {
          "required": [
            "end"
          ]
        }
      ]
    }
  },
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9.-]{1,64}$"
        },
        "extension": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/extension"
          }
        },
        "meta": {
          "type": "object",
          "properties": {
            "versionId": {
              "type": "string",
              "minLength": 1
            },
            "lastUpdated": {
              "type": "string",
              "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
            },
            "profile": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "security": {
              "type": "array",
              "minItems": 1,
              "maxItems": 32,
              "items": {
                "$ref": "visibility.schema.json#/$defs/label"
              }
            },
            "tag": {
              "type": "array",
              "minItems": 1,
              "items": {
                "$ref": "#/$defs/coding"
              }
            }
          },
          "required": [],
          "additionalProperties": true
        },
        "note": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string",
                "minLength": 1
              },
              "time": {
                "type": "string",
                "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
              }
            },
            "required": [
              "text"
            ],
            "additionalProperties": true
          }
        },
        "recordedDate": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
        },
        "resourceType": {
          "const": "Condition"
        },
        "subject": {
          "$ref": "#/$defs/reference"
        },
        "code": {
          "$ref": "#/$defs/concept"
        },
        "clinicalStatus": {
          "$ref": "#/$defs/concept"
        },
        "verificationStatus": {
          "$ref": "#/$defs/concept"
        },
        "onsetDateTime": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
        },
        "onsetString": {
          "type": "string",
          "minLength": 1
        },
        "onsetPeriod": {
          "$ref": "#/$defs/period"
        },
        "onsetAge": {
          "type": "object"
        },
        "onsetRange": {
          "type": "object"
        },
        "abatementDateTime": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
        },
        "abatementString": {
          "type": "string",
          "minLength": 1
        },
        "abatementPeriod": {
          "$ref": "#/$defs/period"
        },
        "abatementAge": {
          "type": "object"
        },
        "abatementRange": {
          "type": "object"
        }
      },
      "required": [
        "resourceType",
        "subject",
        "code"
      ],
      "additionalProperties": true
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9.-]{1,64}$"
        },
        "extension": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/extension"
          }
        },
        "meta": {
          "type": "object",
          "properties": {
            "versionId": {
              "type": "string",
              "minLength": 1
            },
            "lastUpdated": {
              "type": "string",
              "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
            },
            "profile": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "security": {
              "type": "array",
              "minItems": 1,
              "maxItems": 32,
              "items": {
                "$ref": "visibility.schema.json#/$defs/label"
              }
            },
            "tag": {
              "type": "array",
              "minItems": 1,
              "items": {
                "$ref": "#/$defs/coding"
              }
            }
          },
          "required": [],
          "additionalProperties": true
        },
        "note": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string",
                "minLength": 1
              },
              "time": {
                "type": "string",
                "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
              }
            },
            "required": [
              "text"
            ],
            "additionalProperties": true
          }
        },
        "recordedDate": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
        },
        "resourceType": {
          "const": "AllergyIntolerance"
        },
        "patient": {
          "$ref": "#/$defs/reference"
        },
        "code": {
          "$ref": "#/$defs/concept"
        },
        "clinicalStatus": {
          "$ref": "#/$defs/concept"
        },
        "verificationStatus": {
          "$ref": "#/$defs/concept"
        },
        "onsetDateTime": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
        },
        "onsetString": {
          "type": "string",
          "minLength": 1
        },
        "onsetPeriod": {
          "$ref": "#/$defs/period"
        },
        "onsetAge": {
          "type": "object"
        },
        "onsetRange": {
          "type": "object"
        }
      },
      "required": [
        "resourceType",
        "patient",
        "code"
      ],
      "additionalProperties": true
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9.-]{1,64}$"
        },
        "extension": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/extension"
          }
        },
        "meta": {
          "type": "object",
          "properties": {
            "versionId": {
              "type": "string",
              "minLength": 1
            },
            "lastUpdated": {
              "type": "string",
              "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
            },
            "profile": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "security": {
              "type": "array",
              "minItems": 1,
              "maxItems": 32,
              "items": {
                "$ref": "visibility.schema.json#/$defs/label"
              }
            },
            "tag": {
              "type": "array",
              "minItems": 1,
              "items": {
                "$ref": "#/$defs/coding"
              }
            }
          },
          "required": [],
          "additionalProperties": true
        },
        "note": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string",
                "minLength": 1
              },
              "time": {
                "type": "string",
                "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
              }
            },
            "required": [
              "text"
            ],
            "additionalProperties": true
          }
        },
        "recordedDate": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
        },
        "resourceType": {
          "const": "MedicationStatement"
        },
        "subject": {
          "$ref": "#/$defs/reference"
        },
        "status": {
          "enum": [
            "active",
            "completed",
            "entered-in-error",
            "intended",
            "stopped",
            "on-hold",
            "unknown",
            "not-taken"
          ]
        },
        "medicationCodeableConcept": {
          "$ref": "#/$defs/concept"
        },
        "effectiveDateTime": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
        },
        "effectivePeriod": {
          "$ref": "#/$defs/period"
        }
      },
      "required": [
        "resourceType",
        "subject",
        "status",
        "medicationCodeableConcept"
      ],
      "additionalProperties": true
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9.-]{1,64}$"
        },
        "extension": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/extension"
          }
        },
        "meta": {
          "type": "object",
          "properties": {
            "versionId": {
              "type": "string",
              "minLength": 1
            },
            "lastUpdated": {
              "type": "string",
              "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
            },
            "profile": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "security": {
              "type": "array",
              "minItems": 1,
              "maxItems": 32,
              "items": {
                "$ref": "visibility.schema.json#/$defs/label"
              }
            },
            "tag": {
              "type": "array",
              "minItems": 1,
              "items": {
                "$ref": "#/$defs/coding"
              }
            }
          },
          "required": [],
          "additionalProperties": true
        },
        "note": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string",
                "minLength": 1
              },
              "time": {
                "type": "string",
                "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
              }
            },
            "required": [
              "text"
            ],
            "additionalProperties": true
          }
        },
        "recordedDate": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
        },
        "resourceType": {
          "const": "Encounter"
        },
        "subject": {
          "$ref": "#/$defs/reference"
        },
        "status": {
          "enum": [
            "planned",
            "arrived",
            "triaged",
            "in-progress",
            "onleave",
            "finished",
            "cancelled",
            "entered-in-error",
            "unknown"
          ]
        },
        "class": {
          "$ref": "#/$defs/coding"
        },
        "period": {
          "$ref": "#/$defs/period"
        }
      },
      "required": [
        "resourceType",
        "subject",
        "status",
        "class"
      ],
      "additionalProperties": true
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9.-]{1,64}$"
        },
        "extension": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/extension"
          }
        },
        "meta": {
          "type": "object",
          "properties": {
            "versionId": {
              "type": "string",
              "minLength": 1
            },
            "lastUpdated": {
              "type": "string",
              "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
            },
            "profile": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "security": {
              "type": "array",
              "minItems": 1,
              "maxItems": 32,
              "items": {
                "$ref": "visibility.schema.json#/$defs/label"
              }
            },
            "tag": {
              "type": "array",
              "minItems": 1,
              "items": {
                "$ref": "#/$defs/coding"
              }
            }
          },
          "required": [],
          "additionalProperties": true
        },
        "note": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string",
                "minLength": 1
              },
              "time": {
                "type": "string",
                "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
              }
            },
            "required": [
              "text"
            ],
            "additionalProperties": true
          }
        },
        "recordedDate": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
        },
        "resourceType": {
          "const": "Procedure"
        },
        "subject": {
          "$ref": "#/$defs/reference"
        },
        "code": {
          "$ref": "#/$defs/concept"
        },
        "status": {
          "enum": [
            "preparation",
            "in-progress",
            "not-done",
            "on-hold",
            "stopped",
            "completed",
            "entered-in-error",
            "unknown"
          ]
        },
        "performedDateTime": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
        },
        "performedPeriod": {
          "$ref": "#/$defs/period"
        },
        "performedString": {
          "type": "string",
          "minLength": 1
        },
        "performedAge": {
          "type": "object"
        },
        "performedRange": {
          "type": "object"
        }
      },
      "required": [
        "resourceType",
        "subject",
        "code",
        "status"
      ],
      "additionalProperties": true
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9.-]{1,64}$"
        },
        "extension": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/extension"
          }
        },
        "meta": {
          "type": "object",
          "properties": {
            "versionId": {
              "type": "string",
              "minLength": 1
            },
            "lastUpdated": {
              "type": "string",
              "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
            },
            "profile": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "security": {
              "type": "array",
              "minItems": 1,
              "maxItems": 32,
              "items": {
                "$ref": "visibility.schema.json#/$defs/label"
              }
            },
            "tag": {
              "type": "array",
              "minItems": 1,
              "items": {
                "$ref": "#/$defs/coding"
              }
            }
          },
          "required": [],
          "additionalProperties": true
        },
        "note": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string",
                "minLength": 1
              },
              "time": {
                "type": "string",
                "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
              }
            },
            "required": [
              "text"
            ],
            "additionalProperties": true
          }
        },
        "recordedDate": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
        },
        "resourceType": {
          "const": "Immunization"
        },
        "patient": {
          "$ref": "#/$defs/reference"
        },
        "status": {
          "enum": [
            "completed",
            "entered-in-error",
            "not-done"
          ]
        },
        "vaccineCode": {
          "$ref": "#/$defs/concept"
        },
        "occurrenceDateTime": {
          "type": "string",
          "pattern": "^\\d{4}(-\\d{2}(-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?(Z|[+-]\\d{2}:\\d{2}))?)?)?$"
        },
        "occurrenceString": {
          "type": "string",
          "minLength": 1
        },
        "primarySource": {
          "type": "boolean"
        }
      },
      "required": [
        "resourceType",
        "patient",
        "status",
        "vaccineCode"
      ],
      "additionalProperties": true,
      "oneOf": [
        {
          "required": [
            "occurrenceDateTime"
          ],
          "not": {
            "required": [
              "occurrenceString"
            ]
          }
        },
        {
          "required": [
            "occurrenceString"
          ],
          "not": {
            "required": [
              "occurrenceDateTime"
            ]
          }
        }
      ]
    }
  ]
}