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

Distinct coach from bus when reading in GTFS data and in GTFS GraphQL API #6171

Merged
merged 8 commits into from
Nov 7, 2024

Conversation

miklcct
Copy link
Contributor

@miklcct miklcct commented Oct 17, 2024

Summary

The GTFS specification does not have official support for coach services (as distinct from bus services). This add support for coach services, which changes the behavior as follow:

  • GTFS extended route types 200 to 299 are imported as coach services instead of bus services
  • When the plan field in the GTFS GraphQL API is called with BUS mode, only bus services are returned, whereas the current behavior, kept when the feature flag is off by default, is that bus and coach services are both returned in the itineraries.

In addition, this fixes an API error Exception while fetching data (/plan) : Qualified mode is not valid: 'COACH', details: No enum constant org.opentripplanner.api.parameter.ApiRequestMode.COACH when I attempt to specify COACH as a mode as an argument in the plan field.

This replaces #6086 for bus and coach services, without the change for the legacy REST API which has since been moved to the sandbox (I can put it back if desired).

Issue

Fixes #5550

Unit tests

Added for bus and coach

Documentation

Added

@t2gran t2gran added this to the 2.7 (next release) milestone Oct 22, 2024
Copy link

codecov bot commented Oct 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.75%. Comparing base (ee53e50) to head (13949af).
Report is 43 commits behind head on dev-2.x.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6171      +/-   ##
=============================================
- Coverage      69.91%   69.75%   -0.17%     
+ Complexity     17736    17652      -84     
=============================================
  Files           2006     2006              
  Lines          75526    75525       -1     
  Branches        7730     7731       +1     
=============================================
- Hits           52804    52679     -125     
- Misses         20036    20134      +98     
- Partials        2686     2712      +26     

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

@t2gran t2gran added Improvement GTFS Related to import of GTFS data bump serialization id Add this label if you want the serialization id automatically bumped after merging the PR Config Change labels Oct 22, 2024
@optionsome
Copy link
Member

I think @leonardehrenfried already checked that coaches are not used in his deployments. I have now also checked that these are not used in ours. @flaktack are these used in any of yours? If no one opposed the idea, I think we could apply these changes even without the feature flag.

@flaktack
Copy link
Contributor

We are for applying this without a feature flag. It is a reasonable change (bus is bus, coach is coach) which we've also done locally.

@leonardehrenfried
Copy link
Member

I can confirm that I don't need a feature flag.

@miklcct
Copy link
Contributor Author

miklcct commented Oct 29, 2024

We are for applying this without a feature flag. It is a reasonable change (bus is bus, coach is coach) which we've also done locally.

Does this PR pose any incompatibilities with your local changes?

# Conflicts:
#	application/src/test/java/org/opentripplanner/gtfs/mapping/TransitModeMapperTest.java
@flaktack
Copy link
Contributor

Does this PR pose any incompatibilities with your local changes?

No, merging this as-is or without the features flag is OK with us.

Copy link
Member

@leonardehrenfried leonardehrenfried left a comment

Choose a reason for hiding this comment

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

Just remove the import and this is good to go.

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.

Should we also edit TraverseMode#fromTransitMode? I'm a bit unsure what would be the effect of it. Seemingly Transmodel API also has this situation where COACH mode is replaced by BUS at least in one place.

@optionsome
Copy link
Member

Should we also edit TraverseMode#fromTransitMode? I'm a bit unsure what would be the effect of it. Seemingly Transmodel API also has this situation where COACH mode is replaced by BUS at least in one place.

Ignore this comment, I just realized the branch I was on used really old version of otp2 where there was transit mode stuff in TraverseMode as well.

Co-authored-by: Leonard Ehrenfried <[email protected]>
@optionsome optionsome changed the title Enable coach support for GTFS Distinct coach from bus when reading in GTFS data in GTFS GraphQL API Nov 7, 2024
@optionsome optionsome changed the title Distinct coach from bus when reading in GTFS data in GTFS GraphQL API Distinct coach from bus when reading in GTFS data and in GTFS GraphQL API Nov 7, 2024
@optionsome optionsome merged commit 0999ca7 into opentripplanner:dev-2.x Nov 7, 2024
5 checks passed
t2gran pushed a commit that referenced this pull request Nov 7, 2024
t2gran pushed a commit that referenced this pull request Nov 7, 2024
@miklcct miklcct deleted the coach_gtfs_import branch November 26, 2024 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump serialization id Add this label if you want the serialization id automatically bumped after merging the PR Config Change GTFS Related to import of GTFS data Improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenTripPlanner returns a route as mode "BUS" instead of "COACH" for GTFS route type 200
5 participants