Design a Driver Review Leaderboard
Design a fresh, reproducible city leaderboard derived from versioned rider reviews of completed trips.
Problem statement
For this exercise, assume riders may submit one rating from 1 to 5 after a completed trip. The latest accepted version of that trip review contributes to the driver's rolling 90-day score in the trip's city; deleted or moderated reviews stop contributing. A driver becomes eligible after 20 contributing reviews.
Leaderboards return the top 100 eligible drivers by average rating, then contributing-review count, then stable driver ID. The system must support review correction and moderation, prevent retry inflation, and rebuild rankings from durable source records.
Dispatch, trip matching, driver compensation, free-text review serving, and fraud-model design are out of scope.
What to build
- A rider can idempotently create or replace the one rating associated with an eligible completed trip.
- An authorized moderation decision can exclude or restore a review and cause derived scores to converge without double applying the change.
- A reader can fetch a versioned top-100 leaderboard for a city with score, contributing-review count, rank, and freshness metadata.
- Operators can rebuild and compare a city's derived scores and rankings from authoritative review versions before publishing a corrected generation.
At scale
- For this exercise, assume 5 million active drivers across 10,000 cities and peaks of 100,000 accepted review changes per second globally.
- For this exercise, assume 20,000 leaderboard reads per second, with the busiest 100 cities receiving 80 percent of reads and review changes.
- For this exercise, target 200 milliseconds p95 for leaderboard reads and one minute p95 from an accepted review or moderation change to a newly published ranking generation.
- For this exercise, retain authoritative review versions for seven years and rolling-ranking event history for 120 days; a failed city partition must rebuild a current generation within 30 minutes.