Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements comprehensive support for the GTFS-Flex specification, enabling handling of flexible transit services (demand-responsive, deviated route, etc.). The implementation covers the officially adopted GTFS-Flex spec and includes two proposed columns for future compatibility. The changes span database schema, entity definitions, CSV/GeoJSON parsing, and validation rules.
Key Changes
- Added four new GTFS-Flex entity types:
Location,LocationGroup,LocationGroupStop, andBookingRulewith full database schema support - Extended
StopTimeentity with 10 new GTFS-Flex fields including time windows, booking rules, and duration calculation parameters - Implemented GeoJSON reader for
locations.geojsonfile (GTFS-Flex zones use GeoJSON instead of CSV) - Added comprehensive validation rules for GTFS-Flex: stop location type checking, location group emptiness, geography ID uniqueness, and enhanced stop time sequence validation supporting time windows
Reviewed changes
Copilot reviewed 44 out of 45 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| gtfs/stop_time.go | Extended StopTime with 10 GTFS-Flex fields, implemented comprehensive conditional validation for time windows vs fixed times, mutual exclusion of location identifiers |
| gtfs/location_group_stop.go | New entity for associating stops with location groups |
| tt/key.go | Added Set() method to Key type to validate non-empty values on assignment |
| tlcsv/geojson.go | Generic GeoJSON reader with feature parser pattern for extensibility |
| tlcsv/geojson_test.go | Comprehensive tests for GeoJSON reading including Polygon and MultiPolygon geometries |
| tlcsv/reader.go | Added Locations() method that reads from locations.geojson |
| tldb/reader.go | Added reader methods for 4 new GTFS-Flex entity types |
| rules/stop_time_sequence.go | Enhanced validation to handle GTFS-Flex time windows, skips time progression checks for flex stops |
| rules/stop_time_sequence_test.go | Completely rewritten with 30+ test cases covering scheduled, flex, and mixed trips |
| rules/flex_*.go | Five new validation rule files for GTFS-Flex constraints |
| schema/sqlite/sqlite.sql | Added 4 new tables and 10 new columns to stop_times with proper indexing |
| schema/postgres/migrations/*.pgsql | PostgreSQL migration script mirroring SQLite schema changes |
| testdata/gtfs-external/ctran-flex.zip | Real-world GTFS-Flex feed for integration testing |
| testdata/gtfs-examples/bad-entities/*.txt | Test data files for validation error cases |
| validator/validator.go | Integrated FlexLocationGroupEmptyCheck at validation level 1 |
| internal/testutil/*.go | Added ParseExpectErrors helper and updated minimal feed to use tt.NewKey |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
closes interline-io/calact-network-analysis-tool#211