Exploration · semantics
Solved, to a lookup table.
The vendor's trip number never appears in the timetable. Could every vendor trip be matched to exactly one timetable trip from route, day and the sequence of stops and scheduled times? Over the whole month, 136,684 trip-days, the answer is yes for all but forty.
- 99.78%of trip-days match exactly one timetable trip on the strict key, 99.97% with a one-minute tolerance
- 267misses, all on 1 September, where the published feed is one minute off the vendor's schedule at a few stops
- 40ambiguous trip-days: one school route run by two buses on an identical schedule, twenty weekdays each
- 14,961vendor trip numbers, each mapping to one timetable trip for its board period. The mapping is a stable lookup, not a daily computation
The vendor's trip number turned out to be a schedule key, not a daily run number: each one has a single stop-and-time signature for the whole month, and the trip counts per day equal the timetable's exactly. That is what makes a lookup possible.
The matcher narrows to timetable trips on the same route whose service runs that date, then requires every timetable stop time to appear in the vendor's scheduled times with the same set of stops. Two vendor habits had to be absorbed: a stop listed twice, once as a timing node, and a first stop listed at arrival and again at departure.
Nothing in the result depends on fields the key used. The vendor's trip end time equals the timetable's last departure in every match, and the compass letter in the timetable headsign agrees with the vendor's direction code in every match that has one.
- For the design
- Keep a per-board-period lookup from vendor trip number to timetable trip, rebuilt when a feed or board period lands. The semantics layer becomes a 15,000-row table
- Simplest key that works
- Route, service day, first stop and the trip's start matched to the timetable's first arrival time. Same result as the full key, zero misses
- Flag, do not guess
- Identical twin schedules should be reported as a pair, not resolved silently. Block or actual times could separate them
- Use the feed in force
- The older board period in a later feed was a minute off. Build the lookup from the feed valid on the day
- Passenger counts
- All 130,413 counter trip-days share the vendor key with the vehicle file and reach the timetable through the same lookup
What this changes on the site. The Exchange, Cross-checks and In action pages describe the trip identifier as the open semantics problem. It remains true that the raw numbers do not match. It is no longer true that the mapping is unknown: it is a lookup this exploration produced, in explorations/trip-matching/trip_map.csv, with the forty twins flagged.
Caveats. One agency, one month, one feed. Agreement between keys is not ground truth; the plausibility checks are the evidence. The direction mapping was learned from the data. Reproduce with the commands in the write-up; the match runs in under a minute.