# immohitsen/jeevveda architecture

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

- Interactive diagram: https://gitdiagram.com/immohitsen/jeevveda
- Repository: https://github.com/immohitsen/jeevveda

## Overview

#### Purpose and Runtime
JeevVeda is a Next.js/React prototype for early-stage cancer screening workflows: symptom/chat assessment, blood-report analysis, MRI/OSCC prediction, DICOM review, and persisted patient reports. It runs as a Node.js 18+ Next.js App Router application, with browser dashboard clients calling same-origin route handlers. Primary entry points are `src/app/page.tsx`, `src/app/layout.tsx`, and `src/app/dashboard/layout.tsx`.

#### Application Shell and Navigation
Public landing, login, and signup routes lead into a shared dashboard shell with responsive navigation. Dashboard pages are distinct feature workspaces rather than a single unified screening flow.
- `src/app/dashboard/layout.tsx`
- `src/components/expandable-sidebar.tsx`
- `src/app/dashboard/page.tsx`

#### Identity and Session Boundary
Authentication is implemented through user API endpoints, backed by database configuration and a user model. Client-side user state is exposed through a hook, allowing dashboard screens to determine the current user/session.
- `src/app/api/users/login/route.ts`
- `src/app/api/users/signup/route.ts`
- `src/app/api/users/me/route.ts`
- `src/dbConfig/dbConfig.ts`
- `src/models/userModel.js`
- `src/hooks/useUser.ts`

#### Screening and AI API Layer
Server-side App Router handlers isolate screening requests from UI pages. The symptom-risk, chatbot, blood-analysis, MRI, and OSCC routes are the integration boundary for model inference and external AI services; the README identifies Gemini 2.5 Pro for blood interpretation and describes prototype ML pipelines for symptom and imaging assessment.
- `src/app/api/assess-risk/route.ts`
- `src/app/api/chat/route.ts`
- `src/app/api/blood-analyzer/route.ts`
- `src/app/api/mri-predict/route.ts`
- `src/app/api/oscc-predict/route.ts`

#### Clinical Workflow Clients
Each screening modality has a dedicated dashboard route that gathers inputs, calls its API endpoint, and renders modality-specific output. Reusable report viewers separate presentation of blood, cancer/OSCC, and MRI results from the workflow pages.
- `src/app/dashboard/blood-analyzer/page.tsx`
- `src/app/dashboard/chatbot/page.tsx`
- `src/app/dashboard/mri-analysis/page.tsx`
- `src/app/dashboard/oscc-analyzer/page.tsx`
- `src/components/blood-report-viewer.tsx`
- `src/components/mri-report-viewer.tsx`

#### Imaging and DICOM Boundary
The DICOM viewer is a browser-facing imaging subsystem, with DICOM parsing/utilities kept outside route handlers. It is architecturally separate from the MRI prediction endpoint: one supports interactive image review, while the other performs predictive analysis.
- `src/app/dashboard/dicom-viewer/page.tsx`
- `src/lib/dicom.ts`
- `src/app/api/mri-predict/route.ts`

#### Reports, Helpdesk, and Persistence
Generated reports have collection and ID-addressable APIs, database model support, history/detail pages, and specialized viewers. Helpdesk is a parallel persisted support workflow. The database is likely MongoDB/Mongoose-oriented given the model layout and README terminology, but deployment and schema details should be verified in implementation.
- `src/app/api/reports/route.ts`
- `src/app/api/reports/[id]/route.ts`
- `src/models/reportModel.js`
- `src/app/dashboard/report-history/page.tsx`
- `src/app/dashboard/report/[id]/page.tsx`
- `src/app/api/helpdesk/route.ts`
- `src/models/helpDeskModel.js`

Main entry points: [`src/app/dashboard/layout.tsx`](https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/layout.tsx) (Dashboard shell), [`src/app/dashboard/blood-analyzer/page.tsx`](https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/blood-analyzer/page.tsx) (Blood analyzer), [`src/app/dashboard/mri-analysis/page.tsx`](https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/mri-analysis/page.tsx) (MRI analysis), [`src/app/api/reports/route.ts`](https://github.com/immohitsen/jeevveda/blob/main/src/app/api/reports/route.ts) (Reports API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser &amp; Dashboard"]
  node_app_shell["App shell<br/>Next.js App Router<br/>[layout.tsx]"]
  node_dashboard_shell["Dashboard shell<br/>dashboard layout<br/>[layout.tsx]"]
  node_sidebar["Expandable sidebar<br/>navigation component"]
  node_dashboard_home["Dashboard home<br/>dashboard page<br/>[page.tsx]"]
  node_user_session["User session hook<br/>client auth state<br/>[useUser.ts]"]
  node_screening_workspaces["Screening workspaces<br/>dashboard pages"]
  node_blood_page["Blood analyzer<br/>dashboard page<br/>[page.tsx]"]
  node_chat_page["Chatbot assessment<br/>dashboard page<br/>[page.tsx]"]
  node_mri_page["MRI analysis<br/>dashboard page<br/>[page.tsx]"]
  node_oscc_page["OSCC analyzer<br/>dashboard page<br/>[page.tsx]"]
  node_report_viewers["Report viewers<br/>presentation components"]
  node_dicom_viewer["DICOM viewer<br/>dashboard page<br/>[page.tsx]"]
  node_dicom_utils["DICOM utilities<br/>imaging library<br/>[dicom.ts]"]
  node_report_history["Report history &amp; detail<br/>dashboard pages<br/>[page.tsx]"]
end

subgraph group_api["Server API"]
  node_auth_api["User auth API<br/>route handlers"]
  node_screening_api["Screening AI API<br/>route handlers"]
  node_reports_api["Reports API<br/>route handlers<br/>[route.ts]"]
  node_helpdesk_api["Helpdesk API<br/>route handler<br/>[route.ts]"]
end

subgraph group_data["Persistence"]
  node_database_config[("Database connection<br/>database configuration<br/>[dbConfig.ts]")]
  node_user_model["User model<br/>database model<br/>[userModel.js]"]
  node_report_model["Report model<br/>database model<br/>[reportModel.js]"]
  node_helpdesk_model["Helpdesk model<br/>database model<br/>[helpDeskModel.js]"]
end

node_app_shell -->|"hosts"| node_dashboard_shell
node_dashboard_shell -->|"uses"| node_sidebar
node_dashboard_shell -->|"routes to"| node_dashboard_home
node_dashboard_shell -->|"hosts"| node_screening_workspaces
node_dashboard_shell -->|"hosts"| node_dicom_viewer
node_dashboard_shell -->|"hosts"| node_report_history
node_user_session -->|"gets current user"| node_auth_api
node_screening_workspaces -->|"includes"| node_blood_page
node_screening_workspaces -->|"includes"| node_chat_page
node_screening_workspaces -->|"includes"| node_mri_page
node_screening_workspaces -->|"includes"| node_oscc_page
node_blood_page -->|"analyzes blood"| node_screening_api
node_chat_page -->|"assesses symptoms"| node_screening_api
node_mri_page -->|"requests prediction"| node_screening_api
node_oscc_page -->|"requests prediction"| node_screening_api
node_blood_page -->|"renders results"| node_report_viewers
node_mri_page -->|"renders results"| node_report_viewers
node_dicom_viewer -->|"parses DICOM"| node_dicom_utils
node_report_history -->|"lists and fetches reports"| node_reports_api
node_auth_api -->|"connects through"| node_database_config
node_auth_api -->|"reads and writes"| node_user_model
node_reports_api -->|"connects through"| node_database_config
node_reports_api -->|"reads and writes"| node_report_model
node_helpdesk_api -->|"connects through"| node_database_config
node_helpdesk_api -->|"persists requests"| node_helpdesk_model

click node_app_shell "https://github.com/immohitsen/jeevveda/blob/main/src/app/layout.tsx"
click node_dashboard_shell "https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/layout.tsx"
click node_sidebar "https://github.com/immohitsen/jeevveda/blob/main/src/components/expandable-sidebar.tsx"
click node_dashboard_home "https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/page.tsx"
click node_user_session "https://github.com/immohitsen/jeevveda/blob/main/src/hooks/useUser.ts"
click node_blood_page "https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/blood-analyzer/page.tsx"
click node_chat_page "https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/chatbot/page.tsx"
click node_mri_page "https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/mri-analysis/page.tsx"
click node_oscc_page "https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/oscc-analyzer/page.tsx"
click node_report_viewers "https://github.com/immohitsen/jeevveda/blob/main/src/components/blood-report-viewer.tsx"
click node_dicom_viewer "https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/dicom-viewer/page.tsx"
click node_dicom_utils "https://github.com/immohitsen/jeevveda/blob/main/src/lib/dicom.ts"
click node_report_history "https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/report-history/page.tsx"
click node_reports_api "https://github.com/immohitsen/jeevveda/blob/main/src/app/api/reports/route.ts"
click node_helpdesk_api "https://github.com/immohitsen/jeevveda/blob/main/src/app/api/helpdesk/route.ts"
click node_database_config "https://github.com/immohitsen/jeevveda/blob/main/src/dbConfig/dbConfig.ts"
click node_user_model "https://github.com/immohitsen/jeevveda/blob/main/src/models/userModel.js"
click node_report_model "https://github.com/immohitsen/jeevveda/blob/main/src/models/reportModel.js"
click node_helpdesk_model "https://github.com/immohitsen/jeevveda/blob/main/src/models/helpDeskModel.js"

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_app_shell,node_dashboard_shell,node_sidebar,node_dashboard_home,node_user_session,node_screening_workspaces,node_blood_page,node_chat_page,node_mri_page,node_oscc_page,node_report_viewers,node_dicom_viewer,node_dicom_utils,node_report_history toneBlue
class node_auth_api,node_screening_api,node_reports_api,node_helpdesk_api toneAmber
class node_database_config,node_user_model,node_report_model,node_helpdesk_model toneMint
```

## Components

### Browser & Dashboard

Next.js client routes and shared dashboard navigation.

- [App shell](https://github.com/immohitsen/jeevveda/blob/main/src/app/layout.tsx): Next.js App Router · Root layout and public entry route. · `src/app/layout.tsx`
- [Dashboard shell](https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/layout.tsx): dashboard layout · Shared authenticated workspace navigation. · `src/app/dashboard/layout.tsx`
- [Expandable sidebar](https://github.com/immohitsen/jeevveda/blob/main/src/components/expandable-sidebar.tsx): navigation component · `src/components/expandable-sidebar.tsx`
- [Dashboard home](https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/page.tsx): dashboard page · `src/app/dashboard/page.tsx`
- [User session hook](https://github.com/immohitsen/jeevveda/blob/main/src/hooks/useUser.ts): client auth state · Exposes current user state to dashboard screens. · `src/hooks/useUser.ts`
- **Screening workspaces**: dashboard pages · Dedicated blood, chat, MRI, and OSCC workflows.
- [Blood analyzer](https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/blood-analyzer/page.tsx): dashboard page · `src/app/dashboard/blood-analyzer/page.tsx`
- [Chatbot assessment](https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/chatbot/page.tsx): dashboard page · `src/app/dashboard/chatbot/page.tsx`
- [MRI analysis](https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/mri-analysis/page.tsx): dashboard page · `src/app/dashboard/mri-analysis/page.tsx`
- [OSCC analyzer](https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/oscc-analyzer/page.tsx): dashboard page · `src/app/dashboard/oscc-analyzer/page.tsx`
- [Report viewers](https://github.com/immohitsen/jeevveda/blob/main/src/components/blood-report-viewer.tsx): presentation components · Renders blood and MRI result reports. · `src/components/blood-report-viewer.tsx`
- [DICOM viewer](https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/dicom-viewer/page.tsx): dashboard page · Interactive browser image review, separate from prediction. · `src/app/dashboard/dicom-viewer/page.tsx`
- [DICOM utilities](https://github.com/immohitsen/jeevveda/blob/main/src/lib/dicom.ts): imaging library · Parsing and viewer support outside route handlers. · `src/lib/dicom.ts`
- [Report history & detail](https://github.com/immohitsen/jeevveda/blob/main/src/app/dashboard/report-history/page.tsx): dashboard pages · Lists persisted reports and opens ID-addressable details. · `src/app/dashboard/report-history/page.tsx`

### Server API

Same-origin App Router route handlers.

- **User auth API**: route handlers · Login, signup, and current-user endpoints.
- **Screening AI API**: route handlers · Risk, chat, blood, MRI, and OSCC inference boundary.
- [Reports API](https://github.com/immohitsen/jeevveda/blob/main/src/app/api/reports/route.ts): route handlers · Collection and ID-addressable report endpoints. · `src/app/api/reports/route.ts`
- [Helpdesk API](https://github.com/immohitsen/jeevveda/blob/main/src/app/api/helpdesk/route.ts): route handler · Persisted support workflow. · `src/app/api/helpdesk/route.ts`

### Persistence

Database configuration and Mongoose-style models.

- [Database connection](https://github.com/immohitsen/jeevveda/blob/main/src/dbConfig/dbConfig.ts): database configuration · `src/dbConfig/dbConfig.ts`
- [User model](https://github.com/immohitsen/jeevveda/blob/main/src/models/userModel.js): database model · `src/models/userModel.js`
- [Report model](https://github.com/immohitsen/jeevveda/blob/main/src/models/reportModel.js): database model · `src/models/reportModel.js`
- [Helpdesk model](https://github.com/immohitsen/jeevveda/blob/main/src/models/helpDeskModel.js): database model · `src/models/helpDeskModel.js`

## Connections

- App shell → Dashboard shell: hosts
- Dashboard shell → Expandable sidebar: uses
- Dashboard shell → Dashboard home: routes to
- Dashboard shell → Screening workspaces: hosts
- Dashboard shell → DICOM viewer: hosts
- Dashboard shell → Report history & detail: hosts
- User session hook → User auth API: gets current user
- Screening workspaces → Blood analyzer: includes
- Screening workspaces → Chatbot assessment: includes
- Screening workspaces → MRI analysis: includes
- Screening workspaces → OSCC analyzer: includes
- Blood analyzer → Screening AI API: analyzes blood
- Chatbot assessment → Screening AI API: assesses symptoms
- MRI analysis → Screening AI API: requests prediction
- OSCC analyzer → Screening AI API: requests prediction
- Blood analyzer → Report viewers: renders results
- MRI analysis → Report viewers: renders results
- DICOM viewer → DICOM utilities: parses DICOM
- Report history & detail → Reports API: lists and fetches reports
- User auth API → Database connection: connects through
- User auth API → User model: reads and writes
- Reports API → Database connection: connects through
- Reports API → Report model: reads and writes
- Helpdesk API → Database connection: connects through
- Helpdesk API → Helpdesk model: persists requests
