Skip to content

Allow filtering of intermediate stops in GraphQL API - #6725

Merged
leonardehrenfried merged 12 commits into
opentripplanner:dev-2.xfrom
ibi-group:intermediate-stops
Jul 8, 2025
Merged

leonardehrenfried merged 12 commits into
opentripplanner:dev-2.xfrom
ibi-group:intermediate-stops

Conversation

@leonardehrenfried

Copy link
Copy Markdown
Member

Summary

Allows the itinerary's intermediatePlaces and intermediateStops fields to be optionally filtered by stop type.

This is useful if you have trips that mix flex and static stops and you're only interested in seeing a particular type.

Unit tests

Lots added.

Documentation

Schema and Javadoc.

Requested by @miles-grant-ibigroup

@leonardehrenfried
leonardehrenfried requested a review from a team as a code owner June 30, 2025 10:26
@leonardehrenfried leonardehrenfried added !Improvement A functional improvement or micro feature IBI Developed by or important for IBI Group labels Jun 30, 2025
@codecov

codecov Bot commented Jun 30, 2025 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 88.37209% with 5 lines in your changes missing coverage. Please review.

Project coverage is 71.79%. Comparing base (6a108c9) to head (0360458).
Report is 22 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...ntripplanner/apis/gtfs/generated/GraphQLTypes.java 75.00% 2 Missing and 2 partials ⚠️
...s/gtfs/support/filter/StopArrivalByTypeFilter.java 95.23% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6725      +/-   ##
=============================================
+ Coverage      71.76%   71.79%   +0.02%     
- Complexity     19063    19091      +28     
=============================================
  Files           2066     2067       +1     
  Lines          77713    77781      +68     
  Branches        7921     7934      +13     
=============================================
+ Hits           55773    55845      +72     
+ Misses         19119    19112       -7     
- Partials        2821     2824       +3     

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +3750 to +3751
"A group of stops. Introduced by the GTFS-Flex spec process."
LOCATION_GROUP

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are the locations always regular stops or can they be geojson locations? I had a feeling that they might be mostly geojson locations, but I couldn't make sense by reading the docs for a minute :D.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In the spec they must be stops but since OTP implemented an earlier draft we allow them to be locations, too. :)

I agree that the name location group is confusing, but people couldn't face another round of renaming at the end of the spec process. "Stop areas" was also already taken. "Stop groups" would have probably been the correct name.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I can call them STOP_GROUP in the schema.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure, maybe using the GTFS terminology here is fine.

@leonardehrenfried

Copy link
Copy Markdown
Member Author

I've removed the filtering from intermediatePlaces completely.

@optionsome optionsome left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just update the pr title/description.

@leonardehrenfried leonardehrenfried changed the title Allow filtering of intermediate stops/places in GraphQL API Allow filtering of intermediate stops in GraphQL API Jul 4, 2025

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM with naming nitpicks.

.withAlightStopIndexInPattern(4)
.withTripPattern(PATTERN)
.build();
private static final LegImpl SUBJECT = new LegImpl();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rename this variable maybe?

}

@Test
void intermediateStopsWithInclude() throws Exception {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
void intermediateStopsWithInclude() throws Exception {
void intermediateStopsWithFilter() throws Exception {

}

@Test
void walkLegWithInclude() throws Exception {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
void walkLegWithInclude() throws Exception {
void walkLegWithFilter() throws Exception {

@leonardehrenfried
leonardehrenfried merged commit a4804c8 into opentripplanner:dev-2.x Jul 8, 2025
t2gran pushed a commit that referenced this pull request Jul 8, 2025
@leonardehrenfried
leonardehrenfried deleted the intermediate-stops branch July 8, 2025 13:40
@leonardehrenfried

Copy link
Copy Markdown
Member Author

@binh-dam-ibigroup I added your suggestions directly to dev-2.x: c3bdc36

@t2gran t2gran added this to the 2.8 (next release) milestone Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

IBI Developed by or important for IBI Group !Improvement A functional improvement or micro feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants