Uber Data Model

In this post I will try to come up with a data model which can serve the requirements of ride sharing companies like Uber, Lyft, Ola etc. We will approach the problem as an interview and see how we can come up with a feasible data model by answering important questions.

Important Entities
The first step towards building a data model is to identify important actors/ entities involved in the process. In our case, if we think about our interaction with taxi apps, we can identify important entities involved. The user (i.e. Rider) is one such entity, so is the Driver/ Partner. Once we open the app, we try to book a trip by finding a suitable taxi/ cab from a particular location to another. After the trip gets finished, the app collects the payment and we are done. Ideally, the flow continues to reviews/ ratings, helpcenter in case of issues etc. but for this post we will only consider scenarios till the ride gets finished. So, to summarize, we have the following key entities;

Rider
Driver
Cab
Trip
Location
Payment

Attributes
Once we have some sense of the important entities in any scenario, the next step is figure out important attributes for each of these entities. 

Rider
A record in this table should be about the details for the rider. Apart for the usual demographic attributes, I have added the current payment attributes for any rider. There can be a case for SCD type implementation for these attributes where we have a new record for the rider everytime he changes his payment preferences (while marking the existing record as inactive).

Driver
Similar to the rider details, we have a table for Drivers which stores demographic attributes. Also, a driver can be driving different vehicles at different points of time. To support that use case, I have a current cab details tagged to the driver record. Again, a case can be made for tracking history of cabs being used by a driver.

Cab
This table stores details about vehicles onboarded to the platform. As the per km rate of the ride gets defined by the vehicle type, there is an attribute capturing the base_rate.

Rider_Bookmarks
A rider might want to save some strategic locations to avoid searching on the map (e.g. home, office etc.). This table will store those locations.

Map_Grid
In order to tag each location on the map to query-able records, we can imagine the map to be a grid (e.g. grids of 1km x 1km). This allows us to query maps data with other tables in our relational schema.

Location
This table will store locations in the "human readable" form. It has provisions to tag some landmarks (e.g. airports, malls, housing society etc.). It can also serve to identify related/ same locations (e.g. front gate and back gate of a railway station) via the related_location_id field.

Trip
This table stores details about every trip. It has different timestamp fields which will be of interest while finding durations related to the trip. It also has joins to different tables above for the join queries. 




References:

https://eng.uber.com/schemaless-part-one/
https://eng.uber.com/schemaless-part-two/

Comments

  1. This was a stunning and valuable content. thanks for sharing this informative post.
    Certified Ethical Hacking Course
    Best Ethical Hacking Certification

    ReplyDelete
  2. Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative.
    Best PTE institute in ambala
    Best IELTS Institute in Ambala
    Best IELTS Coaching in Ambala

    ReplyDelete
  3. Thank you for sharing this article. It will be extremely beneficial to people looking for Uber Data Model on the internet. RideAlike is a car rental company in Toronto. By visiting their website, you can easily book a ride.

    ReplyDelete
  4. "Taxis in stevensville Maryland
    If you’ve crossed the Chesapeake Bay Bridge, you’ve gone right by Kent Island. Located off the west coast of Queen Anne’s County, Kent Island sits at the base of the Chesapeake Bay Bridge, connecting Maryland’s eastern and western shores. Public transportation through this area is limited, and Annapolis Taxi Cabs can alleviate difficult transportation situations. Annapolis Taxi Cabs offers reliable Taxi Cab Service in stevensvill Maryland."

    ReplyDelete
  5. Excellent tips and blog for sharing such useful information! The Uber app clone can help you get your business on the web. Get a branded and customized app like Uber that has more features.Let's Develop an app like uber to make money in the taxi business with our uber app clone.Thank you so much for sharing all this wonderful Blog!

    ReplyDelete
  6. By guiding me away from congested areas, connectsmart ensures that I always arrive at my destination promptly. You can understand why ConnectSmart is an essential tool for regular commuters with its real-time traffic reports and alternative route recommendations!

    ReplyDelete

Post a Comment

Popular posts from this blog

Data Engineer Interview Questions: SQL

Cracking Data Engineering Interviews

Hive Challenges: Bucketing, Bloom Filters and More

UBER Data Architecture