# ram0101k/real-time-climate-disaster-predictionn architecture

> Architecture diagram of the GitHub repository ram0101k/real-time-climate-disaster-predictionn, 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/ram0101k/real-time-climate-disaster-predictionn
- Repository: https://github.com/ram0101k/real-time-climate-disaster-predictionn

## Overview

This is a Streamlit flood-risk prediction application for Telangana districts. A user selects a district; the app fetches current weather, preprocesses it, runs prediction and visualization, then displays a generated map. A separate historical-data workflow converts or preprocesses weather data and trains the hybrid model. The prediction script also creates a confidence chart, though its displayed risk classification is threshold-based on rainfall. Runtime data files are referenced in source but are not present in the supplied tree, so they are represented through producer-to-consumer links. The README is empty; arrows reflect sampled code.

Main entry points: [`predict_and_visualize.py`](https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/predict_and_visualize.py) (Predict and Visualize), [`app.py`](https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/app.py) (Streamlit App), [`train_hybrid.py`](https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/train_hybrid.py) (Hybrid Trainer), [`fetch_data.py`](https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/fetch_data.py) (Fetch Weather)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_app["Streamlit App<br/>[app.py]"]
end

subgraph group_weather["Weather Data"]
  node_fetch["Fetch Weather<br/>[fetch_data.py]"]
  node_live_prep["Live Preprocessing<br/>[preprocess_live.py]"]
  node_dataset_convert["Dataset Conversion"]
  node_train_prep["Training Preprocessing"]
end

subgraph group_modeling["Modeling"]
  node_trainer["Hybrid Trainer<br/>[train_hybrid.py]"]
  node_transformer["Temporal Transformer<br/>[transformer.py]"]
  node_gnn["Graph Network<br/>[gnn.py]"]
  node_checkpoint["Model Checkpoint<br/>[flood_model.pth]"]
end

subgraph group_results["Prediction Results"]
  node_predict["Predict and Visualize"]
  node_map["Flood Risk Map"]
end

node_user(("District User"))
node_weather_api["Weather API"]

node_user -->|"selects district"| node_app
node_app -->|"runs with district"| node_fetch
node_fetch -->|"requests weather"| node_weather_api
node_fetch -->|"saves weather for"| node_live_prep
node_app -->|"runs preprocessing"| node_live_prep
node_app -->|"runs prediction"| node_predict
node_dataset_convert -->|"writes historical data for"| node_train_prep
node_train_prep -->|"writes training data for"| node_trainer
node_trainer -->|"calls"| node_transformer
node_trainer -->|"calls"| node_gnn
node_trainer -->|"saves weights"| node_checkpoint
node_live_prep -->|"writes live features for"| node_predict
node_predict -->|"loads weights"| node_checkpoint
node_predict -->|"calls"| node_transformer
node_predict -->|"calls"| node_gnn
node_predict -->|"generates"| node_map
node_app -->|"displays"| node_map

click node_app "https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/app.py"
click node_fetch "https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/fetch_data.py"
click node_live_prep "https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/preprocess_live.py"
click node_dataset_convert "https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/convert_kaggle_telangana_to_project_format.py"
click node_train_prep "https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/preprocess_train.py"
click node_trainer "https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/train_hybrid.py"
click node_transformer "https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/model/transformer.py"
click node_gnn "https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/model/gnn.py"
click node_checkpoint "https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/model/flood_model.pth"
click node_predict "https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/predict_and_visualize.py"
click node_map "https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/flood_risk_map.html"

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_app,node_user toneBlue
class node_fetch,node_live_prep,node_dataset_convert,node_train_prep toneAmber
class node_trainer,node_transformer,node_gnn,node_checkpoint,node_weather_api toneMint
class node_predict,node_map toneRose
```

## Components

### User Interface

- [Streamlit App](https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/app.py): `app.py`

### Weather Data

- [Fetch Weather](https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/fetch_data.py): `fetch_data.py`
- [Live Preprocessing](https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/preprocess_live.py): `preprocess_live.py`
- [Dataset Conversion](https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/convert_kaggle_telangana_to_project_format.py): `convert_kaggle_telangana_to_project_format.py`
- [Training Preprocessing](https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/preprocess_train.py): `preprocess_train.py`

### Modeling

- [Hybrid Trainer](https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/train_hybrid.py): `train_hybrid.py`
- [Temporal Transformer](https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/model/transformer.py): `model/transformer.py`
- [Graph Network](https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/model/gnn.py): `model/gnn.py`
- [Model Checkpoint](https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/model/flood_model.pth): `model/flood_model.pth`

### Prediction Results

- [Predict and Visualize](https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/predict_and_visualize.py): `predict_and_visualize.py`
- [Flood Risk Map](https://github.com/ram0101k/real-time-climate-disaster-predictionn/blob/main/flood_risk_map.html): `flood_risk_map.html`

### Other components

- **District User**
- **Weather API**

## Connections

- District User → Streamlit App: selects district
- Streamlit App → Fetch Weather: runs with district
- Fetch Weather → Weather API: requests weather
- Fetch Weather → Live Preprocessing: saves weather for
- Streamlit App → Live Preprocessing: runs preprocessing
- Streamlit App → Predict and Visualize: runs prediction
- Dataset Conversion → Training Preprocessing: writes historical data for
- Training Preprocessing → Hybrid Trainer: writes training data for
- Hybrid Trainer → Temporal Transformer: calls
- Hybrid Trainer → Graph Network: calls
- Hybrid Trainer → Model Checkpoint: saves weights
- Live Preprocessing → Predict and Visualize: writes live features for
- Predict and Visualize → Model Checkpoint: loads weights
- Predict and Visualize → Temporal Transformer: calls
- Predict and Visualize → Graph Network: calls
- Predict and Visualize → Flood Risk Map: generates
- Streamlit App → Flood Risk Map: displays
