A one-stop-platform for users to rent cars and owners to put up cars.
Group Members: Mihir Kachroo, Mike Kwak, Parsh Parikh, Rawsab Said, Siddharth Viswanath
In order to run the sample queries against the sample database without using the database-driven application, follow the following steps:
- MySQL Server: Ensure that MySQL Server is installed on your machine.
- MySQL Client: Use either a command-line client or a graphical interface such as MySQL Workbench (recommended).
- SQL File: Download the
sample_database/createdb.sql
file containing the SQL commands to create the tables necessary for the database. - CSV Files: Download the sample data files (in CSV format) for each table which can be found in the
sample_database
directory of the repo. - SQL Query Files: Download the four SQL files that contain test queries to run against the database (e.g.
test-sample-X.sql
).
-
Start MySQL Server: Ensure that the MySQL server is running on your local machine. Open your MySQL client and log into the MYSQL server.
-
Create and Select Database: First create a database using a new SQL script tab:
CREATE DATABASE rent_a_car;
Then switch to the newly created database:
USE rent_a_car;
- Import the SQL Schema File: If using MySQL Workbench, click on
File
>Open SQL Script...
and select thecreatedb.sql
file. Move to the next step.
Otherwise, execute the SQL commands in the provided createdb.sql
file to create the tables as such:
mysql -u <username> -p rent_a_car < path/to/createdb.sql
Ensure that you replace <username>
with your MySQL username and path/to/createdb.sql
with the path to the downloaded createdb.sql
file.
- Import Sample Data into Tables: If using MySQL Workbench (recommended), follow the following steps to import sample data into tables.
Right-click on the target table name in the "Schemas" panel and select the Table Data Import Wizard
option. Select the sample data CSV file and import them into the table you want to import the sample data into. Repeat for all sample data CSV files for each table.
Alternatively, use these steps.
If using MySQL Workbench (recommended), follow these steps:
-
Open the SQL Query File: Click on
File
>Open SQL Script...
and select the downloaded SQL file containing the desired test queries. -
Execute the Test Queries: Finally, execute the selected test queries and review the results in the "Results Grid" at the bottom of the MySQL Workbench window.
Otherwise, use the source
command or direct SQL execution to run your test queries. For example:
source path/to/test_query.sql;
Replace path/to/test_query.sql
with the path to the downloaded SQL file containing the desired test queries. Alternatively, you can copy the queries directly into the MySQL client and execute them.
We generated the production dataset using a combination of synthetic data and cleaned-up real data. The data is sourced from vehicles.csv
(downloaded from Kaggle) and we made several enrichments using the Faker
library to create realistic User and Car Owner profiles, as well as detailed car listings and reviews.
- Loading and Cleaning Data:
- Raw data loaded from
vehicles.csv
. - Missing values filled using randomly sampled values from the non-missing data or generated using specific rules.
- Additional columns are populated with synthetic data to make sure the data is complete, and there are no
NaN
,NULL
orNone
values.
- Raw data loaded from
- Data Transformation:
- Dates generated within a specified range for User, Owner, Rentals tables.
- Descriptions & other text fields generated using the Faker library.
- Non-ASCII characters handled appropriately (manual filtering).
- Data Export:
- The cleaned & enriched data is saved into multiple CSV files representing different tables in the database, then imported onto our MySQL Workbench setup.
You can find all our production data in CSV format here
To populate your database with the production dataset, follow these steps:
- Setup a Python Environment and Install the following libraries:
pip install pandas numpy faker
- Run ALL CELLS in the provided Jupyter Notebook
My Production Database.ipynb
found here to generate and clean the data. This notebook will output the following CSV files:
prod_cars_table.csv
hereprod_users_table.csv
hereprod_owners_table.csv
hereprod_rentals_table.csv
hereprod_listings_table.csv
hereprod_favorites_table.csv
hereprod_states_table.csv
hereprod_reviews_table.csv
here
NOTE: due to randomness we introduced into the dataset, we will have different values in the User, Owner, Reviews, Rentals tables for each run of the notebook. It is crucial all cells are run one-by-one to ensure no discrepancy between Foreign keys in the data.
- Import CSV Files into MySQL Database Using MySQL Workbench. For each CSV file, follow these steps:
- Create Tables & Constraints using the script here
- Follow the same steps from Step 1: Set Up the MySQL Database, already covered in our Sample Data loading steps.
- Clone the project and install dependencies:
- cd into
frontend
- run
npm install
- run
npm start
The application we are developing for our project currently contains a login/registration page and displays listings.
- Login Page:
src/pages/LoginPage.tsx
- Register Page:
src/pages/RegisterPage.tsx
- Owner Login Page:
src/pages/OwnerLoginPage.tsx
- Owner Main Page:
src/pages/OwnerMainPage.tsx
- Authentication Service:
src/services/authService.ts
- Authentication Context:
src/context/AuthContext.tsx
- Auth Router:
src/routes/authRouter.js
- Auth Controller:
src/controllers/authController.js
- Search Page:
src/pages/SearchPage.tsx
- Listing Service:
src/services/listingService.ts
- Advanced Search Component:
src/components/AdvancedSearch.tsx
- Listing Card Component:
src/components/ListingCard.tsx
- Favorites Page:
src/pages/FavouritesPage.tsx
- Search Page:
src/pages/SearchPage.tsx
- User Service:
src/services/userService.ts
- Favourite Router:
src/routes/favouriteRouter.js
- Favourite Controller:
src/controllers/favouriteController.js