0% found this document useful (0 votes)
3 views

seedbmsreport (1)

The Personalized Diet Recommendation System project report details the development of a platform designed to create customized diet plans based on individual health needs and preferences using a Database Management System (DBMS). The system utilizes SQL for managing user data and dynamically adjusts meal recommendations in real-time as users modify their inputs. The report outlines the methodology, software and hardware requirements, and emphasizes the potential for future enhancements through AI integration and wearable device compatibility.

Uploaded by

herogodknows
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

seedbmsreport (1)

The Personalized Diet Recommendation System project report details the development of a platform designed to create customized diet plans based on individual health needs and preferences using a Database Management System (DBMS). The system utilizes SQL for managing user data and dynamically adjusts meal recommendations in real-time as users modify their inputs. The report outlines the methodology, software and hardware requirements, and emphasizes the potential for future enhancements through AI integration and wearable device compatibility.

Uploaded by

herogodknows
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

1

RV COLLEGE OF ENGINEERING®, BENGALURU-560059


(Autonomous Institution Affiliated to VTU, Belagavi)

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

PERSONALISED DIET RECOMMENDATION SYSTEM

Project Report
Submitted by

01 MANAS AGGARWAL 1RV22CS102


02 KHUSH LORIYA 1RV22CS083
03 KAVYA GUPTA 1RV22CS082

in partial fulfillment for the requirement of 5th Semester


DATABASE MANAGEMENT SYSTEMS (CD252IA)

Under the Guidance of

Prof Dr Suma B, Computer Science Engineering, R.V College


of Engineering.

Academic Year 2024 - 2025


2

RV COLLEGE OF ENGINEERING®, BENGALURU 560059


(Autonomous Institution Affiliated to VTU, Belagavi)

DEPARTMENT OF COMPUTER SCIENCE AND


ENGINEERING

CERTIFICATE

Certified that the project work titled Personalized Diet Recommendation System, is carried out
by Manas Aggarwal(1RV22CS102), Kavya Gupta(1RV22CS082), Khush Loriya (1RV22CS083),
who are bonafide students of R. V. College of Engineering, Bengaluru, in partial fulfillment of the
curriculum requirement of 5th Semester Database Management Systems(CD252IA) Laboratory
Mini Project during the academic year 2024-2025. It is certified that all corrections/suggestions
indicated for the internal Assessment have been incorporated in the report. The report has been
approved as it satisfies the academic requirements in all respect laboratory mini-project work
prescribed by the institution.

Signature of Faculty In-charge Head of the Department


Dept. of CSE, RVCE

External Examination

Name of Examiners Signature with date

2
3

Table of Contents

Page No.
Acknowledgement 4

Abstract 5

List of Figures 8
1. Introduction 9
1.1 Objective
1.2 Scope

2. Software Requirement Specification 11


2.1 Software Requirements
2.2 Hardware Requirements
2.3 Functional Requirements

3. Entity Relationship Diagram 13

4. Detailed Design 15
4.1 DFD Level 0
4.2 DFD Level 1

5. Relational Schema and Normalization 18

6. Normalization 21

7. Security and Validation 28

8. Conclusion 29

9. References 30

108.. Appendix 31
4

Acknowledgement

We would like to express our sincere gratitude to K.N. Subramanya, Principal of R.V. College of
Engineering, for providing us with the opportunity and resources to work on our project,
Personalized Diet Recommendation System. Their encouragement and support have been invaluable
in shaping this research.

We extend our heartfelt thanks to Dr. Shanta Rangaswamy, Head of the Department of Computer
Science Engineering, for their continuous guidance and insightful feedback, which helped us refine
our ideas and enhance the technical aspects of our project.

We are deeply grateful to Dr. M.V Renukadevi , Dean Academics, for their motivation and for
fostering an academic environment that encourages innovation and research. Their support has been
instrumental in the successful completion of this project.

Lastly, we would like to thank Dr Suma B, faculty members and mentors for their unwavering
support, valuable suggestions, and technical guidance throughout the project. Their expertise and
constructive feedback have played a crucial role in our learning process and in making this project a
success.

Thank you all for your constant encouragement and support.


5

Abstract

The Personalized Diet Recommendation System is an advanced platform designed to create


customized diet plans that cater to an individual's unique health conditions, dietary preferences, and
nutritional objectives. As awareness grows around the critical role of nutrition in overall health, the
demand for personalized dietary guidance increases, moving beyond one-size-fits-all meal plans.
This system utilizes a Database Management System (DBMS) like SQL to effectively store and
manage user-specific data, including health metrics, activity levels, and dietary restrictions. Through
the use of structured queries, it retrieves and analyzes relevant food information, ensuring that diet
suggestions are precisely tailored to each user's needs. Unlike traditional static diet plans, this system
adjusts dynamically in response to users' changing health goals and lifestyle shifts, offering a more
adaptable and effective approach to nutritional management.

Central to the system is an extensive food database containing detailed nutritional profiles of various
food items, categorized by factors such as caloric content, macronutrient composition, and dietary
preferences (e.g., vegetarian, gluten-free, low-carb). The Recommendation Engine employs SQL
queries to process user data, generating diet plans that align with individual dietary requirements.
This data-driven method ensures that each meal suggestion is balanced and nutritious. Additionally,
the system can accommodate further constraints, such as allergies and medical conditions (e.g.,
diabetes, hypertension), enabling highly specialized recommendations. This degree of
personalization enhances user engagement, providing meal plans that not only support health goals
but also resonate with personal food preferences and cultural practices.

A standout feature of the system is its capability for dynamic querying, allowing diet plans to update
in real-time as users modify inputs like weight, physical activity levels, or dietary preferences. When
a user updates their profile, the system recalculates nutritional needs and adjusts recommendations
accordingly. This responsiveness makes the system interactive and user-centric. Future iterations of
the system could incorporate machine learning algorithms or predictive analytics to refine
recommendations based on past eating patterns and the effectiveness of previous diet plans. With its
capacity to deliver scientifically informed, real-time dietary advice, the Personalized Diet
Recommendation System has the potential to transform personal nutrition management, promoting
healthier lifestyles through technology-driven solutions.
6

METHODOLOGY
The development of the Personalized Diet Recommendation System follows a structured approach,
integrating database management, SQL-based querying, and a recommendation logic that
personalizes diet plans for users. The methodology can be divided into the following stages:

1. User Data Collection and Storage:


○ Users create profiles by inputting personal information such as age, gender, height,
weight, activity level, and specific health conditions.
○ The database stores user preferences, including vegetarian/non-vegetarian choices,
food allergies, and health goals (e.g., weight loss, muscle gain).
○ SQL tables are used to store structured user data, ensuring efficient retrieval and
updates.
2. Food Database Development:
○ A structured food database is designed, containing food items with details such as
calorie content, macronutrient breakdown (carbohydrates, proteins, fats), and dietary
classifications.
○ Each food item is categorized based on its suitability for specific health conditions
(e.g., low-sugar for diabetes, high-protein for muscle gain).
○ SQL queries enable filtering and retrieving food items based on user-specific
constraints.
3. Recommendation Engine Implementation:
○ The system executes SQL queries to match user data with suitable food options,
generating a personalized meal plan.
○ Dynamic SQL queries adjust meal recommendations based on user modifications,
such as changes in weight or activity level.
○ Additional filtering ensures that recommended foods align with user preferences and
medical restrictions.
4. User Interaction and Real-Time Updates:
○ A front-end interface (web or mobile application) allows users to view, modify, and
track their diet plans.
○ Users receive updated diet recommendations based on real-time changes in their
health data.
○ Future integration with machine learning models could enhance recommendations
by analyzing historical user behavior and diet adherence.
7

RESULT

The Personalized Diet Recommendation System effectively delivers customized meal plans that align
with users’ nutritional needs, health conditions, and personal preferences. By leveraging SQL-based
dynamic querying, the system ensures that diet recommendations are continuously updated in real-
time based on user input, enhancing both adaptability and precision. Initial testing confirms that users
receive highly relevant diet plans tailored to their activity levels, medical constraints, and dietary
goals, leading to greater adherence and long-term sustainability in healthy eating habits.
A key insight from the implementation is that users value interactive meal planning, where they can
modify dietary goals and receive immediate updates to their recommendations. This interactivity not
only increases engagement but also empowers users to take an active role in managing their nutrition.
Additionally, the structured food database ensures that meal suggestions are grounded in
scientifically validated nutritional information, fostering informed and health-conscious decision-
making. The system also demonstrates strong scalability, as it can integrate an expanded food
database, incorporate additional health parameters, and refine recommendations to accommodate a
wider user base.
Future improvements could involve integrating AI-driven predictive analytics to personalize diet
recommendations further based on users’ eating habits and progress over time. Additionally,
connecting the system with wearable devices (e.g., fitness trackers, smartwatches) could enable
continuous monitoring of key health metrics, allowing for even more precise and real-time dietary
adjustments. Overall, the Personalized Diet Recommendation System emerges as a powerful, user-
centric solution that leverages technology to promote balanced, sustainable, and personalized
nutrition management.
8

List of Figures

FIG 1- ER DIAGRAM…………………………………………………………………..……………13
FIG2: DFD LEVEL 0…………………………………………………...…………………………...14
FIG 3: DFD Level 1…………………………………..………………..…….……………………...14
FIG 4: RELATIONAL SCHEMA……………………..…………………...……………………….15
NORMALIZATION
FIG- 5:USER TABLE (1NF)..................................................................................................16
FIG-6: ACTIVITY LOG (1NF)..............................................................................................16
FIG-7: PROGRESS TRACKING (1NF)................................................................................16
FIG-8: FOOD TABLE (1NF)................................................................................................17
FIG-9: MEAL PLANS (1NF)................................................................................................17
FIG-10: MEAL PLAN FOOD (1NF)....................................................................................17
FIG-11: USER MEAL PLANS (1NF)...................................................................................18
FIG-12: USER TABLE (2NF)..............................................................................................18
FIG-13: ACTIVITY LOG (2NF)..........................................................................................18
FIG-14: PROGRESS TRACKING (2NF)............................................................................18
FIG-15: FOOD TABLE (2NF) ...........................................................................................19
FIG-16: MEAL PLANS (2NF) ...........................................................................................19
FIG-17: USER TABLE (3NF) ............................................................................................19
FIG-18: ACTIVITY LOG (3NF) ........................................................................................20
FIG-19: PROGRESS TRACKING (3NF) ……...................................................................20
FIG-20: FOOD TABLE (3NF) ..........................................................................................21
FIG-21: MEAL PLANS (3NF) ...........................................................................................21
FIG-22: USER MEAL PLANS (3NF) ................................................................................22
FIG-23: FOOD TABLE (BCNF)........................................................................................22
FIG-24: DIET AND FITNESS TRACKER…………………………………………….……….25
FIG-25: SIGNUP…………………………………………………………………………….……25
FIG-26: DIET RECOMMENDATION………………………………………………..………..26
FIG-27: LOG ACTIVITY……………………………………………………………………...…26
9

1. INTRODUCTION

A Personalized Diet Recommendation System provides customized diet plans based on


individual health needs and preferences, using a DBMS (like SQL) to manage user data and dietary
information.

· User Data Storage: Stores user profiles with personal details, health conditions, and
dietary goals in the database.

· Food Database: Contains a comprehensive list of food items, including nutritional values
and categorizations (e.g., vegetarian, gluten-free).

· Recommendation Engine: Uses SQL queries to recommend meals based on user profiles
and nutritional needs.

· Dynamic Querying: Updates diet plans in real-time by adjusting SQL queries as users
modify their goals, activity, or preferences.

1.1 Objective

The objective of a personalized diet recommendation system is to provide customized and


scientifically-backed dietary suggestions tailored to an individual’s unique health needs, preferences,
and goals. The system aims to optimize nutrition by analyzing various factors such as age, gender,
medical history, activity level, and food preferences, in order to recommend meals that promote
overall health, weight management, or specific health outcomes. By leveraging advanced algorithms
and a robust database management system (DBMS), the goal is to offer dynamic, real-time
adjustments to diet plans based on user feedback and evolving health data, ensuring continuous
improvement in dietary adherence and outcomes.

1.2 Scope

The scope for personalized diet recommendation systems is highly promising, driven by
advancements in technology and data analytics, which will enable more precise and adaptive
solutions. Key areas of growth include:
10

1. AI and Machine Learning Integration: Advanced algorithms will allow systems to learn
from user behavior and health data over time, offering increasingly accurate and personalized
recommendations.

2. Wearable Device Integration: Future systems will integrate seamlessly with wearable health
devices, enabling real-time tracking of physical activity, sleep, and health metrics to
continuously refine diet recommendations.

3. Personalized Genetic Data: As genetic testing becomes more accessible, systems could
incorporate genetic information to provide diet advice based on an individual's genetic
profile, enhancing the effectiveness of nutrition plans.

4. Holistic Health Approach: Personalized diet systems will evolve to consider mental health,
stress, and other psychological factors, providing a more comprehensive wellness plan.

5. Global Food Database Expansion: With the growth of global food databases, systems will
offer a wider range of culturally relevant and locally available foods, improving accessibility
and user engagement.

These advancements will lead to highly customized, adaptive, and sustainable diet recommendations,
greatly improving health management and nutrition outcomes.
11

2. SOFTWARE RECOMMENDATION SYSTEM

2.1 Software Requirements


a. OS and Development
● OS: Windows, macOS, Linux, Android, iOS.
● Backend: Python (Flask/Django), Node.js, Java.
● Frontend: React, Angular, Vue.js.
● Mobile Apps: Kotlin (Android), Swift (iOS), Flutter/React Native.
b. Database & APIs
● Databases: MySQL, PostgreSQL, MongoDB.
● APIs: USDA, Nutritionix, Fitbit API.
● Libraries: TensorFlow, PyTorch, Pandas, Scikit-learn.
c. Security
● OAuth2, JWT for login and session management.
● SSL/TLS encryption.

2.2 Hardware Requirements


a. Server-side
● CPU: Intel Xeon, AMD EPYC.
● RAM: Minimum 16 GB.
● Storage: 500 GB SSD.
● Network: High-speed internet.
b. Client-side
● Desktop: 2 GB RAM, Intel Core i3.
● Mobile: Android 8+, iOS 12+.
c. Additional (optional)
● GPU: NVIDIA GTX 1080 Ti (for deep learning).
● IoT devices: Wearables for activity tracking.
12

2.3 Functional Requirements


a. User Management
● User registration, profile creation, and session management.
b. Personalized Diet Plan
● Generate diet plans based on user details (age, gender, goals, etc.).
● Suggest meals with nutritional info and recipes.
c. Food Logging & Tracking
● Allow users to log food intake (manual/barcode) and activity.
● Integration with wearable devices.
d. Progress Monitoring
● Display progress (weight, calories, activity) via charts.
● Provide reminders and notifications.
e. Admin Panel
● Manage user data, food database, and system performance.
f. Security & Privacy
● Encrypt sensitive data and comply with privacy regulations (e.g., GDPR).
13

3. ENTITY RELATIONSHIP DIAGRAM

FIG 1- ER DIAGRAM
Explanation of the ER Diagram for a Personalized Diet and Fitness Tracking System
The ER diagram represents a structured database model for tracking users’ diet and fitness activities.
Below is a complete breakdown of each entity, attribute, and relationship.
Entities and Attributes
1. User (Primary Entity)
• Primary Key: user_id
• Attributes:
• user_id (PK): A unique identifier for each user.
• name: The full name of the user.
• age: The user’s age in years.
• gender: The gender of the user (Male/Female/Other).
• weight: The current weight of the user in kilograms.
• height: The height of the user in centimeters.
14

• activity level: Describes how active the user is (e.g., sedentary, moderate, active).
• health condition: Stores any pre-existing health conditions that may affect dietary or
fitness recommendations.
2. Activity Log
• Primary Key: logid
• Attributes:
• logid (PK): A unique identifier for each logged activity.
• activity type: The type of physical activity (e.g., running, cycling, weightlifting).
• duration: The duration of the activity in minutes.
• calories burnt: The number of calories burned during the activity.
• date: The date when the activity was logged.
3. Progress Tracking
• Primary Key: progress_id
• Attributes:
• progress_id (PK): A unique identifier for each progress record.
• date: The date when the progress was recorded.
• weight: The user’s recorded weight at that point in time.
• BMI: The Body Mass Index (calculated based on weight and height).
4. Meal Plans
• Primary Key: meal_id
• Attributes:
• meal_id (PK): A unique identifier for each meal plan.
• meal name: The name of the meal (e.g., breakfast, lunch, post-workout meal).
• date: The date when the meal plan is scheduled.
• meal time: The time of the day when the meal is planned.
• nutritional goals: The dietary purpose of the meal (e.g., weight gain, weight loss,
muscle building).
5. Food
• Primary Key: food_id
• Attributes:
• food_id (PK): A unique identifier for each food item.
• food name: The name of the food (e.g., chicken breast, banana, brown rice).
• calories: The energy content of the food (measured in kcal).
• carbs: The carbohydrate content (in grams).
• protein: The protein content (in grams).
• fat: The fat content (in grams).
• vitamins: A list of vitamins present in the food.
• minerals: A list of minerals present in the food.
• category: The type of food (e.g., fruit, vegetable, protein source).
Relationships and Cardinalities
1. LOGS (User → Activity Log) [1:N]
• Explanation: A user can log multiple activities, but each activity log belongs to only
one user.
• Cardinality: One-to-Many (1:N)
• Example: A user may log a morning run, an evening gym session, and a cycling
activity, each stored as a separate entry in the activity log.
2. TRACKS (User → Progress Tracking) [1:N]
• Explanation: A user can have multiple progress tracking records over time, but each
record belongs to only one user.
• Cardinality: One-to-Many (1:N)
• Example: A user may track their weight and BMI weekly, resulting in multiple
progress tracking records.
3. ASSIGNS (User → Meal Plans) [1:N]
15

• Explanation: A user can have multiple assigned meal plans, but each meal plan is
associated with only one user.
• Cardinality: One-to-Many (1:N)
• Example: A user may have a “weight loss meal plan” for one week and a “muscle
gain meal plan” for another week.
4. CONTAINS (Meal Plans → Food) [M:N]
• Explanation: A meal plan contains multiple food items, and a food item can be
included in multiple meal plans.
• Cardinality: Many-to-Many (M:N)
• Example: A breakfast meal plan might contain eggs, toast, and milk, while eggs may
also be part of a high-protein lunch meal plan.
Summary
This ER diagram models a personalized diet and fitness tracking system, capturing essential
components such as users, their activity logs, progress tracking, meal plans, and food items. The
relationships ensure proper data organization, enabling efficient tracking of fitness activities, diet
plans, and progress towards health goals

4. DETAILED DESIGN

4.1 DFD LEVEL 0

FIG-2: DFD LEVEL 0


16

4.2 DFD LEVEL 1

FIG 3: DFD LEVEL 1


The DFD represents the flow of data within the Personalized Diet Recommendation System, showing
how information moves between users, processes, and databases.
1. Levels of DFD
• Level 0 (Context Diagram): Shows the system as a single entity interacting with
external users.
• Level 1 DFD: Breaks down the system into major processes and data stores.
• Level 2 DFD: Provides a more detailed breakdown of each process.
Level 0: Context Diagram
At the highest level, the system interacts with two main external entities:
1. User (provides personal details, goals, and logs activities)
2. Admin (manages the database and system settings)
Major Data Flows:
• User → System: Provides details such as weight, height, dietary preferences, and
activity logs.
• System → User: Generates personalized diet plans and progress reports.
• Admin → System: Updates food database, modifies nutritional rules.
• System → Admin: Provides user insights, reports, and logs.
Level 1: Major Processes
The system is broken down into key functional components:
17

1. User Registration & Profile Management


• User submits details (name, age, weight, height, activity level, health conditions).
• System stores the data in the User Database.
2. Diet Plan Generation
• System analyzes user data + food database.
• Generates a personalized diet plan based on user goals (e.g., weight loss, muscle gain).
• Stores diet plan details in the Meal Plans Database.
3. Activity Logging & Progress Tracking
• User logs activities (e.g., workout, walking).
• System updates Activity Log and calculates calories burnt.
• Tracks weight & BMI changes in the Progress Database.
4. Food & Nutrition Database Management
• Admin updates the Food Database (calories, macros, vitamins).
• Ensures accurate meal recommendations.
5. Diet Recommendation & Report Generation
• System generates weekly/monthly reports on:
• Diet effectiveness
• Progress trends
• Suggested modifications
Level 2: Detailed Data Flow Breakdown
Each process is broken into sub-processes:
1. User Registration
• Input: Name, age, weight, height, dietary preferences.
• Process: Validates data and stores it in the User Database.
• Output: Confirmation of successful registration.
2. Diet Plan Assignment
• Input: User profile data + food database.
• Process: Uses AI-based meal planning to generate personalized plans.
• Output: Recommended meal plan.
3. Progress Tracking
• Input: Weight updates, activity logs.
• Process: System calculates BMI & calories burnt.
• Output: Displays progress and suggests modifications.
4. Food Database Management
• Input: Admin enters new food items and updates nutrition values.
• Process: Stores data in the Food Database.
• Output: Updated nutritional information for accurate meal planning.
Conclusion
This Data Flow Diagram (DFD) illustrates how data flows efficiently through the Personalized Diet
Recommendation System, ensuring seamless user registration, diet generation, activity tracking, and
progress monitoring.
18

5. RELATIONAL SCHEMA

FIG-4: RELATIONAL SCHEMA


19

Explanation of the Relational Schema:


The Relational Schema defines how data is structured in a relational database for the Personalized
Diet Recommendation System. It outlines tables, attributes, keys, and relationships between them.
Below is a detailed breakdown:
Tables in the Relational Schema
1. User Table
• Primary Key: user_id
• Attributes:
• user_id (PK) – Unique identifier for each user.
• name – Full name of the user.
• age – Age of the user.
• gender – Gender of the user (Male/Female/Other).
• weight – User’s weight (in kg).
• height – User’s height (in cm).
• activity_level – User’s daily activity level (Sedentary, Moderate, Active).
• health_condition – Any pre-existing medical conditions (e.g., Diabetes,
Hypertension).
Relationships:
• Connected to Activity Log, Progress Tracking, and Meal Plans (1:N relationships).
2. Activity Log Table
• Primary Key: log_id
• Foreign Key: user_id (References User Table)
• Attributes:
• log_id (PK) – Unique identifier for each activity log.
• user_id (FK) – User performing the activity.
• activity_type – Type of physical activity (e.g., Running, Yoga).
• duration – Duration of the activity (in minutes).
• calories_burnt – Estimated calories burned.
• date – Date when the activity was logged.
Relationships:
• Each user can have multiple activity logs (1:N).
3. Progress Tracking Table
• Primary Key: progress_id
• Foreign Key: user_id (References User Table)
• Attributes:
• progress_id (PK) – Unique identifier for each progress tracking entry.
• user_id (FK) – User whose progress is tracked.
• date – Date of weight measurement.
• weight – User’s weight on the given date.
• BMI – Body Mass Index calculated from weight and height.
Relationships:
• Each user can have multiple progress records (1:N).
4. Meal Plans Table
• Primary Key: meal_id
• Foreign Key: user_id (References User Table)
• Attributes:
• meal_id (PK) – Unique identifier for the meal plan.
• user_id (FK) – User for whom the meal plan is generated.
• meal_name – Name of the meal (Breakfast, Lunch, Dinner).
• date – Date of meal plan.
• meal_time – Time when the meal should be consumed.
• nutritional_goals – Purpose of the meal (Weight Loss, Muscle Gain, Balanced Diet).
20

Relationships:
• Each user can have multiple meal plans (1:N).
5. Food Table
• Primary Key: food_id
• Attributes:
• food_id (PK) – Unique identifier for each food item.
• food_name – Name of the food (e.g., Chicken, Oats, Almonds).
• calories – Calories per serving.
• carbs – Carbohydrate content (in grams).
• protein – Protein content (in grams).
• fat – Fat content (in grams).
• vitamins – List of vitamins present.
• minerals – List of minerals present.
• category – Category of food (Vegetarian, Non-Vegetarian, Vegan, etc.).
Relationships:
• Connected to Meal Plans (M:N), meaning a meal plan can have multiple food items,
and the same food item can be part of multiple meal plans.
6. Meal Plan Food (Bridge Table)
• Primary Key: Composite Key (meal_id, food_id)
• Foreign Keys:
• meal_id (References Meal Plans Table)
• food_id (References Food Table)
• Attributes:
• quantity – Quantity of food item in grams.
• unit – Measurement unit (grams, ml, pieces).
Relationships:
• Resolves Many-to-Many (M:N) relationship between Meal Plans and Food.
7. User Meal Plans (Bridge Table)
• Primary Key: Composite Key (user_id, meal_id)
• Foreign Keys:
• user_id (References User Table)
• meal_id (References Meal Plans Table)
• Attributes:
• status – Whether the user has followed the meal plan or not.
Relationships: Resolves Many-to-Many (M:N) relationship between Users and Meal Plans.
21

6.NORMALIZATION
FIRST NORMAL FORM(1NF)

FIG- 5:USER TABLE (1NF)

FIG-6: ACTIVITY LOG (1NF)

FIG-7: PROGRESS TRACKING (1NF)


22

FIG-8: FOOD TABLE (1NF)

FIG-9: MEAL PLANS (1NF)

FIG-10: MEAL PLAN FOOD (1NF)


23

FIG-11: USER MEAL PLANS (1NF)

SECOND NORMAL FORM

FIG-12: USER TABLE (2NF)

FIG-13: ACTIVITY LOG (2NF)

FIG-14: PROGRESS TRACKING (2NF)


24

FIG-15: FOOD TABLE (2NF)

FIG-16: MEAL PLANS (2NF)

THIRD NORMAL FORM

FIG-17: USER TABLE (3NF)


25

FIG-18: ACTIVITY LOG (3NF)

FIG-19: PROGRESS TRACKING (3NF)


26

FIG-20: FOOD TABLE (3NF)

FIG-21: MEAL PLANS (3NF)


27

FIG-22: USER MEAL PLANS (3NF)

BCNF

FIG-23: FOOD TABLE (BCNF)


28

7.Security and Validation Document


Security
Objective:
Ensuring that user data is handled securely is vital to protect against unauthorized access, data
breaches, and malicious activities. Proper form security measures safeguard sensitive user
information, like passwords and personal details.
Key Security Practices:
1. Password Hashing:
- Ensure passwords are never stored in plain text. Use strong hashing algorithms such as bcrypt to
store passwords securely.
- Example:
python
import bcrypt
hashed_password = bcrypt.hashpw(password.encode('utf-8'), bcrypt.gensalt()).decode('utf-8')

2. HTTPS:
- Use HTTPS to encrypt data in transit.
- Ensure all form submissions are handled over HTTPS to protect user data from man-in-the-middle
attacks.
3. Cross-Site Request Forgery (CSRF) Protection:
- Use CSRF tokens in all forms that modify data to prevent unauthorized form submissions.
- Example:
python
import secrets
if "csrf_token" not in st.session_state:
st.session_state.csrf_token = secrets.token_hex(16)
Validation
Objective:
Validation ensures that the data entered by the user is correct, preventing errors and ensuring the
integrity of the information submitted. It helps in improving user experience and system reliability.
Types of Validation:
1. Client-Side Validation:
HTML5 Attributes: Use HTML5 attributes such as required, minlength, maxlength, pattern, etc.,
to validate input before it is submitted to the server.
JavaScript: Implement JavaScript for additional validation logic, such as checking password strength
and email format.
2. Server-Side Validation:
- Always validate user data on the server side as a final check to prevent malicious data from
bypassing client-side validation.
- Example: Check if the email already exists in the database.
python
import re
def validate_email(email):
pattern = r"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$"
return re.match(pattern, email)

3. Field-Level Validation:
- Each form field should be validated for correct data types, length constraints, and format.
- Example: Ensure email fields contain @ and a domain name.
This ensures a secure, robust, and user-friendly Diet Recommendation System
29

8. CONCLUSION

A Personalized Diet Recommendation System is a powerful tool that tailors nutrition advice to
individual users based on their specific needs, goals, and preferences. By utilizing detailed user
profiles, such as age, weight, health conditions, and activity levels, along with a comprehensive food
database, this system can provide customized meal plans to help users achieve their health objectives,
whether it's weight loss, muscle gain, or improved overall wellness.
The system offers various features like daily calorie tracking, meal suggestions, progress monitoring,
and integration with wearable devices, ensuring a holistic approach to health management. Moreover,
by leveraging machine learning and data analysis, the system can adapt and refine recommendations
based on user progress and feedback, ensuring that diet plans remain relevant and effective.
From a technical perspective, the system requires a robust architecture with secure user management,
reliable data storage, and seamless integration with APIs for food data and external activity tracking.
It also needs to be scalable, user-friendly, and accessible across various devices and platforms,
ensuring that it can accommodate a diverse user base.
Ultimately, a Personalized Diet Recommendation System not only promotes healthier eating habits
but also empowers users to take control of their health, providing them with the tools and insights
needed to achieve their dietary goals in a sustainable and informed manner.
30

7. REFERENCES

1. https://www.ijert.org/personalized-diet-recommendation-system-using-machine-learning

2. https://sist.sathyabama.ac.in/sist_naac/aqar_2022_2023/documents/1.3.4/b.e-cse-batchno-
120.pdf

3. https://www.irjmets.com/uploadedfiles/paper//issue_4_april_2024/52779/final/fin_irjmets1
713774239.pdf
31

8. APPENDIX

FIG-24: DIET AND FITNESS TRACKER

FIG-25: SIGNUP
32

FIG-26: DIET RECOMMENDATION

FIG-27: LOG ACTIVITY

You might also like