# madhukanth1906/s5-mini-project architecture

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

- Interactive diagram: https://gitdiagram.com/madhukanth1906/s5-mini-project
- Repository: https://github.com/madhukanth1906/s5-mini-project

## Overview

PolluSense AI is an environmental monitoring and industrial pollution dashboard. Users explore air-quality summaries, maps, industries, hotspots, alerts, forecasts, analytics, and reports through a Next.js interface backed by a FastAPI service and SQLite data model. The backend serves stored pollution and compliance records and enriches hotspot readings with OpenWeatherMap data; seed and dataset-import scripts populate domain records. Several feature pages are documented or present in the tree but were not sampled, so their backend connections are not asserted. Edges reflect excerpts, the source index, or README statements.

Main entry points: [`backend/main.py`](https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/main.py) (HTTP API), [`frontend/src/app/dashboard/page.tsx`](https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/dashboard/page.tsx) (Dashboard), [`backend/models.py`](https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/models.py) (Domain Records), [`backend/database.py`](https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/database.py) (SQLite Database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User Experience"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_mapview["Pollution Map<br/>[PollutionMap.tsx]"]
  node_industriesview["Industries<br/>[page.tsx]"]
  node_hotspotsview["Hotspots<br/>[page.tsx]"]
  node_alertsview["Alerts<br/>[page.tsx]"]
  node_analyticsview["Analytics<br/>[page.tsx]"]
  node_predictionsview["Predictions<br/>[page.tsx]"]
  node_reportsview["Reports<br/>[page.tsx]"]
  node_datasourcesview["Data Sources<br/>[page.tsx]"]
  node_api_client["API URL Client<br/>[api.ts]"]
end

subgraph group_service["API Service"]
  node_api["HTTP API<br/>[main.py]"]
  node_config["Runtime Config<br/>[config.py]"]
  node_schemas["API Schemas<br/>[schemas.py]"]
end

subgraph group_domain["Pollution Domain"]
  node_database[("SQLite Database<br/>[database.py]")]
  node_models["Domain Records<br/>[models.py]"]
end

subgraph group_inputs["Data Inputs"]
  node_seed["Demo Data Seeder<br/>[seed_data.py]"]
  node_dataset_import["Industry Import<br/>[import_dataset.py]"]
  node_openweather["OpenWeatherMap"]
end

node_user(("Environmental User"))

node_user -->|"views"| node_dashboard
node_dashboard -->|"builds API URLs"| node_api_client
node_dashboard -->|"requests summary data"| node_api
node_dashboard -->|"renders"| node_mapview
node_industriesview -->|"builds API URL"| node_api_client
node_industriesview -->|"requests industries"| node_api
node_hotspotsview -->|"builds API URL"| node_api_client
node_hotspotsview -->|"requests hotspots"| node_api
node_api -->|"queries records"| node_database
node_api -->|"queries domain models"| node_models
node_api -->|"validates responses"| node_schemas
node_api -->|"reads settings"| node_config
node_api -->|"fetches live air data"| node_openweather
node_models -->|"uses ORM base"| node_database
node_seed -->|"creates and opens"| node_database
node_seed -->|"creates records"| node_models
node_dataset_import -->|"opens database"| node_database
node_dataset_import -->|"writes industries"| node_models
node_user -.->|"explores locations"| node_mapview
node_user -.->|"reviews alerts"| node_alertsview
node_user -.->|"reviews analytics"| node_analyticsview
node_user -.->|"views forecasts"| node_predictionsview
node_user -.->|"reviews reports"| node_reportsview
node_user -.->|"reviews sources"| node_datasourcesview

click node_dashboard "https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/dashboard/page.tsx"
click node_mapview "https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/components/PollutionMap.tsx"
click node_industriesview "https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/industries/page.tsx"
click node_hotspotsview "https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/hotspots/page.tsx"
click node_alertsview "https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/alerts/page.tsx"
click node_analyticsview "https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/analytics/page.tsx"
click node_predictionsview "https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/predictions/page.tsx"
click node_reportsview "https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/reports/page.tsx"
click node_datasourcesview "https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/data-sources/page.tsx"
click node_api_client "https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/lib/api.ts"
click node_api "https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/main.py"
click node_config "https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/config.py"
click node_schemas "https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/schemas.py"
click node_database "https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/database.py"
click node_models "https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/models.py"
click node_seed "https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/seed_data.py"
click node_dataset_import "https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/import_dataset.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_dashboard,node_mapview,node_industriesview,node_hotspotsview,node_alertsview,node_analyticsview,node_predictionsview,node_reportsview,node_datasourcesview,node_api_client,node_user toneBlue
class node_api,node_config,node_schemas toneAmber
class node_database,node_models toneMint
class node_seed,node_dataset_import,node_openweather toneRose
```

## Components

### User Experience

- [Dashboard](https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/dashboard/page.tsx): `frontend/src/app/dashboard/page.tsx`
- [Pollution Map](https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/components/PollutionMap.tsx): `frontend/src/components/PollutionMap.tsx`
- [Industries](https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/industries/page.tsx): `frontend/src/app/industries/page.tsx`
- [Hotspots](https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/hotspots/page.tsx): `frontend/src/app/hotspots/page.tsx`
- [Alerts](https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/alerts/page.tsx): `frontend/src/app/alerts/page.tsx`
- [Analytics](https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/analytics/page.tsx): `frontend/src/app/analytics/page.tsx`
- [Predictions](https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/predictions/page.tsx): `frontend/src/app/predictions/page.tsx`
- [Reports](https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/reports/page.tsx): `frontend/src/app/reports/page.tsx`
- [Data Sources](https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/app/data-sources/page.tsx): `frontend/src/app/data-sources/page.tsx`
- [API URL Client](https://github.com/madhukanth1906/s5-mini-project/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### API Service

- [HTTP API](https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/main.py): `backend/main.py`
- [Runtime Config](https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/config.py): `backend/config.py`
- [API Schemas](https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/schemas.py): `backend/schemas.py`

### Pollution Domain

- [SQLite Database](https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/database.py): `backend/database.py`
- [Domain Records](https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/models.py): `backend/models.py`

### Data Inputs

- [Demo Data Seeder](https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/seed_data.py): `backend/seed_data.py`
- [Industry Import](https://github.com/madhukanth1906/s5-mini-project/blob/main/backend/import_dataset.py): `backend/import_dataset.py`
- **OpenWeatherMap**

### Other components

- **Environmental User**

## Connections

- Environmental User → Dashboard: views (evidence: `README.md`)
- Dashboard → API URL Client: builds API URLs (evidence: `frontend/src/app/dashboard/page.tsx`)
- Dashboard → HTTP API: requests summary data (evidence: `frontend/src/app/dashboard/page.tsx`)
- Dashboard → Pollution Map: renders (evidence: `frontend/src/app/dashboard/page.tsx`)
- Industries → API URL Client: builds API URL (evidence: `frontend/src/app/industries/page.tsx`)
- Industries → HTTP API: requests industries (evidence: `frontend/src/app/industries/page.tsx`)
- Hotspots → API URL Client: builds API URL (evidence: `frontend/src/app/hotspots/page.tsx`)
- Hotspots → HTTP API: requests hotspots (evidence: `frontend/src/app/hotspots/page.tsx`)
- HTTP API → SQLite Database: queries records (evidence: `backend/main.py`)
- HTTP API → Domain Records: queries domain models (evidence: `backend/main.py`)
- HTTP API → API Schemas: validates responses (evidence: `backend/main.py`)
- HTTP API → Runtime Config: reads settings (evidence: `backend/main.py`)
- HTTP API → OpenWeatherMap: fetches live air data (evidence: `backend/main.py`)
- Domain Records → SQLite Database: uses ORM base (evidence: `backend/models.py`)
- Demo Data Seeder → SQLite Database: creates and opens (evidence: `backend/seed_data.py`)
- Demo Data Seeder → Domain Records: creates records (evidence: `backend/seed_data.py`)
- Industry Import → SQLite Database: opens database (evidence: `backend/import_dataset.py`)
- Industry Import → Domain Records: writes industries (evidence: `backend/import_dataset.py`)
- Environmental User → Pollution Map: explores locations (evidence: `README.md`)
- Environmental User → Alerts: reviews alerts (evidence: `README.md`)
- Environmental User → Analytics: reviews analytics (evidence: `README.md`)
- Environmental User → Predictions: views forecasts (evidence: `README.md`)
- Environmental User → Reports: reviews reports (evidence: `README.md`)
- Environmental User → Data Sources: reviews sources
