Repository navigation
Clarify GTFS-RT time and delay handling - #18
Merged
chtitux merged 1 commit intoNov 7, 2025
Merged
Conversation
This commit implements two major improvements to the library:
1. **GTFS-RT Time/Delay Support:**
- Added arrival_time and departure_time fields to StopTimeRealtime type
- Updated mergeRealtimeData in stop-times.ts to query and export both time and delay fields
- Now exports complete GTFS-RT information as per specification
2. **Unified Filter-Based API:**
- Removed all getXXXByYYYY methods in favor of unified getXXXX methods with optional filters
- All filter parameters now support both single values and arrays
- Simplified API surface and improved consistency:
- stops.ts: Removed getStopById, getStopByCode, getStopsByTrip, getAllStops
- routes.ts: Removed getRouteById, getRoutesByAgency, getAllRoutes
- trips.ts: Removed getTripById, getTripsByRoute, getTripsByRouteAndService, getTripsByRouteServiceAndDirection, getTripsByService
- agencies.ts: Removed getAgencyById, getAllAgencies
- stop-times.ts: Removed getStopTimesByTrip, getStopTimesByStop, getStopTimesByStopAndTrips, getStopTimesForStopRouteDirection
- rt-stop-time-updates.ts: Removed getStopTimeUpdatesByTripId
- gtfs-sqljs.ts: Removed wrapper methods for getXXXByYYYY, updated to use filters
- Kept specialized methods like searchStopsByName that can't be merged into filters
3. **Updated Tests:**
- Migrated all tests to use new filter-based API
- Added tests for array filter support
- All 81 tests passing
The new API is more flexible and consistent. For example:
- Old: `getStopById('STOP1')` → New: `getStops({ stopId: 'STOP1' })[0]`
- New: `getStops({ stopId: ['STOP1', 'STOP2'] })` for multiple stops
Note: Documentation (README and website) still needs to be updated with the new API examples.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit implements two major improvements to the library:
GTFS-RT Time/Delay Support:
Unified Filter-Based API:
Updated Tests:
The new API is more flexible and consistent. For example:
getStopById('STOP1')→ New:getStops({ stopId: 'STOP1' })[0]getStops({ stopId: ['STOP1', 'STOP2'] })for multiple stopsNote: Documentation (README and website) still needs to be updated with the new API examples.