' \
+ for movie in categorized_data['Yet to Watch']))
# Attach the HTML email body
message.attach(MIMEText(html_content, 'html'))
From 5a9f3f4f14ab1eaf5210b62594bb41c87a29eb2e Mon Sep 17 00:00:00 2001
From: rishi2019194 <58341663+rishi2019194@users.noreply.github.com>
Date: Sat, 14 Oct 2023 21:55:49 -0400
Subject: [PATCH 2/7] Added genre tags in the email notifier
---
src/recommenderapp/utils.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/recommenderapp/utils.py b/src/recommenderapp/utils.py
index 9cb70fc33..e94becbc6 100644
--- a/src/recommenderapp/utils.py
+++ b/src/recommenderapp/utils.py
@@ -2,14 +2,18 @@
import logging
import smtplib
-import pandas as pd
from smtplib import SMTPException
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
+import pandas as pd
import constants as c
def create_colored_tags(genres):
+ """
+ Utitilty function to create colored tags for different
+ movie genres
+ """
# Define colors for specific genres
genre_colors = {
'Musical': '#FF1493', # DeepPink
@@ -35,10 +39,10 @@ def create_colored_tags(genres):
}
tags = []
for genre in genres:
- color = genre_colors.get(genre, '#CCCCCC') # Default color if not found
- tag = f'{genre}'
- tags.append(tag)
+ color = genre_colors.get(genre, '#CCCCCC') # Default color if not found
+ tag = f'{genre}'
+ tags.append(tag)
return ' '.join(tags)
def beautify_feedback_data(data):
@@ -85,7 +89,6 @@ def send_email_to_user(recipient_email, categorized_data):
message['From'] = sender_email
message['To'] = recipient_email
message['Subject'] = subject
-
# Load the CSV file into a DataFrame
movie_genre_df = pd.read_csv('../../data/movies.csv')
From 02fdc51d1e94568a0e90ceb132fbe8de5cc47208 Mon Sep 17 00:00:00 2001
From: rishi2019194 <58341663+rishi2019194@users.noreply.github.com>
Date: Sat, 14 Oct 2023 22:03:47 -0400
Subject: [PATCH 3/7] refactor the code
---
src/recommenderapp/utils.py | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/src/recommenderapp/utils.py b/src/recommenderapp/utils.py
index e94becbc6..840bd00de 100644
--- a/src/recommenderapp/utils.py
+++ b/src/recommenderapp/utils.py
@@ -69,6 +69,21 @@ def beautify_feedback_data(data):
return categorized_data_dict
+def create_movie_genres(movie_genre_df):
+ """
+ Utility function for creating a dictionary for movie-genres mapping
+ """
+ # Create a dictionary to map movies to their genres
+ movie_to_genres = {}
+
+ # Iterating on all movies to create the map
+ for row in movie_genre_df.iterrows():
+ movie = row[1]['title']
+ genres = row[1]['genres'].split('|')
+ movie_to_genres[movie] = genres
+ return movie_to_genres
+
+
def send_email_to_user(recipient_email, categorized_data):
"""
Utility function to send movie recommendations to user over email
@@ -91,15 +106,8 @@ def send_email_to_user(recipient_email, categorized_data):
message['Subject'] = subject
# Load the CSV file into a DataFrame
movie_genre_df = pd.read_csv('../../data/movies.csv')
-
- # Create a dictionary to map movies to their genres
- movie_to_genres = {}
-
- for row in movie_genre_df.iterrows():
- movie = row[1]['title']
- genres = row[1]['genres'].split('|')
- movie_to_genres[movie] = genres
-
+ # Creating movie-genres map
+ movie_to_genres = create_movie_genres(movie_genre_df)
# Create the email message with HTML content
html_content = c.EMAIL_HTML_CONTENT.format(
'\n'.join(f'
{movie} \
From 00ce51540dcc978002623060ddb88f71a12f5e48 Mon Sep 17 00:00:00 2001
From: rishi2019194 <58341663+rishi2019194@users.noreply.github.com>
Date: Sat, 14 Oct 2023 22:06:12 -0400
Subject: [PATCH 4/7] refactor the code
---
src/recommenderapp/utils.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/recommenderapp/utils.py b/src/recommenderapp/utils.py
index 840bd00de..2bce115af 100644
--- a/src/recommenderapp/utils.py
+++ b/src/recommenderapp/utils.py
@@ -83,7 +83,6 @@ def create_movie_genres(movie_genre_df):
movie_to_genres[movie] = genres
return movie_to_genres
-
def send_email_to_user(recipient_email, categorized_data):
"""
Utility function to send movie recommendations to user over email
From 3841c9b7f35c2b294918228d131d2ee03ee15283 Mon Sep 17 00:00:00 2001
From: rishi2019194 <58341663+rishi2019194@users.noreply.github.com>
Date: Sat, 14 Oct 2023 22:08:07 -0400
Subject: [PATCH 5/7] refactor the code
---
src/recommenderapp/utils.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/recommenderapp/utils.py b/src/recommenderapp/utils.py
index 2bce115af..476072bc7 100644
--- a/src/recommenderapp/utils.py
+++ b/src/recommenderapp/utils.py
@@ -82,7 +82,6 @@ def create_movie_genres(movie_genre_df):
genres = row[1]['genres'].split('|')
movie_to_genres[movie] = genres
return movie_to_genres
-
def send_email_to_user(recipient_email, categorized_data):
"""
Utility function to send movie recommendations to user over email
From da1db469f993d493920b8a2d1a0d5912c2751230 Mon Sep 17 00:00:00 2001
From: ananya173147
Date: Sun, 15 Oct 2023 17:01:43 -0400
Subject: [PATCH 6/7] pylint refactor, UI improve & code cleaning
---
src/recommenderapp/app.py | 16 +-
.../templates/landing_page.html | 215 ++++++------------
2 files changed, 75 insertions(+), 156 deletions(-)
diff --git a/src/recommenderapp/app.py b/src/recommenderapp/app.py
index 1405756ce..59f43f2f5 100644
--- a/src/recommenderapp/app.py
+++ b/src/recommenderapp/app.py
@@ -2,16 +2,18 @@
Module for routing all calls from the frontend
"""
-from utils import send_email_to_user, beautify_feedback_data
-from flask_cors import CORS
+import json
+import sys
+
from flask import Flask, jsonify, render_template, request
+from flask_cors import CORS
from search import Search
-import sys
-import json
+from utils import beautify_feedback_data, send_email_to_user
+
sys.path.append("../../")
+#pylint: disable=wrong-import-position
from src.prediction_scripts.item_based import recommend_for_new_user
-# pylint: disable=wrong-import-position
-# pylint: enable=wrong-import-position
+#pylint: enable=wrong-import-position
app = Flask(__name__)
@@ -69,7 +71,7 @@ def feedback():
@app.route("/sendMail", methods=["POST"])
-def sendMail():
+def send_mail():
"""
Handles user feedback submission and mails the results.
"""
diff --git a/src/recommenderapp/templates/landing_page.html b/src/recommenderapp/templates/landing_page.html
index cf7b884b3..537e95c66 100644
--- a/src/recommenderapp/templates/landing_page.html
+++ b/src/recommenderapp/templates/landing_page.html
@@ -1,177 +1,94 @@
-
+
+
PopcornPicks🍿
-
-
-
-
+
+
+
+
-
-