Repository navigation
Claude/create gtfs sqljs module 011 c up nn k ltuvz d dz xyz fy rm - #12
Merged
chtitux merged 4 commits intoNov 5, 2025
Merged
Conversation
…tions Implements comprehensive GTFS-RT integration supporting: - Service alerts - Trip updates with stop time updates - Vehicle positions Features: - Configurable feed URLs (array of endpoints) - Staleness threshold (default 120s) to exclude old data - Manual refresh via fetchRealtimeData() - Query methods: getAlerts(), getVehiclePositions() - Enhanced getStopTimes() with includeRealtime option - Enhanced getTrips() with includeRealtime option (includes vehicle position + trip update) - Realtime data stored in SQLite and included in exports Implementation details: - Uses protobufjs for parsing GTFS-RT protobuf feeds - RT tables: rt_alerts, rt_vehicle_positions, rt_trip_updates, rt_stop_time_updates - Each row tracks rt_last_updated timestamp for staleness filtering - Alert active period checking (assume active if no period defined) - Entity-based alert filtering (route, stop, trip) - Nested realtime data in query results (Option A per requirements) - Fetch uses native fetch API (Node.js 18+ required) - TypeScript types for all RT entities and enums Alert filtering: - activeOnly: checks active_period start/end against current time - Affected entity filters: routeId, stopId, tripId - Always applies staleness threshold Vehicle position filtering: - By tripId, routeId, vehicleId - Always applies staleness threshold Trip realtime merging: - Returns vehiclePosition: null if no RT data - Includes trip update data (delay, schedule relationship) Stop time realtime merging: - Nested realtime object with arrival/departure delays - Schedule relationship included Configuration: - Set via constructor options or setRealtimeFeedUrls() - Configurable staleness threshold via constructor or setStalenessThreshold() Dependencies: - Added protobufjs ^7.2.5 for protobuf parsing Breaking changes: None (pure addition)
- test-realtime.ts: Full test with real network URLs (for production testing) - test-realtime-local.ts: Local test demonstrating RT API functionality - Shows all RT methods, data structures, and usage examples - Validates RT configuration, queries, and data merging
- Add camelCase to snake_case conversion for protobuf fields - Fix insertAlerts, insertVehiclePositions, and insertTripUpdates to properly map protobuf field names - Add conversion helper functions (camelToSnake, convertKeysToSnakeCase) - Add test-realtime-local-file.ts for testing with downloaded RT feed - Verify alerts load correctly with French text and all metadata
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.
No description provided.