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 'transfers' build config field #6215

Draft
wants to merge 22 commits into
base: dev-2.x
Choose a base branch
from

Conversation

VillePihlava
Copy link
Contributor

@VillePihlava VillePihlava commented Nov 1, 2024

Summary

This PR adds the transfers build config field for configuring transfers. For example, this allows changing max transfer durations between stops that allow cars for the street modes BIKE and CAR. This is a follow-up PR related to #5966.

Example configuration:

  "transfers": {
    "CAR": {
      "disableDefaultTransfers": true,
      "carsAllowedStopMaxTransferDuration": "3h"
    },
    "BIKE": {
      "maxTransferDuration": "30m",
      "carsAllowedStopMaxTransferDuration": "3h"
    }
  },

Issue

This is a follow-up PR related to issue #5875.

Unit tests

I created new unit tests for testing the changes to the DirectTransferGenerator and StreetNearbyStopFinder.

Documentation

Changes to BuildConfiguration.md

Bumping the serialization version id

This change affects how transfers are calculated and adds a new field to the build-config.json file.

@VillePihlava VillePihlava requested a review from a team as a code owner November 1, 2024 11:15
Copy link

codecov bot commented Nov 1, 2024

Codecov Report

Attention: Patch coverage is 79.71014% with 42 lines in your changes missing coverage. Please review.

Project coverage is 69.84%. Comparing base (69e6f64) to head (41a0674).
Report is 75 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...e/config/buildconfig/TransferParametersMapper.java 0.00% 20 Missing ⚠️
.../graph_builder/module/DirectTransferGenerator.java 93.45% 3 Missing and 4 partials ⚠️
...apping/StreetModeToTransferTraverseModeMapper.java 14.28% 5 Missing and 1 partial ⚠️
...pentripplanner/api/parameter/QualifiedModeSet.java 0.00% 3 Missing ⚠️
...raptoradapter/transit/mappers/TransfersMapper.java 71.42% 2 Missing ⚠️
...t/java/org/opentripplanner/ext/flex/FlexIndex.java 83.33% 1 Missing ⚠️
.../java/org/opentripplanner/ext/flex/FlexRouter.java 0.00% 1 Missing ⚠️
...n/java/org/opentripplanner/model/PathTransfer.java 80.00% 1 Missing ⚠️
.../standalone/config/buildconfig/TransferConfig.java 85.71% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6215      +/-   ##
=============================================
+ Coverage      69.79%   69.84%   +0.04%     
- Complexity     17788    17858      +70     
=============================================
  Files           2017     2024       +7     
  Lines          76042    76441     +399     
  Branches        7781     7818      +37     
=============================================
+ Hits           53074    53390     +316     
- Misses         20264    20332      +68     
- Partials        2704     2719      +15     

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

@habrahamsson-skanetrafiken
Copy link
Contributor

There are some conflicts

Copy link
Member

@optionsome optionsome left a comment

Choose a reason for hiding this comment

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

I've had too many reviews today already so I didn't go properly through this. However, inspired by some concerns from @t2gran, I think to avoid issues we should do a couple of things:

  1. Introduce carsAllowedStopMaxAccessEgressDurationsForMode. This is to prevent weird back-and-forth transfers to avoid access and egress duration limitations.
  2. Prevent these transfers from being used by other street modes. I don't know if this is already done or not but I think at least previously all the transfers were in the same collection. This could again lead to weird back and forth travel by walking for example to escape some other restrictions.

mBuilder.withEgressMode(StreetMode.WALK);
mBuilder.withDirectMode(StreetMode.CAR);
// This is used in transfer cache request calculations.
mBuilder.withAllStreetModes(StreetMode.CAR);
Copy link
Member

Choose a reason for hiding this comment

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

I know this builder method wasn't introduced in this pr but this name is really confusing. Idk what we call Access+Transfer+Egress+Direct. It's difficult to come up with a name that doesn't confuse you into thinking that all modes are enabled. Just making this singular would maybe make it less confusing.

@@ -60,6 +68,23 @@ public DirectTransferGenerator(
this.issueStore = issueStore;
this.radiusByDuration = radiusByDuration;
this.transferRequests = transferRequests;
this.carsAllowedStopMaxTransferDurationsForMode = DurationForEnum.of(StreetMode.class).build();
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should always include this with some default value that is the same as the normal transfer duration limit.

.stream()
.map(StopLocation::getId)
.map(graph::getStopVertexForStopId)
.filter(TransitStopVertex.class::isInstance) // filter out null values if no TransitStopVertex is found for ID
Copy link
Member

Choose a reason for hiding this comment

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

Inline comments are not allowed.

@VillePihlava
Copy link
Contributor Author

I'm changing this to a draft for now. I'll return to this once the work on the separate transfer request collections for modes has been completed.

@VillePihlava VillePihlava marked this pull request as draft November 12, 2024 11:14
@VillePihlava VillePihlava changed the title Add carsAllowedStopMaxTransferDurationsForMode build config parameter Add 'transfers build config field Dec 3, 2024
@VillePihlava VillePihlava changed the title Add 'transfers build config field Add 'transfers' build config field Dec 3, 2024
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.

3 participants