# krrxh/mlharogyam46 architecture

> Architecture diagram of the GitHub repository krrxh/mlharogyam46, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/krrxh/mlharogyam46
- Repository: https://github.com/krrxh/mlharogyam46

## Overview

AROGYAM is a patient-facing Ayurvedic chronic-care and monthly kit subscription platform, with an AYUSH clinician portal and a server-side AI wellness assistant. The documented journey runs from health intake and pathway matching through daily wellness, clinician review, prescription and kit follow-up, with meal analysis and adherence tracking as supporting capabilities. The graph combines sampled call and routing evidence with README-documented product stages; unsampled route internals and persistence details are not inferred.

Main entry points: [`server/src/index.ts`](https://github.com/krrxh/mlharogyam46/blob/main/server/src/index.ts) (Express API), [`shared/arogyamDataset.ts`](https://github.com/krrxh/mlharogyam46/blob/main/shared/arogyamDataset.ts) (Pathway catalog), [`client/src/services/api.ts`](https://github.com/krrxh/mlharogyam46/blob/main/client/src/services/api.ts) (Typed API client), [`client/src/context/AppContext.tsx`](https://github.com/krrxh/mlharogyam46/blob/main/client/src/context/AppContext.tsx) (Patient app state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_care["Patient care"]
  node_intake["Health intake<br/>[OnboardingPage.tsx]"]
  node_dashboard["Care dashboard<br/>[DashboardPage.tsx]"]
  node_meal["Meal scanner"]
  node_exercise["Exercise guidance<br/>[ExercisePage.tsx]"]
  node_diet["Diet guidance<br/>[DietGuidePage.tsx]"]
  node_tracking["Daily tracking"]
end

subgraph group_clinical["Clinical and kits"]
  node_consultation["Consultation"]
  node_doctorportal["Doctor portal"]
  node_prescriptionform["Prescription form"]
  node_kitdetail["Kit details<br/>[KitDetailPage.tsx]"]
  node_subscription["Subscription"]
end

subgraph group_platform["Application platform"]
  node_pathways["Pathway catalog<br/>[arogyamDataset.ts]"]
  node_appstate["Patient app state<br/>[AppContext.tsx]"]
  node_api["Typed API client<br/>[api.ts]"]
end

subgraph group_backend["API services"]
  node_server["Express API<br/>[index.ts]"]
  node_kitroutes["Kit and doctor routes<br/>[kits.ts]"]
  node_trackingroutes["Tracking routes<br/>[tracking.ts]"]
  node_consultationroutes["Consultation routes<br/>[consultations.ts]"]
  node_prescriptionroutes["Prescription routes<br/>[prescriptions.ts]"]
end

subgraph group_ai["AI wellness"]
  node_geminiroutes["Gemini routes<br/>[gemini.ts]"]
  node_geminiservice["Gemini wellness service<br/>[geminiService.ts]"]
end

node_patient(("Patient"))
node_clinician(("AYUSH clinician"))
node_gemini(("Google Gemini"))

node_patient -->|"provides health intake"| node_intake
node_intake -->|"matches conditions"| node_pathways
node_intake -->|"updates patient context"| node_appstate
node_patient -->|"reviews care"| node_dashboard
node_dashboard -->|"renders tracking"| node_tracking
node_tracking -->|"updates adherence"| node_appstate
node_appstate -->|"records tracking"| node_api
node_patient -->|"submits meal photo"| node_meal
node_meal -->|"requests meal analysis"| node_api
node_patient -->|"follows routines"| node_exercise
node_patient -->|"uses diet guidance"| node_diet
node_clinician -->|"consults patient"| node_consultation
node_consultation -->|"sends consultation messages"| node_api
node_clinician -->|"reviews patient"| node_doctorportal
node_doctorportal -->|"renders prescription form"| node_prescriptionform
node_prescriptionform -->|"submits prescription"| node_api
node_patient -->|"views care kit"| node_kitdetail
node_patient -->|"manages subscription"| node_subscription
node_kitdetail -->|"reads kit details"| node_pathways
node_subscription -->|"reads pathway options"| node_pathways
node_appstate -->|"loads demo pathways"| node_pathways
node_api -->|"calls REST API"| node_server
node_server -->|"mounts routes"| node_kitroutes
node_server -->|"mounts routes"| node_trackingroutes
node_server -->|"mounts routes"| node_consultationroutes
node_server -->|"mounts routes"| node_prescriptionroutes
node_server -->|"mounts routes"| node_geminiroutes
node_kitroutes -->|"reads pathway data"| node_pathways
node_prescriptionroutes -->|"uses kit protocols"| node_pathways
node_meal -->|"requests analysis via API"| node_geminiroutes
node_geminiroutes -->|"delegates wellness analysis"| node_geminiservice
node_geminiservice -->|"generates AI responses"| node_gemini
node_clinician -->|"approves care plan"| node_prescriptionroutes
node_prescriptionroutes -.->|"documents approved kit"| node_kitdetail
node_trackingroutes -.->|"returns tracking summary"| node_dashboard

click node_intake "https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/OnboardingPage.tsx"
click node_dashboard "https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/DashboardPage.tsx"
click node_meal "https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/MealScannerPage.tsx"
click node_exercise "https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/ExercisePage.tsx"
click node_diet "https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/DietGuidePage.tsx"
click node_tracking "https://github.com/krrxh/mlharogyam46/blob/main/client/src/components/DailyTrackingCard.tsx"
click node_consultation "https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/ConsultationPage.tsx"
click node_doctorportal "https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/DoctorPortalPage.tsx"
click node_prescriptionform "https://github.com/krrxh/mlharogyam46/blob/main/client/src/components/DoctorPrescriptionForm.tsx"
click node_kitdetail "https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/KitDetailPage.tsx"
click node_subscription "https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/SubscriptionPage.tsx"
click node_pathways "https://github.com/krrxh/mlharogyam46/blob/main/shared/arogyamDataset.ts"
click node_appstate "https://github.com/krrxh/mlharogyam46/blob/main/client/src/context/AppContext.tsx"
click node_api "https://github.com/krrxh/mlharogyam46/blob/main/client/src/services/api.ts"
click node_server "https://github.com/krrxh/mlharogyam46/blob/main/server/src/index.ts"
click node_kitroutes "https://github.com/krrxh/mlharogyam46/blob/main/server/src/routes/kits.ts"
click node_trackingroutes "https://github.com/krrxh/mlharogyam46/blob/main/server/src/routes/tracking.ts"
click node_consultationroutes "https://github.com/krrxh/mlharogyam46/blob/main/server/src/routes/consultations.ts"
click node_prescriptionroutes "https://github.com/krrxh/mlharogyam46/blob/main/server/src/routes/prescriptions.ts"
click node_geminiroutes "https://github.com/krrxh/mlharogyam46/blob/main/server/src/routes/gemini.ts"
click node_geminiservice "https://github.com/krrxh/mlharogyam46/blob/main/server/src/services/geminiService.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_intake,node_dashboard,node_meal,node_exercise,node_diet,node_tracking toneBlue
class node_consultation,node_doctorportal,node_prescriptionform,node_kitdetail,node_subscription toneAmber
class node_pathways,node_appstate,node_api toneMint
class node_server,node_kitroutes,node_trackingroutes,node_consultationroutes,node_prescriptionroutes toneRose
class node_geminiroutes,node_geminiservice,node_patient,node_clinician,node_gemini toneIndigo
```

## Components

### Patient care

- [Health intake](https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/OnboardingPage.tsx): `client/src/pages/OnboardingPage.tsx`
- [Care dashboard](https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/DashboardPage.tsx): `client/src/pages/DashboardPage.tsx`
- [Meal scanner](https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/MealScannerPage.tsx): `client/src/pages/MealScannerPage.tsx`
- [Exercise guidance](https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/ExercisePage.tsx): `client/src/pages/ExercisePage.tsx`
- [Diet guidance](https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/DietGuidePage.tsx): `client/src/pages/DietGuidePage.tsx`
- [Daily tracking](https://github.com/krrxh/mlharogyam46/blob/main/client/src/components/DailyTrackingCard.tsx): `client/src/components/DailyTrackingCard.tsx`

### Clinical and kits

- [Consultation](https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/ConsultationPage.tsx): `client/src/pages/ConsultationPage.tsx`
- [Doctor portal](https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/DoctorPortalPage.tsx): `client/src/pages/DoctorPortalPage.tsx`
- [Prescription form](https://github.com/krrxh/mlharogyam46/blob/main/client/src/components/DoctorPrescriptionForm.tsx): `client/src/components/DoctorPrescriptionForm.tsx`
- [Kit details](https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/KitDetailPage.tsx): `client/src/pages/KitDetailPage.tsx`
- [Subscription](https://github.com/krrxh/mlharogyam46/blob/main/client/src/pages/SubscriptionPage.tsx): `client/src/pages/SubscriptionPage.tsx`

### Application platform

- [Pathway catalog](https://github.com/krrxh/mlharogyam46/blob/main/shared/arogyamDataset.ts): `shared/arogyamDataset.ts`
- [Patient app state](https://github.com/krrxh/mlharogyam46/blob/main/client/src/context/AppContext.tsx): `client/src/context/AppContext.tsx`
- [Typed API client](https://github.com/krrxh/mlharogyam46/blob/main/client/src/services/api.ts): `client/src/services/api.ts`

### API services

- [Express API](https://github.com/krrxh/mlharogyam46/blob/main/server/src/index.ts): `server/src/index.ts`
- [Kit and doctor routes](https://github.com/krrxh/mlharogyam46/blob/main/server/src/routes/kits.ts): `server/src/routes/kits.ts`
- [Tracking routes](https://github.com/krrxh/mlharogyam46/blob/main/server/src/routes/tracking.ts): `server/src/routes/tracking.ts`
- [Consultation routes](https://github.com/krrxh/mlharogyam46/blob/main/server/src/routes/consultations.ts): `server/src/routes/consultations.ts`
- [Prescription routes](https://github.com/krrxh/mlharogyam46/blob/main/server/src/routes/prescriptions.ts): `server/src/routes/prescriptions.ts`

### AI wellness

- [Gemini routes](https://github.com/krrxh/mlharogyam46/blob/main/server/src/routes/gemini.ts): `server/src/routes/gemini.ts`
- [Gemini wellness service](https://github.com/krrxh/mlharogyam46/blob/main/server/src/services/geminiService.ts): `server/src/services/geminiService.ts`

### Other components

- **Patient**
- **AYUSH clinician**
- **Google Gemini**

## Connections

- Patient → Health intake: provides health intake (evidence: `README.md`)
- Health intake → Pathway catalog: matches conditions (evidence: `client/src/pages/OnboardingPage.tsx`)
- Health intake → Patient app state: updates patient context (evidence: `client/src/pages/OnboardingPage.tsx`)
- Patient → Care dashboard: reviews care (evidence: `README.md`)
- Care dashboard → Daily tracking: renders tracking (evidence: `client/src/App.tsx`)
- Daily tracking → Patient app state: updates adherence (evidence: `client/src/components/DailyTrackingCard.tsx`)
- Patient app state → Typed API client: records tracking (evidence: `client/src/context/AppContext.tsx`)
- Patient → Meal scanner: submits meal photo (evidence: `README.md`)
- Meal scanner → Typed API client: requests meal analysis (evidence: `client/src/pages/MealScannerPage.tsx`)
- Patient → Exercise guidance: follows routines (evidence: `README.md`)
- Patient → Diet guidance: uses diet guidance (evidence: `README.md`)
- AYUSH clinician → Consultation: consults patient (evidence: `README.md`)
- Consultation → Typed API client: sends consultation messages (evidence: `client/src/pages/ConsultationPage.tsx`)
- AYUSH clinician → Doctor portal: reviews patient (evidence: `README.md`)
- Doctor portal → Prescription form: renders prescription form (evidence: `client/src/pages/DoctorPortalPage.tsx`)
- Prescription form → Typed API client: submits prescription (evidence: `client/src/components/DoctorPrescriptionForm.tsx`)
- Patient → Kit details: views care kit (evidence: `README.md`)
- Patient → Subscription: manages subscription (evidence: `README.md`)
- Kit details → Pathway catalog: reads kit details (evidence: `client/src/pages/KitDetailPage.tsx`)
- Subscription → Pathway catalog: reads pathway options (evidence: `client/src/pages/SubscriptionPage.tsx`)
- Patient app state → Pathway catalog: loads demo pathways (evidence: `client/src/context/AppContext.tsx`)
- Typed API client → Express API: calls REST API (evidence: `client/src/services/api.ts`)
- Express API → Kit and doctor routes: mounts routes (evidence: `server/src/index.ts`)
- Express API → Tracking routes: mounts routes (evidence: `server/src/index.ts`)
- Express API → Consultation routes: mounts routes (evidence: `server/src/index.ts`)
- Express API → Prescription routes: mounts routes (evidence: `server/src/index.ts`)
- Express API → Gemini routes: mounts routes (evidence: `server/src/index.ts`)
- Kit and doctor routes → Pathway catalog: reads pathway data (evidence: `server/src/routes/kits.ts`)
- Prescription routes → Pathway catalog: uses kit protocols (evidence: `server/src/routes/prescriptions.ts`)
- Meal scanner → Gemini routes: requests analysis via API
- Gemini routes → Gemini wellness service: delegates wellness analysis (evidence: `server/src/routes/gemini.ts`)
- Gemini wellness service → Google Gemini: generates AI responses (evidence: `server/src/services/geminiService.ts`)
- AYUSH clinician → Prescription routes: approves care plan (evidence: `README.md`)
- Prescription routes → Kit details: documents approved kit
- Tracking routes → Care dashboard: returns tracking summary
