An open API service indexing awesome lists of open source software.

https://github.com/andrew-most-likely/movie-db-cli

A database that leverages MySQL and python to recommend users items that best fit there interests using the cosine similarity equation
https://github.com/andrew-most-likely/movie-db-cli

cli cosine-similarity erdiagram mysql python recomendation-system

Last synced: 10 days ago
JSON representation

A database that leverages MySQL and python to recommend users items that best fit there interests using the cosine similarity equation

Awesome Lists containing this project

README

        

# 🎥 Movie Recommendation CLI App

A simple CLI application built with Python SQLAlchemy MySQL and Tabulate to manage users movies and reviews.
Aditionally it uses collaborative filtering to generate basic movie recommendations using a stored procedure.

![erd](erd.png "Title")

## 📦 Features

- Add new users and movies.
- Search for movies by name.
- Submit movie reviews.
- Generate movie recommendations for a user based on collaborative filtering.
- Clean CLI-driven menu interface.

## 🖥️ Setup Instructions

### 1️⃣ Install Dependencies

First ensure you have Python 3.11 or higher installed.

Then install the required Python libraries:

```bash
pip install sqlalchemy pymysql tabulate
```

### 2️⃣ Setup MySQL Database

Make sure MySQL Server is running.

Use the provided SQL statements (from [Data Base Setup](database_setup.sql)) to:

- Create the movie_db database.
- Create the User, Movie, and Review tables.
- Create the GetRecommendations stored procedure.
- Insert sample data into the database.

### 3️⃣ Configure Database Connection

In the provided [Python Program](movie_cli.py), update the DATABASE_URL with your database credentials:

```python
DATABASE_URL = "mysql+pymysql://:@localhost/movie_db"
```

Example:

```python
DATABASE_URL = "mysql+pymysql://root:12345@localhost/movie_db"
```

## 📚 How to Use the Application

Run the Python script from your terminal:

```bash
python movie_cli.py
```

You'll see a CLI menu:

```
--- Movie CLI ---
1. Add User
2. Add Movie
3. Search Movie
4. Submit Review
5. Get Recommendations
6. Exit
```

- **Add User** — Add a new user to the system.
- **Add Movie** — Add a new movie record.
- **Search Movie** — Search for a movie by name.
- **Submit Review** — Submit a review with a rating for a movie by a user.
- **Get Recommendations** — Get top 5 recommended movies for a user based on other users.
- **Exit** — Exit the application.

## 📝 Notes

- Ratings are on a scale from 1 to 10 when submitting reviews.
- The stored procedure runs a form of Collaborative Filtering for meaningful recommendations.
- Error handling is implemented for database connection and stored procedure execution.

## ✅ Requirements

- Python 3.11
- MySQL Server
- Python Packages:
- sqlalchemy
- pymysql
- tabulate

## 🙏 Big Thanks to...

- [Chompunoot Keeratitechakorn](https://medium.com/@pearl.kee/design-a-simple-product-recommendation-system-using-sql-c78493c296f2)
- I Used her article to help inform my algorithm of choice
- [Vatsal](https://towardsdatascience.com/recommendation-systems-explained-a42fc60591ed/#:~:text=Loosely%20defined%2C%20a%20recommender%20system,Amazon%2C%20Reddit%2C%20Netflix%20etc.)
- I used his python implimentation to inform my formatting
- [Davide Mauri]( )
- I adapted his sql version of the cosine similarity function for this project