{
 "openapi": "3.1.0",
 "info": {
  "title": "Emergency Visits (EHR)",
  "version": "20261030b",
  "description": "Arrival, triage, treatment and disposition. An ESI of 1 or 2 raises an alert at triage."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "ed-visits": {
    "type": "object",
    "required": [
     "patient_id",
     "chief_complaint"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "location_id": {
      "type": "string",
      "format": "uuid",
      "description": "Location id",
      "readOnly": true
     },
     "visit_no": {
      "type": "string",
      "description": "Visit no",
      "readOnly": true
     },
     "patient_id": {
      "type": "string",
      "format": "uuid",
      "description": "Patient"
     },
     "encounter_id": {
      "type": "string",
      "format": "uuid",
      "description": "Encounter id"
     },
     "arrived_at": {
      "type": "string",
      "format": "date-time",
      "description": "Arrived at",
      "readOnly": true
     },
     "arrival_mode": {
      "type": "string",
      "description": "Arrival mode"
     },
     "chief_complaint": {
      "type": "string",
      "description": "Chief complaint"
     },
     "acuity": {
      "type": "integer",
      "description": "Acuity"
     },
     "triaged_at": {
      "type": "string",
      "format": "date-time",
      "description": "Triaged at",
      "readOnly": true
     },
     "triaged_by": {
      "type": "string",
      "format": "uuid",
      "description": "Triaged by",
      "readOnly": true
     },
     "triage_notes": {
      "type": "string",
      "description": "Triage notes"
     },
     "vital_bp": {
      "type": "string",
      "description": "Vital bp"
     },
     "vital_pulse": {
      "type": "integer",
      "description": "Vital pulse"
     },
     "vital_temp": {
      "type": "string",
      "format": "decimal",
      "description": "Vital temp"
     },
     "vital_resp": {
      "type": "integer",
      "description": "Vital resp"
     },
     "vital_spo2": {
      "type": "integer",
      "description": "Vital spo2"
     },
     "pain_score": {
      "type": "integer",
      "description": "Pain score"
     },
     "bed": {
      "type": "string",
      "description": "Bed"
     },
     "attending_id": {
      "type": "string",
      "format": "uuid",
      "description": "Attending"
     },
     "roomed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Roomed at",
      "readOnly": true
     },
     "seen_at": {
      "type": "string",
      "format": "date-time",
      "description": "Seen at",
      "readOnly": true
     },
     "disposition": {
      "type": "string",
      "description": "Disposition"
     },
     "disposition_at": {
      "type": "string",
      "format": "date-time",
      "description": "Disposition at",
      "readOnly": true
     },
     "departed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Departed at",
      "readOnly": true
     },
     "status": {
      "type": "string",
      "description": "Status",
      "enum": [
       "waiting",
       "triaged",
       "roomed",
       "in_treatment",
       "pending_results",
       "pending_disposition",
       "departed",
       "left_without_being_seen"
      ]
     },
     "discharge_instructions": {
      "type": "string",
      "description": "Discharge instructions"
     },
     "follow_up_with": {
      "type": "string",
      "description": "Follow up with"
     },
     "follow_up_days": {
      "type": "integer",
      "description": "Follow up days"
     },
     "xf_text_1": {
      "type": "string",
      "description": "Xf text 1",
      "readOnly": true
     },
     "xf_text_2": {
      "type": "string",
      "description": "Xf text 2",
      "readOnly": true
     },
     "xf_text_3": {
      "type": "string",
      "description": "Xf text 3",
      "readOnly": true
     },
     "xf_text_4": {
      "type": "string",
      "description": "Xf text 4",
      "readOnly": true
     },
     "xf_text_5": {
      "type": "string",
      "description": "Xf text 5",
      "readOnly": true
     },
     "xf_num_1": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 1",
      "readOnly": true
     },
     "xf_num_2": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 2",
      "readOnly": true
     },
     "xf_num_3": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 3",
      "readOnly": true
     },
     "xf_date_1": {
      "type": "string",
      "format": "date",
      "description": "Xf date 1",
      "readOnly": true
     },
     "xf_date_2": {
      "type": "string",
      "format": "date",
      "description": "Xf date 2",
      "readOnly": true
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "created_by": {
      "type": "string",
      "format": "uuid",
      "description": "Created by",
      "readOnly": true
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Updated at",
      "readOnly": true
     },
     "updated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Updated by",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/ehr/ed-visits": {
   "get": {
    "summary": "list ed-visits",
    "operationId": "list_ed_visits_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create ed-visits",
    "operationId": "create_ed_visits_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/ehr/ed-visits/{id}": {
   "get": {
    "summary": "get ed-visits",
    "operationId": "get_ed_visits_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change ed-visits",
    "operationId": "change_ed_visits_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete ed-visits",
    "operationId": "delete_ed_visits_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/ehr/ed-visits/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_ed_visits_0_6",
    "description": "Body keys: overrides, preview, withLines",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}