# sajid-ally/jaldrishti architecture

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

- Interactive diagram: https://gitdiagram.com/sajid-ally/jaldrishti
- Repository: https://github.com/sajid-ally/jaldrishti

## Overview

JalDrishti is a citizen and municipal-response platform for water hazards. Citizens submit location-tagged incidents or SOS requests; the backend analyzes and records reports, while authorities review, verify, assign response teams, and update status for citizen tracking. The product also includes maps and hotspot evidence, alerts, and social-media reporting. The graph combines documented capabilities with relationships visible in the excerpts and source index; unsampled internals are represented at their known module paths, without assuming their call details.

Main entry points: [`Backend/app/reports/routes.py`](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/reports/routes.py) (Report endpoints), [`Backend/app/main.py`](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/main.py) (API application), [`frontend/src/routes/AppRoutes.tsx`](https://github.com/sajid-ally/jaldrishti/blob/main/frontend/src/routes/AppRoutes.tsx) (Portal routing), [`Backend/app/reports/service.py`](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/reports/service.py) (Report lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Portals and clients"]
  node_web["Web application<br/>[App.tsx]"]
  node_routing["Portal routing<br/>[AppRoutes.tsx]"]
  node_reportui["Incident reporting<br/>[ReportHazard.tsx]"]
  node_reliefui["SOS and relief<br/>[RescueRelief.tsx]"]
  node_reviewui["Authority review<br/>[ReviewReports.tsx]"]
  node_trackui["Incident tracking<br/>[TrackReport.tsx]"]
end

subgraph group_reports["Incident management"]
  node_reportclient["Report API client<br/>[reportService.ts]"]
  node_reportroutes["Report endpoints<br/>[routes.py]"]
  node_reportdomain["Report lifecycle<br/>[service.py]"]
end

subgraph group_response["Response and evidence"]
  node_reliefroutes["Relief endpoints<br/>[routes.py]"]
  node_reliefservice["Rescue dispatch<br/>[service.py]"]
  node_validation["Incident validation<br/>[service.py]"]
  node_socialreports["Social reports<br/>[service.py]"]
  node_socialbridge["Social detection bridge<br/>[service.py]"]
  node_alerts["Government alerts<br/>[routes.py]"]
  node_notifications["Notifications<br/>[service.py]"]
end

subgraph group_platform["Platform services"]
  node_mongo[("MongoDB<br/>[database.py]")]
  node_auth["Authentication<br/>[service.py]"]
  node_authroutes["Auth endpoints<br/>[routes.py]"]
  node_main["API application<br/>[main.py]"]
end

subgraph group_ml["AI analysis"]
  node_gemini["Gemini verification<br/>[service.py]"]
  node_mlclient["ML service client<br/>[ml_client.py]"]
  node_mlapi["ML inference API<br/>[main.py]"]
  node_hotspots["Hotspot clustering"]
end

node_citizen(("Citizen"))
node_official(("Municipal authority"))

node_citizen -->|"uses"| node_web
node_official -->|"uses"| node_web
node_web -->|"renders"| node_routing
node_routing -->|"routes to"| node_reportui
node_routing -->|"routes to"| node_reviewui
node_routing -->|"routes to"| node_trackui
node_reportui -.->|"submits"| node_reportclient
node_reportclient -->|"HTTP requests"| node_reportroutes
node_reportroutes -->|"delegates"| node_reportdomain
node_reportdomain -->|"reads and writes"| node_mongo
node_reportroutes -->|"verifies with"| node_gemini
node_reportroutes -->|"requests analysis"| node_mlclient
node_mlclient -.->|"calls"| node_mlapi
node_mlapi -.->|"uses"| node_hotspots
node_reviewui -->|"loads reports"| node_reportclient
node_reportdomain -->|"supports dispatch"| node_official
node_citizen -->|"requests rescue"| node_reliefui
node_reliefui -.->|"submits request"| node_reliefroutes
node_reliefroutes -->|"delegates"| node_reliefservice
node_reliefservice -.->|"stores requests"| node_mongo
node_official -->|"assigns teams"| node_reliefservice
node_reportroutes -.->|"validates evidence"| node_validation
node_validation -.->|"queries incidents"| node_mongo
node_validation -->|"serves alert data"| node_alerts
node_socialreports -->|"uses"| node_notifications
node_socialbridge -.->|"forwards reports"| node_socialreports
node_main -->|"registers"| node_reportroutes
node_main -->|"registers"| node_authroutes
node_main -->|"registers"| node_reliefroutes
node_main -->|"registers"| node_alerts
node_authroutes -->|"delegates"| node_auth
node_auth -->|"reads and writes"| node_mongo
node_web -->|"syncs offline reports"| node_reportclient
node_citizen -->|"tracks status"| node_trackui
node_reportdomain -.->|"clusters hazards"| node_hotspots

click node_web "https://github.com/sajid-ally/jaldrishti/blob/main/frontend/src/App.tsx"
click node_routing "https://github.com/sajid-ally/jaldrishti/blob/main/frontend/src/routes/AppRoutes.tsx"
click node_reportui "https://github.com/sajid-ally/jaldrishti/blob/main/frontend/src/pages/Citizen/ReportHazard.tsx"
click node_reliefui "https://github.com/sajid-ally/jaldrishti/blob/main/frontend/src/pages/Citizen/RescueRelief.tsx"
click node_reviewui "https://github.com/sajid-ally/jaldrishti/blob/main/frontend/src/pages/Government/ReviewReports.tsx"
click node_trackui "https://github.com/sajid-ally/jaldrishti/blob/main/frontend/src/pages/Citizen/TrackReport.tsx"
click node_reportclient "https://github.com/sajid-ally/jaldrishti/blob/main/frontend/src/services/reportService.ts"
click node_reportroutes "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/reports/routes.py"
click node_reportdomain "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/reports/service.py"
click node_mongo "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/database.py"
click node_auth "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/auth/service.py"
click node_authroutes "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/auth/routes.py"
click node_main "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/main.py"
click node_reliefroutes "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/relief/routes.py"
click node_reliefservice "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/relief/service.py"
click node_validation "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/validation/service.py"
click node_socialreports "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/social_reports/service.py"
click node_socialbridge "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/social_bridge/service.py"
click node_alerts "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/validation/routes.py"
click node_notifications "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/notifications/service.py"
click node_gemini "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/gemini/service.py"
click node_mlclient "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/ml_client.py"
click node_mlapi "https://github.com/sajid-ally/jaldrishti/blob/main/ml-service/app/main.py"
click node_hotspots "https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/models/hotspot_clustering.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,node_routing,node_reportui,node_reliefui,node_reviewui,node_trackui toneBlue
class node_reportclient,node_reportroutes,node_reportdomain toneAmber
class node_reliefroutes,node_reliefservice,node_validation,node_socialreports,node_socialbridge,node_alerts,node_notifications toneMint
class node_mongo,node_auth,node_authroutes,node_main toneRose
class node_gemini,node_mlclient,node_mlapi,node_hotspots,node_citizen,node_official toneIndigo
```

## Components

### Portals and clients

- [Web application](https://github.com/sajid-ally/jaldrishti/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Portal routing](https://github.com/sajid-ally/jaldrishti/blob/main/frontend/src/routes/AppRoutes.tsx): `frontend/src/routes/AppRoutes.tsx`
- [Incident reporting](https://github.com/sajid-ally/jaldrishti/blob/main/frontend/src/pages/Citizen/ReportHazard.tsx): `frontend/src/pages/Citizen/ReportHazard.tsx`
- [SOS and relief](https://github.com/sajid-ally/jaldrishti/blob/main/frontend/src/pages/Citizen/RescueRelief.tsx): `frontend/src/pages/Citizen/RescueRelief.tsx`
- [Authority review](https://github.com/sajid-ally/jaldrishti/blob/main/frontend/src/pages/Government/ReviewReports.tsx): `frontend/src/pages/Government/ReviewReports.tsx`
- [Incident tracking](https://github.com/sajid-ally/jaldrishti/blob/main/frontend/src/pages/Citizen/TrackReport.tsx): `frontend/src/pages/Citizen/TrackReport.tsx`

### Incident management

- [Report API client](https://github.com/sajid-ally/jaldrishti/blob/main/frontend/src/services/reportService.ts): `frontend/src/services/reportService.ts`
- [Report endpoints](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/reports/routes.py): `Backend/app/reports/routes.py`
- [Report lifecycle](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/reports/service.py): `Backend/app/reports/service.py`

### Response and evidence

- [Relief endpoints](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/relief/routes.py): `Backend/app/relief/routes.py`
- [Rescue dispatch](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/relief/service.py): `Backend/app/relief/service.py`
- [Incident validation](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/validation/service.py): `Backend/app/validation/service.py`
- [Social reports](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/social_reports/service.py): `Backend/app/social_reports/service.py`
- [Social detection bridge](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/social_bridge/service.py): `Backend/app/social_bridge/service.py`
- [Government alerts](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/validation/routes.py): `Backend/app/validation/routes.py`
- [Notifications](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/notifications/service.py): `Backend/app/notifications/service.py`

### Platform services

- [MongoDB](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/database.py): `Backend/app/database.py`
- [Authentication](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/auth/service.py): `Backend/app/auth/service.py`
- [Auth endpoints](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/auth/routes.py): `Backend/app/auth/routes.py`
- [API application](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/main.py): `Backend/app/main.py`

### AI analysis

- [Gemini verification](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/gemini/service.py): `Backend/app/gemini/service.py`
- [ML service client](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/ml_client.py): `Backend/app/ml_client.py`
- [ML inference API](https://github.com/sajid-ally/jaldrishti/blob/main/ml-service/app/main.py): `ml-service/app/main.py`
- [Hotspot clustering](https://github.com/sajid-ally/jaldrishti/blob/main/Backend/app/models/hotspot_clustering.py): `Backend/app/models/hotspot_clustering.py`

### Other components

- **Citizen**
- **Municipal authority**

## Connections

- Citizen → Web application: uses
- Municipal authority → Web application: uses
- Web application → Portal routing: renders (evidence: `frontend/src/App.tsx`)
- Portal routing → Incident reporting: routes to (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Portal routing → Authority review: routes to (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Portal routing → Incident tracking: routes to (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Incident reporting → Report API client: submits
- Report API client → Report endpoints: HTTP requests (evidence: `frontend/src/services/reportService.ts`)
- Report endpoints → Report lifecycle: delegates (evidence: `Backend/app/reports/routes.py`)
- Report lifecycle → MongoDB: reads and writes (evidence: `Backend/app/reports/service.py`)
- Report endpoints → Gemini verification: verifies with (evidence: `Backend/app/reports/routes.py`)
- Report endpoints → ML service client: requests analysis (evidence: `Backend/app/reports/routes.py`)
- ML service client → ML inference API: calls
- ML inference API → Hotspot clustering: uses
- Authority review → Report API client: loads reports (evidence: `frontend/src/pages/Government/ReviewReports.tsx`)
- Report lifecycle → Municipal authority: supports dispatch
- Citizen → SOS and relief: requests rescue
- SOS and relief → Relief endpoints: submits request
- Relief endpoints → Rescue dispatch: delegates (evidence: `Backend/app/relief/routes.py`)
- Rescue dispatch → MongoDB: stores requests
- Municipal authority → Rescue dispatch: assigns teams
- Report endpoints → Incident validation: validates evidence
- Incident validation → MongoDB: queries incidents (evidence: `Backend/app/validation/service.py`)
- Incident validation → Government alerts: serves alert data (evidence: `Backend/app/validation/routes.py`)
- Social reports → Notifications: uses (evidence: `Backend/app/social_reports/service.py`)
- Social detection bridge → Social reports: forwards reports
- API application → Report endpoints: registers (evidence: `Backend/app/main.py`)
- API application → Auth endpoints: registers (evidence: `Backend/app/main.py`)
- API application → Relief endpoints: registers (evidence: `Backend/app/main.py`)
- API application → Government alerts: registers (evidence: `Backend/app/main.py`)
- Auth endpoints → Authentication: delegates (evidence: `Backend/app/auth/routes.py`)
- Authentication → MongoDB: reads and writes (evidence: `Backend/app/auth/service.py`)
- Web application → Report API client: syncs offline reports (evidence: `frontend/src/App.tsx`)
- Citizen → Incident tracking: tracks status
- Report lifecycle → Hotspot clustering: clusters hazards (evidence: `Backend/app/reports/service.py`)
