# yaswanth-989/aqua_sense architecture

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

- Interactive diagram: https://gitdiagram.com/yaswanth-989/aqua_sense
- Repository: https://github.com/yaswanth-989/aqua_sense

## Overview

AquaSense is a web and REST application for municipal water-demand forecasting and drinking-water potability assessment. Utility operators enter through the FastAPI application, which serves analysis views and exposes validation, data-inspection, and prediction APIs; prediction requests are handled by the inference service. Its broader documented capabilities include data preparation, exploratory analysis, linear and tree models, clustering/PCA, evaluation, deployment, and monitoring. Source excerpts and the index show key route and module relationships; unsampled deployment and monitoring implementations are represented only where documented.

Main entry points: [`app.py`](https://github.com/yaswanth-989/aqua_sense/blob/main/app.py) (Web and API), [`src/data/loader.py`](https://github.com/yaswanth-989/aqua_sense/blob/main/src/data/loader.py) (Data Inspection), [`data/processed`](https://github.com/yaswanth-989/aqua_sense/tree/main/data/processed) (Prepared Datasets), [`src/preprocessing/demand_preprocessor.py`](https://github.com/yaswanth-989/aqua_sense/blob/main/src/preprocessing/demand_preprocessor.py) (Demand Preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application Entry"]
  node_app["Web and API<br/>[app.py]"]
end

subgraph group_data["Data Preparation"]
  node_raw[("Source Datasets")]
  node_loader["Data Inspection<br/>[loader.py]"]
  node_validator["Schema Validation<br/>[validator.py]"]
  node_prep_demand["Demand Preparation"]
  node_prep_potability["Potability Preparation"]
  node_processed[("Prepared Datasets")]
end

subgraph group_analysis["Analytics and Models"]
  node_demand_eda["Demand Analysis<br/>[demand_eda.py]"]
  node_potability_eda["Potability Analysis<br/>[potability_eda.py]"]
  node_linear_demand["Demand Models<br/>[linear_demand.py]"]
  node_linear_potability["Potability Models"]
  node_tree_models["Tree Ensembles<br/>[tree_models.py]"]
  node_clustering["Clustering and PCA<br/>[clustering_pca.py]"]
  node_evaluation["Model Evaluation"]
end

subgraph group_serving["Prediction and Operations"]
  node_prediction["Inference Service"]
  node_artifacts[("Model Artifacts")]
  node_deployment["Deployment Information<br/>[deployment.html]"]
  node_monitoring["Monitoring Information<br/>[monitoring.html]"]
end

node_operator(("Utility Operator"))

node_operator -->|"uses"| node_app
node_app -->|"requests inspection"| node_loader
node_app -->|"requests validation"| node_validator
node_app -->|"routes analysis"| node_demand_eda
node_app -->|"routes analysis"| node_potability_eda
node_app -->|"routes preparation"| node_prep_demand
node_app -->|"routes preparation"| node_prep_potability
node_app -->|"runs models"| node_linear_demand
node_app -->|"runs models"| node_linear_potability
node_app -->|"routes models"| node_tree_models
node_app -->|"runs clustering"| node_clustering
node_app -->|"routes evaluation"| node_evaluation
node_app -->|"routes inference"| node_prediction
node_app -->|"renders view"| node_deployment
node_app -->|"renders view"| node_monitoring
node_validator -->|"loads datasets"| node_loader
node_demand_eda -->|"loads demand data"| node_loader
node_potability_eda -->|"loads water data"| node_loader
node_prep_demand -->|"loads demand data"| node_loader
node_prep_potability -->|"loads water data"| node_loader
node_prep_demand -->|"writes splits"| node_processed
node_prep_potability -->|"writes splits"| node_processed
node_raw -.->|"loaded by"| node_loader
node_prediction -.->|"uses models"| node_artifacts
node_linear_demand -->|"reads splits"| node_processed
node_linear_potability -->|"reads splits"| node_processed

click node_app "https://github.com/yaswanth-989/aqua_sense/blob/main/app.py"
click node_raw "https://github.com/yaswanth-989/aqua_sense/tree/main/data/raw"
click node_loader "https://github.com/yaswanth-989/aqua_sense/blob/main/src/data/loader.py"
click node_validator "https://github.com/yaswanth-989/aqua_sense/blob/main/src/data/validator.py"
click node_prep_demand "https://github.com/yaswanth-989/aqua_sense/blob/main/src/preprocessing/demand_preprocessor.py"
click node_prep_potability "https://github.com/yaswanth-989/aqua_sense/blob/main/src/preprocessing/potability_preprocessor.py"
click node_processed "https://github.com/yaswanth-989/aqua_sense/tree/main/data/processed"
click node_demand_eda "https://github.com/yaswanth-989/aqua_sense/blob/main/src/eda/demand_eda.py"
click node_potability_eda "https://github.com/yaswanth-989/aqua_sense/blob/main/src/eda/potability_eda.py"
click node_linear_demand "https://github.com/yaswanth-989/aqua_sense/blob/main/src/models/linear_demand.py"
click node_linear_potability "https://github.com/yaswanth-989/aqua_sense/blob/main/src/models/linear_potability.py"
click node_tree_models "https://github.com/yaswanth-989/aqua_sense/blob/main/src/models/tree_models.py"
click node_clustering "https://github.com/yaswanth-989/aqua_sense/blob/main/src/models/clustering_pca.py"
click node_evaluation "https://github.com/yaswanth-989/aqua_sense/blob/main/src/models/evaluation_tuning.py"
click node_prediction "https://github.com/yaswanth-989/aqua_sense/blob/main/src/models/prediction_service.py"
click node_artifacts "https://github.com/yaswanth-989/aqua_sense/tree/main/models"
click node_deployment "https://github.com/yaswanth-989/aqua_sense/blob/main/templates/deployment.html"
click node_monitoring "https://github.com/yaswanth-989/aqua_sense/blob/main/templates/monitoring.html"

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 toneBlue
class node_raw,node_loader,node_validator,node_prep_demand,node_prep_potability,node_processed toneAmber
class node_demand_eda,node_potability_eda,node_linear_demand,node_linear_potability,node_tree_models,node_clustering,node_evaluation toneMint
class node_prediction,node_artifacts,node_deployment,node_monitoring toneRose
class node_operator toneIndigo
```

## Components

### Application Entry

- [Web and API](https://github.com/yaswanth-989/aqua_sense/blob/main/app.py): `app.py`

### Data Preparation

- [Source Datasets](https://github.com/yaswanth-989/aqua_sense/tree/main/data/raw): `data/raw`
- [Data Inspection](https://github.com/yaswanth-989/aqua_sense/blob/main/src/data/loader.py): `src/data/loader.py`
- [Schema Validation](https://github.com/yaswanth-989/aqua_sense/blob/main/src/data/validator.py): `src/data/validator.py`
- [Demand Preparation](https://github.com/yaswanth-989/aqua_sense/blob/main/src/preprocessing/demand_preprocessor.py): `src/preprocessing/demand_preprocessor.py`
- [Potability Preparation](https://github.com/yaswanth-989/aqua_sense/blob/main/src/preprocessing/potability_preprocessor.py): `src/preprocessing/potability_preprocessor.py`
- [Prepared Datasets](https://github.com/yaswanth-989/aqua_sense/tree/main/data/processed): `data/processed`

### Analytics and Models

- [Demand Analysis](https://github.com/yaswanth-989/aqua_sense/blob/main/src/eda/demand_eda.py): `src/eda/demand_eda.py`
- [Potability Analysis](https://github.com/yaswanth-989/aqua_sense/blob/main/src/eda/potability_eda.py): `src/eda/potability_eda.py`
- [Demand Models](https://github.com/yaswanth-989/aqua_sense/blob/main/src/models/linear_demand.py): `src/models/linear_demand.py`
- [Potability Models](https://github.com/yaswanth-989/aqua_sense/blob/main/src/models/linear_potability.py): `src/models/linear_potability.py`
- [Tree Ensembles](https://github.com/yaswanth-989/aqua_sense/blob/main/src/models/tree_models.py): `src/models/tree_models.py`
- [Clustering and PCA](https://github.com/yaswanth-989/aqua_sense/blob/main/src/models/clustering_pca.py): `src/models/clustering_pca.py`
- [Model Evaluation](https://github.com/yaswanth-989/aqua_sense/blob/main/src/models/evaluation_tuning.py): `src/models/evaluation_tuning.py`

### Prediction and Operations

- [Inference Service](https://github.com/yaswanth-989/aqua_sense/blob/main/src/models/prediction_service.py): `src/models/prediction_service.py`
- [Model Artifacts](https://github.com/yaswanth-989/aqua_sense/tree/main/models): `models`
- [Deployment Information](https://github.com/yaswanth-989/aqua_sense/blob/main/templates/deployment.html): `templates/deployment.html`
- [Monitoring Information](https://github.com/yaswanth-989/aqua_sense/blob/main/templates/monitoring.html): `templates/monitoring.html`

### Other components

- **Utility Operator**

## Connections

- Utility Operator → Web and API: uses (evidence: `README.md`)
- Web and API → Data Inspection: requests inspection (evidence: `app.py`)
- Web and API → Schema Validation: requests validation (evidence: `app.py`)
- Web and API → Demand Analysis: routes analysis (evidence: `app.py`)
- Web and API → Potability Analysis: routes analysis (evidence: `app.py`)
- Web and API → Demand Preparation: routes preparation (evidence: `app.py`)
- Web and API → Potability Preparation: routes preparation (evidence: `app.py`)
- Web and API → Demand Models: runs models (evidence: `app.py`)
- Web and API → Potability Models: runs models (evidence: `app.py`)
- Web and API → Tree Ensembles: routes models (evidence: `app.py`)
- Web and API → Clustering and PCA: runs clustering (evidence: `app.py`)
- Web and API → Model Evaluation: routes evaluation (evidence: `app.py`)
- Web and API → Inference Service: routes inference (evidence: `app.py`)
- Web and API → Deployment Information: renders view (evidence: `app.py`)
- Web and API → Monitoring Information: renders view (evidence: `app.py`)
- Schema Validation → Data Inspection: loads datasets (evidence: `src/data/validator.py`)
- Demand Analysis → Data Inspection: loads demand data (evidence: `src/eda/demand_eda.py`)
- Potability Analysis → Data Inspection: loads water data (evidence: `src/eda/potability_eda.py`)
- Demand Preparation → Data Inspection: loads demand data (evidence: `src/preprocessing/demand_preprocessor.py`)
- Potability Preparation → Data Inspection: loads water data (evidence: `src/preprocessing/potability_preprocessor.py`)
- Demand Preparation → Prepared Datasets: writes splits (evidence: `src/preprocessing/demand_preprocessor.py`)
- Potability Preparation → Prepared Datasets: writes splits (evidence: `src/preprocessing/potability_preprocessor.py`)
- Source Datasets → Data Inspection: loaded by
- Inference Service → Model Artifacts: uses models
- Demand Models → Prepared Datasets: reads splits (evidence: `src/models/linear_demand.py`)
- Potability Models → Prepared Datasets: reads splits (evidence: `src/models/linear_potability.py`)
