The Timetable: Week 7

The Timetable

Next drop Monday Nov 2, 16:00 UTC

Week 7

hosted bydatadriven

Results

next drop

9 scored

20 submissions

first in coral_mesa_9943, 8h 6m

Your DAG2026-10-31 · night 30 of 30

trip_updates248,460 rows
trips51,541 rows
trip_updates_history
trips_history
trip_actuals
trip_actuals
  • trip_idTEXT
  • service_dateTEXT
  • route_idTEXT
  • scheduled_startTEXT
  • actual_startTEXT
  • delay_sINTEGER
  • statusTEXT
  • vehicle_idTEXT
  • unscheduledINTEGER

The challenge

You're a data engineer at a city bus and light rail agency. Each bus and train reports its trips as it runs them, and the service planning team needs 1 clean row per trip: when it was due, when it left, and how late it was. Each night, a job copies 2 raw tables out of 2 systems. The realtime ingest provides trip_updates, a log with a row for every start, end or cancellation a vehicle reported, 1 file per day. The planning team's schedule export provides trips, the timetable with every trip's first departure, published whole as a new version about once a week. Write the DAG that builds the planners' trip table for the days from to .

The mess

The bus and rail units come from 2 suppliers, each with its own clock and its own words. A unit that loses its link holds its reports and sends them when it reconnects. The export stamps every file with the time its run began, and the rail file is loaded last. A new timetable comes weekly, sometimes days early, sometimes sent again with fixes. A planner opens the file in a spreadsheet first.

Raw tables

trip_updates
trips
01trip_idTEXT
02route_idTEXT
05trip_headsignTEXT

Target table

trip_actuals

Click a column for what it holds, or click the bottom of a sheet to see its sample rows.

Notes from service planning

  • A time past 24:00:00 in the timetable belongs to the day before.
  • The agency's clock is 7 hours behind UTC all year.
  • A timetable file applies from its start date until the next file's start date.
  • A trip with no reported start, end or cancellation has no row.
  • The export stamps a whole run's files with the time the run began.

How you're scored

  • +1the right value. A right null counts.
  • 0null where the source held a value. Silence is free.
  • −1a wrong value. Silent corruption costs.
  • −2a row that should not exist: no matching key, or a second row for the same key. The last row for a key is the one scored.
Questions go in this week's thread.