RouteRisk - Flight Delay Network Visualization
================================================
CSE 6242 - Team 054

Interactive D3 network visualization of US domestic flight delays.
Two years of BTS On-Time Performance data (~13.9M records), airports
as nodes, routes as edges, color-coded by delay risk.

Three analysis layers:
  - Propagation Chain: upstream/downstream delay relationships
  - Carrier Reliability: airline comparison on the same route
  - Delay Predictor: Gradient Boosting model for on-time probability

The demo is accessible through the internet without any setup and all features at 
https://route-risk.london-lab.dev/
If you want to set up the demo locally, follow the instructions below

Demo Video
----------

https://youtu.be/4tHc_22-wD0

Windows Prerequisite
-----------
If you are using Windows, you will need to install Visual Studio Desktop C++ Build Tools and Visual Studio Mac/Linux C++ Build Tools. 

Visual Studio Build Tools Link: https://visualstudio.microsoft.com/visual-cpp-build-tools/

Quick Start
-----------

Data is pre-built -- no pipeline steps needed. Just install and run:

Mac / Linux:

    cd CODE
    python3 -m venv .venv
    source .venv/bin/activate
    pip install -r requirements.txt
    cd backend
    python3 run.py

Windows:

    cd CODE
    python3 -m venv .venv
    .venv\Scripts\activate
    pip install -r requirements.txt
    cd backend
    python3 run.py

Open http://localhost:8000 in your browser.
API docs available at http://localhost:8000/docs.

Requires Python 3.11+.


What's in the box
-----------------

    CODE/
    +-- backend/
    |   +-- app/            API routes, models, schemas
    |   +-- core/           DB engine, config
    |   +-- layers/         Analysis pipelines + ML model
    |   +-- scripts/        Data pipeline scripts (already run)
    |   +-- tests/          Backend tests
    |   +-- run.py          Server entry point
    +-- frontend/
    |   +-- index.html      Single-page app
    |   +-- css/
    |   |   +-- layers/     Layer plugins (propagation, carrier, predict)
    |   +-- data/           Pre-computed JSON for layers
    +-- data/
    |   +-- flight_delays.db    Pre-built SQLite (~390 MB)
    +-- requirements.txt
    DOC/
    README.txt


Notes
-----

- Run `python3 run.py` from the backend/ directory, not the repo root.
  Python path needs to resolve core/ and layers/ imports.

- Don't use `uvicorn app.main:app` directly -- there's a Python 3.13
  compatibility issue with SQLAlchemy string imports. run.py works
  around it.

- The API never hits the raw 13.9M-row flights table at runtime.
  Everything goes through pre-aggregated airports (~355 rows) and
  routes (~5,969 rows) tables.

- BTS data source: https://www.transtats.bts.gov/Fields.asp?gnoyr_VQ=FGJ
