{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/elation-health/main/json-schema/elation-health-patched-patient-letter-schema.json",
  "title": "PatchedPatientLetter",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/elation-health-patient-letters-beta-api-openapi.yml#/components/schemas/PatchedPatientLetter",
  "properties": {
    "attachments": {
      "items": {
        "$ref": "#/$defs/LetterAttachment"
      },
      "type": "array"
    },
    "body": {
      "type": "string"
    },
    "category": {
      "format": "int64",
      "readOnly": true,
      "type": [
        "integer",
        "null"
      ]
    },
    "created_date": {
      "format": "date-time",
      "readOnly": true,
      "type": [
        "string",
        "null"
      ]
    },
    "deleted_date": {
      "format": "date-time",
      "readOnly": true,
      "type": [
        "string",
        "null"
      ]
    },
    "delivery_date": {
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "document_date": {
      "format": "date-time",
      "type": "string"
    },
    "files": {
      "description": "Files attached to this letter. Binary upload: set content_type='application/octet-stream' and provide 'base64_content' (and optional 'original_filename'). When any file uses base64, all files in the same request must use base64. On GET, returns file references.",
      "items": {
        "$ref": "#/$defs/S3RetrievingDocumentFile"
      },
      "type": [
        "array",
        "null"
      ]
    },
    "id": {
      "readOnly": true,
      "type": "integer"
    },
    "is_patient_initiated": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "is_processed": {
      "readOnly": true,
      "type": "boolean"
    },
    "letter_type": {
      "readOnly": true,
      "type": "string"
    },
    "patient": {
      "format": "int64",
      "type": "integer"
    },
    "patient_read_time": {
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "practice": {
      "format": "int64",
      "type": "integer"
    },
    "send_out": {
      "type": "boolean"
    },
    "send_to_patient": {
      "readOnly": true,
      "type": "boolean"
    },
    "sign_date": {
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "signed_by": {
      "description": "The user who signed the letter.",
      "format": "int64",
      "type": [
        "integer",
        "null"
      ]
    },
    "subject": {
      "maxLength": 200,
      "type": "string"
    },
    "tags": {
      "description": "A list of Document Tags associated with the letter.",
      "items": {
        "format": "int64",
        "type": "integer"
      },
      "type": "array"
    },
    "viewed_at": {
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    }
  },
  "type": "object",
  "$defs": {
    "AttachmentTypeEnum": {
      "description": "* `Entity` - Entity\n* `RefPanel` - RefPanel\n* `PatientDemog` - PatientDemog\n* `ImmHistory` - ImmHistory\n* `MedsList` - MedsList\n* `CompMedsList` - CompMedsList\n* `WhoHeightChart` - WhoHeightChart\n* `WhoWeightChart` - WhoWeightChart\n* `WhoHcChart` - WhoHcChart\n* `WhoWflChart` - WhoWflChart\n* `CdcHeightChart` - CdcHeightChart\n* `CdcWeightChart` - CdcWeightChart\n* `CdcBmiChart` - CdcBmiChart\n* `CdcHcChart` - CdcHcChart\n* `PremieHeightChart` - PremieHeightChart\n* `PremieWeightChart` - PremieWeightChart\n* `PremieHcChart` - PremieHcChart\n* `DsinfantHeightChart` - DsinfantHeightChart\n* `DsinfantWeightChart` - DsinfantWeightChart\n* `DsinfantHcChart` - DsinfantHcChart\n* `DsHeightChart` - DsHeightChart\n* `DsWeightChart` - DsWeightChart\n* `DsBmiChart` - DsBmiChart\n* `DsHcChart` - DsHcChart",
      "enum": [
        "Entity",
        "RefPanel",
        "PatientDemog",
        "ImmHistory",
        "MedsList",
        "CompMedsList",
        "WhoHeightChart",
        "WhoWeightChart",
        "WhoHcChart",
        "WhoWflChart",
        "CdcHeightChart",
        "CdcWeightChart",
        "CdcBmiChart",
        "CdcHcChart",
        "PremieHeightChart",
        "PremieWeightChart",
        "PremieHcChart",
        "DsinfantHeightChart",
        "DsinfantWeightChart",
        "DsinfantHcChart",
        "DsHeightChart",
        "DsWeightChart",
        "DsBmiChart",
        "DsHcChart"
      ],
      "type": "string"
    },
    "LetterAttachment": {
      "properties": {
        "attachment_type": {
          "$ref": "#/$defs/AttachmentTypeEnum"
        },
        "entity_date": {
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        },
        "entity_description": {
          "type": [
            "string",
            "null"
          ]
        },
        "entity_id": {
          "format": "int64",
          "type": "integer"
        },
        "entity_type": {
          "readOnly": true,
          "type": [
            "integer",
            "null"
          ]
        },
        "handout": {
          "format": "int64",
          "type": [
            "integer",
            "null"
          ]
        },
        "id": {
          "readOnly": true,
          "type": "integer"
        },
        "summary": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "attachment_type"
      ],
      "type": "object"
    },
    "S3RetrievingDocumentFile": {
      "properties": {
        "base64_content": {
          "type": "string"
        },
        "content_type": {
          "type": "string"
        },
        "document": {
          "description": "URL to retrieve the document",
          "format": "uri",
          "type": "string"
        },
        "external_content": {},
        "id": {
          "readOnly": true,
          "type": "integer"
        },
        "original_filename": {
          "type": "string"
        }
      },
      "type": "object"
    }
  }
}