Skip to main content

Health Records Live Low priority

Doctor-issued prescriptions stored under each consumer's profile, viewable across family members.

Status note: feature is functional but deprioritized for revenue (project memory — not driving GMV at launch). Will receive less attention until commerce flows are stable.

1. Overview

Doctors register, log into a doctor portal, can search for a patient by phone or QR code, and either fill out a prescription form OR upload a prescription image. The patient sees these in Profile → Health Records, grouped by family member, with date filters.

2. User journey

Doctor

  1. Doctor logs in (separate auth flow)
  2. Searches consumer by phone OR scans the consumer's QR code
  3. Form prescription: medication, dosage, instructions, follow-up
  4. OR: photo upload (handwritten paper prescription)
  5. Submit → consumer notified

Consumer

  1. Profile → Health → Health Records
  2. See chronological list grouped by family member
  3. Tap a prescription → see form data OR fullscreen image
  4. Optional: order medications via Pharmacy (Shop → Stores filtered to pharmacies)

3. Web ↔ Mobile parity

CapabilityWebMobile
Consumer view records✅ Profile → Healthhealth-records.tsx
Doctor portal (prescribe)/doctor/*❌ Doctor is web-only
Image upload
Family member grouping

4. Key components

  • Web (consumer): src/app/(consumer)/medical/page.tsx
  • Web (doctor): src/app/doctor/* — login, dashboard, prescribe form
  • Mobile: mobile/app/health-records.tsx

5. APIs

EndpointMethodPurpose
/api/prescriptionsGETConsumer's own prescriptions
/api/doctor/prescriptionsPOSTDoctor creates prescription
/api/doctor/patientsGETSearch patient by phone / QR
/api/doctor/authPOSTDoctor login/signup (single endpoint with action)

6. Database touchpoints

  • Doctor — auth, profile, license number, specialization, photoUrl, resetToken + resetTokenExp (added 2026-04-17)
  • Prescription — doctor-issued prescription (medication, dosage, instructions, image, consumer relation, doctor relation)
  • DoctorNotification, DoctorNotifPrefs — doctor's notification bell + per-channel prefs

7. Business logic

  • QR code search: each consumer has a unique QR (KA26-XXXXXX). Doctor scans → identifies patient.
  • Family member grouping: prescriptions for the same consumerId but different patientName are grouped by name in the UI.
  • Doctor broadcast: doctors can send broadcasts to all patients (e.g., "Clinic closed Monday"). doctorBroadcastToPatients() pushes to patients AND doctor (was missing patient push before).

8. Feature flags / env vars

None.

9. Tests

  • tests/seller-verification.test.ts (also covers doctor auth surface)
  • Mobile health-records screen presence

10. Known gotchas

  • Pharmacy ordering deprioritized: not driving revenue per project memory. Don't invest heavily in this flow until commerce side is stable.
  • Doctor portal is web-only — there's no mobile doctor app yet. Doctors use the responsive web view at /doctor/*.
  • Image prescriptions are stored in GCS with consumer-readable signed URLs — be careful with retention policy (medical data has DPDP Act implications).