# pavanreddy565/reservoir_intelligence architecture

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

- Interactive diagram: https://gitdiagram.com/pavanreddy565/reservoir_intelligence
- Repository: https://github.com/pavanreddy565/reservoir_intelligence

## Overview

Reservoir Intelligence is a Flask dashboard for monitoring Chennai-area reservoirs and forecasting storage, outflow, demand, and supply. Its main workflow serves browser views and JSON APIs, reads historical records from Supabase, applies trained forecasting models, and returns time-series results for visualization and supply-demand comparison. The root route also refreshes records from reservoir and weather services. Source excerpts show the principal routes and model flow; GetWeek.py is partial, so uncertain internal details are omitted. ARIMA/SARIMA comparison is mentioned in the README, but no implementation is evident in the tree.

Main entry points: [`app.py`](https://github.com/pavanreddy565/reservoir_intelligence/blob/main/app.py) (Flask routes), [`GetWeek.py`](https://github.com/pavanreddy565/reservoir_intelligence/blob/main/GetWeek.py) (Storage/outflow forecast), [`Load.py`](https://github.com/pavanreddy565/reservoir_intelligence/blob/main/Load.py) (Data refresh), [`static/js/current.js`](https://github.com/pavanreddy565/reservoir_intelligence/blob/main/static/js/current.js) (Browser UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Dashboard and API"]
  node_browser["Browser UI<br/>[current.js]"]
  node_templates["Dashboard pages"]
  node_flask["Flask routes<br/>[app.py]"]
  node_plotting["Interactive charts<br/>[current.js]"]
end

subgraph group_data["Data collection"]
  node_ingestion["Data refresh<br/>[Load.py]"]
  node_reservoir_site["Reservoir data site"]
  node_weather["Weather service"]
  node_supabase[("Supabase records")]
end

subgraph group_forecast["Forecasting"]
  node_history["Recent reservoir data<br/>[GetWeek.py]"]
  node_forecast_engine["Storage/outflow forecast<br/>[GetWeek.py]"]
  node_seq_model["Seq2seq architecture<br/>[model.py]"]
  node_reservoir_weights["Reservoir model weights"]
end

subgraph group_balance["Supply-demand"]
  node_demand_engine["Demand forecast<br/>[GetWeek.py]"]
  node_demand_weights["Demand model weights"]
  node_supply_engine["Supply estimate<br/>[GetWeek.py]"]
  node_supply_weights["Supply model weights"]
end

node_visitor(("Dashboard user"))

node_visitor -->|"uses"| node_browser
node_browser -->|"requests data"| node_flask
node_flask -->|"renders pages"| node_templates
node_flask -->|"refreshes records"| node_ingestion
node_ingestion -->|"fetches levels"| node_reservoir_site
node_ingestion -->|"fetches weather"| node_weather
node_ingestion -->|"inserts records"| node_supabase
node_flask -->|"requests weekly data"| node_history
node_history -->|"reads records"| node_supabase
node_flask -->|"requests predictions"| node_forecast_engine
node_forecast_engine -->|"reads history"| node_supabase
node_forecast_engine -->|"runs inference"| node_seq_model
node_forecast_engine -->|"loads weights"| node_reservoir_weights
node_flask -->|"requests demand"| node_demand_engine
node_demand_engine -->|"reads demand"| node_supabase
node_demand_engine -->|"runs inference"| node_seq_model
node_demand_engine -->|"loads weights"| node_demand_weights
node_flask -->|"requests supply"| node_supply_engine
node_supply_engine -->|"gets forecasts"| node_forecast_engine
node_supply_engine -->|"loads weights"| node_supply_weights
node_browser -->|"plots results"| node_plotting
node_flask -->|"returns JSON"| node_browser

click node_browser "https://github.com/pavanreddy565/reservoir_intelligence/blob/main/static/js/current.js"
click node_templates "https://github.com/pavanreddy565/reservoir_intelligence/tree/main/templates"
click node_flask "https://github.com/pavanreddy565/reservoir_intelligence/blob/main/app.py"
click node_ingestion "https://github.com/pavanreddy565/reservoir_intelligence/blob/main/Load.py"
click node_history "https://github.com/pavanreddy565/reservoir_intelligence/blob/main/GetWeek.py"
click node_forecast_engine "https://github.com/pavanreddy565/reservoir_intelligence/blob/main/GetWeek.py"
click node_seq_model "https://github.com/pavanreddy565/reservoir_intelligence/blob/main/models/storage_90days_to_30days_forecast/model.py"
click node_reservoir_weights "https://github.com/pavanreddy565/reservoir_intelligence/tree/main/models/storage_90days_to_30days_forecast"
click node_demand_engine "https://github.com/pavanreddy565/reservoir_intelligence/blob/main/GetWeek.py"
click node_demand_weights "https://github.com/pavanreddy565/reservoir_intelligence/tree/main/models/Demand_estimation_of_metroplotian"
click node_supply_engine "https://github.com/pavanreddy565/reservoir_intelligence/blob/main/GetWeek.py"
click node_supply_weights "https://github.com/pavanreddy565/reservoir_intelligence/tree/main/models/Supply"
click node_plotting "https://github.com/pavanreddy565/reservoir_intelligence/blob/main/static/js/current.js"

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_browser,node_templates,node_flask,node_plotting,node_visitor toneBlue
class node_ingestion,node_reservoir_site,node_weather,node_supabase toneAmber
class node_history,node_forecast_engine,node_seq_model,node_reservoir_weights toneMint
class node_demand_engine,node_demand_weights,node_supply_engine,node_supply_weights toneRose
```

## Components

### Dashboard and API

- [Browser UI](https://github.com/pavanreddy565/reservoir_intelligence/blob/main/static/js/current.js): `static/js/current.js`
- [Dashboard pages](https://github.com/pavanreddy565/reservoir_intelligence/tree/main/templates): `templates`
- [Flask routes](https://github.com/pavanreddy565/reservoir_intelligence/blob/main/app.py): `app.py`
- [Interactive charts](https://github.com/pavanreddy565/reservoir_intelligence/blob/main/static/js/current.js): `static/js/current.js`

### Data collection

- [Data refresh](https://github.com/pavanreddy565/reservoir_intelligence/blob/main/Load.py): `Load.py`
- **Reservoir data site**
- **Weather service**
- **Supabase records**

### Forecasting

- [Recent reservoir data](https://github.com/pavanreddy565/reservoir_intelligence/blob/main/GetWeek.py): `GetWeek.py`
- [Storage/outflow forecast](https://github.com/pavanreddy565/reservoir_intelligence/blob/main/GetWeek.py): `GetWeek.py`
- [Seq2seq architecture](https://github.com/pavanreddy565/reservoir_intelligence/blob/main/models/storage_90days_to_30days_forecast/model.py): `models/storage_90days_to_30days_forecast/model.py`
- [Reservoir model weights](https://github.com/pavanreddy565/reservoir_intelligence/tree/main/models/storage_90days_to_30days_forecast): `models/storage_90days_to_30days_forecast`

### Supply-demand

- [Demand forecast](https://github.com/pavanreddy565/reservoir_intelligence/blob/main/GetWeek.py): `GetWeek.py`
- [Demand model weights](https://github.com/pavanreddy565/reservoir_intelligence/tree/main/models/Demand_estimation_of_metroplotian): `models/Demand_estimation_of_metroplotian`
- [Supply estimate](https://github.com/pavanreddy565/reservoir_intelligence/blob/main/GetWeek.py): `GetWeek.py`
- [Supply model weights](https://github.com/pavanreddy565/reservoir_intelligence/tree/main/models/Supply): `models/Supply`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Browser UI: uses
- Browser UI → Flask routes: requests data
- Flask routes → Dashboard pages: renders pages
- Flask routes → Data refresh: refreshes records
- Data refresh → Reservoir data site: fetches levels
- Data refresh → Weather service: fetches weather
- Data refresh → Supabase records: inserts records
- Flask routes → Recent reservoir data: requests weekly data
- Recent reservoir data → Supabase records: reads records
- Flask routes → Storage/outflow forecast: requests predictions
- Storage/outflow forecast → Supabase records: reads history
- Storage/outflow forecast → Seq2seq architecture: runs inference
- Storage/outflow forecast → Reservoir model weights: loads weights
- Flask routes → Demand forecast: requests demand
- Demand forecast → Supabase records: reads demand
- Demand forecast → Seq2seq architecture: runs inference
- Demand forecast → Demand model weights: loads weights
- Flask routes → Supply estimate: requests supply
- Supply estimate → Storage/outflow forecast: gets forecasts
- Supply estimate → Supply model weights: loads weights
- Browser UI → Interactive charts: plots results
- Flask routes → Browser UI: returns JSON
