Skip to content

Conversation

@leonardehrenfried
Copy link
Member

Summary

This adds the filter API originally developed for the Transmodel API to the GTFS API.

It allows you to included or exclude routes or agencies from the routing result.

For example it allows you to express the following filter criteria:

  • give me only results for agency A1
  • give me only results for routes R1, R2
  • exclude results from agency A2, A3
  • exclude results from routes A4, A5 and agencies A4
  • ...

Issue

#6239

As discussed in this issue, the schema docs was copied more or less from the Transmodel API and uses the same semantics. Some features like dated service journeys and group of lines, which don't have a GTFS equivalent, are omitted.

Unit tests

Added.

Documentation

Javadoc and schema docs.

@leonardehrenfried leonardehrenfried requested a review from a team as a code owner May 20, 2025 11:47
@codecov
Copy link

codecov bot commented May 20, 2025

Codecov Report

Attention: Patch coverage is 84.40367% with 17 lines in your changes missing coverage. Please review.

Project coverage is 71.39%. Comparing base (fcf784c) to head (b8e0249).
Report is 227 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...ntripplanner/apis/gtfs/generated/GraphQLTypes.java 57.14% 10 Missing and 5 partials ⚠️
...r/apis/gtfs/mapping/routerequest/FilterMapper.java 96.42% 1 Missing ⚠️
...gtfs/mapping/routerequest/SelectRequestMapper.java 93.33% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6668      +/-   ##
=============================================
+ Coverage      71.38%   71.39%   +0.01%     
- Complexity     18551    18573      +22     
=============================================
  Files           2036     2038       +2     
  Lines          76609    76710     +101     
  Branches        7828     7847      +19     
=============================================
+ Hits           54686    54769      +83     
- Misses         19150    19163      +13     
- Partials        2773     2778       +5     

☔ 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.

@t2gran
Copy link
Member

t2gran commented May 21, 2025

Note! I am not reviewing this, just commented on a few things I noticed while reading through part of the code - core domain only.

@leonardehrenfried
Copy link
Member Author

@fpurcell this might also be relevant for you.

@t2gran t2gran added this to the 2.8 (next release) milestone May 22, 2025
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.

Was it possible to define these filters in the router configuration? If it is, we probably should expose the defaults in the schema.

@leonardehrenfried
Copy link
Member Author

Was it possible to define these filters in the router configuration? If it is, we probably should expose the defaults in the schema.

We have banned/whitelisted routes and agencies, but their mapping to this structure is a little awkward.

@leonardehrenfried leonardehrenfried force-pushed the plan-connection-filters branch 2 times, most recently from e3e79d2 to 9d0ffc6 Compare May 26, 2025 11:33
@optionsome optionsome requested review from optionsome and tkalvas May 27, 2025 09:36
@leonardehrenfried
Copy link
Member Author

Move filters to TransitPreferences

@leonardehrenfried
Copy link
Member Author

While moving the filters into the transit preferences I notices a problem with how they interact with mode settings. I reworked the mapping, added tests and improved the docs.

This is now ready for review.

@leonardehrenfried leonardehrenfried force-pushed the plan-connection-filters branch from 59d1868 to 443deac Compare May 30, 2025 11:09
@leonardehrenfried leonardehrenfried force-pushed the plan-connection-filters branch from 79928c7 to b1f0cd0 Compare May 30, 2025 11:22
@leonardehrenfried
Copy link
Member Author

@optionsome I've reworked the documentation a bit.

@leonardehrenfried leonardehrenfried force-pushed the plan-connection-filters branch from 0220a5c to 7e894c9 Compare May 31, 2025 19:46
@leonardehrenfried leonardehrenfried force-pushed the plan-connection-filters branch from 7e894c9 to afa0629 Compare May 31, 2025 19:58
Co-authored-by: Joel Lappalainen <[email protected]>
@leonardehrenfried leonardehrenfried force-pushed the plan-connection-filters branch from a6285b6 to b8e0249 Compare June 1, 2025 06:36
@leonardehrenfried leonardehrenfried added the !New Feature A functional feature targeting the end user. label Jun 1, 2025
optionsome

This comment was marked as outdated.

@leonardehrenfried leonardehrenfried merged commit 782621c into opentripplanner:dev-2.x Jun 5, 2025
7 checks passed
t2gran pushed a commit that referenced this pull request Jun 5, 2025
@leonardehrenfried leonardehrenfried deleted the plan-connection-filters branch June 5, 2025 12:41
@leonardehrenfried leonardehrenfried restored the plan-connection-filters branch June 6, 2025 21:35
@leonardehrenfried leonardehrenfried deleted the plan-connection-filters branch June 12, 2025 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

!New Feature A functional feature targeting the end user.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants