https://github.com/touradbaba/airbnb_datamart
Data Mart designed for an Airbnb-like platform.
https://github.com/touradbaba/airbnb_datamart
data-mart data-modeling database-design database-schema eer-diagram mysql relational-databases sql
Last synced: about 1 month ago
JSON representation
Data Mart designed for an Airbnb-like platform.
- Host: GitHub
- URL: https://github.com/touradbaba/airbnb_datamart
- Owner: TouradBaba
- License: mit
- Created: 2024-02-18T19:07:06.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-16T18:22:23.000Z (over 1 year ago)
- Last Synced: 2025-01-21T00:49:44.397Z (over 1 year ago)
- Topics: data-mart, data-modeling, database-design, database-schema, eer-diagram, mysql, relational-databases, sql
- Homepage:
- Size: 695 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Airbnb-Like Platform DataMart Project
---
## Abstract
This document provides an overview of a comprehensive data mart designed for a dynamic platform similar to Airbnb. The system is engineered to enhance user experiences for hosts, guests, and administrators by efficiently managing listings, bookings, payments, reviews, user ratings, and property statistics. Leveraging various database features such as triggers, events, and automation mechanisms, this system streamlines operations, reduces manual data entry, and provides real-time information.
---
## Enhanced Entity-Relationship (EER) Diagram
.png)
- Refer to the included EER diagram files in the `EER Diagram` folder. The folder contains both an image (`EER Diagram (Enhanced Entity Relationship Diagram).png`) and a PDF (`EER Diagram.pdf`) for a visual representation of the database structure. The PDF file provides a clearer resolution compared to the image.
---
## Triggers
The system incorporates several triggers to respond to specific events, including:
1. **CalculateExpectedIncome Trigger:** Calculates expected income and occupancy rates for properties after creation.
2. **UpdatePropertyCount Trigger:** Keeps hosts informed about the number of properties they manage.
3. **CalculateTotalPriceAndCommissions Trigger:** Ensures accurate pricing for bookings by calculating total prices, host commissions, and guest commissions.
4. **OccupancyRate Trigger:** Dynamically updates property occupancy rates based on booking and availability data.
5. **UpdateBookingCount Trigger:** Maintains a count of a guest's bookings, facilitating user management.
6. **PropertyAvailability Trigger:** Ensures properties are marked as 'Booked' for relevant dates in the PropertyAvailability table.
7. **CalculateTotalAmount Trigger:** Aids in precise financial transactions by calculating the total amount, including guest commissions.
8. **SetStatus Trigger:** Establishes the payment status of a transaction based on the success of the payment procedure.
9. **UpdateBookingStatusOnPayment Trigger:** Updates booking statuses to 'Booked' or 'Failed' upon successful or failed payments.
10. **UpdatePropertyAverageRating Trigger:** Keeps property ratings up-to-date based on user reviews.
11. **UpdateUserAverageRating Trigger:** Maintains user ratings by calculating the average ratings for each user.
---
## Events
Automated events further enhance the system's efficiency:
- **automate_host_payments Event:** Processes guest arrivals older than 24 hours and marks bookings as processed every second.
- **AutoInsertReservations Event:** Inserts reservations for bookings with a 'Booked' status every minute.
- **UpdatePhoneNumbers Event:** Ensures phone numbers include country codes every minute.
---
## Metadata
The database comprises 39 tables, covering various aspects of the platform.
---
## Installation Manual
### Prerequisites
- Install [MySQL Workbench](https://www.mysql.com/products/workbench/).
### Database Setup
1. **Create Database:**
- Open MySQL Workbench.
- Open a Local instance.
- Execute the following SQL script:
```sql
CREATE DATABASE AirBnB_Project;
```
2. **Run Data Mart Script:**
- Run the SQL script named `Data Mart.sql` using MySQL Workbench or any MySQL-compatible tool.
- This script includes necessary tables, triggers, events, and initial data for the AirBnB_Project database.
3. **Insert Test Data:**
- Utilize the SQL INSERT File `SQL INSERT File.sql` to insert sample rows into tables for testing purposes.
### Note on Compatibility
- The database scripts are optimized for MySQL Workbench. Using other database management systems may require adjustments.
### Uninstallation
- To uninstall the database, use the following query:
```sql
DROP DATABASE AirBnB_Project;
```
---
## License
This project is licensed under the MIT License. See the `LICENSE` file for more details.