Skip to content

Code for Careem Hackathon Event Bangalore India 2017

Notifications You must be signed in to change notification settings

itisjoshi/HaCareem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HaCareem

Code for Careem Hackathon Event Bangalore India 2017

Live Demo

The code has been delpoyed in AWS you can see here live: http:https://ec2-35-167-86-187.us-west-2.compute.amazonaws.com/

Task:

Book A Ride

One of the goals we strive towards at Careem is creating a perfect booking experience for our Customers- extremely reliable ETAS, accurate locations, best Captains and so on. Build a ride dispatching platform that collects location updates from ‘drivers on the move’ to later be used as data to dispatch the best driver to a customer that wants to book a ride. It is up to you to creatively decide the features, capability and complexity of the platform (Eg: Moving cars on the map, multiple bookings per driver etc.)

Things to Think About

What REST frameworks you will use In-memory vs. persistent storage Testing (unit testing/integration testing/mocking etc.) Optimized dispatching algorithms Service Oriented Architecture Asynchronous processing of location updates like message queues Horizontal scaling Design patterns, dependency injection etc. We will be judging you on the following criteria:

Judging Criteria

  1. Innovativeness
  2. Architecture
  3. Manageability and Scalability
  4. Application Performance
  5. Code Toxicity
  6. Robustness
  7. Completeness (Demoable)

Our Approach

Project is all about booking a ride. Here We are priortized things for booking a cab based on the following criteria such as Minimum wage of the driver on that current day, Longest waiting time of the driver and shortest distance driver. We covered the distance of 1 Km from the current customer location based on the latitude and longitude We will search the cab and allocate based on the above criteria. The user setting preferences can be done apart from the default settings like switching driver gender and Minimum driver rating as well.

In order to prevent Race Condition upon booking a Queueing system is used for a specific driver. The location of the driver is get trakced for every 5 seconds and we are using a Amazon SQS queue to process the location queue. We are using Redis to keep track of the moving car with the customer latitude and longitude until the destination is reached. We can lively locate a vehicle. After the destination is reached location data is moved to mysql from redis.

Technology & Architecture used:

  1. SPRING MVC
  2. Hibernate
  3. MySql(All Meta informations)
  4. Redis(frequest changes to the current location of the cab is stored here.)
  5. SQS(Location Changes Information will be stored by lining up in Amazon SQS)
  6. Queuing System(To Prevent Race Condition, an internal queuing system is used)
  7. JUnit(For unit run cases)

Installation

  1. mvn clean
  2. mvn install
  3. mvn deploy

API Calls:

Return Type Request Method URL Mapping
List GET /user/list
UserModel POST /user/create
UserModel PUT /user/edit
UserModel DELETE /user/delete
UserModel:
{
	Long userId;
	String name;
	String email;
}
Return Type Request Method URL Mapping
List GET /driver/list
DriverModel POST /driver/create
DriverModel PUT /driver/edit
DriverModel DELETE /driver/delete
DriverModel:
{
	Long driverId;
	String bookingStatus;
	Date lastDriveFinishedDate;
	Long userId;
	String name;
	String email;
	Long cabid;
	CabType cabType;
	String gender;
	String rating;
	Double latitude;	
	Double longitude;
}

Returns CustomerModel GET /customer/list Returns CustomerModel POST /customer/create Returns CustomerModel PUT /customer/edit Returns CustomerModel DELETE /customer/delete

Return Type Request Method URL Mapping
List GET /customer/list
CustomerModel POST /customer/create
CustomerModel PUT /customer/edit
CustomerModel DELETE /customer/delete
CustomerModel: 
{
	String preference;
	Long customerId;
	String name;
	String email;
	String gender;
	Long userId;
}
Return Type Request Method URL Mapping
List GET /cab/list
CabModel POST /cab/create
CabModel PUT /cab/edit
CabModel DELETE /cab/delete
CabModel
{
  Long cabId;
  CabType cabType;
  Long seatsCount;
}
CabType {
	MINI,
	PRIME
}
Return Type Request Method URL Mapping
BookingModel GET /booking/{customerid}/{latitude}/{longitude}/{cabtype}/book
BookingModel GET /booking/{customerid}/{cabtype}/book
BookingModel GET /booking/generatecost/{bookingid}
BookingModel GET /booking/updatedrop/{bookingid}/{latitude}/{longitude}/drop
BookingModel GET /booking/updaterating/{bookingid}/{rating}
BookingModel GET /booking/updatecablocation/{driverid}/{latitude}/{longitude}/book
HashMap<String, Double> GET /booking/getcablocation/{driverid}
void GET /booking/cancelbooking/{bookingid}
HashMap<String, String> GET /booking/estimate/{fromlatitude}/{fromlongitude}/{tolatitude}/{tolongitude}/cost
BookingModel {
	Date lastDriveFinishedDate;
	Long customerId;
	Long driverId;
	String preference;
	Date lastDrive;
	String bookingStatus;
	CabType cabType;
	Long seatsCount;
	String distanceTravelled;
	String rating;
	Double cost;
	String costDenomination;
	Double customerFromLatitude;
	Double customerFromlongitude;
	Double driverFromLatitude;
	Double driverFromLongitude;
	Double driverEndLatitude;
	Double driverEndLongitude;
}

Contributors

  1. Prathap Manohar Joshi : https://github.com/itisjoshi

  2. Karthekeyan Devanand : https://github.com/Karthekeyan-Engine

About

Code for Careem Hackathon Event Bangalore India 2017

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages