MELIKA’s appointment system covers the full journey from initial booking through completion or cancellation. Every appointment is anchored to a time slot (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Imjuanisss/proyecto-melika/llms.txt
Use this file to discover all available pages before exploring further.
franja_horaria), a specific doctor, and a specialty — ensuring consistent scheduling across both in-person and teleconsultation modalities. The platform enforces concurrency-safe booking, automatic slot liberation on cancellation, and real-time calendar rendering for patients.
Appointment Lifecycle
Each appointment moves through a set of well-defined states. The flow begins atpendiente when a patient books a slot, then resolves to one of three terminal states once the appointment date has passed or an action is taken.
| State | Color | Hex | Meaning |
|---|---|---|---|
pendiente | Amber | #B45309 | Appointment has been booked and is awaiting the scheduled date |
completada | Green | #1A7A52 | The appointment was attended and the doctor has filed the clinical record |
no_asistio | Gray | #6B7280 | The patient did not show up for the scheduled appointment |
cancelada | — | — | Explicitly cancelled before taking place; excluded from calendar events |
pendiente, completada, and no_asistio map directly to backgroundColor/borderColor values returned by GET /citas/calendario. Cancelled appointments are excluded from the calendar response (estado != 'cancelada') and only appear in the list view.| State | backgroundColor | borderColor |
|---|---|---|
pendiente | #B45309 | #92400E |
completada | #1A7A52 | #145C3E |
no_asistio | #6B7280 | #4B5563 |
Consultation Types
When booking, patients choose between two consultation modalities via thetipo_consulta field:
Presencial
In-person visit at the clinic or doctor’s office. Selected by passing
tipo_consulta: "presencial" in the booking request.Teleconsulta
Remote video consultation. Selected by passing
tipo_consulta: "teleconsulta" in the booking request. Doctor availability for this modality is exposed via acepta_teleconsulta on the specialty-doctor listing.How Booking Works
Browse Available Specialties
Fetch the active specialties catalog. Only specialties with Returns an array of specialty objects including
activa = TRUE are returned.id, nombre, descripcion, precio_base, and imagen_url.Pick a Doctor
List all active doctors for a chosen specialty. The response includes profile details such as
foto_url, tarifa, calificacion, acepta_teleconsulta, acepta_presencial, biografia, and anos_experiencia.Check Slot Availability
Query available To query across a date range and receive FullCalendar-ready event objects, use the range endpoint instead:
franjas_horarias for a specific doctor on a given date.Booking Request Parameters
Required Fields
id_medico— ID of the selected doctorid_especialidad— ID of the specialtyid_franja— ID of the time slot fromfranjas_horariasfecha— Date of appointment (YYYY-MM-DD)hora_inicio— Start time of the slot (HH:MM:SS)
Optional Fields
tipo_consulta—"presencial"or"teleconsulta"(defaults to"presencial")motivo— Free-text reason for the visit (max 300 chars in the UI)
Viewing Appointments
- Appointment List
- Calendar View
Returns all appointments for the authenticated patient, ordered by date descending. The response includes the doctor’s name fields separately, the specialty name, and Example response item:
hora_fin joined from franjas_horarias.Cancellation Rules
To cancel apendiente appointment, send a PATCH request with a mandatory cancellation reason. Attempting to cancel a completada appointment or one already in cancelada state returns a 400 error.
franja_horaria is automatically freed via a database trigger, making it immediately available for other patients to book.
Deleting an Appointment
Only appointments withestado = 'cancelada' may be permanently deleted by the owning patient. Attempting to delete an appointment in any other state returns a 400 error.
Concurrency Protection
MELIKA uses database-level concurrency control to prevent double-booking. If two patients attempt to book the same slot simultaneously, only one request succeeds. The other receives a structured error response.| Error Code | error value | Description |
|---|---|---|
45002 | CONCURRENCY_CONFLICT | Another user booked the same slot between your availability check and your booking request. Prompt the user to select a different slot. |
45001 | INVALID_SLOT | The selected franja_horaria does not exist or is not available for the requested doctor and date combination. |
When a
CONCURRENCY_CONFLICT error occurs, refresh the availability query (GET /especialidades/disponibilidad) to retrieve the updated list of free slots before allowing the user to rebook.