# anotherhalf004/seedlings-jalrakshak architecture

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

- Interactive diagram: https://gitdiagram.com/anotherhalf004/seedlings-jalrakshak
- Repository: https://github.com/anotherhalf004/seedlings-jalrakshak

## Overview

JalRakshak is a municipal water intelligence platform: source datasets are consolidated, demand and supply are forecast, deficits are classified and loss anomalies assessed, then API results power city monitoring, prediction and NRW what-if views. The README documents the broader data and model workflow; source excerpts confirm key inference, shortage, API and frontend links. Training and anomaly internals were not sampled, so those stages are represented from documented capabilities without inferred call-level links.

Main entry points: [`data/final/jalrakshak_master.csv`](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/data/final/jalrakshak_master.csv) (City master data), [`ml/predict.py`](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/predict.py) (City inference), [`frontend/src/App.jsx`](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/frontend/src/App.jsx) (App navigation), [`backend/main.py`](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/backend/main.py) (REST API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_municipal_sources["Water datasets"]
  node_population_data["Census data"]
  node_master_data["City master data"]
  node_data_audit["Data audit<br/>[data_audit.py]"]
  node_preprocessing["Data preparation<br/>[preprocessing.py]"]
end

subgraph group_analytics["Water analytics"]
  node_demand_model["Demand forecasting<br/>[train_demand.py]"]
  node_supply_model["Supply forecasting<br/>[train_supply.py]"]
  node_anomaly_model["Loss anomaly detection<br/>[train_anomaly.py]"]
  node_inference["City inference<br/>[predict.py]"]
  node_shortage["Shortage and risk<br/>[shortage_engine.py]"]
  node_evaluation["Model evaluation<br/>[evaluate.py]"]
end

subgraph group_service["API service"]
  node_backend["REST API<br/>[main.py]"]
end

subgraph group_client["Dashboard client"]
  node_app["App navigation<br/>[App.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_dashboard["City dashboard<br/>[Dashboard.jsx]"]
  node_predictor["Prediction view<br/>[Predictor.jsx]"]
  node_simulator["NRW simulator<br/>[Simulator.jsx]"]
  node_charts["Water visualizations<br/>[Charts.jsx]"]
end

node_user(("Municipal user"))

node_municipal_sources -.->|"prepares"| node_preprocessing
node_population_data -.->|"prepares"| node_preprocessing
node_preprocessing -.->|"generates"| node_master_data
node_master_data -.->|"serves city data"| node_backend
node_master_data -.->|"trains"| node_demand_model
node_master_data -.->|"trains"| node_supply_model
node_master_data -.->|"trains"| node_anomaly_model
node_demand_model -.->|"forecasts demand"| node_inference
node_supply_model -.->|"forecasts supply"| node_inference
node_anomaly_model -.->|"detects anomalies"| node_inference
node_inference -->|"calculates deficit"| node_shortage
node_shortage -->|"returns risk"| node_inference
node_master_data -.->|"evaluates models"| node_evaluation
node_backend -->|"runs predictions"| node_inference
node_backend -->|"uses risk engine"| node_shortage
node_user -.->|"uses"| node_app
node_app -->|"loads cities"| node_api_client
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_predictor
node_app -->|"renders"| node_simulator
node_dashboard -->|"renders charts"| node_charts
node_predictor -->|"requests prediction"| node_api_client
node_simulator -->|"requests simulation"| node_api_client
node_predictor -->|"renders results"| node_charts
node_simulator -->|"renders comparison"| node_charts
node_api_client -->|"calls REST endpoints"| node_backend

click node_municipal_sources "https://github.com/anotherhalf004/seedlings-jalrakshak/tree/main/data/raw"
click node_population_data "https://github.com/anotherhalf004/seedlings-jalrakshak/tree/main/population"
click node_master_data "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/data/final/jalrakshak_master.csv"
click node_data_audit "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/data_audit.py"
click node_preprocessing "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/preprocessing.py"
click node_demand_model "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/train_demand.py"
click node_supply_model "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/train_supply.py"
click node_anomaly_model "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/train_anomaly.py"
click node_inference "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/predict.py"
click node_shortage "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/shortage_engine.py"
click node_evaluation "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/evaluate.py"
click node_backend "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/backend/main.py"
click node_app "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/frontend/src/App.jsx"
click node_api_client "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/frontend/src/api.js"
click node_dashboard "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/frontend/src/pages/Dashboard.jsx"
click node_predictor "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/frontend/src/pages/Predictor.jsx"
click node_simulator "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/frontend/src/pages/Simulator.jsx"
click node_charts "https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/frontend/src/components/Charts.jsx"

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_municipal_sources,node_population_data,node_master_data,node_data_audit,node_preprocessing,node_user toneBlue
class node_demand_model,node_supply_model,node_anomaly_model,node_inference,node_shortage,node_evaluation toneAmber
class node_backend toneMint
class node_app,node_api_client,node_dashboard,node_predictor,node_simulator,node_charts toneRose
```

## Components

### Data preparation

- [Water datasets](https://github.com/anotherhalf004/seedlings-jalrakshak/tree/main/data/raw): `data/raw`
- [Census data](https://github.com/anotherhalf004/seedlings-jalrakshak/tree/main/population): `population`
- [City master data](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/data/final/jalrakshak_master.csv): `data/final/jalrakshak_master.csv`
- [Data audit](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/data_audit.py): `ml/data_audit.py`
- [Data preparation](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/preprocessing.py): `ml/preprocessing.py`

### Water analytics

- [Demand forecasting](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/train_demand.py): `ml/train_demand.py`
- [Supply forecasting](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/train_supply.py): `ml/train_supply.py`
- [Loss anomaly detection](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/train_anomaly.py): `ml/train_anomaly.py`
- [City inference](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/predict.py): `ml/predict.py`
- [Shortage and risk](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/shortage_engine.py): `ml/shortage_engine.py`
- [Model evaluation](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/ml/evaluate.py): `ml/evaluate.py`

### API service

- [REST API](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/backend/main.py): `backend/main.py`

### Dashboard client

- [App navigation](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [City dashboard](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Prediction view](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/frontend/src/pages/Predictor.jsx): `frontend/src/pages/Predictor.jsx`
- [NRW simulator](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/frontend/src/pages/Simulator.jsx): `frontend/src/pages/Simulator.jsx`
- [Water visualizations](https://github.com/anotherhalf004/seedlings-jalrakshak/blob/main/frontend/src/components/Charts.jsx): `frontend/src/components/Charts.jsx`

### Other components

- **Municipal user**

## Connections

- Water datasets → Data preparation: prepares (evidence: `README.md`)
- Census data → Data preparation: prepares (evidence: `README.md`)
- Data preparation → City master data: generates (evidence: `README.md`)
- City master data → REST API: serves city data (evidence: `README.md`)
- City master data → Demand forecasting: trains (evidence: `README.md`)
- City master data → Supply forecasting: trains (evidence: `README.md`)
- City master data → Loss anomaly detection: trains (evidence: `README.md`)
- Demand forecasting → City inference: forecasts demand (evidence: `README.md`)
- Supply forecasting → City inference: forecasts supply (evidence: `README.md`)
- Loss anomaly detection → City inference: detects anomalies (evidence: `README.md`)
- City inference → Shortage and risk: calculates deficit (evidence: `ml/predict.py`)
- Shortage and risk → City inference: returns risk (evidence: `ml/predict.py`)
- City master data → Model evaluation: evaluates models (evidence: `README.md`)
- REST API → City inference: runs predictions (evidence: `backend/main.py`)
- REST API → Shortage and risk: uses risk engine (evidence: `backend/main.py`)
- Municipal user → App navigation: uses (evidence: `README.md`)
- App navigation → API client: loads cities (evidence: `frontend/src/App.jsx`)
- App navigation → City dashboard: renders (evidence: `frontend/src/App.jsx`)
- App navigation → Prediction view: renders (evidence: `frontend/src/App.jsx`)
- App navigation → NRW simulator: renders (evidence: `frontend/src/App.jsx`)
- City dashboard → Water visualizations: renders charts (evidence: `frontend/src/pages/Dashboard.jsx`)
- Prediction view → API client: requests prediction (evidence: `frontend/src/pages/Predictor.jsx`)
- NRW simulator → API client: requests simulation (evidence: `frontend/src/pages/Simulator.jsx`)
- Prediction view → Water visualizations: renders results (evidence: `frontend/src/pages/Predictor.jsx`)
- NRW simulator → Water visualizations: renders comparison (evidence: `frontend/src/pages/Simulator.jsx`)
- API client → REST API: calls REST endpoints (evidence: `frontend/src/api.js`)
