# sergiorubio01/weather-regulation-prediction architecture

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

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

## Overview

##### Project Type & Purpose
- This is a modular, end-to-end Machine Learning (ML) system for predicting Air Traffic Flow Management regulations based on weather.
- It provides:
- A configurable Data Pipeline (ingestion → validation → feature engineering → preprocessing)
- 13 ML models (traditional & deep learning)
- Hyperparameter‐tuning workflows (Grid/Random/Bayesian/Ray Tune/Keras Tuner/Multi‐objective)
- Experiment management (MLflow integration)
- Results storage & multi‐format reporting
- Visualization (static plots & interactive Dash dashboards)
- Orchestrated via Python scripts, CLI entry‐point (`run_experiments.py`), notebooks, and YAML configs.

##### High-Level Module Analysis
Top-level directories:
- configs/ : YAML templates for all experiment parameters
- src/ : core utilities (config parsing, CLI, helpers)
- data/ : data_loader, validation, feature_engineering, preprocessing
- models/ : model classes (base_model, random_forest, LSTM, Transformer, etc.) & saved artifacts
- training/ : Trainer & hyperparameter_tuning strategies
- results/ : ResultsManager & ReportGenerator
- visualization/ : Plotting utilities & Dash-based dashboard
- scripts/ : Ready‐to‐run pipelines (balanced dataset pipeline, examples, utilities)
- tests/ : end-to-end, unit, performance tests
- notebooks/ : Quick‐start & advanced tutorials
- configs/, visualizations/, results/: supporting files and outputs

##### Key Architectural Patterns & Data Flow
- **Separation of Concerns**: Data pipeline ←→ Model training ←→ Results & visualization
- **Config-Driven**: All behavior is driven by YAML (configs/) via src/config_parser
- **Experiment Runner**: `run_experiments.py` uses ExperimentConfig → ExperimentRunner
- **Modularity**: Each domain (data/models/training/results/visualization) is a self-contained sub-system.
- **Extensibility Points**:
- New model by subclassing BaseModel + config + tests
- New tuner by implementing HyperparameterTuner interface

##### Components & Relationships
- configs/*.yaml
- src/config.py, config_parser.py, config_utils.py
→ provides ExperimentConfig to all downstream modules via CLI or API

- data/data_loader.py (CSV/Parquet loader, caching)
- data/data_validation.py (quality checks, anomaly/diff detection)
- data/feature_engineering.py (weather & time-series features)
- data/preprocessing.py (scaling, encoding)
→ outputs X_train, X_val, y_train, y_val

- models/base_model.py → abstraction
- models/*.py (random_forest, fnn, lstm, transformer, cnn, rnn, gru, wavenet, autoencoder, ensemble, hybrids)
- models/deep_learning/*.keras/.pkl → pre-trained artifacts
→ defines train() and predict() interfaces

- training/trainer.py (orchestrates model.fit, callbacks, MLflow logging)
- training/hyperparameter_tuning.py (GridSearchTuner, BayesianOptimizer, RayTuneTuner, KerasTuner, MultiObjectiveTuner)
- run_experiments.py (entry point invoking Trainer or Tuner based on config)
→ produces trained model artifacts & metrics

- results/results_manager.py (save/load/list/compare experiments)
- results/report_generator.py (HTML/PDF/LaTeX/PPTX outputs)
→ persisted under /results and MLflow back end

- visualization/plots.py (Matplotlib/Plotly utilities)
- visualization/dashboard.py (Dash server + UI components)
- visualizations/ (static deliverables summaries)
→ reads from results, model artifacts, data to render charts & dashboards

- scripts/… (balanced_dataset pipeline, examples, utilities)
- notebooks/ (01 quick start, 02 advanced DL)
→ orchestrate common workflows; depend on Config + Data + Training modules

H. **Testing** (Bordered outline)
- tests/test_*.py
→ validates each layer end-to-end; should be shown as side-band verifying correctness

- MLflow server (experiment tracking)
- Ray cluster (for distributed tuning)
- Dash (for interactive dashboard)
- Optional: database or object store for large data/MLflow artifact store

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Configuration Layer
    subgraph "Configuration Layer"
        direction TB
        CFG_DIR["configs/"]:::config
        CFG_YAML["configs/*.yaml"]:::config
        SRC_CONFIG["src/config.py"]:::config
        SRC_PARSER["src/config_parser.py"]:::config
        SRC_UTILS["src/config_utils.py"]:::config
    end

    %% Data Pipeline
    subgraph "Data Pipeline"
        direction TB
        DL["data/data_loader.py"]:::data
        DV["data/data_validation.py"]:::data
        FE["data/feature_engineering.py"]:::data
        PP["data/preprocessing.py"]:::data
    end

    %% Model Layer
    subgraph "Model Layer"
        direction TB
        BM["models/base_model.py"]:::model
        RF["models/random_forest.py"]:::model
        FNN["models/fnn.py"]:::model
        LSTM["models/lstm.py"]:::model
        TRANS["models/transformer.py"]:::model
        CNN["models/cnn.py"]:::model
        RNN["models/rnn.py"]:::model
        GRU["models/gru.py"]:::model
        WN["models/wavenet.py"]:::model
        AE["models/autoencoder.py"]:::model
        ENS["models/ensemble.py"]:::model
        HYB["models/hybrid_models.py"]:::model
        ATT["models/attention_lstm.py"]:::model
        DL_ART["models/deep_learning/"]:::model
    end

    %% Training & Tuning
    subgraph "Training & Tuning"
        direction TB
        TR["training/trainer.py"]:::train
        HT["training/hyperparameter_tuning.py"]:::train
        RE["run_experiments.py"]:::train
    end

    %% Results Management
    subgraph "Results Management"
        direction TB
        RM["results/results_manager.py"]:::results
        RG["results/report_generator.py"]:::results
    end

    %% Visualization
    subgraph "Visualization"
        direction TB
        PLOT["visualization/plots.py"]:::viz
        DASH["visualization/dashboard.py"]:::viz
        STAT["visualizations/"]:::viz
    end

    %% Scripts & Notebooks
    subgraph "Scripts & Notebooks"
        direction TB
        BS["scripts/balanced_dataset/"]:::script
        EXM["scripts/examples/"]:::script
        LEG["scripts/legacy/"]:::script
        UTIL["scripts/utilities/"]:::script
        NB1["notebooks/01_Quick_Start_Tutorial.ipynb"]:::script
        NB2["notebooks/02_Advanced_Deep_Learning.ipynb"]:::script
    end

    %% Testing
    subgraph "Testing" 
        direction TB
        TC1["tests/test_config.py"]:::test
        TC2["tests/test_data_pipeline.py"]:::test
        TC3["tests/test_models.py"]:::test
        TC4["tests/test_training_pipeline.py"]:::test
        TC5["tests/test_integration.py"]:::test
        TC6["tests/test_performance.py"]:::test
    end

    %% External Services
    MLFLOW[(MLflow Server)]:::ext
    RAY[(Ray Cluster)]:::ext
    DASH_SERV[(Dash)]:::ext
    OBJSTORE[(Object Store/DB)]:::ext

    %% Connections
    CFG_DIR -->|provides config| DL
    CFG_DIR -->|provides config| DV
    CFG_DIR -->|provides config| FE
    CFG_DIR -->|provides config| PP
    SRC_CONFIG --> CFG_DIR
    SRC_PARSER --> CFG_DIR
    SRC_UTILS --> CFG_DIR

    DL -->|outputs features| BM
    DV -->|validates data| DL
    FE -->|engineers features| DL
    PP -->|preprocesses data| DL

    BM --> TR
    RF --> TR
    FNN --> TR
    LSTM --> TR
    TRANS --> TR
    CNN --> TR
    RNN --> TR
    GRU --> TR
    WN --> TR
    AE --> TR
    ENS --> TR
    HYB --> TR
    ATT --> TR
    DL_ART --> TR

    TR -->|logs metrics| MLFLOW
    HT -->|uses configs| RE
    RE --> TR
    RE --> HT

    TR --> RM
    RM --> RG
    RM -->|reads experiments| MLFLOW
    RG --> STAT

    RM --> STAT
    STAT --> PLOT
    STAT --> DASH

    PLOT -->|uses results| RM
    DASH -->|serves UI| STAT
    DASH --> DASH_SERV

    BS --> DL
    EXM --> TR
    LEG -.-> DL
    LEG -.-> TR
    UTIL --> RE
    NB1 --> CFG_DIR
    NB1 --> DL
    NB1 --> TR
    NB2 --> CFG_DIR
    NB2 --> DL
    NB2 --> TR

    TC1 -.-> CFG_DIR
    TC2 -.-> DL
    TC3 -.-> BM
    TC4 -.-> TR
    TC5 -.-> RE
    TC6 -.-> RM

    MLFLOW --> RM
    RAY --> HT

    %% Click Events
    click CFG_DIR "https://github.com/sergiorubio01/weather-regulation-prediction/tree/main/configs/"
    click SRC_CONFIG "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/src/config.py"
    click SRC_PARSER "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/src/config_parser.py"
    click SRC_UTILS "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/src/config_utils.py"
    click DL "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/data/data_loader.py"
    click DV "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/data/data_validation.py"
    click FE "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/data/feature_engineering.py"
    click PP "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/data/preprocessing.py"
    click BM "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/models/base_model.py"
    click RF "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/models/random_forest.py"
    click FNN "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/models/fnn.py"
    click LSTM "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/models/lstm.py"
    click TRANS "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/models/transformer.py"
    click CNN "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/models/cnn.py"
    click RNN "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/models/rnn.py"
    click GRU "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/models/gru.py"
    click WN "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/models/wavenet.py"
    click AE "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/models/autoencoder.py"
    click ENS "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/models/ensemble.py"
    click HYB "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/models/hybrid_models.py"
    click ATT "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/models/attention_lstm.py"
    click DL_ART "https://github.com/sergiorubio01/weather-regulation-prediction/tree/main/models/deep_learning/"
    click TR "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/training/trainer.py"
    click HT "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/training/hyperparameter_tuning.py"
    click RE "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/run_experiments.py"
    click RM "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/results/results_manager.py"
    click RG "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/results/report_generator.py"
    click PLOT "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/visualization/plots.py"
    click DASH "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/visualization/dashboard.py"
    click STAT "https://github.com/sergiorubio01/weather-regulation-prediction/tree/main/visualizations/"
    click BS "https://github.com/sergiorubio01/weather-regulation-prediction/tree/main/scripts/balanced_dataset/"
    click EXM "https://github.com/sergiorubio01/weather-regulation-prediction/tree/main/scripts/examples/"
    click LEG "https://github.com/sergiorubio01/weather-regulation-prediction/tree/main/scripts/legacy/"
    click UTIL "https://github.com/sergiorubio01/weather-regulation-prediction/tree/main/scripts/utilities/"
    click NB1 "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/notebooks/01_Quick_Start_Tutorial.ipynb"
    click NB2 "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/notebooks/02_Advanced_Deep_Learning.ipynb"
    click TC1 "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/tests/test_config.py"
    click TC2 "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/tests/test_data_pipeline.py"
    click TC3 "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/tests/test_models.py"
    click TC4 "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/tests/test_training_pipeline.py"
    click TC5 "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/tests/test_integration.py"
    click TC6 "https://github.com/sergiorubio01/weather-regulation-prediction/blob/main/tests/test_performance.py"

    %% Styles
    classDef config fill:#D0E6FA,stroke:#0A4C8C,color:#000
    classDef data fill:#DFF2DF,stroke:#2E7D32,color:#000
    classDef model fill:#FFE8CC,stroke:#EF6C00,color:#000
    classDef train fill:#E1D4F0,stroke:#6A1B9A,color:#000
    classDef results fill:#D0F0F7,stroke:#00838F,color:#000
    classDef viz fill:#FDE0E0,stroke:#C62828,color:#000
    classDef script fill:#F0F0F0,stroke:#616161,color:#000
    classDef test fill:none,stroke:#9E9E9E,stroke-dasharray: 5 5,color:#000
    classDef ext fill:#FFFFFF,stroke:#000000,stroke-dasharray: 2 2,color:#000
```
