# balaji9441570-stack/rising-waters-flood-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/balaji9441570-stack/rising-waters-flood-prediction
- Repository: https://github.com/balaji9441570-stack/rising-waters-flood-prediction

## Overview

Rising Waters combines a synthetic-data generator, exploratory analysis, model training and selection, and a Flask flood-risk prediction app. The main user workflow is entering weather and rainfall values in the web form, which the Flask app transforms and scales before classifying them and rendering a YES or NO result. The graph also shows dataset and model artifacts. Relationships for the analysis and training stages are supported by their source excerpts; the web-page routes and workflow are also documented in the README.

Main entry points: [`app.py`](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/app.py) (Flask Application), [`src/train_model.py`](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/src/train_model.py) (Preprocessing and Training), [`data/flood_dataset.csv`](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/data/flood_dataset.csv) (Flood Dataset), [`src/eda.py`](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/src/eda.py) (Dataset Analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data Preparation"]
  node_generator["Synthetic Data Generator"]
end

subgraph group_analysis["Exploratory Analysis"]
  node_eda["Dataset Analysis<br/>[eda.py]"]
end

subgraph group_training["Model Training"]
  node_trainer["Preprocessing and Training<br/>[train_model.py]"]
end

subgraph group_web["Prediction Web App"]
  node_flask["Flask Application<br/>[app.py]"]
  node_home_page["Home Page<br/>[home.html]"]
  node_input_page["Prediction Form<br/>[predict.html]"]
  node_yes_page["Flood Result Page<br/>[flood_chance.html]"]
  node_no_page["No-Flood Result Page"]
  node_base_template["Shared Page Layout<br/>[base.html]"]
  node_styles["Web Styling<br/>[style.css]"]
end

subgraph group_artifacts["Data and Artifacts"]
  node_dataset[("Flood Dataset<br/>[flood_dataset.csv]")]
  node_eda_outputs["Analysis Outputs"]
  node_model_bundle["Trained Model Bundle<br/>[floods.save]"]
  node_comparison["Model Comparison"]
end

node_user(("Browser User"))

node_generator -->|"writes dataset"| node_dataset
node_eda -->|"reads dataset"| node_dataset
node_eda -->|"writes analysis"| node_eda_outputs
node_trainer -->|"reads dataset"| node_dataset
node_trainer -->|"saves winner"| node_model_bundle
node_trainer -->|"saves accuracies"| node_comparison
node_user -->|"submits inputs"| node_flask
node_flask -->|"renders home"| node_home_page
node_flask -->|"renders form"| node_input_page
node_flask -->|"renders YES result"| node_yes_page
node_flask -->|"renders NO result"| node_no_page
node_flask -->|"loads bundle"| node_model_bundle
node_flask -.->|"uses styling"| node_styles
node_base_template -.->|"loads styling"| node_styles

click node_generator "https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/src/generate_dataset.py"
click node_dataset "https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/data/flood_dataset.csv"
click node_eda "https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/src/eda.py"
click node_eda_outputs "https://github.com/balaji9441570-stack/rising-waters-flood-prediction/tree/main/static/eda_plots"
click node_trainer "https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/src/train_model.py"
click node_model_bundle "https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/models/floods.save"
click node_comparison "https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/models/model_comparison.json"
click node_flask "https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/app.py"
click node_home_page "https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/templates/home.html"
click node_input_page "https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/templates/predict.html"
click node_yes_page "https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/templates/flood_chance.html"
click node_no_page "https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/templates/no_flood_chance.html"
click node_base_template "https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/templates/base.html"
click node_styles "https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/static/style.css"

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_generator,node_user toneBlue
class node_eda toneAmber
class node_trainer toneMint
class node_flask,node_home_page,node_input_page,node_yes_page,node_no_page,node_base_template,node_styles toneRose
class node_dataset,node_eda_outputs,node_model_bundle,node_comparison toneIndigo
```

## Components

### Data Preparation

- [Synthetic Data Generator](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/src/generate_dataset.py): `src/generate_dataset.py`

### Exploratory Analysis

- [Dataset Analysis](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/src/eda.py): `src/eda.py`

### Model Training

- [Preprocessing and Training](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/src/train_model.py): `src/train_model.py`

### Prediction Web App

- [Flask Application](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/app.py): `app.py`
- [Home Page](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/templates/home.html): `templates/home.html`
- [Prediction Form](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/templates/predict.html): `templates/predict.html`
- [Flood Result Page](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/templates/flood_chance.html): `templates/flood_chance.html`
- [No-Flood Result Page](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/templates/no_flood_chance.html): `templates/no_flood_chance.html`
- [Shared Page Layout](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/templates/base.html): `templates/base.html`
- [Web Styling](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/static/style.css): `static/style.css`

### Data and Artifacts

- [Flood Dataset](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/data/flood_dataset.csv): `data/flood_dataset.csv`
- [Analysis Outputs](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/tree/main/static/eda_plots): `static/eda_plots`
- [Trained Model Bundle](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/models/floods.save): `models/floods.save`
- [Model Comparison](https://github.com/balaji9441570-stack/rising-waters-flood-prediction/blob/main/models/model_comparison.json): `models/model_comparison.json`

### Other components

- **Browser User**

## Connections

- Synthetic Data Generator → Flood Dataset: writes dataset (evidence: `src/generate_dataset.py`)
- Dataset Analysis → Flood Dataset: reads dataset (evidence: `src/eda.py`)
- Dataset Analysis → Analysis Outputs: writes analysis (evidence: `src/eda.py`)
- Preprocessing and Training → Flood Dataset: reads dataset (evidence: `src/train_model.py`)
- Preprocessing and Training → Trained Model Bundle: saves winner (evidence: `src/train_model.py`)
- Preprocessing and Training → Model Comparison: saves accuracies (evidence: `src/train_model.py`)
- Browser User → Flask Application: submits inputs (evidence: `README.md`)
- Flask Application → Home Page: renders home (evidence: `app.py`)
- Flask Application → Prediction Form: renders form (evidence: `app.py`)
- Flask Application → Flood Result Page: renders YES result (evidence: `app.py`)
- Flask Application → No-Flood Result Page: renders NO result (evidence: `app.py`)
- Flask Application → Trained Model Bundle: loads bundle (evidence: `app.py`)
- Flask Application → Web Styling: uses styling
- Shared Page Layout → Web Styling: loads styling
