This project focuses on designing and implementing a relational (SQL) and NoSQL (MongoDB) database, developing API endpoints using FastAPI, and creating a script to fetch and prepare data for machine learning predictions.
We designed a relational database using MYSQL with the following tables:
- Passenger (passenger_id,Name,Sex, SibSp,Parch,TicketId)
- TIckets (TicketId, Passenger_id, Fare,Cabin,Embarked)
- Survivors (SurvivorId, PassengerId, Survived)
Primary and foreign keys were defined to ensure data integrity. The ERD Diagram was created using Lucidchart.
A MongoDB collection was implemented to store unstructured data related to user activity logs.
- Stored Procedure: Automatically updates user transaction history upon a new transaction.
- Trigger: Logs changes whenever a user updates their email.
- FastAPI for API development.
- Create (POST): Add new users, transactions, or products.
- Read (GET): Retrieve data from the database.
- Update (PUT): Modify existing records.
- Delete (DELETE): Remove records from the database.
These operations interact with the MYSQL database .
- Fetch Latest Entry: The script retrieves the most recent entry record using the API.
- Prepare Data for Prediction: The retrieved data is preprocessed.
- ML Model Integration:
- We trained a Logistic Regression Model
- The model predicts whether a passenger survived or not.
- Kevin Kenny Mugisha - SQL and MongoDB Implementation
- Bernice Awinpang Akudbilla – API Development for both SQL and MongoDB
- Steven SHYAKA – Data Fetching & ML Prediction
- Clone the Repository:
git clone https://github.com/KennyKvn001/Database_Design.git cd Database_Design - Set Up MYSQL DB & MongoDB:
- Import the SQL schema.
- Run MongoDB collections.
- Start FastAPI Server:
uvicorn main:app --reload
- Run the Prediction Script:
python fetch_data.py
This project follows best practices for database management, API integration, and machine learning model implementation.
Api endpoint: https://database-design-l3k7.onrender.com/docs/