# rahul-roy-hub/smart-waste-management architecture

> Architecture diagram of the GitHub repository rahul-roy-hub/smart-waste-management, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rahul-roy-hub/smart-waste-management
- Repository: https://github.com/rahul-roy-hub/smart-waste-management

## Overview

Smart Waste Management Analytics turns municipal waste, population, and weather data into a feature-enriched training dataset, fits and evaluates an XGBoost forecasting pipeline, and presents operational summaries in a Streamlit dashboard. The main workflow is CLI-driven ingestion, preprocessing, and training; the dashboard separately reads the processed dataset and any saved model. The README also documents KPI, trend, weather, zone-table, and geospatial views. The graph reflects the shown calls and file reads; unsampled implementation details are not inferred.

Main entry points: [`src/data_pipeline/build_raw_from_preview.py`](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/data_pipeline/build_raw_from_preview.py) (Raw data builder), [`src/data_pipeline/preprocess.py`](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/data_pipeline/preprocess.py) (Feature preprocessing), [`src/ml/train.py`](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/ml/train.py) (Model training), [`src/visualization/app.py`](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/visualization/app.py) (Streamlit dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Data preparation"]
  node_cli["Project CLI<br/>[cli.py]"]
  node_waste_preview["Waste preview"]
  node_population_preview["Population preview"]
  node_raw_builder["Raw data builder"]
  node_raw_waste["Waste records<br/>[waste_records.csv]"]
  node_raw_population["Population records<br/>[population.csv]"]
  node_raw_weather["Weather records<br/>[weather.csv]"]
  node_preprocess["Feature preprocessing<br/>[preprocess.py]"]
end

subgraph group_model["Model training"]
  node_training_data["Training dataset<br/>[training_data.csv]"]
  node_trainer["Model training<br/>[train.py]"]
  node_model_artifact["Forecast model"]
  node_metrics["Training metrics"]
end

subgraph group_dashboard["Analytics dashboard"]
  node_dashboard_app["Streamlit dashboard<br/>[app.py]"]
  node_dashboard_views["Operational views<br/>[app.py]"]
end

subgraph group_shared["Shared utilities"]
  node_paths["Path configuration<br/>[paths.py]"]
  node_logging["Logging helper<br/>[logging.py]"]
end

node_operator(("Operator"))

node_operator -->|"runs commands"| node_cli
node_operator -->|"opens dashboard"| node_dashboard_app
node_cli -->|"dispatches build"| node_raw_builder
node_cli -->|"dispatches preprocess"| node_preprocess
node_cli -->|"dispatches training"| node_trainer
node_raw_builder -->|"reads preview"| node_waste_preview
node_raw_builder -->|"reads preview"| node_population_preview
node_raw_builder -->|"writes records"| node_raw_waste
node_raw_builder -->|"writes records"| node_raw_population
node_preprocess -->|"reads records"| node_raw_waste
node_preprocess -->|"reads records"| node_raw_population
node_preprocess -->|"reads records"| node_raw_weather
node_preprocess -->|"writes features"| node_training_data
node_trainer -->|"loads dataset"| node_training_data
node_trainer -->|"saves pipeline"| node_model_artifact
node_trainer -->|"writes metrics"| node_metrics
node_dashboard_app -->|"loads dataset"| node_training_data
node_dashboard_app -->|"loads model"| node_model_artifact
node_dashboard_app -->|"renders views"| node_dashboard_views
node_raw_builder -->|"uses paths"| node_paths
node_preprocess -->|"uses paths"| node_paths
node_trainer -->|"uses paths"| node_paths
node_dashboard_app -->|"uses paths"| node_paths
node_raw_builder -->|"gets logger"| node_logging
node_preprocess -->|"gets logger"| node_logging
node_trainer -->|"gets logger"| node_logging

click node_cli "https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/cli.py"
click node_waste_preview "https://github.com/rahul-roy-hub/smart-waste-management/blob/main/data/raw/waste_records_csv_preview.csv"
click node_population_preview "https://github.com/rahul-roy-hub/smart-waste-management/blob/main/data/raw/population_csv_preview.csv"
click node_raw_builder "https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/data_pipeline/build_raw_from_preview.py"
click node_raw_waste "https://github.com/rahul-roy-hub/smart-waste-management/blob/main/data/raw/waste_records.csv"
click node_raw_population "https://github.com/rahul-roy-hub/smart-waste-management/blob/main/data/raw/population.csv"
click node_raw_weather "https://github.com/rahul-roy-hub/smart-waste-management/blob/main/data/raw/weather.csv"
click node_preprocess "https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/data_pipeline/preprocess.py"
click node_training_data "https://github.com/rahul-roy-hub/smart-waste-management/blob/main/data/processed/training_data.csv"
click node_trainer "https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/ml/train.py"
click node_dashboard_app "https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/visualization/app.py"
click node_dashboard_views "https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/visualization/app.py"
click node_paths "https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/utils/paths.py"
click node_logging "https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/utils/logging.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_cli,node_waste_preview,node_population_preview,node_raw_builder,node_raw_waste,node_raw_population,node_raw_weather,node_preprocess toneBlue
class node_training_data,node_trainer,node_model_artifact,node_metrics toneAmber
class node_dashboard_app,node_dashboard_views toneMint
class node_paths,node_logging toneRose
class node_operator toneIndigo
```

## Components

### Data preparation

- [Project CLI](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/cli.py): `src/cli.py`
- [Waste preview](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/data/raw/waste_records_csv_preview.csv): `data/raw/waste_records_csv_preview.csv`
- [Population preview](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/data/raw/population_csv_preview.csv): `data/raw/population_csv_preview.csv`
- [Raw data builder](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/data_pipeline/build_raw_from_preview.py): `src/data_pipeline/build_raw_from_preview.py`
- [Waste records](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/data/raw/waste_records.csv): `data/raw/waste_records.csv`
- [Population records](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/data/raw/population.csv): `data/raw/population.csv`
- [Weather records](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/data/raw/weather.csv): `data/raw/weather.csv`
- [Feature preprocessing](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/data_pipeline/preprocess.py): `src/data_pipeline/preprocess.py`

### Model training

- [Training dataset](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/data/processed/training_data.csv): `data/processed/training_data.csv`
- [Model training](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/ml/train.py): `src/ml/train.py`
- **Forecast model**
- **Training metrics**

### Analytics dashboard

- [Streamlit dashboard](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/visualization/app.py): `src/visualization/app.py`
- [Operational views](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/visualization/app.py): `src/visualization/app.py`

### Shared utilities

- [Path configuration](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/utils/paths.py): `src/utils/paths.py`
- [Logging helper](https://github.com/rahul-roy-hub/smart-waste-management/blob/main/src/utils/logging.py): `src/utils/logging.py`

### Other components

- **Operator**

## Connections

- Operator → Project CLI: runs commands (evidence: `README.md`)
- Operator → Streamlit dashboard: opens dashboard (evidence: `README.md`)
- Project CLI → Raw data builder: dispatches build (evidence: `src/cli.py`)
- Project CLI → Feature preprocessing: dispatches preprocess (evidence: `src/cli.py`)
- Project CLI → Model training: dispatches training (evidence: `src/cli.py`)
- Raw data builder → Waste preview: reads preview (evidence: `src/data_pipeline/build_raw_from_preview.py`)
- Raw data builder → Population preview: reads preview (evidence: `src/data_pipeline/build_raw_from_preview.py`)
- Raw data builder → Waste records: writes records (evidence: `src/data_pipeline/build_raw_from_preview.py`)
- Raw data builder → Population records: writes records (evidence: `src/data_pipeline/build_raw_from_preview.py`)
- Feature preprocessing → Waste records: reads records (evidence: `src/data_pipeline/preprocess.py`)
- Feature preprocessing → Population records: reads records (evidence: `src/data_pipeline/preprocess.py`)
- Feature preprocessing → Weather records: reads records (evidence: `src/data_pipeline/preprocess.py`)
- Feature preprocessing → Training dataset: writes features (evidence: `src/data_pipeline/preprocess.py`)
- Model training → Training dataset: loads dataset (evidence: `src/ml/train.py`)
- Model training → Forecast model: saves pipeline (evidence: `src/ml/train.py`)
- Model training → Training metrics: writes metrics (evidence: `src/ml/train.py`)
- Streamlit dashboard → Training dataset: loads dataset (evidence: `src/visualization/app.py`)
- Streamlit dashboard → Forecast model: loads model (evidence: `src/visualization/app.py`)
- Streamlit dashboard → Operational views: renders views (evidence: `src/visualization/app.py`)
- Raw data builder → Path configuration: uses paths (evidence: `src/data_pipeline/build_raw_from_preview.py`)
- Feature preprocessing → Path configuration: uses paths (evidence: `src/data_pipeline/preprocess.py`)
- Model training → Path configuration: uses paths (evidence: `src/ml/train.py`)
- Streamlit dashboard → Path configuration: uses paths (evidence: `src/visualization/app.py`)
- Raw data builder → Logging helper: gets logger (evidence: `src/data_pipeline/build_raw_from_preview.py`)
- Feature preprocessing → Logging helper: gets logger (evidence: `src/data_pipeline/preprocess.py`)
- Model training → Logging helper: gets logger (evidence: `src/ml/train.py`)
