# vishalbasker/flight-delay-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/vishalbasker/flight-delay-prediction
- Repository: https://github.com/vishalbasker/flight-delay-prediction

## Overview

This repository develops flight-delay prediction in two parallel notebook-based implementations: an original build and a corrected rebuild, plus a Python inference agent. The documented training workflow covers merging flight and hourly weather data, cleaning and feature preparation, classification and regression, and evaluation. The sampled agent source confirms whitelist filtering, preprocessing, threshold-based classification, regression, and a response; unlike the README’s description, it runs regression for every input. Notebook internals were not sampled, so their links reflect only documented workflow.

Main entry points: [`claude-code-build/fsa.py`](https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/fsa.py) (Flight status agent), [`manual/ML_Flight_Part2 (after_removing_cols).ipynb`](https://github.com/vishalbasker/flight-delay-prediction/blob/main/manual/ML_Flight_Part2%20(after_removing_cols).ipynb) (Column cleaning), [`manual/ML_Flight_Part1.ipynb`](https://github.com/vishalbasker/flight-delay-prediction/blob/main/manual/ML_Flight_Part1.ipynb) (Data extraction and merge), [`manual/ML_Flight_Part3 (Classification).ipynb`](https://github.com/vishalbasker/flight-delay-prediction/blob/main/manual/ML_Flight_Part3%20(Classification).ipynb) (Classification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Model development"]
end

subgraph group_original["Original build"]
  node_manual_merge["Data extraction and merge"]
  node_manual_clean["Column cleaning"]
  node_manual_classify["Classification"]
  node_manual_regress["Regression"]
  node_manual_pipeline["Final pipeline"]
end

subgraph group_corrected["Corrected build"]
  node_rebuild_workflow["Corrected notebook workflow"]
end

subgraph group_inference["Inference"]
  node_supporting_artifacts["Feature and model settings"]
  node_scaler["Feature scaler<br/>[scaler_v2.pkl]"]
  node_encoder["One-hot encoder<br/>[ohe_v2.pkl]"]
  node_classifier_choice["Classifier settings"]
  node_regressor_choice["Regressor settings"]
  node_agent["Flight status agent<br/>[fsa.py]"]
  node_input_filter["Input validation<br/>[fsa.py]"]
  node_preprocess["Feature preprocessing<br/>[fsa.py]"]
  node_classifier["Delay classifier<br/>[fsa.py]"]
  node_regressor["Delay regressor<br/>[fsa.py]"]
  node_prediction["Prediction response<br/>[fsa.py]"]
end

node_flight_weather_data[("Flight and weather data")]
node_user(("Prediction caller"))

node_flight_weather_data -->|"merge inputs"| node_manual_merge
node_manual_merge -->|"prepare data"| node_manual_clean
node_manual_clean -->|"train classifier"| node_manual_classify
node_manual_clean -->|"train regressor"| node_manual_regress
node_manual_classify -->|"pipeline models"| node_manual_pipeline
node_manual_regress -->|"pipeline models"| node_manual_pipeline
node_flight_weather_data -->|"merge inputs"| node_rebuild_workflow
node_user -->|"submit flight"| node_agent
node_agent -->|"load metadata"| node_supporting_artifacts
node_agent -->|"load scaler"| node_scaler
node_agent -->|"load encoder"| node_encoder
node_agent -->|"load threshold"| node_classifier_choice
node_agent -->|"load settings"| node_regressor_choice
node_agent -->|"validate input"| node_input_filter
node_input_filter -->|"filtered fields"| node_preprocess
node_preprocess -->|"scale features"| node_scaler
node_agent -->|"classify flight"| node_classifier
node_agent -->|"estimate minutes"| node_regressor
node_classifier -->|"delay probability"| node_prediction
node_regressor -->|"delay estimate"| node_prediction
node_agent -->|"format response"| node_prediction
node_prediction -->|"return result"| node_user

click node_manual_merge "https://github.com/vishalbasker/flight-delay-prediction/blob/main/manual/ML_Flight_Part1.ipynb"
click node_manual_clean "https://github.com/vishalbasker/flight-delay-prediction/blob/main/manual/ML_Flight_Part2%20(after_removing_cols).ipynb"
click node_manual_classify "https://github.com/vishalbasker/flight-delay-prediction/blob/main/manual/ML_Flight_Part3%20(Classification).ipynb"
click node_manual_regress "https://github.com/vishalbasker/flight-delay-prediction/blob/main/manual/ML_Flight_Part4%20(Regression).ipynb"
click node_manual_pipeline "https://github.com/vishalbasker/flight-delay-prediction/blob/main/manual/ML_Flight_Part5%20(Pipelining%2BRegression%20Analysis).ipynb"
click node_rebuild_workflow "https://github.com/vishalbasker/flight-delay-prediction/tree/main/claude-code-build"
click node_supporting_artifacts "https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/feature_metadata_v2.pkl"
click node_scaler "https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/scaler_v2.pkl"
click node_encoder "https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/ohe_v2.pkl"
click node_classifier_choice "https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/classifier_choice_v2.pkl"
click node_regressor_choice "https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/regressor_choice_v2.pkl"
click node_agent "https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/fsa.py"
click node_input_filter "https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/fsa.py"
click node_preprocess "https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/fsa.py"
click node_classifier "https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/fsa.py"
click node_regressor "https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/fsa.py"
click node_prediction "https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/fsa.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_manual_merge,node_manual_clean,node_manual_classify,node_manual_regress,node_manual_pipeline,node_flight_weather_data toneAmber
class node_rebuild_workflow toneMint
class node_supporting_artifacts,node_scaler,node_encoder,node_classifier_choice,node_regressor_choice,node_agent,node_input_filter,node_preprocess,node_classifier,node_regressor,node_prediction toneRose
class node_user toneIndigo
```

## Components

### Original build

- [Data extraction and merge](https://github.com/vishalbasker/flight-delay-prediction/blob/main/manual/ML_Flight_Part1.ipynb): `manual/ML_Flight_Part1.ipynb`
- [Column cleaning](https://github.com/vishalbasker/flight-delay-prediction/blob/main/manual/ML_Flight_Part2%20(after_removing_cols).ipynb): `manual/ML_Flight_Part2 (after_removing_cols).ipynb`
- [Classification](https://github.com/vishalbasker/flight-delay-prediction/blob/main/manual/ML_Flight_Part3%20(Classification).ipynb): `manual/ML_Flight_Part3 (Classification).ipynb`
- [Regression](https://github.com/vishalbasker/flight-delay-prediction/blob/main/manual/ML_Flight_Part4%20(Regression).ipynb): `manual/ML_Flight_Part4 (Regression).ipynb`
- [Final pipeline](https://github.com/vishalbasker/flight-delay-prediction/blob/main/manual/ML_Flight_Part5%20(Pipelining%2BRegression%20Analysis).ipynb): `manual/ML_Flight_Part5 (Pipelining+Regression Analysis).ipynb`

### Corrected build

- [Corrected notebook workflow](https://github.com/vishalbasker/flight-delay-prediction/tree/main/claude-code-build): `claude-code-build`

### Inference

- [Feature and model settings](https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/feature_metadata_v2.pkl): `claude-code-build/feature_metadata_v2.pkl`
- [Feature scaler](https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/scaler_v2.pkl): `claude-code-build/scaler_v2.pkl`
- [One-hot encoder](https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/ohe_v2.pkl): `claude-code-build/ohe_v2.pkl`
- [Classifier settings](https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/classifier_choice_v2.pkl): `claude-code-build/classifier_choice_v2.pkl`
- [Regressor settings](https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/regressor_choice_v2.pkl): `claude-code-build/regressor_choice_v2.pkl`
- [Flight status agent](https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/fsa.py): `claude-code-build/fsa.py`
- [Input validation](https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/fsa.py): `claude-code-build/fsa.py`
- [Feature preprocessing](https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/fsa.py): `claude-code-build/fsa.py`
- [Delay classifier](https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/fsa.py): `claude-code-build/fsa.py`
- [Delay regressor](https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/fsa.py): `claude-code-build/fsa.py`
- [Prediction response](https://github.com/vishalbasker/flight-delay-prediction/blob/main/claude-code-build/fsa.py): `claude-code-build/fsa.py`

### Other components

- **Flight and weather data**
- **Prediction caller**

## Connections

- Flight and weather data → Data extraction and merge: merge inputs
- Data extraction and merge → Column cleaning: prepare data
- Column cleaning → Classification: train classifier
- Column cleaning → Regression: train regressor
- Classification → Final pipeline: pipeline models
- Regression → Final pipeline: pipeline models
- Flight and weather data → Corrected notebook workflow: merge inputs
- Prediction caller → Flight status agent: submit flight
- Flight status agent → Feature and model settings: load metadata
- Flight status agent → Feature scaler: load scaler
- Flight status agent → One-hot encoder: load encoder
- Flight status agent → Classifier settings: load threshold
- Flight status agent → Regressor settings: load settings
- Flight status agent → Input validation: validate input
- Input validation → Feature preprocessing: filtered fields
- Feature preprocessing → Feature scaler: scale features
- Flight status agent → Delay classifier: classify flight
- Flight status agent → Delay regressor: estimate minutes
- Delay classifier → Prediction response: delay probability
- Delay regressor → Prediction response: delay estimate
- Flight status agent → Prediction response: format response
- Prediction response → Prediction caller: return result
