{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/elation-health/main/json-schema/elation-health-patient-create-schema.json",
  "title": "PatientCreate",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/elation-health-patients-api-openapi.yml#/components/schemas/PatientCreate",
  "type": "object",
  "required": [
    "first_name",
    "last_name",
    "dob",
    "primary_physician",
    "caregiver_practice",
    "sex"
  ],
  "properties": {
    "first_name": {
      "type": "string",
      "maxLength": 70,
      "description": "Patient's first name"
    },
    "middle_name": {
      "type": "string",
      "maxLength": 50,
      "description": "Patient's middle name"
    },
    "last_name": {
      "type": "string",
      "maxLength": 70,
      "description": "Patient's last name"
    },
    "suffix": {
      "type": "string",
      "maxLength": 20,
      "description": "Name suffix"
    },
    "actual_name": {
      "type": "string",
      "maxLength": 150,
      "description": "Preferred name variation"
    },
    "dob": {
      "type": "string",
      "format": "date",
      "description": "Date of birth (YYYY-MM-DD)"
    },
    "sex": {
      "type": "string",
      "enum": [
        "Female",
        "Male",
        "Other",
        "Unknown"
      ],
      "description": "Biological sex"
    },
    "gender_identity": {
      "type": "string",
      "enum": [
        "man",
        "woman",
        "nonbinary",
        "transgender_man",
        "transgender_woman",
        "prefer_not_to_say"
      ],
      "description": "Personal gender identity"
    },
    "legal_gender_marker": {
      "type": "string",
      "enum": [
        "M",
        "F",
        "X",
        "U"
      ],
      "description": "Document gender marker"
    },
    "pronouns": {
      "type": "string",
      "enum": [
        "he_him_his",
        "she_her_hers",
        "they_them_theirs",
        "not_listed"
      ],
      "description": "Preferred pronouns"
    },
    "sexual_orientation": {
      "type": "string",
      "enum": [
        "straight",
        "gay",
        "lesbian",
        "bisexual",
        "queer",
        "asexual",
        "unknown"
      ]
    },
    "race": {
      "type": "string",
      "description": "Racial category"
    },
    "ethnicity": {
      "type": "string",
      "description": "Hispanic/Latino status"
    },
    "preferred_language": {
      "type": "string",
      "description": "Patient's preferred communication language"
    },
    "preferred_contact": {
      "type": "string",
      "enum": [
        "sms",
        "email",
        "phone",
        "passport"
      ]
    },
    "ssn": {
      "type": "string",
      "maxLength": 37,
      "description": "Social Security Number"
    },
    "primary_physician": {
      "type": "integer",
      "description": "ID of physician providing care within practice"
    },
    "caregiver_practice": {
      "type": "integer",
      "description": "Practice ID"
    },
    "address": {
      "$ref": "#/$defs/Address_2"
    },
    "phones": {
      "type": "array",
      "maxItems": 2,
      "items": {
        "$ref": "#/$defs/Phone_2"
      }
    },
    "emails": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Email_2"
      }
    },
    "notes": {
      "type": "string",
      "maxLength": 500,
      "description": "Additional notes about patient"
    },
    "vip": {
      "type": "boolean",
      "description": "VIP status flag"
    },
    "tags": {
      "type": "array",
      "maxItems": 10,
      "items": {
        "type": "string"
      }
    },
    "patient_status": {
      "$ref": "#/$defs/PatientStatus"
    },
    "metadata": {
      "type": "object",
      "description": "Custom metadata"
    }
  },
  "$defs": {
    "Address_2": {
      "type": "object",
      "properties": {
        "address_line1": {
          "type": "string",
          "description": "Primary street address"
        },
        "address_line2": {
          "type": "string",
          "description": "Secondary address line"
        },
        "city": {
          "type": "string"
        },
        "state": {
          "type": "string",
          "description": "Two-letter state code"
        },
        "zip": {
          "type": "string",
          "description": "ZIP or postal code"
        }
      }
    },
    "Email_2": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "format": "email"
        }
      }
    },
    "PatientStatus": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "Active",
            "Inactive",
            "Prospect",
            "Deceased"
          ]
        },
        "reason": {
          "type": "string",
          "description": "Reason for status"
        },
        "deleted_date": {
          "type": "string",
          "format": "date-time",
          "readOnly": true
        }
      }
    },
    "Phone_2": {
      "type": "object",
      "properties": {
        "phone": {
          "type": "string",
          "description": "Phone number"
        },
        "phone_type": {
          "type": "string",
          "enum": [
            "Home",
            "Work",
            "Cell",
            "Fax"
          ]
        }
      }
    }
  }
}