Code for Careem Hackathon Event Bangalore India 2017
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/
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.)
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:
- Innovativeness
- Architecture
- Manageability and Scalability
- Application Performance
- Code Toxicity
- Robustness
- Completeness (Demoable)
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.
- SPRING MVC
- Hibernate
- MySql(All Meta informations)
- Redis(frequest changes to the current location of the cab is stored here.)
- SQS(Location Changes Information will be stored by lining up in Amazon SQS)
- Queuing System(To Prevent Race Condition, an internal queuing system is used)
- JUnit(For unit run cases)
- mvn clean
- mvn install
- mvn deploy
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;
}