How pattaraladadara/ku-med works
KU-MED is a university-clinic patient and staff workflow application. Staff register or look up patients, then manage clinical records, appointments, triage, medications, certificates, and payments; dashboard and reporting views summarize operational data. Separate branches cover staff account approval and evaluation workflows. The README documents major product behavior; sampled routes and the source index support several internal dependencies. Some UI-to-API wiring and unsampled route behavior are not shown, so those connections are omitted rather than inferred.
Main entry points: db.ts PostgreSQL data · patient-profile.tsx Patient profile · registration-form.tsx Registration form · email.ts Account email
Components 34
Access and accounts
- Login and registration
src/components/login-form.tsx - Authentication routes
src/app/api/auth/register/route.ts - Account administration
src/components/account-admin.tsx - Account admin API
src/app/api/admin/accounts/route.ts - Account email
src/lib/email.ts
Patient care
- Patient
src/app/api/patients/route.ts - Registration form
src/components/registration-form.tsx - Student lookup
src/app/api/student-lookup/[studentId]/route.ts - Citizen card reader
src/app/api/citizen-card/read/route.ts - Patient search
src/components/patient-search.tsx - Patient profile
src/components/patient-profile.tsx - Patient records API
src/app/api/patients/[id]/route.ts - Care detail views
src/components/patient-general.tsx - Certificates and documents
src/components/patient-documents.tsx - Treatment actions
src/components/treatment-record-actions.tsx - Medication dispensing
src/components/medication-dispensing.tsx
Operations and finance
- Payment workflow
src/components/payment-workflow.tsx - Dashboard
src/components/dashboard.tsx - Dashboard data API
src/app/api/dashboard/route.ts - Reports panel
src/components/reports-panel.tsx - Finance reports
src/components/finance-reports.tsx - Reports data API
src/app/api/reports/route.ts - User settings
src/app/api/settings/route.ts
Evaluations
- Service evaluations
src/app/api/evaluations/service/route.ts - Evaluation form
src/components/evaluation-form.tsx - System evaluations
src/app/api/evaluations/system/route.ts
Shared services
- PostgreSQL data
src/lib/db.ts - API validation
src/lib/api-validation.ts - Demo session gate
src/components/demo-session-gate.tsx - Demo session state
src/lib/demo-session.ts
Other components
- Clinic staff
- KU All-Login
- Student lookup service
- Google Sheets
Connections 39
- Clinic staff → Registration form: registers patient
- Registration form → Student lookup: looks up student
- Student lookup → Student lookup service: fetches details
- Clinic staff → Citizen card reader: reads identity
- Registration form → Patient: saves patient
- Clinic staff → Patient search: searches records
- Patient search → Patient records API: opens patient
- Patient profile → Care detail views: renders
src/components/patient-profile.tsx - Patient profile → Certificates and documents: renders
src/components/patient-profile.tsx - Patient profile → Treatment actions: renders
src/components/patient-profile.tsx - Patient profile → Medication dispensing: renders
src/components/patient-profile.tsx - Patient profile → Payment workflow: renders
src/components/patient-profile.tsx - Patient records API → PostgreSQL data: reads and writes
src/app/api/patients/[id]/route.ts - Registration form → Patient: persists after review
- Clinic staff → Dashboard: views activity
- Dashboard data API → PostgreSQL data: queries metrics
src/app/api/dashboard/route.ts - Clinic staff → Reports panel: views summaries
- Reports panel → Finance reports: renders
src/components/reports-panel.tsx - Reports data API → PostgreSQL data: queries summaries
src/app/api/reports/route.ts - Clinic staff → Login and registration: signs in
- Login and registration → Authentication routes: submits account
- Login and registration → KU All-Login: starts login
- Clinic staff → Account administration: reviews accounts
- Account admin API → PostgreSQL data: updates accounts
src/app/api/admin/accounts/route.ts - Account admin API → Account email: sends status mail
src/app/api/admin/accounts/route.ts - Account email → PostgreSQL data: uses support settings
- Account email → Clinic staff: sends notifications
- Clinic staff → Evaluation form: submits evaluation
- Evaluation form → Service evaluations: imports responses
- Service evaluations → Google Sheets: downloads responses
src/app/api/evaluations/service/route.ts - Service evaluations → PostgreSQL data: stores evaluations
src/app/api/evaluations/service/route.ts - System evaluations → PostgreSQL data: stores evaluations
src/app/api/evaluations/system/route.ts - User settings → PostgreSQL data: reads and writes
src/app/api/settings/route.ts - Authentication routes → PostgreSQL data: stores accounts
src/app/api/auth/register/route.ts - Authentication routes → Account email: sends verification
src/app/api/auth/register/route.ts - Demo session gate → Demo session state: checks session
src/components/demo-session-gate.tsx - Patient → PostgreSQL data: creates patient
src/app/api/patients/route.ts - Patient → API validation: validates input
src/app/api/patients/route.ts - Patient records API → API validation: validates input
src/app/api/patients/[id]/route.ts