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

158 bug gtfs stops with no departures 1 #160

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

clukas1
Copy link
Member

@clukas1 clukas1 commented Dec 13, 2024

See comment in issue

@clukas1 clukas1 linked an issue Dec 13, 2024 that may be closed by this pull request
@clukas1 clukas1 self-assigned this Dec 13, 2024
@clukas1 clukas1 added bug Something isn't working enhancement New feature or request labels Dec 13, 2024
@clukas1 clukas1 requested a review from munterfi December 18, 2024 22:05
Copy link
Member

@munterfi munterfi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upon further reflection, I think my initial approach of just adding all stops from the GTFS schedule to the RAPTOR makes more sense, as it introduces less complexity and no inconsistencies between the schedule and the router.

If a stop occurs in the GTFS schedule, it should be included in RAPTOR, even if no departures are scheduled from that stop. While adding a large number of such stops could negatively impact performance during the generation of transfers at startup, the effect on routing would be minimal since no route scanning occurs from these stops.

Since this issue originates in the GTFS input, we could issue a warning when adding stops with no departures. Ultimately, however, it is the responsibility of the GTFS producer to address this. Our public transit service should handle such cases gracefully but should not attempt to fix the underlying data issue.

What, in your opinion, speaks against this solution?

@@ -42,9 +41,15 @@ public RoutingController(PublicTransitService service) {
this.service = service;
}

private static void handleConnectionRoutingException(ConnectionRoutingException e) {
private static ConnectionResponse handleConnectionRoutingException(ConnectionRoutingException e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vote against wrapping the responses in DTOs again, as it seems like reinventing the wheel.

Spring already provides built-in strategies for exception handling, and we are already using them. See: Error Handling for REST with Spring

I think the better approach is to have more speaking exceptions names and handle them in the already existing ch.naviqore.app.controllerGlobalExceptionHandler (@ControllerAdvice).

return map(List.of(), e.getMessage(), MessageType.ERROR);
}

private static IsoLineResponse handleConnectionRoutingException(ConnectionRoutingException e, TimeType timeType,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same :)

}
}

private void addStop(String stopId) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still have the inconsistency between the GTFS schedule and the RAPTOR Router? Specifically, there could be stops in the schedule that the router doesn't recognize. I assume in that case, the router throws an exception when a route is requested from a stop with no departures in the GTFS.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we decide to add all stops to the router, it would simply result in no connections being returned, which accurately reflects the reality: the stop exists in the schedule, but there are no departures and, therefore, no connections.

Whether it makes semantic sense to include stops without departures in a schedule is another question entirely, but I believe that is not our responsibility to address.

@munterfi
Copy link
Member

See comment in issue

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: GTFS stops with no departures
2 participants