Assumption, total available space = 1000
3 types of parking space 1. Car 2. Truck 3. TwoWheeler
Car space = 500
Truck space = 200
TwoWheeler = 300
Daily Active Users count - 100K
Request Per Second = 1
Read = Write
Storage capacity = 100 bytes of info per space
1000*100 = 1 MB storage
[{
space1:{status:"Free", park_type:"Car"},
space2:{status:"Occupied", park_type:"Truck"
}]
returns the recommendation list
[{
rank:1, floor:1, park_no:16
},
{
rank:2, floor:2, park_no:22
}
]
{park_no:22}
{
park_no:22
vehicle_id:2000
}
{
vehicle_id:2000
}
Choice of DB - SQL
inventory
parking
Assumption:
System has 3 types of parking space
1. Car
2. Truck
3. TwoWheeler
Core Entities:
Authentication Service:
Inventory Service:
Recommadation Service:
Receives vehicle type criteria from user, this service talks to inventory service to match vehicle type with park type and based on availability runs a ranking algorithm and provides a recommendation to User.
Parking Service:
User chooses a park space and makes book request, this service processes the request and assigns the park space chosen by user.
Use can also use random pick, in that case parking service, talks to recommendation service and gets the rank 1 data and assign it to user.
This service also ensures the vehicles are correctly parked in the chosen park space, with a confirmation request from park space.
Also handles the exit request of user and makes the park type status back to available.
Billing Service:
Upon exit request, calculates the bill amount and send notification to user, Pay option is enabled in APP.
Payment Service:
Handles payment request from user with integration of Payment service provider.
Parking service plays a crucial role in deciding which parking space to chose, by talking to recommendation service, by running a matching algorithm.
This algorithm - considers features like vehicle dimension, nearby space vehicle dimension, nearby slot occupied or free information, taking into account all this information
If he is a regular customer, algorithm also considers previous allotted space and try to provide the same based on availability