Data Engineering

Case study · Data Engineering

Aviation Telemetry Pipeline

Streaming pipeline from a live API to a tested star schema in BigQuery.

StreamingData ModellingData Quality

The pipeline collects the live position of every aircraft reported by the OpenSky Network, streams it through Kafka and Spark into a data lake, and models it in BigQuery with dbt. The output is a set of tested tables for reporting: an aircraft catalogue, daily metrics per aircraft and a list of flights flying outside normal civil limits. The same pattern fits any business that tracks moving assets, such as delivery fleets, vehicles or field sensors.

Local · Docker

  1. 01

    OpenSky API

    Live positions of every aircraft, polled every 15 minutes

  2. 02

    Redpanda

    Kafka-compatible broker, one event per aircraft

  3. 03

    Spark Streaming

    Reads the topic and adds ingestion metadata

  4. 04

    Bronze

    Raw JSON in Parquet, partitioned by date

Parquet files uploaded to the data lake

Google Cloud · BigQuery and dbt

  1. 05

    Cloud Storage

    Data lake, synced idempotently from Bronze

  2. 06

    Silver

    Typed and cleaned in BigQuery, incremental dbt model

  3. 07

    Gold

    Star schema: aircraft, daily metrics, anomalies

  4. 08Next

    Reports

    Dashboard on top of the Gold tables

Airport reference data

5,282 airports with elevation, loaded as a dbt seed

Data quality tests

Run on every build against Silver and Gold: physical limits, ground readings against the nearest airport, keys and anomaly categories.

Role
Sole engineer
Scope
Ingestion, streaming, data lake, warehouse modelling, data quality
Status
Running end to end, dashboard in progress
3
layers: Bronze, Silver, Gold
19
data quality tests in dbt
5,282
airports used to validate ground readings
15 min
polling interval, within the free API quota

Contents

What you will find here

01 · Architecture

From a live API to tested tables

The streaming part runs locally in Docker. A Python producer polls the OpenSky API and publishes one event per aircraft to a Redpanda topic. Spark Structured Streaming reads the topic and writes the raw payload to Parquet, partitioned by date, with a checkpoint so restarts never lose or duplicate events.

Bronze files are synced to Google Cloud Storage, keeping the date partitions, and BigQuery reads them from there. Everything after that point is SQL managed by dbt: Silver parses and types the raw JSON, Gold reshapes it into a star schema for reporting.

Every dbt build also runs the data quality tests, so a bad batch is visible before anyone reads a report built on it.

Ingestion

Pythonrequestskafka-python

Streaming

Redpanda (Kafka API)Spark Structured StreamingDocker Compose

Storage

ParquetHive partitioningGoogle Cloud Storage

Warehouse

BigQuerydbtStandard SQL

02 · Systems

What I designed and built

Grouped by stage of the pipeline.

Ingestion and streaming

Getting raw events into the lake without losing any.

01

API producer

Polls the OpenSky API and turns each response into individual events.

+
  • One Kafka event per aircraft, so downstream consumers process aircraft independently.
  • Polling every 15 minutes keeps the producer inside the daily credit limit of the free API.
  • Failed calls are logged and the loop continues, so one bad response does not stop ingestion.
  • Only record counts are logged, never payloads, to keep memory and logs flat.
02

Streaming to Bronze

Spark Structured Streaming writes the raw stream to Parquet.

+
  • The payload is stored untouched as JSON, so a change in the source schema never breaks ingestion and every record can be reprocessed.
  • Each event gets its broker timestamp and an ingestion date, used as the partition key.
  • A checkpoint directory tracks offsets: after a restart the stream continues where it stopped.
03

Data lake sync

Uploads Bronze to Google Cloud Storage.

+
  • Keeps the date partition layout, so BigQuery and Spark can skip days they do not need.
  • Idempotent: files already in the bucket are skipped, so the job can run on any schedule.

Warehouse modelling

Turning raw JSON into tables people can report on.

04

Incremental Silver layer

Parses the raw payload into typed columns, one row per aircraft event.

+
  • Incremental dbt model with insert_overwrite: each run replaces only the latest day and the day before it.
  • Events have no natural unique key, so replacing whole day partitions is what makes re-runs safe.
  • Defensive casting turns malformed sensor values into nulls instead of failing the run.
05

Star schema in Gold

One dimension and two fact tables for reporting.

+
  • Aircraft dimension with the latest call sign and country per aircraft, deduplicated with a window function.
  • Daily fact table per aircraft: readings received, highest speed and highest altitude.
  • Static attributes live only in the dimension, so the fact tables stay narrow and cheaper to scan.
06

Anomaly detection

Flags aircraft flying outside normal civil limits, separating sensor noise from real readings.

+
  • Limits set above normal civil traffic: 380 m/s ground speed (airliners with a strong tailwind reach about 370) and 16,000 m (business jets fly up to about 15,500).
  • Evaluated per aircraft and day. A single reading above a limit is an isolated spike, two or more are a sustained reading.
  • Counting readings works the same whether the producer polls every minute or every 15 minutes.

Data quality

Catching bad data before it reaches a report.

07

Physical limit tests

Checks every reading against what an aircraft can physically report.

+
  • Coordinates within range, no negative speeds, altitudes between -300 m and 18,500 m.
  • Aircraft reported on the ground at take-off speed or above are flagged.
  • Tests run as warnings: they surface problems without stopping the pipeline.
08

Ground altitude against the nearest airport

Replaces a fixed altitude threshold that flagged every aircraft parked at a high airport.

+
  • Reference table of 5,282 large and medium airports with their elevation, built from the public OurAirports dataset and loaded as a dbt seed.
  • Each aircraft on the ground is matched to the closest airport within 5 km with BigQuery geography functions.
  • A reading is flagged when it differs from the airport elevation by more than 300 m, which covers normal changes in air pressure.
09

Model tests

Generic dbt tests on the Gold tables.

+
  • Unique and not-null keys, and every fact row linked to an aircraft in the dimension.
  • Anomaly categories restricted to the four accepted values.

03 · Decisions

Engineering trade-offs

Raw JSON in Bronze instead of parsing on ingestion

The source can change its format without breaking the stream, and any day can be reprocessed from the original data.

Redpanda instead of Apache Kafka

Same Kafka API in a single container with no ZooKeeper, enough for a single-node setup.

Partitioning by ingestion date

Spark, Cloud Storage and BigQuery can all skip the days a query does not need, and a single day can be rebuilt on its own.

Replace day partitions instead of merging rows

Events have no unique key to merge on. Replacing whole days makes every run safe to repeat and picks up late data.

Airport elevation instead of a fixed altitude threshold

A fixed limit flagged every aircraft parked at a high airport. Checking against the real airport removes those false alarms.

Two readings before calling something an anomaly

One out-of-range reading is usually sensor noise. Requiring two keeps the anomaly table useful for review.

Work with me

Need data you can trust?

Pipelines, data lakes and warehouse models that turn raw events into tables your team can report on.

Contents