# harsh0259/sih-2026 architecture

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

- Interactive diagram: https://gitdiagram.com/harsh0259/sih-2026
- Repository: https://github.com/harsh0259/sih-2026

## Overview

SENTINEL is a personnel welfare and stress-monitoring system. Personnel and welfare officers use its web interface to review rosters, risk analytics, sleep, wellness, and alerts; personnel can submit wellness and sleep information. The frontend calls a FastAPI backend that exposes authentication and personnel-management domains, while risk assessment can invoke a separate AI engine for prediction and explanations. The backend persists domain records through SQLAlchemy. The README is empty, so the capability map relies on the file tree and source index; unsampled route implementations and API wiring limit some relationship details.

Main entry points: [`Frontend/src/App.jsx`](https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/App.jsx) (Web app), [`Backend/app/main.py`](https://github.com/harsh0259/sih-2026/blob/main/Backend/app/main.py) (FastAPI app), [`Backend/src/predict.py`](https://github.com/harsh0259/sih-2026/blob/main/Backend/src/predict.py) (Risk prediction), [`Frontend/src/api/client.js`](https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/api/client.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_web_app["Web app<br/>[App.jsx]"]
  node_api_client["API client<br/>[client.js]"]
  node_dashboard["Dashboard<br/>[DashboardPage.jsx]"]
  node_roster["Personnel roster<br/>[RosterPage.jsx]"]
  node_risk_analytics["Risk analytics"]
  node_wellness_page["Wellness check-in"]
  node_sleep_page["Sleep tracker"]
  node_alerts_page["Alerts<br/>[AlertsPage.jsx]"]
end

subgraph group_backend["Backend API"]
  node_backend_app["FastAPI app<br/>[main.py]"]
  node_auth_routes["Authentication<br/>[auth.py]"]
  node_personnel_routes["Personnel routes<br/>[personnel.py]"]
  node_workload_routes["Workload routes<br/>[workload.py]"]
  node_deployment_routes["Deployment routes<br/>[deployment.py]"]
  node_leave_routes["Leave routes<br/>[leave.py]"]
  node_wellness_routes["Wellness routes<br/>[wellness.py]"]
  node_sleep_routes["Sleep routes<br/>[sleep.py]"]
  node_risk_routes["Risk routes<br/>[risk.py]"]
  node_ai_client["AI service client<br/>[ai_client.py]"]
end

subgraph group_data["Welfare data"]
  node_db_session["Database sessions<br/>[database.py]"]
  node_personnel_data[("Personnel records<br/>[personnel.py]")]
  node_user_data[("User accounts<br/>[user.py]")]
  node_wellness_data[("Wellness records<br/>[wellness.py]")]
end

subgraph group_engine["Risk engine"]
  node_engine_api["AI risk API<br/>[main.py]"]
  node_prediction["Risk prediction<br/>[predict.py]"]
  node_sleep_estimation["Sleep estimation<br/>[sleep.py]"]
  node_feature_engineering["Feature engineering<br/>[features.py]"]
  node_explanations["Factor explanations<br/>[explain.py]"]
  node_trend_analysis["Risk trends<br/>[trend.py]"]
end

node_officer(("Welfare officer"))
node_personnel_actor(("Personnel user"))

node_officer -->|"reviews welfare"| node_web_app
node_personnel_actor -->|"submits check-ins"| node_web_app
node_web_app -->|"shows"| node_dashboard
node_web_app -->|"shows"| node_roster
node_web_app -->|"shows"| node_risk_analytics
node_web_app -->|"shows"| node_wellness_page
node_web_app -->|"shows"| node_sleep_page
node_web_app -->|"shows"| node_alerts_page
node_web_app -->|"loads personnel"| node_api_client
node_dashboard -.->|"uses"| node_api_client
node_wellness_page -->|"submits check-ins"| node_api_client
node_sleep_page -->|"uses"| node_api_client
node_web_app -.->|"requests API"| node_backend_app
node_backend_app -->|"registers"| node_auth_routes
node_backend_app -->|"registers"| node_personnel_routes
node_backend_app -->|"registers"| node_workload_routes
node_backend_app -->|"registers"| node_deployment_routes
node_backend_app -->|"registers"| node_leave_routes
node_backend_app -->|"registers"| node_wellness_routes
node_backend_app -->|"registers"| node_sleep_routes
node_backend_app -->|"registers"| node_risk_routes
node_auth_routes -->|"queries"| node_user_data
node_auth_routes -->|"uses session"| node_db_session
node_personnel_routes -->|"manages"| node_personnel_data
node_wellness_routes -->|"manages"| node_wellness_data
node_risk_routes -->|"requests prediction"| node_ai_client
node_ai_client -->|"posts prediction"| node_engine_api
node_engine_api -->|"dispatches"| node_prediction
node_prediction -->|"estimates sleep"| node_sleep_estimation
node_prediction -->|"builds features"| node_feature_engineering
node_prediction -->|"explains factors"| node_explanations
node_prediction -->|"calculates trend"| node_trend_analysis

click node_web_app "https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/App.jsx"
click node_api_client "https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/api/client.js"
click node_dashboard "https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/pages/DashboardPage.jsx"
click node_roster "https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/pages/RosterPage.jsx"
click node_risk_analytics "https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/pages/RiskAnalyticsPage.jsx"
click node_wellness_page "https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/pages/WellnessCheckinPage.jsx"
click node_sleep_page "https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/pages/SleepTrackerPage.jsx"
click node_alerts_page "https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/pages/AlertsPage.jsx"
click node_backend_app "https://github.com/harsh0259/sih-2026/blob/main/Backend/app/main.py"
click node_auth_routes "https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/auth.py"
click node_personnel_routes "https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/personnel.py"
click node_workload_routes "https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/workload.py"
click node_deployment_routes "https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/deployment.py"
click node_leave_routes "https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/leave.py"
click node_wellness_routes "https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/wellness.py"
click node_sleep_routes "https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/sleep.py"
click node_risk_routes "https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/risk.py"
click node_ai_client "https://github.com/harsh0259/sih-2026/blob/main/Backend/app/services/ai_client.py"
click node_db_session "https://github.com/harsh0259/sih-2026/blob/main/Backend/app/core/database.py"
click node_personnel_data "https://github.com/harsh0259/sih-2026/blob/main/Backend/app/models/personnel.py"
click node_user_data "https://github.com/harsh0259/sih-2026/blob/main/Backend/app/models/user.py"
click node_wellness_data "https://github.com/harsh0259/sih-2026/blob/main/Backend/app/models/wellness.py"
click node_engine_api "https://github.com/harsh0259/sih-2026/blob/main/AI_RISK_ENGINE/api/main.py"
click node_prediction "https://github.com/harsh0259/sih-2026/blob/main/Backend/src/predict.py"
click node_sleep_estimation "https://github.com/harsh0259/sih-2026/blob/main/Backend/src/sleep.py"
click node_feature_engineering "https://github.com/harsh0259/sih-2026/blob/main/Backend/src/features.py"
click node_explanations "https://github.com/harsh0259/sih-2026/blob/main/Backend/src/explain.py"
click node_trend_analysis "https://github.com/harsh0259/sih-2026/blob/main/Backend/src/trend.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_web_app,node_api_client,node_dashboard,node_roster,node_risk_analytics,node_wellness_page,node_sleep_page,node_alerts_page,node_personnel_actor toneBlue
class node_backend_app,node_auth_routes,node_personnel_routes,node_workload_routes,node_deployment_routes,node_leave_routes,node_wellness_routes,node_sleep_routes,node_risk_routes,node_ai_client toneAmber
class node_db_session,node_personnel_data,node_user_data,node_wellness_data toneMint
class node_engine_api,node_prediction,node_sleep_estimation,node_feature_engineering,node_explanations,node_trend_analysis toneRose
class node_officer toneIndigo
```

## Components

### Web application

- [Web app](https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/App.jsx): `Frontend/src/App.jsx`
- [API client](https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/api/client.js): `Frontend/src/api/client.js`
- [Dashboard](https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/pages/DashboardPage.jsx): `Frontend/src/pages/DashboardPage.jsx`
- [Personnel roster](https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/pages/RosterPage.jsx): `Frontend/src/pages/RosterPage.jsx`
- [Risk analytics](https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/pages/RiskAnalyticsPage.jsx): `Frontend/src/pages/RiskAnalyticsPage.jsx`
- [Wellness check-in](https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/pages/WellnessCheckinPage.jsx): `Frontend/src/pages/WellnessCheckinPage.jsx`
- [Sleep tracker](https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/pages/SleepTrackerPage.jsx): `Frontend/src/pages/SleepTrackerPage.jsx`
- [Alerts](https://github.com/harsh0259/sih-2026/blob/main/Frontend/src/pages/AlertsPage.jsx): `Frontend/src/pages/AlertsPage.jsx`

### Backend API

- [FastAPI app](https://github.com/harsh0259/sih-2026/blob/main/Backend/app/main.py): `Backend/app/main.py`
- [Authentication](https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/auth.py): `Backend/app/routes/auth.py`
- [Personnel routes](https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/personnel.py): `Backend/app/routes/personnel.py`
- [Workload routes](https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/workload.py): `Backend/app/routes/workload.py`
- [Deployment routes](https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/deployment.py): `Backend/app/routes/deployment.py`
- [Leave routes](https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/leave.py): `Backend/app/routes/leave.py`
- [Wellness routes](https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/wellness.py): `Backend/app/routes/wellness.py`
- [Sleep routes](https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/sleep.py): `Backend/app/routes/sleep.py`
- [Risk routes](https://github.com/harsh0259/sih-2026/blob/main/Backend/app/routes/risk.py): `Backend/app/routes/risk.py`
- [AI service client](https://github.com/harsh0259/sih-2026/blob/main/Backend/app/services/ai_client.py): `Backend/app/services/ai_client.py`

### Welfare data

- [Database sessions](https://github.com/harsh0259/sih-2026/blob/main/Backend/app/core/database.py): `Backend/app/core/database.py`
- [Personnel records](https://github.com/harsh0259/sih-2026/blob/main/Backend/app/models/personnel.py): `Backend/app/models/personnel.py`
- [User accounts](https://github.com/harsh0259/sih-2026/blob/main/Backend/app/models/user.py): `Backend/app/models/user.py`
- [Wellness records](https://github.com/harsh0259/sih-2026/blob/main/Backend/app/models/wellness.py): `Backend/app/models/wellness.py`

### Risk engine

- [AI risk API](https://github.com/harsh0259/sih-2026/blob/main/AI_RISK_ENGINE/api/main.py): `AI_RISK_ENGINE/api/main.py`
- [Risk prediction](https://github.com/harsh0259/sih-2026/blob/main/Backend/src/predict.py): `Backend/src/predict.py`
- [Sleep estimation](https://github.com/harsh0259/sih-2026/blob/main/Backend/src/sleep.py): `Backend/src/sleep.py`
- [Feature engineering](https://github.com/harsh0259/sih-2026/blob/main/Backend/src/features.py): `Backend/src/features.py`
- [Factor explanations](https://github.com/harsh0259/sih-2026/blob/main/Backend/src/explain.py): `Backend/src/explain.py`
- [Risk trends](https://github.com/harsh0259/sih-2026/blob/main/Backend/src/trend.py): `Backend/src/trend.py`

### Other components

- **Welfare officer**
- **Personnel user**

## Connections

- Welfare officer → Web app: reviews welfare
- Personnel user → Web app: submits check-ins
- Web app → Dashboard: shows (evidence: `Frontend/src/App.jsx`)
- Web app → Personnel roster: shows (evidence: `Frontend/src/App.jsx`)
- Web app → Risk analytics: shows (evidence: `Frontend/src/App.jsx`)
- Web app → Wellness check-in: shows (evidence: `Frontend/src/App.jsx`)
- Web app → Sleep tracker: shows (evidence: `Frontend/src/App.jsx`)
- Web app → Alerts: shows (evidence: `Frontend/src/App.jsx`)
- Web app → API client: loads personnel (evidence: `Frontend/src/App.jsx`)
- Dashboard → API client: uses (evidence: `Frontend/src/pages/DashboardPage.jsx`)
- Wellness check-in → API client: submits check-ins (evidence: `Frontend/src/pages/WellnessCheckinPage.jsx`)
- Sleep tracker → API client: uses (evidence: `Frontend/src/pages/SleepTrackerPage.jsx`)
- Web app → FastAPI app: requests API
- FastAPI app → Authentication: registers (evidence: `Backend/app/main.py`)
- FastAPI app → Personnel routes: registers (evidence: `Backend/app/main.py`)
- FastAPI app → Workload routes: registers (evidence: `Backend/app/main.py`)
- FastAPI app → Deployment routes: registers (evidence: `Backend/app/main.py`)
- FastAPI app → Leave routes: registers (evidence: `Backend/app/main.py`)
- FastAPI app → Wellness routes: registers (evidence: `Backend/app/main.py`)
- FastAPI app → Sleep routes: registers (evidence: `Backend/app/main.py`)
- FastAPI app → Risk routes: registers (evidence: `Backend/app/main.py`)
- Authentication → User accounts: queries (evidence: `Backend/app/routes/auth.py`)
- Authentication → Database sessions: uses session (evidence: `Backend/app/routes/auth.py`)
- Personnel routes → Personnel records: manages
- Wellness routes → Wellness records: manages (evidence: `Backend/app/routes/wellness.py`)
- Risk routes → AI service client: requests prediction (evidence: `Backend/app/routes/risk.py`)
- AI service client → AI risk API: posts prediction (evidence: `Backend/app/services/ai_client.py`)
- AI risk API → Risk prediction: dispatches (evidence: `AI_RISK_ENGINE/api/main.py`)
- Risk prediction → Sleep estimation: estimates sleep (evidence: `Backend/src/predict.py`)
- Risk prediction → Feature engineering: builds features (evidence: `Backend/src/predict.py`)
- Risk prediction → Factor explanations: explains factors (evidence: `Backend/src/predict.py`)
- Risk prediction → Risk trends: calculates trend (evidence: `Backend/src/predict.py`)
