TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/KevxxAlva/femesalud-zen-flow/llms.txt
Use this file to discover all available pages before exploring further.
appointments table is the scheduling backbone of FemeSalud. Each row represents a single booked visit — pairing a patient with the doctor who will see them at a specific date and time. Beyond scheduling, appointments also carry optional payment data (amount, method, and reference), making the table the primary source of truth for the practice’s revenue tracking. A completed appointment can be linked to exactly one consultation record, which is used throughout the UI to indicate whether clinical notes have been filed for the visit.
Appointment Status
Thestatus field follows a defined lifecycle:
| Value | Meaning |
|---|---|
programada | Appointment is booked and pending. Default value on insert. |
completada | The visit took place and a consultation record has been filed. |
cancelada | Appointment was cancelled before the visit occurred. |
Fields
Primary key. Auto-generated UUID.
Foreign key to
patients.id. Identifies the patient attending the appointment. Cascading deletes are not applied — deleting a patient will only succeed if no appointments reference them, or the consuming code must clean up appointments first.Foreign key to
profiles.id. Identifies the doctor responsible for the visit. Row Level Security uses this field to restrict which appointments a non-admin user can read.ISO 8601 datetime with time zone. Represents the start time of the appointment. Used as the primary sort key — appointments are ordered by
scheduled_at descending by default.Expected duration of the appointment in minutes. Defaults to
60 when not explicitly provided.Lifecycle state of the appointment. Defaults to
programada. Accepted values: programada | completada | cancelada.Free-text description of the reason for the visit as stated by the patient. Nullable.
Internal notes added by the scheduling staff or doctor. Not shown to the patient. Nullable.
Amount charged for the appointment, denominated in USD. Nullable when no fee has been set.
Method used to settle the appointment fee. Nullable. Accepted values:
| Value | Description |
|---|---|
efectivo | Cash payment |
zelle | Zelle transfer (USD) |
pago_movil | Venezuelan mobile pay |
transferencia | Bank wire transfer |
tarjeta_debito | Debit card |
tarjeta_credito | Credit card |
seguro | Health insurance |
Transaction reference number or confirmation code for the payment. Nullable.
Timestamp set automatically by the database when the row is inserted.
Timestamp updated automatically by the database on each modification.
Foreign key to
auth.users.id. Records which authenticated user created the appointment. Set at the application layer from supabase.auth.getUser() at insert time. Nullable.Extended Type: AppointmentWithPatient
When the appointments list is fetched byuseAppointments, the query joins the patients and consultations tables to enrich each row with two computed fields:
has_consultation is computed in the application by checking whether the consultations join returns at least one row. It is used in the agenda UI to display a visual indicator and to control whether the “File Consultation” action is available.
Filtering with AppointmentFilters
TheuseAppointments hook accepts an optional AppointmentFilters object to narrow the result set server-side before returning data to the client:
Example usage
Default Sort Order
All appointment queries use.order("scheduled_at", { ascending: false }), meaning the most recently scheduled appointment appears first. There is no secondary sort key — appointments scheduled at identical timestamps will appear in an arbitrary order determined by the database.