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.
consultations table is the richest clinical object in FemeSalud. A consultation is always linked to a parent appointment and captures the full encounter record: chief complaint, complete vitals, systematic physical examination, colposcopy findings, obstetric control measurements, and the treatment plan including diagnosis, indications, and follow-up date. Because a consultation may also consume materials (gloves, swabs, reagents), consumable line items are stored in a child table (consultation_consumables) and are always written atomically with the consultation itself through dedicated Supabase RPC functions.
Consultations are never inserted or updated with direct table writes. All create and update operations must go through the
create_consultation_rpc and update_consultation_rpc Supabase remote procedure calls. This ensures the consultation row and its consumables are always committed together in a single database transaction, preventing orphaned or mismatched records.Visit Type Enum
| Value | Clinical meaning |
|---|---|
CONSULTA_NUEVA | First consultation for a new problem or episode. |
CONTROL | Routine follow-up or monitoring visit. |
EMERGENCIA | Unscheduled urgent or emergency encounter. |
POST_TRATAMIENTO | Post-treatment review after a procedure or therapy. |
OTRO | Any other visit type not covered above. |
Core Identity Fields
Primary key. Auto-generated UUID returned by the RPC after a successful insert.
Foreign key to
appointments.id. Each appointment can have at most one consultation. The has_consultation flag on AppointmentWithPatient reflects whether this link exists.Foreign key to
patients.id. Denormalised from the appointment to allow direct patient-scoped queries without joining through appointments.Foreign key to
profiles.id. Nullable — may be null if the consultation was created by a user without a matching profile row.Classifies the clinical purpose of the visit. Defaults to
CONSULTA_NUEVA on insert if not provided. See the VisitType enum above for accepted values.true when this is the patient’s first consultation at the clinic. Defaults to false. Used to auto-populate initial anamnesis sections in the UI.Subjective examination — the patient’s own description of their symptoms and concerns (anamnesis). Nullable.
Marketing or referral channel through which the patient first contacted the clinic (e.g.
Instagram, Referido, Google). Nullable. Used in CRM and acquisition reports.Vitals Fields
Patient height in centimetres. Nullable.
Patient weight in kilograms. Nullable.
Body Mass Index. Nullable. May be auto-calculated in the UI from
height_cm and weight_kg, but is stored as a separate column so it can be queried directly.Arterial blood pressure as a free-text string in
systolic/diastolic format (e.g. "120/80"). Nullable.Heart rate in beats per minute. Nullable.
Respiratory rate in breaths per minute. Nullable.
Body temperature in degrees Celsius. Nullable.
Physical Examination Fields
All physical exam fields are nullable free-text strings describing findings for each body system.Skin examination findings. Nullable.
Head and neck examination findings. Nullable.
Breast examination findings. Nullable.
Abdominal examination findings. Nullable.
Gynecological examination findings (speculum, bimanual). Nullable.
Extremities examination findings. Nullable.
Neurological examination findings. Nullable.
Colposcopy Fields
Colposcopy fields are populated when the visit includes a colposcopic procedure. All fields are nullable.Result or description of the acetic acid (VIA) test finding. Nullable.
Clock-face position of the acetic acid finding on the cervix (e.g.
"3"). Nullable.Relative anatomical position of the acetic acid finding (e.g.
"anterior lip"). Nullable.Result or description of the Lugol’s iodine (VILI) test finding. Nullable.
Clock-face position of the Lugol finding on the cervix. Nullable.
Relative anatomical position of the Lugol finding. Nullable.
Obstetric Control Fields
These fields are used during prenatal or obstetric follow-up consultations. All fields are nullable.Gestational age at the time of the visit (e.g.
"28 weeks + 3 days"). Stored as text to accommodate mixed formats. Nullable.Estimated fetal weight in grams. Nullable.
Obstetric blood pressure reading in
systolic/diastolic format. Separate from the general blood_pressure vital to allow independent tracking. Nullable.Uterine fundal height in centimetres measured by tape measure. Nullable.
Fetal presentation (e.g.
cefálica, podálica, transversa). Nullable.Fetal heart rate in beats per minute. Nullable.
Description of fetal movement activity as reported by the patient or observed. Nullable.
Presence and severity of oedema (e.g.
"No", "+/+++"). Nullable.Presence and description of obstetric alarm signs. Nullable.
Treatment & Plan Fields
Clinical diagnosis or differential diagnosis at the end of the encounter. Nullable.
Prescription or treatment indications given to the patient. May be populated from a
prescription_templates row. Nullable.Additional examinations or tests ordered during the consultation (labs, imaging, etc.). Nullable.
Overall clinical management plan narrative. Nullable.
ISO 8601 date (
YYYY-MM-DD) suggested for the patient’s next visit. Nullable.Audit Fields
Timestamp set automatically by the database when the consultation is first created.
Timestamp updated automatically on each modification.
ConsultationConsumable Sub-table
Materials used during a consultation are stored in theconsultation_consumables table. Rows in this table are always replaced wholesale when a consultation is updated — the RPC deletes existing consumables and inserts the new set in the same transaction.
Primary key. Auto-generated UUID.
Foreign key to
consultations.id. Links the consumable to its parent consultation.Name of the material or supply item used (e.g.
"Guantes de látex", "Ácido acético 5%").Quantity of the item consumed. Defaults to
1.Unit of measure (e.g.
"par", "ml", "unidad"). Nullable.Timestamp set automatically when the row is inserted.
Supabase RPCs
create_consultation_rpc
Creates a new consultation and its associated consumables in a single database transaction.
Consultation object, including the generated id.
update_consultation_rpc
Updates an existing consultation’s fields and replaces all its consumables atomically.
consultation_consumables rows are deleted and re-inserted within the same transaction, so the consumables list is always consistent with the patch. Passing an empty array clears all consumables.
Because both RPCs are transactional, a failure in either the consultation write or the consumables write rolls back the entire operation. The client will receive a Supabase
PostgrestError and no partial data will be committed to the database.