seedbmsreport (1)
seedbmsreport (1)
Project Report
Submitted by
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.
External Examination
2
3
Table of Contents
Page No.
Acknowledgement 4
Abstract 5
List of Figures 8
1. Introduction 9
1.1 Objective
1.2 Scope
4. Detailed Design 15
4.1 DFD Level 0
4.2 DFD Level 1
6. Normalization 21
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.
Abstract
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:
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
· 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
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
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
5. RELATIONAL SCHEMA
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)
BCNF
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-25: SIGNUP
32