# punyakp/ecowatch architecture

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

- Interactive diagram: https://gitdiagram.com/punyakp/ecowatch
- Repository: https://github.com/punyakp/ecowatch

## Overview

EcoWatch is a Flask-based environmental reporting and monitoring dashboard. Users sign in, submit environmental issue reports, and view them through report, alert, analytics, map, and AI-insight screens; users can also manage accounts and settings. The app computes report statistics and persists reports and user records in JSON files, with an S3 upload helper and OpenWeather data helpers present in app.py. The excerpts do not show all route bodies or template forms, so uncertain calls—especially which screens invoke the external-service helpers—are omitted.

Main entry points: [`app.py`](https://github.com/punyakp/ecowatch/blob/main/app.py) (Flask routes), [`reports.json`](https://github.com/punyakp/ecowatch/blob/main/reports.json) (Report records), [`templates/login.html`](https://github.com/punyakp/ecowatch/blob/main/templates/login.html) (Login screen), [`templates/index.html`](https://github.com/punyakp/ecowatch/blob/main/templates/index.html) (Dashboard screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_flask["Flask routes<br/>[app.py]"]
  node_auth["Login and access<br/>[app.py]"]
  node_login["Login screen<br/>[login.html]"]
  node_dashboard["Dashboard screen<br/>[index.html]"]
  node_reports_view["Reports screen<br/>[reports.html]"]
  node_alerts["Alerts screen<br/>[alerts.html]"]
  node_analytics["Analytics screen<br/>[analytics.html]"]
  node_map["Map screen<br/>[map.html]"]
  node_ai["AI insights screen<br/>[ai.html]"]
  node_user_admin["User management screen<br/>[users.html]"]
  node_settings["Settings screen<br/>[settings.html]"]
end

subgraph group_domain["Reporting and insights"]
  node_report_ops["Report operations<br/>[app.py]"]
  node_stats["Report statistics<br/>[app.py]"]
end

subgraph group_state["Application state"]
  node_reports_store[("Report records<br/>[reports.json]")]
  node_users_store[("User records<br/>[users.json]")]
  node_uploads[("Uploaded files")]
end

subgraph group_integrations["External integrations"]
  node_s3_helper["S3 upload helper<br/>[app.py]"]
  node_s3[("AWS S3")]
  node_weather_helper["Weather data helpers<br/>[app.py]"]
  node_openweather["OpenWeather API"]
end

node_visitor(("User"))

node_visitor -->|"requests pages"| node_flask
node_flask -->|"handles login"| node_auth
node_auth -->|"loads and saves"| node_users_store
node_flask -->|"renders"| node_login
node_flask -->|"renders"| node_dashboard
node_flask -->|"renders"| node_reports_view
node_flask -->|"renders"| node_alerts
node_flask -->|"renders"| node_analytics
node_flask -->|"renders"| node_map
node_flask -->|"renders"| node_ai
node_flask -->|"renders"| node_user_admin
node_flask -->|"renders"| node_settings
node_flask -->|"handles reports"| node_report_ops
node_report_ops -->|"loads and saves"| node_reports_store
node_flask -->|"requests statistics"| node_stats
node_stats -->|"reads reports"| node_reports_store
node_s3_helper -.->|"uploads files"| node_s3
node_weather_helper -.->|"requests conditions"| node_openweather

click node_flask "https://github.com/punyakp/ecowatch/blob/main/app.py"
click node_auth "https://github.com/punyakp/ecowatch/blob/main/app.py"
click node_login "https://github.com/punyakp/ecowatch/blob/main/templates/login.html"
click node_dashboard "https://github.com/punyakp/ecowatch/blob/main/templates/index.html"
click node_reports_view "https://github.com/punyakp/ecowatch/blob/main/templates/reports.html"
click node_alerts "https://github.com/punyakp/ecowatch/blob/main/templates/alerts.html"
click node_analytics "https://github.com/punyakp/ecowatch/blob/main/templates/analytics.html"
click node_map "https://github.com/punyakp/ecowatch/blob/main/templates/map.html"
click node_ai "https://github.com/punyakp/ecowatch/blob/main/templates/ai.html"
click node_user_admin "https://github.com/punyakp/ecowatch/blob/main/templates/users.html"
click node_settings "https://github.com/punyakp/ecowatch/blob/main/templates/settings.html"
click node_report_ops "https://github.com/punyakp/ecowatch/blob/main/app.py"
click node_stats "https://github.com/punyakp/ecowatch/blob/main/app.py"
click node_reports_store "https://github.com/punyakp/ecowatch/blob/main/reports.json"
click node_users_store "https://github.com/punyakp/ecowatch/blob/main/users.json"
click node_uploads "https://github.com/punyakp/ecowatch/tree/main/static/uploads"
click node_s3_helper "https://github.com/punyakp/ecowatch/blob/main/app.py"
click node_weather_helper "https://github.com/punyakp/ecowatch/blob/main/app.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_flask,node_auth,node_login,node_dashboard,node_reports_view,node_alerts,node_analytics,node_map,node_ai,node_user_admin,node_settings,node_visitor toneBlue
class node_report_ops,node_stats toneAmber
class node_reports_store,node_users_store,node_uploads toneMint
class node_s3_helper,node_s3,node_weather_helper,node_openweather toneRose
```

## Components

### Web interface

- [Flask routes](https://github.com/punyakp/ecowatch/blob/main/app.py): `app.py`
- [Login and access](https://github.com/punyakp/ecowatch/blob/main/app.py): `app.py`
- [Login screen](https://github.com/punyakp/ecowatch/blob/main/templates/login.html): `templates/login.html`
- [Dashboard screen](https://github.com/punyakp/ecowatch/blob/main/templates/index.html): `templates/index.html`
- [Reports screen](https://github.com/punyakp/ecowatch/blob/main/templates/reports.html): `templates/reports.html`
- [Alerts screen](https://github.com/punyakp/ecowatch/blob/main/templates/alerts.html): `templates/alerts.html`
- [Analytics screen](https://github.com/punyakp/ecowatch/blob/main/templates/analytics.html): `templates/analytics.html`
- [Map screen](https://github.com/punyakp/ecowatch/blob/main/templates/map.html): `templates/map.html`
- [AI insights screen](https://github.com/punyakp/ecowatch/blob/main/templates/ai.html): `templates/ai.html`
- [User management screen](https://github.com/punyakp/ecowatch/blob/main/templates/users.html): `templates/users.html`
- [Settings screen](https://github.com/punyakp/ecowatch/blob/main/templates/settings.html): `templates/settings.html`

### Reporting and insights

- [Report operations](https://github.com/punyakp/ecowatch/blob/main/app.py): `app.py`
- [Report statistics](https://github.com/punyakp/ecowatch/blob/main/app.py): `app.py`

### Application state

- [Report records](https://github.com/punyakp/ecowatch/blob/main/reports.json): `reports.json`
- [User records](https://github.com/punyakp/ecowatch/blob/main/users.json): `users.json`
- [Uploaded files](https://github.com/punyakp/ecowatch/tree/main/static/uploads): `static/uploads`

### External integrations

- [S3 upload helper](https://github.com/punyakp/ecowatch/blob/main/app.py): `app.py`
- **AWS S3**
- [Weather data helpers](https://github.com/punyakp/ecowatch/blob/main/app.py): `app.py`
- **OpenWeather API**

### Other components

- **User**

## Connections

- User → Flask routes: requests pages
- Flask routes → Login and access: handles login
- Login and access → User records: loads and saves
- Flask routes → Login screen: renders
- Flask routes → Dashboard screen: renders
- Flask routes → Reports screen: renders
- Flask routes → Alerts screen: renders
- Flask routes → Analytics screen: renders
- Flask routes → Map screen: renders
- Flask routes → AI insights screen: renders
- Flask routes → User management screen: renders
- Flask routes → Settings screen: renders
- Flask routes → Report operations: handles reports
- Report operations → Report records: loads and saves
- Flask routes → Report statistics: requests statistics
- Report statistics → Report records: reads reports
- S3 upload helper → AWS S3: uploads files
- Weather data helpers → OpenWeather API: requests conditions
