{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/elation-health/main/json-schema/elation-health-allergy-schema.json",
  "title": "Allergy",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/elation-health-allergies-api-openapi.yml#/components/schemas/Allergy",
  "allOf": [
    {
      "$ref": "#/$defs/AllergyCreate"
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "readOnly": true
        },
        "created_date": {
          "type": "string",
          "format": "date-time",
          "readOnly": true
        },
        "deleted_date": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "readOnly": true
        }
      }
    }
  ],
  "$defs": {
    "AllergyCreate": {
      "type": "object",
      "required": [
        "patient",
        "allergen",
        "status"
      ],
      "properties": {
        "patient": {
          "type": "integer",
          "description": "Patient ID"
        },
        "allergen": {
          "type": "string",
          "description": "Substance causing the allergy"
        },
        "reaction": {
          "type": "string",
          "description": "Allergic reaction description"
        },
        "severity": {
          "type": "string",
          "enum": [
            "Mild",
            "Moderate",
            "Severe",
            "Unknown"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "Active",
            "Inactive"
          ]
        },
        "start_date": {
          "type": "string",
          "format": "date"
        },
        "notes": {
          "type": "string"
        }
      }
    }
  }
}