# ajay-aj7899/arogya_ai architecture

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

- Interactive diagram: https://gitdiagram.com/ajay-aj7899/arogya_ai
- Repository: https://github.com/ajay-aj7899/arogya_ai

## Overview

Arogya AI is a radiology triage platform spanning hospital staff and patient portals, an Express/MongoDB workflow service, and a FastAPI imaging-analysis engine. The intended workflow runs from doctor intake through technologist scan upload and AI scoring to radiologist review, archived results, and patient access. The graph includes documented capabilities such as lab correlation, prioritization, feedback, and reporting. Some frontend-to-AI wiring is unsampled, so that integration is shown as unverified rather than as a confirmed call.

Main entry points: [`server/index.js`](https://github.com/ajay-aj7899/arogya_ai/blob/master/server/index.js) (Workflow API), [`frontend/src/store/patientStore.ts`](https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/store/patientStore.ts) (Patient State), [`frontend/src/App.tsx`](https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/App.tsx) (Route Application), [`frontend/src/pages/HospitalPortal.tsx`](https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/pages/HospitalPortal.tsx) (Hospital Portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portals["Clinical Portals"]
  node_hospital_page["Hospital Portal<br/>[HospitalPortal.tsx]"]
  node_patient_page["Patient Page<br/>[PatientPage.tsx]"]
  node_patient_portal["Patient Status<br/>[PatientPortal.tsx]"]
  node_app["Route Application<br/>[App.tsx]"]
  node_not_found["Fallback Page<br/>[NotFound.tsx]"]
end

subgraph group_workflow["Triage Workflow"]
  node_doctor["Doctor Intake<br/>[DoctorPortal.tsx]"]
  node_technologist["Scan Upload<br/>[TechStation.tsx]"]
  node_radiologist["Radiologist Review"]
  node_results["Doctor Results<br/>[DoctorResults.tsx]"]
  node_priority["Priority Worklist"]
end

subgraph group_services["Application Services"]
  node_patient_store["Patient State<br/>[patientStore.ts]"]
  node_express["Workflow API<br/>[index.js]"]
  node_patients[("Active Patients<br/>[Patient.js]")]
  node_done_reports[("Archived Reports<br/>[DoneReport.js]")]
end

subgraph group_analysis["AI Analysis"]
  node_ai_api["Analysis API<br/>[main.py]"]
  node_ai_engine["Imaging Models<br/>[ai_engine.py]"]
end

node_staff(("Hospital Staff"))
node_patient(("Patient"))
node_mongodb[("MongoDB")]

node_app -->|"routes to"| node_hospital_page
node_app -->|"routes to"| node_patient_page
node_app -->|"routes to"| node_not_found
node_hospital_page -->|"renders"| node_doctor
node_staff -->|"registers patients"| node_doctor
node_doctor -.->|"persists intake"| node_patient_store
node_technologist -.->|"uploads scans"| node_ai_api
node_ai_api -->|"calls analysis"| node_ai_engine
node_ai_api -.->|"returns triage"| node_radiologist
node_radiologist -->|"reviews worklist"| node_priority
node_radiologist -.->|"submits feedback"| node_patient_store
node_patient_store -->|"requests records"| node_express
node_express -->|"reads and updates"| node_patients
node_express -->|"archives reports"| node_done_reports
node_express -->|"removes completed case"| node_patients
node_hospital_page -->|"shows results"| node_results
node_patient_page -->|"renders"| node_patient_portal
node_patient -->|"checks status"| node_patient_portal
node_patient_portal -.->|"retrieves reports"| node_patient_store
node_mongodb -->|"stores"| node_patients
node_mongodb -->|"stores"| node_done_reports

click node_doctor "https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/components/DoctorPortal.tsx"
click node_technologist "https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/components/TechStation.tsx"
click node_radiologist "https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/components/RadiologistDashboard.tsx"
click node_results "https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/components/DoctorResults.tsx"
click node_priority "https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/components/PrioritySidebar.tsx"
click node_patient_store "https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/store/patientStore.ts"
click node_hospital_page "https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/pages/HospitalPortal.tsx"
click node_patient_page "https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/pages/PatientPage.tsx"
click node_patient_portal "https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/components/PatientPortal.tsx"
click node_app "https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/App.tsx"
click node_not_found "https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/pages/NotFound.tsx"
click node_express "https://github.com/ajay-aj7899/arogya_ai/blob/master/server/index.js"
click node_patients "https://github.com/ajay-aj7899/arogya_ai/blob/master/server/models/Patient.js"
click node_done_reports "https://github.com/ajay-aj7899/arogya_ai/blob/master/server/models/DoneReport.js"
click node_ai_api "https://github.com/ajay-aj7899/arogya_ai/blob/master/backend/main.py"
click node_ai_engine "https://github.com/ajay-aj7899/arogya_ai/blob/master/backend/ai_engine.py"

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_hospital_page,node_patient_page,node_patient_portal,node_app,node_not_found toneBlue
class node_doctor,node_technologist,node_radiologist,node_results,node_priority,node_mongodb toneAmber
class node_patient_store,node_express,node_patients,node_done_reports toneMint
class node_ai_api,node_ai_engine toneRose
class node_staff,node_patient toneIndigo
```

## Components

### Clinical Portals

- [Hospital Portal](https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/pages/HospitalPortal.tsx): `frontend/src/pages/HospitalPortal.tsx`
- [Patient Page](https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/pages/PatientPage.tsx): `frontend/src/pages/PatientPage.tsx`
- [Patient Status](https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/components/PatientPortal.tsx): `frontend/src/components/PatientPortal.tsx`
- [Route Application](https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Fallback Page](https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/pages/NotFound.tsx): `frontend/src/pages/NotFound.tsx`

### Triage Workflow

- [Doctor Intake](https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/components/DoctorPortal.tsx): `frontend/src/components/DoctorPortal.tsx`
- [Scan Upload](https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/components/TechStation.tsx): `frontend/src/components/TechStation.tsx`
- [Radiologist Review](https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/components/RadiologistDashboard.tsx): `frontend/src/components/RadiologistDashboard.tsx`
- [Doctor Results](https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/components/DoctorResults.tsx): `frontend/src/components/DoctorResults.tsx`
- [Priority Worklist](https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/components/PrioritySidebar.tsx): `frontend/src/components/PrioritySidebar.tsx`

### Application Services

- [Patient State](https://github.com/ajay-aj7899/arogya_ai/blob/master/frontend/src/store/patientStore.ts): `frontend/src/store/patientStore.ts`
- [Workflow API](https://github.com/ajay-aj7899/arogya_ai/blob/master/server/index.js): `server/index.js`
- [Active Patients](https://github.com/ajay-aj7899/arogya_ai/blob/master/server/models/Patient.js): `server/models/Patient.js`
- [Archived Reports](https://github.com/ajay-aj7899/arogya_ai/blob/master/server/models/DoneReport.js): `server/models/DoneReport.js`

### AI Analysis

- [Analysis API](https://github.com/ajay-aj7899/arogya_ai/blob/master/backend/main.py): `backend/main.py`
- [Imaging Models](https://github.com/ajay-aj7899/arogya_ai/blob/master/backend/ai_engine.py): `backend/ai_engine.py`

### Other components

- **Hospital Staff**
- **Patient**
- **MongoDB**

## Connections

- Route Application → Hospital Portal: routes to (evidence: `frontend/src/App.tsx`)
- Route Application → Patient Page: routes to (evidence: `frontend/src/App.tsx`)
- Route Application → Fallback Page: routes to (evidence: `frontend/src/App.tsx`)
- Hospital Portal → Doctor Intake: renders (evidence: `frontend/src/pages/HospitalPortal.tsx`)
- Hospital Staff → Doctor Intake: registers patients
- Doctor Intake → Patient State: persists intake
- Scan Upload → Analysis API: uploads scans
- Analysis API → Imaging Models: calls analysis (evidence: `backend/main.py`)
- Analysis API → Radiologist Review: returns triage
- Radiologist Review → Priority Worklist: reviews worklist
- Radiologist Review → Patient State: submits feedback
- Patient State → Workflow API: requests records (evidence: `frontend/src/store/patientStore.ts`)
- Workflow API → Active Patients: reads and updates (evidence: `server/index.js`)
- Workflow API → Archived Reports: archives reports (evidence: `server/index.js`)
- Workflow API → Active Patients: removes completed case (evidence: `server/index.js`)
- Hospital Portal → Doctor Results: shows results
- Patient Page → Patient Status: renders (evidence: `frontend/src/pages/PatientPage.tsx`)
- Patient → Patient Status: checks status
- Patient Status → Patient State: retrieves reports
- MongoDB → Active Patients: stores (evidence: `server/models/Patient.js`)
- MongoDB → Archived Reports: stores (evidence: `server/models/DoneReport.js`)
