-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addressing review feedback: Implementing changes #6
Conversation
- Introduce presence enum with levels: REQUIRED, OPTIONAL, CONDITIONALLY_REQUIRED, CONDITIONALLY_FORBIDDEN, RECOMMENDED. - Throw FileNotFoundException if a required file is not provided.
Since the construtors of the model entities are package private, which restricts to use the builder to modify a GtfsSchedule. However, semantically the builer itself is not part of the model. But i dont know a different way to achieve this behavior this in Java. |
The sequence information is redundant given the departure time; therefore, I omitted it in the StopTime class. The sequence is implicitly encoded in the sorted array after building the schedule. However, there could be issues down the road since departure_time is only conditionally required. One important difference, if we base equality on the sequence information instead of departure time, is that we then cannot compare stop times of different trips anymore, which is done, for example, when initializing the stops in the schedule: https://github.com/naviqore/raptor/blob/0cc5f65cfced412642a53b7975b97952a632efb4/src/main/java/ch/naviqore/gtfs/schedule/model/Stop.java#L27 I suggest we keep it as it is but keep in mind the possibility of trouble with conditionally required departure times if we encounter null pointer exceptions someday. |
Good point! I think this functionality belongs to the Perhaps we could inject the schedule into the Converter, allowing it to preprocess the schedule using a |
Since the |
- Introduce interface for route type. - Implement with two enums: DefaultRouteType and HierarchicalVehicleType - Parser decides depending on code which type to choose.
Solved by 6273663 |
- Add test extension for parameter injection of the builder. - Adjust existing test.
- Create larger example schedule with more calendar variations and both directions. - Increase test coverage concerning boundary cases in next departures (midnight), nearest stops (same location query) and active trips (dates outside validity or no service day).
- Add IntelliJ code style to project. - Reformat complete project.
…uence - Add GtfsRoutePartitioner and corresponding test. - Adjust GtfsToRaptorConverter to use the GtfsRoutePartitioner. - Fix bug in GtfsScheduleTestBuilder; reversed routes also have reversed stops sequences.
Solved by f2479d3, introduces |
Hi @clukas1 and @Brunner246, this PR should address all issues in the review. |
Some minor comments:
|
Addressed by @munterfi in 050da21. Nice work! Looking at conditionally_required made me think if we should add a check to check for these conditions. For now either a calendar.txt or a calendar_dates.txt file has to be present at least. |
That's just if Google Maps supports the transport mode. The information was in the table, and i thought maybe at some point its important, but i dont think we need it at the moment. So i will delete it (5958bad), but we still have it in the history. |
Hierarchical Vehicle Type (HVT) is the name from the codes of the European TPEG standard. So there is no connection between the original GTFS route types and the HVTs. There are some mappings avaiblabe here, unfortunately they are not complete:
Since we don't really need the relationship or mode in general for the Raptor at this point, I would suggest keeping these two types separate and ensure that we can access their values (code description) through the common interface "RouteType". |
I would adhere to the GTFS specification and throw an exception (at least in the builder) if a schedule is invalid. Currently, we only process required files and attributes, and we should treat them as guaranteed. |
In general, I would advocate for representing the GTFS as closely as possible to the specification and separating the logic needed for Raptor into separate classes that operate on the GTFS schedule (or interface, see below). Since the specification may change in the future, the more we decouple our logic from the GTFS formats, the easier it will be to adapt later. Maybe it would make sense in future to introduce a more general |
I would move this into a new issue and merge this PR, since it is already quite extensive. |
Added to NAV-26 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some very minor ideas. But think this pull request is more than good enough to be merged.
private GtfsSchedule schedule; | ||
private GtfsRoutePartitioner partitioner; | ||
|
||
@BeforeEach |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use @BeforeAll and make setUp
, schedule
, partitioner
static. Since this data is not manipulated by any test, I don't see why whe should rebuild the GTFS Schedule instance everytime.
.isNotNull(); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add test, to make sure that the expected number of trips are found in each (or specific cases) subroute instance.
Review by @clukas1: