API Documentation
Integration guide for pre-existing clinics using MedTrack's Doctor and Patient roles.
Overview
MedTrack MY allows existing clinics to integrate their doctor and patient workflows. Doctors can prescribe medications and import discharge data; patients can view their schedule and log doses (Complete or Skipped). This document describes the data formats and workflows for clinic integration.
Doctor Role
Doctors manage assigned patients, prescribe medications, and import discharge data from hospital or clinic systems.
Workflow
- Admin registers the doctor and assigns patients via the Admin dashboard.
- Doctor logs in and sees assigned patients on the Doctor Dashboard.
- Doctor prescribes meds (or imports discharge JSON) → creates medication plans and scheduled doses.
- Patient receives today's schedule and logs doses (Complete / Skipped).
Import JSON Format
From the Doctor Import page (/doctor/import), paste a JSON payload to bulk-create a patient, medication plan, and scheduled doses.
{
"patient": {
"full_name": "Ahmad Ali",
"mrn": "M0004499",
"phone": "+60129441105",
"dob": "2024-12-01"
},
"plan": {
"start_date": "2026-02-14",
"end_date": null
},
"meds": [
{
"med_name": "METFORMIN 500MG TAB",
"dose": "1 tab",
"route": "PO",
"times": [
"06:00",
"12:00",
"18:00"
],
"freq": "TDS",
"critical": false
},
{
"med_name": "ATORVASTATIN 20MG TAB",
"dose": "2 tab",
"route": "PO",
"times": [
"08:00"
],
"freq": "OD",
"critical": false
}
]
}patient: full_name, mrn, phone, dob (YYYY-MM-DD)
plan: start_date, end_date (optional)
meds: Array of med_name, dose, route, times (HH:mm 24h), freq, critical (boolean)
times: e.g. ["06:00","12:00","18:00"] for TDS; ["08:00"] for OD
Patient Role
Patients view their daily medication schedule and log each dose as Complete or Skipped. Doctors can see adherence on the patient detail page.
Patient Flow
- Patient logs in with username (e.g. ahmad1234) and password.
- Today's Medications: List of doses grouped by time, with Complete / Skipped buttons.
- History: Weekly adherence chart and dose counts.
- Dose status: pending → taken (Complete) or skipped.
Data Schema
Key tables used by Doctor and Patient roles:
profiles— full_name, role, mrn, phone, dobpatient_doctor— Links patient_id to doctor_idmedication_plans— patient_id, pres_no, start_date, end_datemedications— plan_id, med_name, dose, route, times[], freq, criticalscheduled_doses— medication_id, patient_id, scheduled_at, status (pending|taken|skipped|missed)
Clinic Setup
- Admin creates doctor and patient accounts (Register Staff / Register Patient).
- Admin assigns patients to doctors (Register Patient tab → assign Doctor).
- Doctor imports discharge JSON or prescribes via the Prescribe form.
- Patients log in and use the Today / History views to manage adherence.
For programmatic integration, contact MedTrack for API keys and webhook support.