Skip to content
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

REFACTOR: Query template and facade for routing in service #177

Merged
merged 49 commits into from
Jan 24, 2025

Conversation

munterfi
Copy link
Member

First draft / concept on how to break down the complexity of the routing in the service.

Challenges:

  • Stops vs. Coordinates cases and Time direction (times the cases).
  • Non trivial logic of routing query preparation and result postprocessing.
  • How to test or reproduce all the cases (i was a bit lost in all the if else branches)?

Goal: Reduce the complexity by introducing individual cases without code duplication.

I think with the template method pattern and swapping the cases, we can break it down and encapsulate the logic behind a facade, which should be testable.

munterfi and others added 22 commits December 9, 2024 17:29
- Add all stops to RAPTOR, even if they have no departures / stopping trips.
- When transfers are generated, it could be that connections from or to stops with no trips are available via a footpath / transfer as first or last leg.
 - Test passes when all stops are added to raptor, even if they have no departures.
 - The asserts are checking actual transfer ids or keys, which makes it easier to follow the test cases.
 - Clearly differentiate between same stop transfers and between stop transfers.
 - Suppress unchecked cast compiler warnings in test cases.
- The RAPTOR should not contain all stops, due to the parent stops, which often have not got any departures but would increase the stop array size significantly.
Now only stops with departures are added to the raptor.
…s from router in service

- Move transfer generation to convert package.
- Pass generators to converter instead of transfers.
- Generator uses a stop collection to build transfers instead of the complete schedule.
- Service catches IllegalArgumentException of raptor router and returns an empty list.
- Introduce GtfsToRaptorTestSchedule to reuse the ManualSchedule.
- Rename isoLines to isolines, be consistent.
… pattern and invalid stop exception handling.
- Still has open TODOs and points to be discussed.
- Introduce routing query facade the hide complexity of routing from the service.
@munterfi munterfi requested a review from clukas1 January 14, 2025 16:10
@munterfi munterfi self-assigned this Jan 14, 2025
@munterfi munterfi marked this pull request as draft January 14, 2025 16:10
- Add descriptive logging to most public methods in GtfsRaptorService.
- Ensure consistent and informative log messages for easier debugging and tracing.
- Set RaptorRouter logging level to DEBUG, as those logs are more important for a technical audience during debugging.
…wo stops

This case occurs if a stop query does not return any results, due to missing departures on stops, then a query from the stop coordinates is executed as fallback.
- Add location interface to stop.
- Refactor error message in walk calculator.
…cade

Note: The test cases are still failing.
- Times are still failing due to an issue with the date.
@munterfi munterfi marked this pull request as ready for review January 23, 2025 13:06
@munterfi
Copy link
Member Author

@clukas1 I think this is ready for review.

For the merging of consecutive walks at the service level (#181) and the non-deterministic behavior in the RAPTOR router (#180), I have created two separate issues, since they are thematically not part of this refactoring.

@clukas1
Copy link
Member

clukas1 commented Jan 24, 2025

@munterfi nice work. From looking through I couldn't find any issues with this pull request. I will try to address at least one of the two remaining issues this weekend.

@clukas1 clukas1 merged commit 189205e into main Jan 24, 2025
2 checks passed
@clukas1 clukas1 deleted the concept/refactor-service branch January 24, 2025 16:36
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.

2 participants