# robotgyal/weather-prediction architecture

> Architecture diagram of the GitHub repository robotgyal/weather-prediction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/robotgyal/weather-prediction
- Repository: https://github.com/robotgyal/weather-prediction

## Overview

##### Project type and purpose
- This is a data-science/ML project for “Weather Prediction using LSTM and Keras with TensorFlow” packaged together with a static web front-end to present results.
- Key indicators:
- Python scripts and Jupyter notebooks (`weather_lstm.py`, `*.ipynb`) under the repo root
- Model artifact (`lstm_model.h5`)
- Raw data (`data/*.csv`)
- Static HTML pages (`index.html`, `ml.html`, etc.) and `assets/` directory for CSS/JS

##### File structure
- Top-level folders and files:
- `data/` – CSV files and archives (raw input)
- `assets/` – CSS, JS and webfonts; SASS sources for styling the static site
- `*.ipynb` & `weather_lstm.py` – exploratory data analysis, preprocessing, model training & evaluation
- `lstm_model.h5` – trained LSTM model artifact
- `*.html` files – static pages to display research, visuals, reference, etc.
- No dedicated API or server framework present—front-end is purely static, model is invoked offline or in notebooks

##### README
- Describes an LSTM/Keras/TensorFlow workflow
- Mentions “Built Using” defaults (MongoDB/Express/Vue/Node) – this appears boilerplate and not relevant here

a. Main components
1) Data Layer
– Raw CSVs in `data/`
2) Preprocessing & Feature Engineering
– Python notebooks (`Weather_Prediction_Test_2.ipynb`, `playground.ipynb`)
– `weather_lstm.py` preprocessing functions
3) Model Training
– Keras LSTM training routine in `weather_lstm.py` & notebooks
4) Model Artifact Storage
– `lstm_model.h5` persisted weights and model topology
5) Inference / Prediction Service
– (If online: a Flask/FastAPI microservice wrapping the model)
– (Currently: local inference in notebooks or CLI script)
6) Presentation Layer (Static Website)
– HTML (`index.html`, `ml.html`, `research.html`, `visuals.html`, `reference.html`)
– Static assets in `assets/` (CSS, JS, Sass, webfonts)
– Embedded charts or videos (e.g., `weather prediction.mp4`)

b. Relationships & data flows
- Preprocessing → Model Training
- Model Training → Model Artifact Storage
- Model Artifact → Inference Service (online or offline)
- Inference output → Presentation Layer (pass JSON or embed images/plots into static pages)

c. Architectural patterns & principles
– Separation of concerns: data ingestion vs. training vs. serving vs. presentation
– Offline batch pipeline for training; optional microservice for online inference
– Static hosting for the front-end (can be GitHub Pages or CDN)

d. Key technologies & libraries
– Python 3.x, Jupyter Notebooks
– Keras (TensorFlow backend) for LSTM
– NumPy/Pandas for data prep
– Front-end: HTML5, CSS3 (Sass preprocessor), JavaScript utilities

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Data_CSV["Raw CSVs<br/>(data/)"]:::data
    end

    %% Preprocessing & Feature Engineering
    subgraph "Preprocessing & Feature Engineering"
        direction TB
        Notebook1["Weather_Prediction_Test_2.ipynb"]:::compute
        Playground["playground.ipynb"]:::compute
        PreprocessingScript["weather_lstm.py<br/>(Preprocessing)"]:::compute
    end

    %% Model Training
    subgraph "Model Training"
        direction TB
        TrainingScript["weather_lstm.py<br/>(Training)"]:::compute
        TrainingNotebook["Weather_Prediction_Test_2.ipynb<br/>(Training Cells)"]:::compute
    end

    %% Model Artifact Storage
    subgraph "Model Artifact Storage"
        direction TB
        ModelArtifact["lstm_model.h5"]:::storage
    end

    %% Inference / Prediction Service
    subgraph "Inference / Prediction Service"
        direction TB
        CLIInference["weather_lstm.py<br/>(CLI Inference)"]:::compute
        NotebookInference["Notebooks<br/>(Offline Inference)"]:::compute
    end

    %% Presentation Layer
    subgraph "Presentation Layer (Static Website)"
        direction TB
        subgraph "HTML Pages"
            direction TB
            Index["index.html"]:::presentation
            ML["ml.html"]:::presentation
            Research["research.html"]:::presentation
            Visuals["visuals.html"]:::presentation
            Reference["reference.html"]:::presentation
            LSTM_HTML["LSTM.html"]:::presentation
        end
        subgraph "Assets"
            direction TB
            CSSMain["assets/css/main.css"]:::presentation
            CSSNoScript["assets/css/noscript.css"]:::presentation
            JSMain["assets/js/main.js"]:::presentation
            JSUtil["assets/js/util.js"]:::presentation
            Sass["assets/sass/"]:::presentation
            Webfonts["assets/webfonts/"]:::presentation
            Img["img/"]:::presentation
            Video["weather prediction.mp4"]:::presentation
        end
    end

    %% Data Flows
    Data_CSV -->|"reads data"| Notebook1
    Data_CSV -->|"reads data"| Playground
    Data_CSV -->|"reads data"| PreprocessingScript

    Notebook1 -->|"calls preprocess"| TrainingNotebook
    PreprocessingScript -->|"calls preprocess"| TrainingScript

    TrainingNotebook -->|"trains model"| ModelArtifact
    TrainingScript -->|"trains model"| ModelArtifact

    ModelArtifact -->|"loaded by"| CLIInference
    ModelArtifact -->|"loaded by"| NotebookInference

    CLIInference -->|"outputs results to"| Index
    CLIInference -->|"outputs results to"| ML
    NotebookInference -->|"embeds plots in"| Visuals

    %% Click Events
    click Data_CSV "https://github.com/robotgyal/weather-prediction/tree/master/data/"
    click Notebook1 "https://github.com/robotgyal/weather-prediction/blob/master/Weather_Prediction_Test_2.ipynb"
    click Playground "https://github.com/robotgyal/weather-prediction/blob/master/playground.ipynb"
    click PreprocessingScript "https://github.com/robotgyal/weather-prediction/blob/master/weather_lstm.py"
    click TrainingScript "https://github.com/robotgyal/weather-prediction/blob/master/weather_lstm.py"
    click TrainingNotebook "https://github.com/robotgyal/weather-prediction/blob/master/Weather_Prediction_Test_2.ipynb"
    click ModelArtifact "https://github.com/robotgyal/weather-prediction/blob/master/lstm_model.h5"
    click CLIInference "https://github.com/robotgyal/weather-prediction/blob/master/weather_lstm.py"
    click NotebookInference "https://github.com/robotgyal/weather-prediction/blob/master/playground.ipynb"
    click Index "https://github.com/robotgyal/weather-prediction/blob/master/index.html"
    click ML "https://github.com/robotgyal/weather-prediction/blob/master/ml.html"
    click Research "https://github.com/robotgyal/weather-prediction/blob/master/research.html"
    click Visuals "https://github.com/robotgyal/weather-prediction/blob/master/visuals.html"
    click Reference "https://github.com/robotgyal/weather-prediction/blob/master/reference.html"
    click LSTM_HTML "https://github.com/robotgyal/weather-prediction/blob/master/LSTM.html"
    click CSSMain "https://github.com/robotgyal/weather-prediction/blob/master/assets/css/main.css"
    click CSSNoScript "https://github.com/robotgyal/weather-prediction/blob/master/assets/css/noscript.css"
    click JSMain "https://github.com/robotgyal/weather-prediction/blob/master/assets/js/main.js"
    click JSUtil "https://github.com/robotgyal/weather-prediction/blob/master/assets/js/util.js"
    click Sass "https://github.com/robotgyal/weather-prediction/tree/master/assets/sass/"
    click Webfonts "https://github.com/robotgyal/weather-prediction/tree/master/assets/webfonts/"
    click Img "https://github.com/robotgyal/weather-prediction/tree/master/img/"
    click Video "https://github.com/robotgyal/weather-prediction/blob/master/weather prediction.mp4"

    %% Styles
    classDef data fill:#e0f7fa,stroke:#006064,color:#006064;
    classDef compute fill:#e8f5e9,stroke:#1b5e20,color:#1b5e20;
    classDef storage fill:#f1f8e9,stroke:#33691e,color:#33691e;
    classDef presentation fill:#fff3e0,stroke:#e65100,color:#e65100;
```
