System Design: Ride-Hailing Pricing Service
Design a ride-hailing pricing service that maximizes company revenue while ensuring fairness for riders and drivers.
Requirements
-
Pricing Strategy Framework
-
Define components: base fare, time, distance, surge/dynamic pricing from supply–demand, discounts/promotions, fees/surcharges.
-
Candidate Routes and Selection
-
For each ride request, return multiple candidate routes (e.g., fastest, cheapest, toll-free). Compute a price for the selected route.
-
Pooled Rides
-
Support pooled rides; specify how prices are split among pooled riders and how drivers are compensated.
-
APIs, Data Models, and Core Classes
-
Expose APIs, data models, and core classes; provide pseudocode for price computation.
-
Fairness Metrics and Constraints
-
State fairness metrics and constraints (price caps, surge limits, driver earnings floors) and describe interaction with revenue maximization.
-
Edge Cases and Reliability
-
Handle cancellations, detours, tolls, promos; include rate limiting and idempotency.
-
Scalability and Extensibility
-
Discuss scalability, caching, latency SLOs, and how to add new pricing rules.