Making Five Cities' Transit Data Speak the Same Language
· 7 min read

I like looking at how different cities run their transit, so I built an app that shows what’s arriving at a stop right now. It covers New York, Boston, Chicago, Washington, DC and San Francisco, across subways, buses, commuter rail, ferries and cable cars. You can try it on the Transit page.
The app itself is simple: pick a station, see what’s coming. Most of the work was getting the data underneath it to make sense. This is the story of that work, including the mistakes.
How I built it
I built this with Claude, an AI coding assistant. It wrote a lot of the code, and I want to be clear about that. What I noticed looking back through the history is that the moments that mattered weren’t the ones where code got written quickly. They were the ones where something looked right but wasn’t, and we caught it by checking against something we could trust. That’s most of this story.
Two kinds of data, and they don’t match up
Transit agencies publish two kinds of data.
The schedule. This is a bundle of spreadsheet-style files describing every stop, route and trip. It’s called GTFS, and it’s a common standard, which sounds like good news.
The live feed. This is a constant stream saying things like “trip 4821 will reach stop 902 in three minutes.” It’s compact and fast, but it only speaks in ID numbers. It doesn’t know that stop 902 is called Times Sq or that the trip is the 7 train.
To show a rider something useful, the app has to combine the two. So before the app runs, I process each agency’s schedule once and boil it down to two small files: one listing stops, and one listing lines and the order of their stops. Across all 17 agencies that comes to roughly 31,000 stops and 1,100 lines, about 5 MB in total. That’s small enough to load quickly on a phone.
The app started on November 18 with just the New York subway and Boston’s trains. By November 20 it covered all five cities. That speed was the exciting part, and also where the trouble came from.
Problem 1: the files are huge
Boston’s schedule has a file of every stop every trip makes. It’s 131 MB, which is too big to open the normal way. So from the first version, the code reads it like a very long scroll, picking out only the lines it needs and ignoring the rest.
That worked until New York’s buses showed up. Their schedule holds millions of individual stops, and keeping a record of each one used up too much memory. The fix was to keep a running count instead of a full list, which is like keeping a tally on paper instead of copying every receipt.
Problem 2: every agency does it differently
The standard is a standard in the way that “English” is a standard. Everyone follows it, but with accents.
- The Long Island Rail Road puts quotation marks around every value, and one column other agencies include is missing entirely.
- Metro-North labels every trip on a line with the same route shape. My first attempt built each line from a single short local train, so the Hudson Line stopped at Greystone instead of going all the way up. The fix was to blend together every stopping pattern on the line.
- Metro-North’s live feed also leaves out which direction a train is going. The code read “missing” as “zero,” so every train was labeled Outbound. Now it only reports a direction when the feed actually states one, and otherwise works it out from the order of stops.
- BART’s live feed doesn’t say which line a train is on, and about a quarter of its trains aren’t in the schedule at all. So for BART, the app uses BART’s own arrivals service instead.
Problem 3: it looked right, but nothing matched
San Francisco’s Muni was the most humbling one. We built the stops from Muni’s schedule, and everything looked fine, but at that point we didn’t yet have the access key to check against the live feed. The commit said so plainly: not yet checked.
When the key arrived, we tested it. Of the 3,159 stop IDs in the live feed, none matched. Not a few. None. The live feed identifies stops by the number printed on the stop’s sign, while the schedule uses a different internal number. After switching to the sign numbers, every stop the feed reported lined up: 285 of 285 for the Metro, 2,759 of 2,759 for buses and 115 of 115 for cable cars.
The lesson was an easy one to say and a hard one to remember: until you test against live data, you haven’t actually tested it.
Problem 4: the compass was off
Each bus stop in the app says which way it faces, such as “Northbound.” The app works that out from the direction the buses travel. It turned out to have a math mistake: it was squashing the map using each stop’s own latitude, which skewed directions more the farther from the center of the map you were. In San Francisco it was enough to turn north-south streets into east-west ones.
How do you find a mistake like that? Chicago’s CTA states the direction of every stop itself, so it served as an answer key. The old math agreed with CTA on 72% of nearly 10,000 stops. The fixed math agreed on 96%. We rebuilt thousands of stops in New York, Boston and Washington with the corrected directions.
Problem 5: stops in the wrong order
Here’s a line from San Francisco’s N Judah before a fix: Hillway, Arguello, 5th, 8th, then 2nd, 6th. Anyone who’s been on the train can tell that’s scrambled.
There was no answer key for this one, so we made a measurement up. Add up the distance from each stop to the next along a line. If the order is jumbled, the route zigzags and the total goes up. After the fix, 870 of the 877 lines we reordered got shorter. New York’s total went from 8,446 km to 5,655 km, and the N Judah now reads sensibly. One line got about 70 meters longer, which we noted and moved on.
What I took from it
- Fast is great, but checking is the job. The AI wrote code quickly. What kept the app honest was comparing the output to something independent: a live feed, another agency’s labels, a distance total.
- “Looks right” is not the same as “is right.” Four of the five problems above looked fine at a glance.
- Write down what you haven’t verified. That one honest line about not yet having tested Muni is the reason the mismatch got caught instead of shipped.
- Real data is messy in ways no standard predicts. Each agency taught me something the documentation didn’t.
If you work with data for a living, none of this will be a surprise. Most of the job is making sure the numbers mean what everyone thinks they mean. It was still a good reminder that the same discipline applies when an AI is helping write the code.
Keep reading
May 2, 2026 · 5 min read
Teaching a Computer to Tell Food From Menus
Google Maps photos of restaurants are a mix of dishes, menus, signs and empty rooms. Here's how I used an AI model to put the food first, and how I built it with an AI coding assistant.
February 24, 2026 · 9 min read
I Automated the Most Tedious Grind in Final Fantasy VIII
Maxing stats in Final Fantasy VIII is less 'challenge' and more 'press confirm for eight hours.' I wrote a Python script that handles the whole grind with simulated keypresses.