# sazzysara/aquacop---3 architecture

> Architecture diagram of the GitHub repository sazzysara/aquacop---3, 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/sazzysara/aquacop---3
- Repository: https://github.com/sazzysara/aquacop---3

## Overview

AquaCop is a waterbody-monitoring and encroachment-response system for Tamil Nadu. Its central workflow combines satellite imagery and other geospatial evidence to assess water loss and threats, presents alerts and risk context to officials, and supports citizen complaints and statutory notices. The backend also documents historical-water, weather, and flood-risk capabilities; the Next.js console exposes mapping, analytics, enforcement, citizen, and simulation views. Edges follow shown imports/calls or README descriptions; some backend route wiring and frontend data integration are not visible in the excerpts.

Main entry points: [`backend/main.py`](https://github.com/sazzysara/aquacop---3/blob/main/backend/main.py) (FastAPI Routes), [`frontend/src/app/page.tsx`](https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/app/page.tsx) (Console Entry), [`frontend/src/components/CitizenPortal.tsx`](https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/CitizenPortal.tsx) (Citizen Portal), [`backend/geo/ndwi.py`](https://github.com/sazzysara/aquacop---3/blob/main/backend/geo/ndwi.py) (Water Change Analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Mission Control"]
  node_mission["Console Entry<br/>[page.tsx]"]
  node_citizen_portal["Citizen Portal<br/>[CitizenPortal.tsx]"]
  node_complaint_form["Complaint Intake<br/>[ComplaintModal.tsx]"]
  node_officer_portal["Officer Console<br/>[OfficerPortal.tsx]"]
  node_auth_ui["Authentication UI<br/>[AuthPage.tsx]"]
  node_heatmap["Encroachment Map"]
  node_satellite_view["Satellite Viewer"]
  node_analytics["Analytics Dashboard"]
  node_flood_sim["Flood Simulator<br/>[FloodSimulator.tsx]"]
  node_sidebar["Console Navigation<br/>[Sidebar.tsx]"]
  node_theme["Theme State<br/>[ThemeContext.tsx]"]
end

subgraph group_geospatial["Geospatial Analysis"]
  node_stac["Sentinel STAC Search<br/>[stac_client.py]"]
  node_ndwi["Water Change Analysis<br/>[ndwi.py]"]
  node_threats["Threat Classification<br/>[threats.py]"]
  node_overpass["OSM Footprints<br/>[overpass.py]"]
  node_jrc["Historical Water Baseline<br/>[jrc_water.py]"]
  node_weather["Weather Risk<br/>[weather.py]"]
  node_marine["Marine Context<br/>[marine.py]"]
end

subgraph group_response["Response Services"]
  node_pdf["Statutory PDF Dossier<br/>[pdf_generator.py]"]
end

subgraph group_platform["Backend Platform"]
  node_api["FastAPI Routes<br/>[main.py]"]
  node_auth["Role Authentication<br/>[auth.py]"]
  node_config["Region Configuration<br/>[config.py]"]
  node_models["Domain Records<br/>[models.py]"]
  node_database[("SQLite Database<br/>[aquacop.db]")]
end

node_citizen(("Citizen"))
node_officer(("Officer"))
node_jrc_service[("JRC Water Data")]
node_stac_service["Copernicus STAC"]
node_osm_service["OpenStreetMap"]
node_weather_service["Open-Meteo"]

node_citizen -->|"opens console"| node_mission
node_officer -->|"uses console"| node_mission
node_mission -->|"renders"| node_citizen_portal
node_mission -->|"renders"| node_complaint_form
node_mission -->|"renders"| node_officer_portal
node_mission -->|"renders"| node_auth_ui
node_mission -->|"renders"| node_heatmap
node_mission -->|"renders"| node_analytics
node_mission -->|"renders"| node_flood_sim
node_mission -->|"renders"| node_sidebar
node_heatmap -->|"uses"| node_satellite_view
node_mission -->|"reads theme"| node_theme
node_citizen -->|"files complaints"| node_citizen_portal
node_citizen_portal -->|"opens intake"| node_complaint_form
node_officer -->|"reviews alerts"| node_officer_portal
node_api -->|"loads settings"| node_config
node_api -->|"uses auth"| node_auth
node_api -->|"uses records"| node_models
node_models -->|"persists records"| node_database
node_api -->|"requests scenes"| node_stac
node_api -->|"requests analysis"| node_ndwi
node_api -->|"serves threat data"| node_threats
node_api -->|"requests footprints"| node_overpass
node_api -->|"requests baseline"| node_jrc
node_api -->|"requests forecasts"| node_weather
node_api -->|"requests context"| node_marine
node_ndwi -->|"searches scenes"| node_stac
node_ndwi -->|"checks footprints"| node_overpass
node_api -->|"generates notice"| node_pdf
node_officer_portal -.->|"requests dossier"| node_pdf
node_stac -->|"searches imagery"| node_stac_service
node_overpass -.->|"queries footprints"| node_osm_service
node_jrc -.->|"reads baseline"| node_jrc_service
node_weather -.->|"fetches forecasts"| node_weather_service
node_api -.->|"serves API"| node_citizen_portal

click node_mission "https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/app/page.tsx"
click node_citizen_portal "https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/CitizenPortal.tsx"
click node_complaint_form "https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/ComplaintModal.tsx"
click node_officer_portal "https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/OfficerPortal.tsx"
click node_auth_ui "https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/AuthPage.tsx"
click node_heatmap "https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/EncroachmentHeatmap.tsx"
click node_satellite_view "https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/SatelliteMapViewer.tsx"
click node_analytics "https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/AnalyticsDashboard.tsx"
click node_flood_sim "https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/FloodSimulator.tsx"
click node_sidebar "https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/Sidebar.tsx"
click node_theme "https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/ThemeContext.tsx"
click node_stac "https://github.com/sazzysara/aquacop---3/blob/main/backend/geo/stac_client.py"
click node_ndwi "https://github.com/sazzysara/aquacop---3/blob/main/backend/geo/ndwi.py"
click node_threats "https://github.com/sazzysara/aquacop---3/blob/main/backend/geo/threats.py"
click node_overpass "https://github.com/sazzysara/aquacop---3/blob/main/backend/geo/overpass.py"
click node_jrc "https://github.com/sazzysara/aquacop---3/blob/main/backend/geo/jrc_water.py"
click node_weather "https://github.com/sazzysara/aquacop---3/blob/main/backend/geo/weather.py"
click node_marine "https://github.com/sazzysara/aquacop---3/blob/main/backend/geo/marine.py"
click node_api "https://github.com/sazzysara/aquacop---3/blob/main/backend/main.py"
click node_auth "https://github.com/sazzysara/aquacop---3/blob/main/backend/auth.py"
click node_config "https://github.com/sazzysara/aquacop---3/blob/main/backend/config.py"
click node_models "https://github.com/sazzysara/aquacop---3/blob/main/backend/models.py"
click node_database "https://github.com/sazzysara/aquacop---3/blob/main/backend/aquacop.db"
click node_pdf "https://github.com/sazzysara/aquacop---3/blob/main/backend/reports/pdf_generator.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_mission,node_citizen_portal,node_complaint_form,node_officer_portal,node_auth_ui,node_heatmap,node_satellite_view,node_analytics,node_flood_sim,node_sidebar,node_theme toneBlue
class node_stac,node_ndwi,node_threats,node_overpass,node_jrc,node_weather,node_marine,node_jrc_service toneAmber
class node_pdf toneMint
class node_api,node_auth,node_config,node_models,node_database toneRose
class node_citizen,node_officer,node_stac_service,node_osm_service,node_weather_service toneIndigo
```

## Components

### Mission Control

- [Console Entry](https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/app/page.tsx): `frontend/src/app/page.tsx`
- [Citizen Portal](https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/CitizenPortal.tsx): `frontend/src/components/CitizenPortal.tsx`
- [Complaint Intake](https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/ComplaintModal.tsx): `frontend/src/components/ComplaintModal.tsx`
- [Officer Console](https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/OfficerPortal.tsx): `frontend/src/components/OfficerPortal.tsx`
- [Authentication UI](https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/AuthPage.tsx): `frontend/src/components/AuthPage.tsx`
- [Encroachment Map](https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/EncroachmentHeatmap.tsx): `frontend/src/components/EncroachmentHeatmap.tsx`
- [Satellite Viewer](https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/SatelliteMapViewer.tsx): `frontend/src/components/SatelliteMapViewer.tsx`
- [Analytics Dashboard](https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/AnalyticsDashboard.tsx): `frontend/src/components/AnalyticsDashboard.tsx`
- [Flood Simulator](https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/FloodSimulator.tsx): `frontend/src/components/FloodSimulator.tsx`
- [Console Navigation](https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/Sidebar.tsx): `frontend/src/components/Sidebar.tsx`
- [Theme State](https://github.com/sazzysara/aquacop---3/blob/main/frontend/src/components/ThemeContext.tsx): `frontend/src/components/ThemeContext.tsx`

### Geospatial Analysis

- [Sentinel STAC Search](https://github.com/sazzysara/aquacop---3/blob/main/backend/geo/stac_client.py): `backend/geo/stac_client.py`
- [Water Change Analysis](https://github.com/sazzysara/aquacop---3/blob/main/backend/geo/ndwi.py): `backend/geo/ndwi.py`
- [Threat Classification](https://github.com/sazzysara/aquacop---3/blob/main/backend/geo/threats.py): `backend/geo/threats.py`
- [OSM Footprints](https://github.com/sazzysara/aquacop---3/blob/main/backend/geo/overpass.py): `backend/geo/overpass.py`
- [Historical Water Baseline](https://github.com/sazzysara/aquacop---3/blob/main/backend/geo/jrc_water.py): `backend/geo/jrc_water.py`
- [Weather Risk](https://github.com/sazzysara/aquacop---3/blob/main/backend/geo/weather.py): `backend/geo/weather.py`
- [Marine Context](https://github.com/sazzysara/aquacop---3/blob/main/backend/geo/marine.py): `backend/geo/marine.py`

### Response Services

- [Statutory PDF Dossier](https://github.com/sazzysara/aquacop---3/blob/main/backend/reports/pdf_generator.py): `backend/reports/pdf_generator.py`

### Backend Platform

- [FastAPI Routes](https://github.com/sazzysara/aquacop---3/blob/main/backend/main.py): `backend/main.py`
- [Role Authentication](https://github.com/sazzysara/aquacop---3/blob/main/backend/auth.py): `backend/auth.py`
- [Region Configuration](https://github.com/sazzysara/aquacop---3/blob/main/backend/config.py): `backend/config.py`
- [Domain Records](https://github.com/sazzysara/aquacop---3/blob/main/backend/models.py): `backend/models.py`
- [SQLite Database](https://github.com/sazzysara/aquacop---3/blob/main/backend/aquacop.db): `backend/aquacop.db`

### Other components

- **Citizen**
- **Officer**
- **JRC Water Data**
- **Copernicus STAC**
- **OpenStreetMap**
- **Open-Meteo**

## Connections

- Citizen → Console Entry: opens console (evidence: `README.md`)
- Officer → Console Entry: uses console (evidence: `README.md`)
- Console Entry → Citizen Portal: renders (evidence: `frontend/src/app/page.tsx`)
- Console Entry → Complaint Intake: renders (evidence: `frontend/src/app/page.tsx`)
- Console Entry → Officer Console: renders (evidence: `frontend/src/app/page.tsx`)
- Console Entry → Authentication UI: renders (evidence: `frontend/src/app/page.tsx`)
- Console Entry → Encroachment Map: renders (evidence: `frontend/src/app/page.tsx`)
- Console Entry → Analytics Dashboard: renders (evidence: `frontend/src/app/page.tsx`)
- Console Entry → Flood Simulator: renders (evidence: `frontend/src/app/page.tsx`)
- Console Entry → Console Navigation: renders (evidence: `frontend/src/app/page.tsx`)
- Encroachment Map → Satellite Viewer: uses (evidence: `frontend/src/components/EncroachmentHeatmap.tsx`)
- Console Entry → Theme State: reads theme (evidence: `frontend/src/app/page.tsx`)
- Citizen → Citizen Portal: files complaints (evidence: `README.md`)
- Citizen Portal → Complaint Intake: opens intake (evidence: `README.md`)
- Officer → Officer Console: reviews alerts (evidence: `README.md`)
- FastAPI Routes → Region Configuration: loads settings (evidence: `backend/main.py`)
- FastAPI Routes → Role Authentication: uses auth (evidence: `backend/main.py`)
- FastAPI Routes → Domain Records: uses records (evidence: `backend/main.py`)
- Domain Records → SQLite Database: persists records (evidence: `backend/models.py`)
- FastAPI Routes → Sentinel STAC Search: requests scenes (evidence: `backend/main.py`)
- FastAPI Routes → Water Change Analysis: requests analysis (evidence: `backend/main.py`)
- FastAPI Routes → Threat Classification: serves threat data (evidence: `backend/main.py`)
- FastAPI Routes → OSM Footprints: requests footprints (evidence: `backend/main.py`)
- FastAPI Routes → Historical Water Baseline: requests baseline (evidence: `backend/main.py`)
- FastAPI Routes → Weather Risk: requests forecasts (evidence: `backend/main.py`)
- FastAPI Routes → Marine Context: requests context (evidence: `backend/main.py`)
- Water Change Analysis → Sentinel STAC Search: searches scenes (evidence: `backend/geo/ndwi.py`)
- Water Change Analysis → OSM Footprints: checks footprints (evidence: `backend/geo/ndwi.py`)
- FastAPI Routes → Statutory PDF Dossier: generates notice (evidence: `backend/main.py`)
- Officer Console → Statutory PDF Dossier: requests dossier (evidence: `README.md`)
- Sentinel STAC Search → Copernicus STAC: searches imagery (evidence: `backend/geo/stac_client.py`)
- OSM Footprints → OpenStreetMap: queries footprints (evidence: `README.md`)
- Historical Water Baseline → JRC Water Data: reads baseline (evidence: `README.md`)
- Weather Risk → Open-Meteo: fetches forecasts (evidence: `README.md`)
- FastAPI Routes → Citizen Portal: serves API (evidence: `README.md`)
