Tugas Pertemuan 7 PPL

Nama : 1. Frederick Yonatan Susanto / 5025211121

             2. Akmal Sulthon Fathulloh / 5025211047

Kelas : PPL A

Tahun Ajaran : 2023/2024 (Genap)

    Pada pertemuan ketujuh di kelas PPL A, kita diminta untuk mendeskripsikan bagaimana Low Level Design dan High Level Designnya dari sistem food delivery/restaurant. Referensi dapat dicari dari paperwork, jurnal, dokumentasi aplikasi, dll.


High Level Design and Low Level Design 
Food Delivery System


A. Problem Statement

Design online food delivery system.


B. Functional Requirements

  • User can search different restaurant based on his/her location
  • User can select a restaurant
  • User can see the menu of selected restraunt
  • Restraunt can change the menu any time
  • User selects restraunt and add different food items from the menu
  • User orders the food by selecting different online payment modes
  • Cash on delivery can be also option (Optional)
  • User can track the order in real time
  • User can cancel the order
  • The restaurant process the orders by preparing the meal and packaging the orders.
  • The restaurant contacts the delivery service or their personnel delivery staff to deliver.
  • Daily allows users to schedule their meals in advance or opt for a daily, weekly or monthly subscription. (Not in scope but it will be good to have in future.)
  • Customers will have different offers in the form of coupon, discounts, etc.


C. Non-functional Requirements

  • No. of orders = 10,000 orders per minute
  • No. of cities and towns operational = 500
  • Total number of restraunts listed on the application = 140,000
  • Total active delivery partners = 2,00000
  • Total number of order cancellations = 1,500 daily
  • System should be highly scalable and available.
  • User should be able to get all features with minimal latency.

D. Scalability Estimation

a. Traffic Estimates

System is expecting 10,000 orders per minute. So, order requests per second will be:

10, 000 orders per minute/60 = ~ 167 Orders /Second


b. Storage Estimates

Since we are expecting 10,000 orders per minute so, per day will be:

Orders per day = 10, 000 orders/minute * 60 * 24 = 14,400,000 orders/day

Total expected orders in 5 years = 14,400,000 orders/day * 12 Months * 5 Years = 864,000,000

Lets assume the size of object = 500 bytes

Total storage in 5 years = 432 GB


c. Bandwidth Estimates

For order, since we are expecting 167 Orders /Second so, the total incoming data for the service will be:

167 Orders/Second * 500 bytes = ~ 1 MB/Second


E. High Level Design (HLD)

Food delivery system can be devided into three major components:

  • Customer's Application
  • Driver's Application or Delivery guy's application
  • Admin Panel


a. Customer's Application

Selection of city and listing of restraunts

  • Searching menu: Allow users to search for different restaurants, cafes, pubs, and bars by location and cuisines. Users can go through the menus and choose an item from using the search filter; users can easily find their favorite eating places.
  • Order placement/Cancellation: The user can place an order of selected dishes and food with just a few simple taps on the screen. User can cancel order with a given allowed time.
  • Tracking Drivers: Users can check how much time a driver will take to reach their food parcel.
  • Payment gateway integration: It will be required for the payment by users. It will have multiple options of payment.


b. Driver's Application or Delivery guy's application

  • Driver's profile: Driver can update his profile details like his name, email, address, phone number, photos, or any other details.
  • Notification for orders: Through push notifications, drivers can get constant updates & alerts for new food orders online. It will help in the accurate delivery service of your restaurant.
  • Map for the delivery route: Integrate Google Map or Waze and allow drivers to choose the shortest and fastest routes to reach the location.

c. Admin Panel

  • Restaurant management: Being on the admin panel, one can directly manage all the restaurants by adding, updating, and removing any eating joint from the list. He can also check active restaurant status and also menu pricing.
  • Analytics & report generation: Using the analysis and report feature, you can get real-time insights of reports and other accounting information, which helps you to identify the growth and opportunities to expand reach.
  • Monitoring every action: Monitor all the drivers, changes in the menu, deliveries, ratings & reviews of drivers, canceled orders, and other important data related to the driver’s performance.
  • Payment and commission management: Allow owners to set payment and commission rates and manage it directly from the panel with every single partner and make payments.

d. Other components can also be included (Not in current scope. This can be the part of future scope):

  • Customer Relationship Management (CRM): This will be required to help and understand about customers. It will include the solution or query related to ordering or any problem related to order and delivery, likes-deslikes, transancation details, sales details, order patterns, etc.
  • Estock Management: It can maintain raw material management, stock availability, consumption report (monthly/yearly), and stock expiration date, etc.
  • High level design for each component or area can be very wide. Each component will have separate high level design. You should discuss about the area before the development and drawing of high-level design. Interviewer will ask you to pickup one from three of them. Lets say its customer's application.

High-level design in general is as below:

Explanation:

  • User Interface: Customers engage with the system through mobile apps, web interfaces, or desktop applications.
  • Authentication and Registration Services: This service handles user authentication and registration. All users, including customers, restaurant admins, and delivery agents, undergo authentication and registration processes.
  • Database: Storing user data, restaurant details, menus, orders, and metadata, the database serves as the central repository for the system.
  • Payment Services: Responsible for managing all payment-related data and services.
  • Order Services: This service is tasked with placing orders at restaurants and managing all order-related processes.
  • Delivery Services: Focused on delivery-related operations, this service locates delivery agents and facilitates real-time package tracking using Map Services.
  • Restaurant Admin Services: Enabling restaurants to view and manage placed orders, this service also allows admins to modify menus, prices, and food images.
  • Tracking Services: Tracking user and delivery agent locations, Map Services collaborate with Delivery Services and customers for real-time location tracking.

The data flow within the system would include the following:



Explanation:

  • User selects the preferred payment option from the User Interface component.
  • The User Interface component sends the user’s payment request to the Payment Options component.
  • The Payment Options component selects the appropriate payment gateway and sends the payment request to the Payment Gateway component.
  • The Payment Gateway component interacts with external payment providers and financial institutions to authorize and settle the transaction.
  • The Payment Gateway component sends the payment confirmation to the Payment Options component.
  • The Payment Options component sends the payment confirmation to the User Interface component.
  • The User Interface component displays the payment confirmation to the user.

F. Low-Level Design (LLD)

Low-level design in general is as below:


a. Component and Interface

    1. Restaurant Service


All the functionalities related to the restaurants will be handled by the Restaurant Service. It will interact with Restaurant Data only. It will render the first page of the application, i.e., the list of all restaurants or the searched restaurants. It will also allow restaurants to register and Admin to manage.
  • Restaurants can register themselves — addRestaurant
  • Customers can see the list of all the restaurants — getAllRestaurants
  • Admin can search for the restaurant using Id — getRestaurantById
  • Customers can search for restaurants using name — getRestaurantsByName
  • Customers can search for restaurants using city — getRestaurantsByCity

    2. User Service


User profile related features will be provided by User Service. It will interact with User Data only. It will allow Customers and Delivery boys to register and update their profiles.
  • Users can register themselves — addUser
  • Users can delete their profiles — deleteUser
  • Users can update their profiles — updateUser
  • Users can get info of their profiles — getUser
    3. Food Menu Service


Once the customer selected the restaurant, the second page of the application, i.e., the food menu will be rendered by the Food Menu Service. It will also allow customers to search for the items on the menu basis on some category. It will interact with Food Menu Data only.
  • Restaurants can add the food menu — addMenuByRestaurantId
  • Admin can search for the food menu using Id — getMenuById
  • Customers can see the menu — getMenuByRestaurantId
  • Admin can add more items in the menu — addMenuItemsByMenuId
  • Restaurants can add more items — addMenuItemsByRestaurantId
  • Customers can search for the items using cuisine type — getMenuItemsByRestaurantIdAndCuisine
  • Customers can search for the items using meal type — getMenuItemsByRestaurantIdAndMealType
  • Admin can search for the item using Id — getMenuItemById
    4. Pricing Service


On the cart page, Pricing Service will allow Customers to see the bill details. It will call the Cart Service to get all the items of the cart to render the bill. We can use a Strategy Pattern and have different types of strategies — TwentyPercentOff, FiveHundredOff, etc.
  • Customers can see the bill details — getBill
    5. Order Service


Customers can place or cancel the order, once the cart is finalized, using Order Service. It will interact with Order Data only. It will allow customers to see the order history also. Customers can select the history based on the restaurant also. We can use the Command Pattern to handle place or cancel commands.
  • Customers can place or cancel orders — updateOrder
  • Admin can search for the order — getOrderById
  • Customers can see their order history for a restaurant — getAllOrdersByRestautantId
  • Customers can see their all order history — getAllOrders
    6. Payment Service


Payments can be made to the restaurants using Payment Service. It will interact with the Payment Data and also call the Pricing Service to validate the payment made & the Order Service to update the order status. It will allow Customers to add the Payment against their order.
  • Customers can pay for their orders — addPayment
  • Admin can search for the payment using Id — getPaymentById
  • Customers can see the payment made — getPaymentByOrderId
  • Payment must match the bill — validatePayment
    7. Delivery Service


Delivery Service will deal with all the functionalities related to the order delivery. It will interact with the Delivery Data and also call the Order Service to get the order to be delivered.
  • Admin/Restaurants can add delivery — addDelivery
  • Admin can get the delivery by Id — getDeliveryById
  • Delivery boy can see all the deliveries made — getDeliveriesByDeliveryBoyId
  • Customers can track the order status — getOrderStatus

b. Algorithm

Creating a food delivery system involves several algorithms to ensure a smooth and efficient service. Here are some key algorithms you might consider:

1. Personalization Algorithm: This algorithm considers the user's location, past orders, and preferences to display the most relevant options¹. For instance, if a customer typically orders Indian cuisine, the app will prioritize Indian restaurants nearby¹.

2. Popularity Algorithm: This algorithm takes into account the popularity of restaurants. Restaurants often ordered from and with high ratings will be given greater visibility on the app¹.

3. Distance Algorithm: The distance between the restaurant and the customer is critical. Restaurants located closer to the customer will appear higher in the search results¹. This is because the app assumes that these restaurants will have shorter delivery times, making them more convenient for customers¹.

4. Real-time Data Algorithm: Food delivery apps use real-time data to make their algorithms even more accurate. For example, if a restaurant is experiencing a high volume of orders, the app may lower its ranking in the search results¹.

5. Recommendation System: A recommendation system can be based on the number of orders stored by a real food-delivery application². This system is based on the nearest-neighbor technique that calculates the client’s preferred restaurants and analyzes other clients with similar buying patterns².
Data Structure

c. Data Structure


d. Detail Implementation

  • The code is implented using Java language
  • The framework that will be used are: Spring Boost and Firebase (for the backend)

G. User Interface Design

1. Home Page


2. Menu Page


3. Tracking Page


4. Payment Page


H. Reference


https://bootcamp.uxdesign.cc/swiggys-high-level-design-system-33d271ebb340



Comments

Popular posts from this blog

Quiz 1 PBKK A

EAS APSI