Skip to content

Conversation

@t2gran
Copy link
Member

@t2gran t2gran commented Aug 8, 2025

Summary

This PR introduces carpooling as a sandbox feature in OTP, enabling passengers to be matched with shared carpool trips and integrating carpooling into multi-modal journey planning.

Key capabilities:

  • Direct carpooling routing (door-to-door trips)
  • Optimal passenger insertion into multi-stop carpool routes
  • Real-time updates via SIRI-ET
  • Multi-phase filtering (capacity, time, distance, direction)
  • A* street routing with performance optimizations

Implementation approach:

  • Sandbox feature behind OTPFeature.CarPooling toggle
  • Comprehensive test coverage (189+ tests, 100% passing)

Context:
This POC enables pilot programs where carpooling services integrate with public transit. Development is expected to take at least one year as we refine the feature based on pilot feedback and work with SIRI standardization in parallel.


What's Included

Core Routing

  • Optimal insertion algorithm with A* routing
  • Multi-stop trip support with passenger delta tracking
  • Passenger delay constraint validation (protects existing passengers)
  • Multi-phase filtering to eliminate incompatible trips

Data Management

  • CarpoolTrip domain model
  • SIRI-ET real-time updates via SiriETCarpoolingUpdater

Performance Optimizations

  • Beeline heuristics for early rejection
  • Segment caching
  • Ordered filter chain for maximum early rejection

API Integration

  • GraphQL carpooling types (CarpoolLeg)
  • Transmodel schema integration

What's NOT Included (Future Work)

Not in this PR:

  • Access/egress routing (actively being developed)
  • Pickup/dropoff area restrictions
  • Seat reservation system
  • Driver/passenger preference matching (wheelchair, bike compatibility, etc.)
  • Fare integration
  • Scaling optimizations for large trip counts

Configuration

Enable feature:

// otp-config.json
{
  "otpFeatures": {
    "CarPooling": true
  }
}

Configure SIRI-ET updater:
// router-config.json
{
  "updaters": [
    {
      "type": "siri-et-carpooling-updater",
      "feedId": "carpool-provider",
      "url": "https://api.example.com/siri",
      "frequencySec": 30
    }
  ]
}

Issue

Part of #7012 (carpooling feature request)
Supersedes #6604 (original POC issue)


Unit tests

189+ carpooling-specific tests (100% passing)

Test infrastructure includes builders and mocks for fast, isolated testing without graph infrastructure.


Documentation

JavaDoc throughout codebase


Changelog

Added:

  • Carpooling sandbox feature with optimal insertion routing
  • SIRI-ET carpooling updater for real-time trip updates

Configuration:

  • OTPFeature.CarPooling toggle (disabled by default)
  • SIRI-ET carpooling updater

Bumping the serialization version id

N/A - Sandbox feature does not require serialization bump (carpool trips stored in-memory only, not in graph.obj).


Migration / Compatibility

No breaking changes - all functionality behind OTPFeature.CarPooling toggle (disabled by default).

@t2gran t2gran requested a review from a team as a code owner August 8, 2025 10:57
@t2gran t2gran added !New Feature A functional feature targeting the end user. +Sandbox This will be implemented as a Sandbox feature Entur Test This is currently being tested at Entur +Skip Changelog This is not a relevant change for a product owner since last release. labels Aug 8, 2025
@t2gran t2gran marked this pull request as draft August 8, 2025 10:58
@codecov
Copy link

codecov bot commented Aug 8, 2025

Codecov Report

❌ Patch coverage is 42.82983% with 598 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.12%. Comparing base (c235cab) to head (b61e439).
⚠️ Report is 1 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...nner/ext/carpooling/updater/CarpoolSiriMapper.java 0.00% 115 Missing ⚠️
...entripplanner/ext/carpooling/model/CarpoolLeg.java 0.00% 96 Missing ⚠️
...t/carpooling/service/DefaultCarpoolingService.java 0.00% 68 Missing ⚠️
...xt/carpooling/updater/SiriETCarpoolingUpdater.java 0.00% 48 Missing ⚠️
...er/ext/carpooling/routing/CarpoolStreetRouter.java 0.00% 44 Missing ⚠️
...lanner/ext/carpooling/model/CarpoolLegBuilder.java 0.00% 41 Missing ⚠️
...xt/carpooling/internal/CarpoolItineraryMapper.java 0.00% 39 Missing ⚠️
...ntripplanner/ext/carpooling/model/CarpoolStop.java 34.54% 36 Missing ⚠️
...anner/ext/carpooling/model/CarpoolTripBuilder.java 55.31% 20 Missing and 1 partial ⚠️
...ntripplanner/ext/carpooling/model/CarpoolTrip.java 65.95% 16 Missing ⚠️
... and 18 more
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6791      +/-   ##
=============================================
- Coverage      72.49%   72.12%   -0.37%     
- Complexity     20460    20615     +155     
=============================================
  Files           2206     2232      +26     
  Lines          82240    83274    +1034     
  Branches        8229     8345     +116     
=============================================
+ Hits           59622    60064     +442     
- Misses         19699    20275     +576     
- Partials        2919     2935      +16     

☔ 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 t2gran added this to the 2.8 (next release) milestone Aug 11, 2025
@vpaturet vpaturet removed the Entur Test This is currently being tested at Entur label Aug 13, 2025
@eibakke eibakke added the Entur Test This is currently being tested at Entur label Aug 19, 2025
@t2gran t2gran removed the Entur Test This is currently being tested at Entur label Aug 19, 2025
@eibakke eibakke added Entur Test This is currently being tested at Entur and removed Entur Test This is currently being tested at Entur labels Aug 20, 2025
@optionsome optionsome changed the title Carpooling POK Carpooling POC Sep 2, 2025
@t2gran t2gran modified the milestones: 2.8, 2.9 (next release) Sep 10, 2025
@eibakke eibakke added the Entur Test This is currently being tested at Entur label Sep 11, 2025
@t2gran t2gran added Entur Test This is currently being tested at Entur and removed Entur Test This is currently being tested at Entur labels Sep 11, 2025
@t2gran t2gran removed the Entur Test This is currently being tested at Entur label Sep 22, 2025
@eibakke eibakke force-pushed the carpooling_pok branch 2 times, most recently from 7067369 to 408397a Compare October 23, 2025 11:31
@eibakke eibakke marked this pull request as ready for review October 24, 2025 13:22
@t2gran t2gran self-assigned this Nov 6, 2025
…s for a CarpoolTrip.

They really are just the first and last stop for a trip. This change also keeps all the various times for a stop location.
@optionsome optionsome self-requested a review November 6, 2025 15:22
@eibakke eibakke requested a review from optionsome November 7, 2025 14:35
@t2gran
Copy link
Member Author

t2gran commented Nov 12, 2025

I am ready to approve this, but there is one reminding comment that needs a answer: https://github.com/opentripplanner/OpenTripPlanner/pull/6791/files#r2519853610
in standalone/config/routerconfig/updaters/SiriETCarpoolingUpdaterConfig.java

…daterParameters.java and reuses the vanilla versions.
Resolved merge conflict in doc/user/Configuration.md by:
1. Accepting incoming changes from dev-2.x
2. Regenerating documentation via ConfigurationDocTest

The regenerated file includes both dev-2.x changes and carpooling feature.
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. +Sandbox This will be implemented as a Sandbox feature +Skip Changelog This is not a relevant change for a product owner since last release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants