# sribalaji2907/weathergpt architecture

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

- Interactive diagram: https://gitdiagram.com/sribalaji2907/weathergpt
- Repository: https://github.com/sribalaji2907/weathergpt

## Overview

WeatherGPT serves a multilingual web interface backed by a FastAPI service. The main workflow is city search, geocoding, retrieval of current conditions and a 7-day forecast, then display and rule-based chat using the loaded data. Separate capabilities provide a next-calendar-month seasonal outlook and an optional historical rainfall summary from a user-supplied CSV. The API implementation is excerpted; interface internals are not, so UI-to-API and UI behavior links rely on README statements rather than inspected frontend code.

Main entry points: [`app.py`](https://github.com/sribalaji2907/weathergpt/blob/main/app.py) (FastAPI service), [`static/index.html`](https://github.com/sribalaji2907/weathergpt/blob/main/static/index.html) (WeatherGPT interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_web["WeatherGPT interface<br/>[index.html]"]
  node_chat["Rule-based chat<br/>[index.html]"]
end

subgraph group_weather["Live weather"]
  node_api["FastAPI service<br/>[app.py]"]
  node_geocode["City geocoding<br/>[app.py]"]
  node_forecast["Current and 7-day data<br/>[app.py]"]
  node_cache["In-memory cache<br/>[app.py]"]
end

subgraph group_outlook["Seasonal outlook"]
  node_seasonal["Seasonal data retrieval<br/>[app.py]"]
  node_summary["Monthly outlook summary<br/>[app.py]"]
end

subgraph group_history["Rainfall history"]
  node_history_endpoint["History endpoint<br/>[app.py]"]
  node_csv_summary["Rainfall CSV summary<br/>[app.py]"]
  node_rainfall_csv["Rainfall CSV"]
end

node_visitor(("Visitor"))
node_geocoder{{"Open-Meteo geocoding"}}
node_forecast_api{{"Open-Meteo forecast"}}
node_seasonal_api{{"Open-Meteo seasonal"}}

node_visitor -->|"uses"| node_web
node_web -.->|"requests data"| node_api
node_web -->|"uses loaded data"| node_chat
node_api -->|"serves"| node_web
node_api -->|"calls"| node_geocode
node_api -->|"calls"| node_forecast
node_api -->|"reads and writes"| node_cache
node_geocode -->|"requests location"| node_geocoder
node_forecast -->|"requests forecast"| node_forecast_api
node_api -->|"calls"| node_seasonal
node_seasonal -->|"resolves city"| node_geocode
node_seasonal -->|"requests outlook"| node_seasonal_api
node_seasonal -->|"summarizes values"| node_summary
node_api -->|"routes"| node_history_endpoint
node_history_endpoint -->|"summarizes CSV"| node_csv_summary
node_csv_summary -->|"reads"| node_rainfall_csv

click node_web "https://github.com/sribalaji2907/weathergpt/blob/main/static/index.html"
click node_chat "https://github.com/sribalaji2907/weathergpt/blob/main/static/index.html"
click node_api "https://github.com/sribalaji2907/weathergpt/blob/main/app.py"
click node_geocode "https://github.com/sribalaji2907/weathergpt/blob/main/app.py"
click node_forecast "https://github.com/sribalaji2907/weathergpt/blob/main/app.py"
click node_cache "https://github.com/sribalaji2907/weathergpt/blob/main/app.py"
click node_seasonal "https://github.com/sribalaji2907/weathergpt/blob/main/app.py"
click node_summary "https://github.com/sribalaji2907/weathergpt/blob/main/app.py"
click node_history_endpoint "https://github.com/sribalaji2907/weathergpt/blob/main/app.py"
click node_csv_summary "https://github.com/sribalaji2907/weathergpt/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_web,node_chat toneBlue
class node_api,node_geocode,node_forecast,node_cache toneAmber
class node_seasonal,node_summary toneMint
class node_history_endpoint,node_csv_summary,node_rainfall_csv toneRose
class node_visitor,node_geocoder,node_forecast_api,node_seasonal_api toneIndigo
```

## Components

### User interface

- [WeatherGPT interface](https://github.com/sribalaji2907/weathergpt/blob/main/static/index.html): `static/index.html`
- [Rule-based chat](https://github.com/sribalaji2907/weathergpt/blob/main/static/index.html): `static/index.html`

### Live weather

- [FastAPI service](https://github.com/sribalaji2907/weathergpt/blob/main/app.py): `app.py`
- [City geocoding](https://github.com/sribalaji2907/weathergpt/blob/main/app.py): `app.py`
- [Current and 7-day data](https://github.com/sribalaji2907/weathergpt/blob/main/app.py): `app.py`
- [In-memory cache](https://github.com/sribalaji2907/weathergpt/blob/main/app.py): `app.py`

### Seasonal outlook

- [Seasonal data retrieval](https://github.com/sribalaji2907/weathergpt/blob/main/app.py): `app.py`
- [Monthly outlook summary](https://github.com/sribalaji2907/weathergpt/blob/main/app.py): `app.py`

### Rainfall history

- [History endpoint](https://github.com/sribalaji2907/weathergpt/blob/main/app.py): `app.py`
- [Rainfall CSV summary](https://github.com/sribalaji2907/weathergpt/blob/main/app.py): `app.py`
- **Rainfall CSV**

### Other components

- **Visitor**
- **Open-Meteo geocoding**
- **Open-Meteo forecast**
- **Open-Meteo seasonal**

## Connections

- Visitor → WeatherGPT interface: uses (evidence: `README.md`)
- WeatherGPT interface → FastAPI service: requests data (evidence: `README.md`)
- WeatherGPT interface → Rule-based chat: uses loaded data (evidence: `README.md`)
- FastAPI service → WeatherGPT interface: serves (evidence: `app.py`)
- FastAPI service → City geocoding: calls (evidence: `app.py`)
- FastAPI service → Current and 7-day data: calls (evidence: `app.py`)
- FastAPI service → In-memory cache: reads and writes (evidence: `app.py`)
- City geocoding → Open-Meteo geocoding: requests location (evidence: `app.py`)
- Current and 7-day data → Open-Meteo forecast: requests forecast (evidence: `app.py`)
- FastAPI service → Seasonal data retrieval: calls (evidence: `app.py`)
- Seasonal data retrieval → City geocoding: resolves city (evidence: `app.py`)
- Seasonal data retrieval → Open-Meteo seasonal: requests outlook (evidence: `app.py`)
- Seasonal data retrieval → Monthly outlook summary: summarizes values (evidence: `app.py`)
- FastAPI service → History endpoint: routes (evidence: `app.py`)
- History endpoint → Rainfall CSV summary: summarizes CSV (evidence: `app.py`)
- Rainfall CSV summary → Rainfall CSV: reads (evidence: `app.py`)
