Preview — Sub-unit 1
The problem: a reliable upfront fare
Quote a reliable upfront fare before the trip and keep pricing responsive to demand, without whiplash for riders or arbitrary swings.
Functional
- Estimate the fare from route distance and duration before the trip.
- Apply demand-based surge per pricing zone.
- Return a transparent breakdown: base, distance, time, surge, fees.
- Honor the quoted upfront price unless the route materially changes.
Non-functional
- Sub-millisecond fare computation on the request path.
- Surge that tracks demand without oscillating.
- Respect regulatory caps and transparency rules.
- An immutable audit trail for every quote.
Constraints
- Distance and ETA inputs are themselves estimates (Units 1, 4).
- Demand and supply shift minute to minute per zone.
- Surge events are noisy — most last under five minutes.
- Cached multipliers can go stale between refreshes.
Uber's own framing: surge pricing is a market-clearing mechanism. When requests outnumber drivers in an area, a higher price does two things at once — it rations scarce cars by pricing out some demand, and it pulls more drivers toward the shortage. The multiplier is the actuator of a supply/demand control loop, not an arbitrary markup.
Pro content
Fare Estimation & Pricing
This unit is part of qodebase Pro. Upgrade to unlock all tracks, checkpoints, benchmarks, and progress sync.