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

Add support for query parameter to enforce booking time in trip search for flexible services #5606

Merged
merged 75 commits into from
Jun 6, 2024

Conversation

vpaturet
Copy link
Contributor

@vpaturet vpaturet commented Jan 8, 2024

Summary

Implements #5077

This PR add a new request parameter bookingTime:

The date and time for the latest time the user is expected to book the journey. Normally this is when the search is
performed(now), plus a small grace period to complete the booking. Services witch must be booked before this
time is excluded. The latestBookingTime and minimumBookingPeriod in BookingArrangement (flexible
services only) is used to enforce this. If this parameter is not set, no booking-time restrictions are applied - all
journeys are listed.

The bookingRestrictions ie enforced for access, egress and direct FLEX services. Only the boarding time is considered, but the flex service is time-shifted to meet the boarding time restrictions (as long as it is possible). Both the boarding and alighting window is still honered.

To solve this I made a lot of refactorings in the flex implementation. The routing no longer have any dependencies to AStar (only to Vertx and Edges & and Path calculator) and not to the TransitService. This is important to be able to unit-test this. I have so fare NOT added many tests, but will create a separate PR with more tests. When we have proper unit-tests in place, then we can refactor the design as well and remove the reminding dependencies to other OTP models (using adaptors).

Issue

Closes #5077

Unit tests

Some tests are added/improved, but we will provide a new PR with more tests.

Documentation

API do is up to date, but design doc is not updated. I want to go over the design again before updating the doc.

Copy link

codecov bot commented Jan 8, 2024

Codecov Report

Attention: Patch coverage is 84.49198% with 87 lines in your changes missing coverage. Please review.

Project coverage is 68.59%. Comparing base (f535524) to head (e7b622d).
Report is 25 commits behind head on dev-2.x.

Files Patch % Lines
...anner/ext/flex/template/FlexDirectPathFactory.java 69.11% 15 Missing and 6 partials ⚠️
...ipplanner/ext/flex/trip/ScheduledDeviatedTrip.java 38.46% 4 Missing and 4 partials ⚠️
.../java/org/opentripplanner/ext/flex/FlexRouter.java 86.66% 4 Missing and 2 partials ⚠️
...it/model/timetable/booking/RoutingBookingInfo.java 90.62% 2 Missing and 4 partials ⚠️
...org/opentripplanner/ext/flex/FlexAccessEgress.java 61.53% 4 Missing and 1 partial ⚠️
...ipplanner/ext/flex/template/FlexAccessFactory.java 64.28% 5 Missing ⚠️
...lanner/ext/flex/template/AbstractFlexTemplate.java 78.94% 4 Missing ⚠️
...planner/ext/flex/template/FlexTemplateFactory.java 90.90% 1 Missing and 3 partials ⚠️
...opentripplanner/ext/flex/template/ClosestTrip.java 92.85% 1 Missing and 2 partials ⚠️
...opentripplanner/ext/flex/trip/UnscheduledTrip.java 85.71% 3 Missing ⚠️
... and 15 more
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #5606      +/-   ##
=============================================
+ Coverage      68.51%   68.59%   +0.07%     
- Complexity     16725    16819      +94     
=============================================
  Files           1918     1927       +9     
  Lines          72734    72928     +194     
  Branches        7456     7475      +19     
=============================================
+ Hits           49834    50024     +190     
- Misses         20329    20331       +2     
- Partials        2571     2573       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

vpaturet and others added 20 commits April 29, 2024 16:28
…o OTP transit request time

Otp transit request time is the number of seconds since/before the `transitSearchTimeZero`
…t the raptor interface.

This allow us to extend the interface inside the otp internal model.
- Implement latestArrivalTime in BookingTimeAccessEgress
- Make Booking time work with time-penaly
- Move bussiness logic into business classes from services
  and OpeningHoursAdjuster
@t2gran t2gran marked this pull request as ready for review April 29, 2024 21:07
@t2gran t2gran requested a review from a team as a code owner April 29, 2024 21:07
@t2gran t2gran marked this pull request as ready for review May 29, 2024 11:27
Co-authored-by: Johan Torin <[email protected]>
Co-authored-by: Leonard Ehrenfried <[email protected]>
Co-authored-by: Leonard Ehrenfried <[email protected]>
@vpaturet vpaturet added the Entur Test This is currently being tested at Entur label Jun 6, 2024
@t2gran t2gran merged commit e210605 into opentripplanner:dev-2.x Jun 6, 2024
5 checks passed
@t2gran t2gran deleted the booking_time branch June 6, 2024 14:35
t2gran pushed a commit that referenced this pull request Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Entur Test This is currently being tested at Entur New Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support for query parameter to enforce bookingtime in trip search for flexible services
4 participants