How naim-006/chronicai works
ChronicAI is a patient-facing health-record and clinical-intelligence platform. Patients use its dashboard to manage records and care; the documented ingestion workflow scans a document, extracts clinical information, presents it for human verification, and stores it. The frontend also offers longitudinal health features and a grounded copilot, while a FastAPI backend provides OCR, retrieval, copilot, and medication-scheduling services. Several pages and routes were not sampled, so their internal calls are omitted; documented architecture relationships are cited to the README.
Main entry points: dashboard/page.tsx Health dashboard · vault/page.tsx Health vault · main.py FastAPI application · rag.py RAG service
Components 25
Patient experience
- Health dashboard
src/app/(dashboard)/dashboard/page.tsx - Authentication UI
src/app/(auth)/login/page.tsx - Auth context
src/context/AuthContext.tsx - Language context
src/context/LanguageContext.tsx
Records and care
- Health vault
src/app/(dashboard)/vault/page.tsx - Record analysis API
src/app/api/records/analyze/route.ts - Document storage
src/lib/supabase/storage.ts - Medication tracking
src/app/(dashboard)/medications/page.tsx - Appointments
src/app/(dashboard)/appointments/page.tsx - Health analytics
src/app/(dashboard)/metrics/page.tsx - Risk screening
src/app/(dashboard)/screenings/page.tsx - Health timeline
src/app/(dashboard)/timeline/page.tsx
Clinical intelligence
- Clinical copilot UI
src/app/(dashboard)/assistant/page.tsx - Copilot chat API
src/app/api/assistant/chat/route.ts - Embedding API
src/app/api/rag/embed/route.ts
AI backend
- FastAPI application
backend/app/main.py - OCR service
backend/app/routers/ocr.py - RAG service
backend/app/routers/rag.py - Copilot service
backend/app/routers/copilot.py - Medication scheduler
backend/app/services/chrono_service.py - Backend auth
backend/app/core/auth.py
Identity and persistence
- Supabase
- Profile service
src/lib/supabase/services/profile.ts - Realtime updates
src/hooks/useRealtime.ts
Other components
- Patient
Connections 32
- Patient → Health dashboard: uses
- Patient → Authentication UI: signs in
- Health dashboard → Health vault: manages records
- Health vault → Record analysis API: submits scans
- Record analysis API → OCR service: requests extraction
- OCR service → Health vault: returns extraction
- Health vault → Document storage: uploads documents
- Document storage → Supabase: stores files
src/lib/supabase/storage.ts - Health vault → Supabase: persists verified records
- Health dashboard → Medication tracking: tracks doses
- Health dashboard → Appointments: manages visits
- Health dashboard → Health analytics: views trends
- Health dashboard → Risk screening: views risk
- Health dashboard → Health timeline: reviews history
- Health dashboard → Clinical copilot UI: opens copilot
- Clinical copilot UI → Copilot chat API: sends questions
- Copilot chat API → RAG service: retrieves context
- Copilot chat API → Copilot service: requests guidance
- Embedding API → Supabase: stores embeddings
- FastAPI application → OCR service: registers route
backend/app/main.py - FastAPI application → RAG service: registers route
backend/app/main.py - FastAPI application → Copilot service: registers route
backend/app/main.py - Copilot service → RAG service: retrieves context
backend/app/routers/copilot.py - RAG service → Supabase: queries vectors
backend/app/routers/rag.py - FastAPI application → Medication scheduler: registers scheduler route
backend/app/main.py - Medication scheduler → Backend auth: requires identity
- Authentication UI → Auth context: maintains session
- Auth context → Profile service: loads profile
src/context/AuthContext.tsx - Profile service → Supabase: reads profile
src/lib/supabase/services/profile.ts - Health dashboard → Realtime updates: subscribes to updates
- Realtime updates → Supabase: receives changes
- Health dashboard → Language context: localizes interface