Skip to content

Include MTA Bus Company static GTFS feed for bus routes - #15

Merged
OnFreund merged 1 commit into
mainfrom
claude/q18-route-stops-failure-ebccd0
Oct 10, 2026
Merged

OnFreund merged 1 commit into
mainfrom
claude/q18-route-stops-failure-ebccd0

Conversation

@OnFreund

Copy link
Copy Markdown
Owner

Problem

BusFeed.get_stops("Q18") raised MTAFeedError: Route Q18 not found in any borough GTFS feed.

Q18 is operated by MTA Bus Company (agency MTABC), not NYC Transit. MTA Bus Company publishes its own static GTFS feed (http://web.mta.info/developers/data/busco/google_transit.zip), and the library only searched the five NYCT borough feeds. About 90 routes were affected the same way, including Q06–Q115 (several of them), Q52+/Q53+/Q70+, B100, B103, BX23, and all BM/BXM/QM express routes.

get_arrivals also builds its stop-name lookup from the same five feeds, so arrivals for these routes had no destination names.

Changes

  • constants.py: add bus_company to STATIC_GTFS_URLS, and add a BUS_STATIC_GTFS_FEEDS list (the five NYCT borough feeds plus MTA Bus Company).
  • __init__.py: get_stops and get_arrivals both use BUS_STATIC_GTFS_FEEDS, replacing two duplicated inline lists. The error message now says "bus GTFS feed".
  • Tests: add a test for a route found only in the MTA Bus Company feed, and one for a route missing from all six feeds.
  • README: update the get_stops note.

Notes for reviewers

  • The MTA Bus Company feed is searched last, so its routes still download and scan all five borough feeds first. That cost is the same as before.
  • Lookups for routes that don't exist, and the first stop-name lookup, now download one more file of about 10 MB. It's cached like the other feeds.
  • Testing: all 27 tests pass. I also ran get_stops("Q18") against the real feed files: 58 stops in two directions (69 ST/GRAND AV, 1 ST/27 AV).
  • Not changed: the README says static GTFS is cached for 24 hours, but the default TTL is 168 hours.

🤖 Generated with Claude Code

Routes operated by MTA Bus Company (e.g. Q18, Q52+, BxM1, QM2) are
published in a separate static GTFS feed, not the NYCT borough feeds,
so get_stops raised "route not found" for them and get_arrivals had no
stop names for their destinations. Add the feed and share a single
BUS_STATIC_GTFS_FEEDS list between both methods.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@OnFreund
OnFreund force-pushed the claude/q18-route-stops-failure-ebccd0 branch from e977880 to f856094 Compare October 10, 2026 14:36
@OnFreund
OnFreund merged commit 1261cd5 into main Oct 10, 2026
1 check passed
@OnFreund
OnFreund deleted the claude/q18-route-stops-failure-ebccd0 branch October 10, 2026 14:37
This was referenced Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant