Skip to content

Matching Flow ​

Inputs ​

From the driver's journey:

  • origin and destination
  • route geometry
  • departure time
  • available seats

From the passenger's request:

  • pickup and dropoff
  • requested time
  • passenger count

Pipeline ​

text
Candidate Discovery   coarse spatial pre-filter, index-backed
      ↓
Spatial Filter        pickup within the configured radius of the route
      ↓
Time Filter           departure window
      ↓
Seats                 capacity available for the requested count
      ↓
Route & Detour        overlap, added distance, added time, percentage
      ↓
Hard Filters          account state, geography, eligibility
      ↓
Compliance            ALLOW / REVIEW / BLOCK
      ↓
Score                 rank what survived
      ↓
Offer                 with an expiry

The spatial pre-filter runs before route recalculation. ST_DWithin on a point column is index-backed; ST_Distance against every route LineString is neither.

Candidate metrics ​

Each recorded on the match:

  • pickup distance from the driver route
  • dropoff distance from the driver route
  • route overlap
  • additional distance (metres)
  • additional duration (seconds)
  • detour percentage
  • departure time difference
  • available seats
  • component scores and overall score
  • algorithm version

Compliance gate ​

Compliance runs before scoring.

text
ALLOW   → ranked and offered
REVIEW  → queued for a human; not offered
BLOCK   → not surfaced

Ranking candidates that are about to be blocked is wasted work, and offering a REVIEW match as though it were available would misrepresent the decision.

Explainability ​

The passenger sees the factors:

text
Route compatibility      94%
Pickup distance          420 m
Dropoff distance         510 m
Additional distance      1.2 km
Additional time          4 min

The internal compliance reason codes are not shown. A match that requires review is not shown at all — it is not a degraded option, it is a held one.

Scoring ​

FactorWeight
Route compatibility35
Pickup compatibility20
Dropoff compatibility20
Time compatibility15
Seats10

Weights are configuration, tunable during the pilot. Detour thresholds are policy, not weights — the order options appear in is a product judgement; what is permitted is a regulatory one. The second is never adjusted by tuning the first.

Expiry ​

Every offer carries an expiry. An expired match cannot be accepted — accepting one would mean booking a journey whose seats may since have gone.

KHAWI — same route, go together.