Eren .
EN TR

Data & Analytics · Data Engineering & Analytics

US Flight Operations Intelligence

An end-to-end aviation analytics platform built on 5.82M 2015 US DOT flight records in PostgreSQL, resolving an October 2015 airport ID anomaly and serving a bilingual (TR | EN) Streamlit + Plotly dashboard.

Python PostgreSQL SQLAlchemy Streamlit Plotly Data Quality
US Flight Operations Intelligence — Executive Overview dashboard showing 5,819,079 flights, delay metrics, and monthly volume
Executive Overview captured from the live Streamlit application running against PostgreSQL (all 12 months of 2015, all 14 carriers).

Purpose

US Flight Operations Intelligence transforms the 2015 US Department of Transportation (DOT / BTS) domestic flight dataset (5,819,079 records across 12 months and 14 airlines) from raw CSV tables into a verified PostgreSQL analytical layer and an interactive, bilingual (TR | EN) operations dashboard.

Rather than stopping at static exploratory charts, the project was developed across 11 structured engineering sprints covering raw data profiling, airport identifier reconciliation, SQL view design, query-plan performance tuning, and a custom dark-navy Streamlit + Plotly user interface.

Problem

During early data-quality audits, airport and corridor aggregations exposed a silent schema drift in the source dataset:

  • October 2015 Airport Identifier Anomaly: For October 2015 only (486,165 flight records), origin_airport and destination_airport were encoded as 5-digit numeric DOT Airport IDs (such as 10397 instead of ATL) rather than 3-letter IATA codes. Joining flights directly to airports silently dropped 100% of October airport and route records from rankings and monthly heatmaps.
  • Query Performance Bottlenecks on 5.82M Rows: Unfiltered airport and route queries originally joined the normalized flight view to public.airports before GROUP BY, causing PostgreSQL to misestimate group cardinality and scan the full table multiple times per page load (13–27 seconds per query; ~58.7 s cold Airport Intelligence page load).

Solution & Approach

  1. Non-Destructive Reconciliation (public.flights_normalized): Built and validated an official 307-row October 2015 DOT Airport ID → IATA crosswalk (public.airport_id_iata_crosswalk), verified with 20 / 20 passing read-only SQL assertions, and exposed normalized endpoints through a non-destructive SQL view without mutating raw source rows.
  2. Read-Only Parameterized Data Layer: Centralized database access through a singleton SQLAlchemy 2.0 + psycopg2 connection pool (python/db_connect.py and dashboard/data_access.py) enforcing SET TRANSACTION READ ONLY, parameterized queries, and 5-minute TTL caching (@st.cache_data).
  3. Query-Plan Optimization (Sprint 9): Used plan-only EXPLAIN diagnostics to aggregate by normalized IATA code before joining public.airports, share cached aggregates across ranking and metric functions, canonicalize set-filter cache keys, and short-circuit empty selections—achieving 100% verified analytical equivalence with zero schema changes.
  4. Bilingual Interactive Interface (Sprint 10): Built a 6-page Streamlit + Plotly application with 21 interactive charts, a unified hover-tooltip builder, and a persistent TR | EN language switcher covering 219 localized UI keys.

Key Features

  • Executive Overview: Five validated KPI cards (5,819,079 flights, 9.37 min avg departure delay, 4.41 min avg arrival delay, 1.54% cancellation rate, 0.26% diversion rate), peak-month callout banner, monthly volume and delay trend charts, and carrier performance bubble matrix.
  • Flight Operations: Monthly operating volume, source day_of_week numeric distribution, scheduled departure-hour delay curve (00–23), cancellation/diversion trends, and carrier volume breakdown.
  • Airport Intelligence: Normalized top origin and destination hubs, departure-delay hub rankings (>50,000 flight eligibility threshold), supplemental arrival rankings, and an airport-by-month departure-delay heatmap with full October coverage.
  • Route Intelligence: Top 15 domestic corridors by volume, top 30 route delay profile scatter plot, top 10 monthly corridor trends, and interactive origin/destination airport selectors.
  • Delay Analysis: FAA 5-cause attribution donut paired with a ranked summary card covering 994,254 attributed delay hours (Late Aircraft 41.84%, Airline Operations 33.76%, Air System/NAS 19.09%, Weather 5.17%, Security 0.14%), stacked monthly delay causes, and 30-minute delay distributions.
  • Data Quality: Side-by-side verification comparing the audited Sprint 5 reconciliation baseline (486,165 October rows, 307 crosswalk mappings, 20 / 20 PASS) against live read-only PostgreSQL checks.

Technologies & Tools

  • Database & SQL: PostgreSQL, SQL Views (public.flights_normalized), Crosswalk DDL, Read-Only Validation Assertions.
  • Data Access & Processing: Python 3.10+, SQLAlchemy 2.0, psycopg2-binary, Pandas, NumPy, python-dotenv.
  • Interactive App & Charts: Streamlit (>=1.36,<2.0), Plotly (>=5.18,<7.0), custom CSS dark-navy design tokens, centralized TR/EN localization (dashboard/i18n.py).
  • Static Visualization: Matplotlib, Seaborn, Pillow for standalone normalized heatmap scripts and README visual assets.

Visual Showcase

US Flight Operations Intelligence radar corridor overview with validated 2015 KPIs
Project overview banner summarizing the 2015 US domestic hub network and validated PostgreSQL baseline figures.
Delay Analysis page showing FAA 5-cause donut chart and 994,254 attributed delay hours
Delay Analysis — FAA 5-cause root-cause attribution across 994,254 delay hours.
Data Quality page showing Live Reconciliation Checks PASS and Sprint 5 audit baseline
Data Quality — Live PostgreSQL reconciliation verification alongside Sprint 5 audit baselines.
Airport Intelligence page displaying hub rankings and monthly departure-delay heatmap
Airport Intelligence — Normalized hub delay rankings and monthly heatmap.
Route Intelligence page displaying top domestic corridors and delay profile scatter
Route Intelligence — Domestic corridor volumes, delay profiles, and route table.
Normalized monthly departure delay heatmap across top 10 US airports including October
Sprint 7 normalized Matplotlib heatmap confirming uninterrupted 12-month coverage—including October—across the 10 busiest US hubs.

Outcomes & Takeaways

Validated Baseline & Measured Optimization

Metric / BenchmarkValidated ResultNotes
Total 2015 Flight Records5,819,079Full-year count on public.flights_normalized
October 2015 Reconciliation486,165 / 486,165 (100%)307 / 307 DOT ID → IATA mappings, 0 unresolved
Airport Intelligence Cold Load~58.70 s → 11.73 s~5.0× faster cold; 0.15 s warm cache
Route Intelligence Cold Load~39.75 s → 22.46 s~1.8× faster cold; 0.13 s warm cache

Known Limitations & Engineering Lessons

  • Honest Scope Constraints: The dataset covers calendar year 2015 only and requires a local PostgreSQL instance (raw CSVs are excluded to keep the repository lightweight). Because public.flights intentionally carries zero database indexes in the current schema, cold full-year route queries still take ~11 s on first visit before hitting the 5-minute cache.
  • Key Takeaway: Auditing reference integrity before charting caught an entire missing month of hub data, and keeping reconciliation in a non-destructive SQL view made every downstream SQL query, Matplotlib chart, and Streamlit view consistent from a single source of truth.