# aadityasingh0709/taap-chetna architecture

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

- Interactive diagram: https://gitdiagram.com/aadityasingh0709/taap-chetna
- Repository: https://github.com/aadityasingh0709/taap-chetna

## Overview

Taap Chetna is a citizen heat-health assessment and municipal response platform. Citizens use the web app to assess personal risk, compare travel climates, and explore safer activity times; municipal officers use a role-restricted dashboard for ward conditions, alerts, and heat-health burden, while admins manage authority access. The Node API connects these workflows to weather telemetry, domain calculations, and MongoDB-backed records. The README also describes a macro-burden ML capability. Some frontend-to-API and ML-service wiring is not visible in the excerpts, so those links are omitted or marked unverified.

Main entry points: [`backend/routes`](https://github.com/aadityasingh0709/taap-chetna/tree/main/backend/routes) (Route dispatch), [`frontend/src/App.jsx`](https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/App.jsx) (Role-based app), [`backend/controllers/authorityController.js`](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/authorityController.js) (Authority operations), [`backend/controllers/citizenController.js`](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/citizenController.js) (Citizen profile & risk)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["Role-based app<br/>[App.jsx]"]
  node_authui["Sign-in &amp; registration<br/>[AuthModal.jsx]"]
  node_personal["Personal risk"]
  node_travel["Travel analyzer"]
  node_whatif["Time-shift planner<br/>[WhatIfPlanner.jsx]"]
  node_municipal["Municipal dashboard"]
  node_burdenpanel["Burden panel"]
  node_adminui["Admin portal<br/>[AdminPortal.jsx]"]
  node_authstate["Authentication state<br/>[AuthContext.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["API workflows"]
  node_server["API server<br/>[index.js]"]
  node_routes["Route dispatch"]
  node_auth["Identity &amp; access<br/>[authController.js]"]
  node_citizenapi["Citizen profile &amp; risk"]
  node_authorityapi["Authority operations"]
  node_adminapi["Admin operations<br/>[adminController.js]"]
  node_weatherapi["Weather endpoints"]
  node_travelapi["Travel comparison"]
  node_whatifapi["What-if simulation"]
end

subgraph group_domain["Heat intelligence"]
  node_weather["Weather &amp; geocoding<br/>[weatherService.js]"]
  node_burden["Heat burden estimates"]
end

subgraph group_records["Platform records"]
  node_database[("MongoDB records<br/>[db.js]")]
  node_user[("Users &amp; profiles<br/>[User.js]")]
  node_profile[("Citizen profiles<br/>[CitizenProfile.js]")]
  node_ward[("Ward records<br/>[Ward.js]")]
  node_alerts[("Alert records<br/>[Alert.js]")]
  node_requests[("Authority requests")]
end

subgraph group_ml["ML intelligence"]
  node_mlservice["Burden ML service<br/>[serve.py]"]
  node_mlfeatures["ML feature utilities<br/>[heat_metrics.py]"]
end

node_citizen(("Citizen / officer"))

node_citizen -->|"uses"| node_app
node_app -->|"routes to"| node_personal
node_app -->|"routes to"| node_travel
node_app -->|"routes to"| node_whatif
node_app -->|"routes to"| node_municipal
node_app -->|"routes to"| node_adminui
node_app -->|"renders"| node_authui
node_authui -->|"invokes"| node_authstate
node_authstate -->|"uses"| node_api_client
node_api_client -.->|"requests"| node_server
node_server -->|"mounts"| node_routes
node_routes -->|"dispatches"| node_auth
node_routes -->|"dispatches"| node_citizenapi
node_routes -->|"dispatches"| node_authorityapi
node_routes -->|"dispatches"| node_adminapi
node_routes -->|"dispatches"| node_weatherapi
node_routes -->|"dispatches"| node_travelapi
node_routes -.->|"dispatches"| node_whatifapi
node_auth -->|"reads &amp; writes"| node_user
node_citizenapi -->|"reads &amp; writes"| node_profile
node_citizenapi -->|"reads &amp; updates"| node_user
node_citizenapi -->|"fetches weather"| node_weather
node_weatherapi -->|"fetches weather"| node_weather
node_authorityapi -->|"fetches weather"| node_weather
node_authorityapi -->|"requests estimates"| node_burden
node_authorityapi -->|"reads"| node_ward
node_authorityapi -->|"reads &amp; writes"| node_alerts
node_adminapi -->|"reads &amp; updates"| node_requests
node_adminapi -->|"creates &amp; updates"| node_user
node_mlservice -->|"uses metrics"| node_mlfeatures
node_burden -.->|"may query"| node_mlservice
node_database -.->|"stores"| node_user

click node_app "https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/components/AuthModal.jsx"
click node_personal "https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/components/PersonalRiskCalculator.jsx"
click node_travel "https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/components/TravelRiskAnalyzer.jsx"
click node_whatif "https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/components/WhatIfPlanner.jsx"
click node_municipal "https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/components/MunicipalDashboard.jsx"
click node_burdenpanel "https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/components/HeatHealthBurdenPanel.jsx"
click node_adminui "https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/components/AdminPortal.jsx"
click node_authstate "https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/context/AuthContext.jsx"
click node_api_client "https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/services/api.js"
click node_server "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/index.js"
click node_routes "https://github.com/aadityasingh0709/taap-chetna/tree/main/backend/routes"
click node_auth "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/authController.js"
click node_citizenapi "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/citizenController.js"
click node_authorityapi "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/authorityController.js"
click node_adminapi "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/adminController.js"
click node_weatherapi "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/weatherController.js"
click node_travelapi "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/travelController.js"
click node_whatifapi "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/whatIfController.js"
click node_weather "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/services/weatherService.js"
click node_burden "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/services/heatBurdenService.js"
click node_database "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/config/db.js"
click node_user "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/models/User.js"
click node_profile "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/models/CitizenProfile.js"
click node_ward "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/models/Ward.js"
click node_alerts "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/models/Alert.js"
click node_requests "https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/models/AuthorityRequest.js"
click node_mlservice "https://github.com/aadityasingh0709/taap-chetna/blob/main/ml/serve.py"
click node_mlfeatures "https://github.com/aadityasingh0709/taap-chetna/blob/main/ml/utils/heat_metrics.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_app,node_authui,node_personal,node_travel,node_whatif,node_municipal,node_burdenpanel,node_adminui,node_authstate,node_api_client toneBlue
class node_server,node_routes,node_auth,node_citizenapi,node_authorityapi,node_adminapi,node_weatherapi,node_travelapi,node_whatifapi toneAmber
class node_weather,node_burden toneMint
class node_database,node_user,node_profile,node_ward,node_alerts,node_requests toneRose
class node_mlservice,node_mlfeatures,node_citizen toneIndigo
```

## Components

### Web experience

- [Role-based app](https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Sign-in & registration](https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/components/AuthModal.jsx): `frontend/src/components/AuthModal.jsx`
- [Personal risk](https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/components/PersonalRiskCalculator.jsx): `frontend/src/components/PersonalRiskCalculator.jsx`
- [Travel analyzer](https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/components/TravelRiskAnalyzer.jsx): `frontend/src/components/TravelRiskAnalyzer.jsx`
- [Time-shift planner](https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/components/WhatIfPlanner.jsx): `frontend/src/components/WhatIfPlanner.jsx`
- [Municipal dashboard](https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/components/MunicipalDashboard.jsx): `frontend/src/components/MunicipalDashboard.jsx`
- [Burden panel](https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/components/HeatHealthBurdenPanel.jsx): `frontend/src/components/HeatHealthBurdenPanel.jsx`
- [Admin portal](https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/components/AdminPortal.jsx): `frontend/src/components/AdminPortal.jsx`
- [Authentication state](https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [API client](https://github.com/aadityasingh0709/taap-chetna/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### API workflows

- [API server](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/index.js): `backend/index.js`
- [Route dispatch](https://github.com/aadityasingh0709/taap-chetna/tree/main/backend/routes): `backend/routes`
- [Identity & access](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Citizen profile & risk](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/citizenController.js): `backend/controllers/citizenController.js`
- [Authority operations](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/authorityController.js): `backend/controllers/authorityController.js`
- [Admin operations](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/adminController.js): `backend/controllers/adminController.js`
- [Weather endpoints](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/weatherController.js): `backend/controllers/weatherController.js`
- [Travel comparison](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/travelController.js): `backend/controllers/travelController.js`
- [What-if simulation](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/controllers/whatIfController.js): `backend/controllers/whatIfController.js`

### Heat intelligence

- [Weather & geocoding](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/services/weatherService.js): `backend/services/weatherService.js`
- [Heat burden estimates](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/services/heatBurdenService.js): `backend/services/heatBurdenService.js`

### Platform records

- [MongoDB records](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/config/db.js): `backend/config/db.js`
- [Users & profiles](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/models/User.js): `backend/models/User.js`
- [Citizen profiles](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/models/CitizenProfile.js): `backend/models/CitizenProfile.js`
- [Ward records](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/models/Ward.js): `backend/models/Ward.js`
- [Alert records](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/models/Alert.js): `backend/models/Alert.js`
- [Authority requests](https://github.com/aadityasingh0709/taap-chetna/blob/main/backend/models/AuthorityRequest.js): `backend/models/AuthorityRequest.js`

### ML intelligence

- [Burden ML service](https://github.com/aadityasingh0709/taap-chetna/blob/main/ml/serve.py): `ml/serve.py`
- [ML feature utilities](https://github.com/aadityasingh0709/taap-chetna/blob/main/ml/utils/heat_metrics.py): `ml/utils/heat_metrics.py`

### Other components

- **Citizen / officer**

## Connections

- Citizen / officer → Role-based app: uses (evidence: `frontend/src/App.jsx`)
- Role-based app → Personal risk: routes to (evidence: `frontend/src/App.jsx`)
- Role-based app → Travel analyzer: routes to (evidence: `frontend/src/App.jsx`)
- Role-based app → Time-shift planner: routes to (evidence: `frontend/src/App.jsx`)
- Role-based app → Municipal dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Role-based app → Admin portal: routes to (evidence: `frontend/src/App.jsx`)
- Role-based app → Sign-in & registration: renders (evidence: `frontend/src/App.jsx`)
- Sign-in & registration → Authentication state: invokes (evidence: `frontend/src/components/AuthModal.jsx`)
- Authentication state → API client: uses (evidence: `frontend/src/context/AuthContext.jsx`)
- API client → API server: requests
- API server → Route dispatch: mounts (evidence: `backend/index.js`)
- Route dispatch → Identity & access: dispatches (evidence: `backend/routes/auth.js`)
- Route dispatch → Citizen profile & risk: dispatches (evidence: `backend/routes/citizen.js`)
- Route dispatch → Authority operations: dispatches (evidence: `backend/routes/authority.js`)
- Route dispatch → Admin operations: dispatches (evidence: `backend/routes/admin.js`)
- Route dispatch → Weather endpoints: dispatches (evidence: `backend/routes/weather.js`)
- Route dispatch → Travel comparison: dispatches (evidence: `backend/routes/travel.js`)
- Route dispatch → What-if simulation: dispatches
- Identity & access → Users & profiles: reads & writes (evidence: `backend/controllers/authController.js`)
- Citizen profile & risk → Citizen profiles: reads & writes (evidence: `backend/controllers/citizenController.js`)
- Citizen profile & risk → Users & profiles: reads & updates (evidence: `backend/controllers/citizenController.js`)
- Citizen profile & risk → Weather & geocoding: fetches weather (evidence: `backend/controllers/citizenController.js`)
- Weather endpoints → Weather & geocoding: fetches weather (evidence: `backend/controllers/weatherController.js`)
- Authority operations → Weather & geocoding: fetches weather (evidence: `backend/controllers/authorityController.js`)
- Authority operations → Heat burden estimates: requests estimates (evidence: `backend/controllers/authorityController.js`)
- Authority operations → Ward records: reads (evidence: `backend/controllers/authorityController.js`)
- Authority operations → Alert records: reads & writes (evidence: `backend/controllers/authorityController.js`)
- Admin operations → Authority requests: reads & updates (evidence: `backend/controllers/adminController.js`)
- Admin operations → Users & profiles: creates & updates (evidence: `backend/controllers/adminController.js`)
- Burden ML service → ML feature utilities: uses metrics
- Heat burden estimates → Burden ML service: may query
- MongoDB records → Users & profiles: stores
