Skip to content

Treatments

Treatments group medications into time-bound blocks per patient. They are used for medication analytics (TIR before/during/after) and for the patient timeline.

Data model

{
"id": "uuid",
"patientId": "uuid",
"startDate": "2024-01-01",
"endDate": null,
"medications": [
{
"name": "Metformin",
"activePrinciples": [{ "name": "Metformin", "dose": "500", "unit": "mg" }],
"intakes": [{ "type": "meal", "meal": "breakfast", "amount": "1" }]
}
]
}

endDate: null means the treatment is currently active. Stored via patientTreatment + patientMedication tables and synced with syncPatientTreatments(patientId, treatments) on PUT /api/v1/patients/:id.

UI

  • PatientModal → TreatmentModal (TreatmentModal.vue) — start/end dates (end is hidden behind a CheckboxCard “Definir fecha de fin” that reveals a new-line FormField), and a list of MedicationEntry with intakes.
  • Medication analytics (ViewMedicationAnalytics.vue) shows empty state with a Pill icon and a button that opens TreatmentModal when a patient has no treatments.

API

Session routes below require a dashboard login. With an API key use GET /api/v1/public/patients/:patientId/treatments instead (read scope) — see the API reference.

  • GET /api/v1/patients/:id includes treatments[] sorted newest first.
  • PUT /api/v1/patients/:id { treatments: [...] } replaces the whole list (delete + insert).