# aryankv08-png/telangana-hydrosense architecture

> Architecture diagram of the GitHub repository aryankv08-png/telangana-hydrosense, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aryankv08-png/telangana-hydrosense
- Repository: https://github.com/aryankv08-png/telangana-hydrosense

## Overview

Aqua Intel is a Telangana water-quality monitoring and treatment decision-support application. Its main workflow is: an operator or viewer uses the web interface to submit or inspect water-quality data; the Node.js API coordinates prediction, safety and operational analysis, persists results, and returns findings and actions. The product also provides identity and role controls, water-body and alert management, restoration plans, reports, WQI/LSI calculations, impact-radius analysis and treatment-cost estimates. README documents the Python ML service; some frontend and route wiring is not excerpted, so uncertain links are omitted or marked unverified.

Main entry points: [`src/routes/core.js`](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/routes/core.js) (Core routes), [`server.js`](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/server.js) (Express application), [`src/routes/aquaIntel.js`](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/routes/aquaIntel.js) (Aqua Intel routes), [`src/db.js`](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/db.js) (MySQL access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_web["Web interface<br/>[index.html]"]
  node_browser_assets["Browser features"]
end

subgraph group_api["Node API"]
  node_express["Express application<br/>[server.js]"]
  node_auth_routes["Auth routes<br/>[auth.js]"]
  node_core_routes["Core routes<br/>[core.js]"]
  node_intel_routes["Aqua Intel routes<br/>[aquaIntel.js]"]
  node_wqi_routes["WQI LSI routes<br/>[wqiLsi.js]"]
  node_auth["Identity and roles<br/>[auth.js]"]
  node_errors["Error handling<br/>[errorHandler.js]"]
end

subgraph group_analysis["Water analysis"]
  node_safety["Safety standards<br/>[safety.js]"]
  node_false_alarms["False alarm filtering<br/>[falseAlarms.js]"]
  node_matrix["Risk matrix<br/>[matrix.js]"]
  node_recommendations["Action recommendations<br/>[recommendations.js]"]
  node_usage["Usage guidance<br/>[usageGuidance.js]"]
  node_wqi_lsi["WQI and LSI<br/>[wqiLsi.js]"]
end

subgraph group_data["Data and ML"]
  node_mysql_client["MySQL access<br/>[db.js]"]
  node_database[("Water-quality database<br/>[schema.sql]")]
  node_migrations["Schema and seeds<br/>[migrate.js]"]
  node_ml_client["ML service client<br/>[mlClient.js]"]
  node_ml_service["Prediction and analytics<br/>[ml_service.py]"]
end

node_operator(("Water user"))

node_operator -->|"uses"| node_web
node_web -.->|"submits requests"| node_express
node_express -->|"mounts routes"| node_auth_routes
node_express -->|"mounts routes"| node_core_routes
node_express -->|"mounts routes"| node_intel_routes
node_express -->|"mounts routes"| node_wqi_routes
node_express -->|"initializes schema"| node_migrations
node_express -->|"registers handler"| node_errors
node_auth_routes -->|"reads and writes"| node_mysql_client
node_auth_routes -->|"uses authentication"| node_auth
node_core_routes -->|"reads and writes"| node_mysql_client
node_core_routes -->|"requests predictions"| node_ml_client
node_core_routes -->|"evaluates samples"| node_safety
node_core_routes -->|"filters alarms"| node_false_alarms
node_core_routes -->|"uses risk matrix"| node_matrix
node_core_routes -->|"uses recommendations"| node_recommendations
node_core_routes -->|"builds guidance"| node_usage
node_intel_routes -->|"reads and writes"| node_mysql_client
node_intel_routes -->|"checks roles"| node_auth
node_intel_routes -->|"checks ML health"| node_ml_client
node_intel_routes -->|"evaluates safety"| node_safety
node_intel_routes -->|"uses risk matrix"| node_matrix
node_wqi_routes -->|"reads and writes"| node_mysql_client
node_wqi_routes -->|"calculates indices"| node_wqi_lsi
node_migrations -->|"creates and seeds"| node_mysql_client
node_mysql_client -->|"queries"| node_database
node_ml_client -->|"calls HTTP API"| node_ml_service
node_browser_assets -.->|"calls API"| node_express

click node_web "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/index.html"
click node_browser_assets "https://github.com/aryankv08-png/telangana-hydrosense/tree/main/public"
click node_express "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/server.js"
click node_auth_routes "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/routes/auth.js"
click node_core_routes "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/routes/core.js"
click node_intel_routes "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/routes/aquaIntel.js"
click node_wqi_routes "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/routes/wqiLsi.js"
click node_auth "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/middleware/auth.js"
click node_errors "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/middleware/errorHandler.js"
click node_safety "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/services/safety.js"
click node_false_alarms "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/services/falseAlarms.js"
click node_matrix "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/services/matrix.js"
click node_recommendations "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/services/recommendations.js"
click node_usage "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/services/usageGuidance.js"
click node_wqi_lsi "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/services/wqiLsi.js"
click node_mysql_client "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/db.js"
click node_database "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/schema.sql"
click node_migrations "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/migrate.js"
click node_ml_client "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/services/mlClient.js"
click node_ml_service "https://github.com/aryankv08-png/telangana-hydrosense/blob/main/ml_service.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_browser_assets,node_operator toneBlue
class node_express,node_auth_routes,node_core_routes,node_intel_routes,node_wqi_routes,node_auth,node_errors toneAmber
class node_safety,node_false_alarms,node_matrix,node_recommendations,node_usage,node_wqi_lsi toneMint
class node_mysql_client,node_database,node_migrations,node_ml_client,node_ml_service toneRose
```

## Components

### User experience

- [Web interface](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/index.html): `index.html`
- [Browser features](https://github.com/aryankv08-png/telangana-hydrosense/tree/main/public): `public`

### Node API

- [Express application](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/server.js): `server.js`
- [Auth routes](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/routes/auth.js): `src/routes/auth.js`
- [Core routes](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/routes/core.js): `src/routes/core.js`
- [Aqua Intel routes](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/routes/aquaIntel.js): `src/routes/aquaIntel.js`
- [WQI LSI routes](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/routes/wqiLsi.js): `src/routes/wqiLsi.js`
- [Identity and roles](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/middleware/auth.js): `src/middleware/auth.js`
- [Error handling](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/middleware/errorHandler.js): `src/middleware/errorHandler.js`

### Water analysis

- [Safety standards](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/services/safety.js): `src/services/safety.js`
- [False alarm filtering](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/services/falseAlarms.js): `src/services/falseAlarms.js`
- [Risk matrix](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/services/matrix.js): `src/services/matrix.js`
- [Action recommendations](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/services/recommendations.js): `src/services/recommendations.js`
- [Usage guidance](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/services/usageGuidance.js): `src/services/usageGuidance.js`
- [WQI and LSI](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/services/wqiLsi.js): `src/services/wqiLsi.js`

### Data and ML

- [MySQL access](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/db.js): `src/db.js`
- [Water-quality database](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/schema.sql): `schema.sql`
- [Schema and seeds](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/migrate.js): `src/migrate.js`
- [ML service client](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/src/services/mlClient.js): `src/services/mlClient.js`
- [Prediction and analytics](https://github.com/aryankv08-png/telangana-hydrosense/blob/main/ml_service.py): `ml_service.py`

### Other components

- **Water user**

## Connections

- Water user → Web interface: uses (evidence: `README.md`)
- Web interface → Express application: submits requests
- Express application → Auth routes: mounts routes (evidence: `server.js`)
- Express application → Core routes: mounts routes (evidence: `server.js`)
- Express application → Aqua Intel routes: mounts routes (evidence: `server.js`)
- Express application → WQI LSI routes: mounts routes (evidence: `server.js`)
- Express application → Schema and seeds: initializes schema (evidence: `server.js`)
- Express application → Error handling: registers handler (evidence: `server.js`)
- Auth routes → MySQL access: reads and writes (evidence: `src/routes/auth.js`)
- Auth routes → Identity and roles: uses authentication (evidence: `src/routes/auth.js`)
- Core routes → MySQL access: reads and writes (evidence: `src/routes/core.js`)
- Core routes → ML service client: requests predictions (evidence: `src/routes/core.js`)
- Core routes → Safety standards: evaluates samples (evidence: `src/routes/core.js`)
- Core routes → False alarm filtering: filters alarms (evidence: `src/routes/core.js`)
- Core routes → Risk matrix: uses risk matrix (evidence: `src/routes/core.js`)
- Core routes → Action recommendations: uses recommendations (evidence: `src/routes/core.js`)
- Core routes → Usage guidance: builds guidance (evidence: `src/routes/core.js`)
- Aqua Intel routes → MySQL access: reads and writes (evidence: `src/routes/aquaIntel.js`)
- Aqua Intel routes → Identity and roles: checks roles (evidence: `src/routes/aquaIntel.js`)
- Aqua Intel routes → ML service client: checks ML health (evidence: `src/routes/aquaIntel.js`)
- Aqua Intel routes → Safety standards: evaluates safety (evidence: `src/routes/aquaIntel.js`)
- Aqua Intel routes → Risk matrix: uses risk matrix (evidence: `src/routes/aquaIntel.js`)
- WQI LSI routes → MySQL access: reads and writes (evidence: `src/routes/wqiLsi.js`)
- WQI LSI routes → WQI and LSI: calculates indices (evidence: `src/routes/wqiLsi.js`)
- Schema and seeds → MySQL access: creates and seeds (evidence: `src/migrate.js`)
- MySQL access → Water-quality database: queries (evidence: `src/db.js`)
- ML service client → Prediction and analytics: calls HTTP API (evidence: `src/services/mlClient.js`)
- Browser features → Express application: calls API
