Skip to content

Commit 65750a7

Browse files
committed
Added Diet Recommendation system with all documentation.
1 parent d16779a commit 65750a7

File tree

8 files changed

+15209
-0
lines changed

8 files changed

+15209
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright (c) 2024 RAMESWAR BISOYI
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
2+
# 🥗 Diet Recommendation System
3+
4+
A simple, interactive diet recommendation system that generates personalized meal plans based on user data, including age, weight, height, activity level, and dietary goals. Perfect for users aiming to maintain, lose, or gain weight with tailored calorie and meal suggestions.
5+
6+
## 📜 Project Overview
7+
8+
This tool helps users get personalized meal recommendations based on their unique health metrics and dietary objectives. It calculates BMI, estimates daily caloric needs, and suggests a daily meal plan to help users stay on track with their nutrition goals.
9+
10+
## 📂 Project Structure
11+
12+
- `diet_recommendation_system.ipynb`: The Jupyter Notebook with the interactive code.
13+
- `requirements.txt`: Contains a list of necessary Python libraries for easy setup.
14+
15+
## 🚀 Features
16+
17+
- **BMI Calculation**: Calculates Body Mass Index based on height and weight.
18+
- **Calorie Estimation**: Recommends daily caloric intake based on activity level and dietary goal.
19+
- **Meal Plan**: Provides a basic meal plan with breakfast, lunch, and dinner.
20+
21+
## 🛠️ Installation
22+
23+
To set up the environment, follow these steps:
24+
25+
1. Clone the repository:
26+
```bash
27+
git clone https://github.com/RB137/diet-recommendation-system.git
28+
cd diet-recommendation-system
29+
```
30+
31+
2. Install dependencies:
32+
```bash
33+
pip install -r requirements.txt
34+
```
35+
36+
## 📚 Dependencies
37+
38+
- **pandas** 📊 - For data handling and manipulation.
39+
40+
Install it with:
41+
```bash
42+
pip install pandas
43+
```
44+
45+
## ⚙️ How to Use
46+
47+
1. Open the `diet_recommendation_system.ipynb` file in Jupyter Notebook.
48+
2. Run the cells in sequence.
49+
3. Input your age, weight, height, activity level, and dietary goal when prompted.
50+
4. View your personalized BMI, caloric needs, and meal plan.
51+
52+
## 📝 Example Usage
53+
54+
1. **Age**: `25`
55+
2. **Weight (kg)**: `70`
56+
3. **Height (cm)**: `175`
57+
4. **Activity Level**: `medium`
58+
5. **Goal**: `maintain`
59+
60+
Your meal plan will be displayed based on the input data.
61+
62+
## 💡 Future Improvements
63+
64+
- Adding a more detailed meal database for diverse options.
65+
- Customizing based on dietary restrictions like vegan, gluten-free, etc.
66+
- Integrating API for more dynamic meal recommendations.
67+
68+
## 🤝 Contributing
69+
70+
Contributions are welcome! Please fork the repository and create a pull request with your improvements or suggestions.
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "e51b3661-7552-4625-a1a2-f8a53cdbda54",
6+
"metadata": {},
7+
"source": [
8+
"# Diet Recommendation System (Basic Version)"
9+
]
10+
},
11+
{
12+
"cell_type": "markdown",
13+
"id": "5918a4e1-c0f0-46b1-8b63-6e25e0816620",
14+
"metadata": {},
15+
"source": [
16+
"# Install necessary libraries"
17+
]
18+
},
19+
{
20+
"cell_type": "code",
21+
"execution_count": 7,
22+
"id": "bfd7cc27-4a1d-4aac-81fe-eac8f21df9ef",
23+
"metadata": {},
24+
"outputs": [
25+
{
26+
"name": "stdout",
27+
"output_type": "stream",
28+
"text": [
29+
"Requirement already satisfied: pandas in c:\\users\\rameswar bisoyi\\anaconda3\\lib\\site-packages (2.2.2)\n",
30+
"Requirement already satisfied: numpy>=1.26.0 in c:\\users\\rameswar bisoyi\\anaconda3\\lib\\site-packages (from pandas) (1.26.4)\n",
31+
"Requirement already satisfied: python-dateutil>=2.8.2 in c:\\users\\rameswar bisoyi\\anaconda3\\lib\\site-packages (from pandas) (2.9.0.post0)\n",
32+
"Requirement already satisfied: pytz>=2020.1 in c:\\users\\rameswar bisoyi\\anaconda3\\lib\\site-packages (from pandas) (2024.1)\n",
33+
"Requirement already satisfied: tzdata>=2022.7 in c:\\users\\rameswar bisoyi\\anaconda3\\lib\\site-packages (from pandas) (2023.3)\n",
34+
"Requirement already satisfied: six>=1.5 in c:\\users\\rameswar bisoyi\\anaconda3\\lib\\site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)\n"
35+
]
36+
}
37+
],
38+
"source": [
39+
"!pip install pandas\n",
40+
"\n",
41+
"import pandas as pd"
42+
]
43+
},
44+
{
45+
"cell_type": "markdown",
46+
"id": "495edbf2-870d-403b-a35c-504f505630cd",
47+
"metadata": {},
48+
"source": [
49+
"# Function to get basic diet recommendations"
50+
]
51+
},
52+
{
53+
"cell_type": "code",
54+
"execution_count": 9,
55+
"id": "b21d9cf3-df1a-4376-90f5-9596a0f31d18",
56+
"metadata": {},
57+
"outputs": [],
58+
"source": [
59+
"def get_diet_recommendation(age, weight, height, activity_level, goal):\n",
60+
" # Basic calculations\n",
61+
" bmi = weight / (height / 100) ** 2\n",
62+
" calories_needed = 0\n",
63+
"\n",
64+
" # Determine calorie needs based on activity level\n",
65+
" if activity_level == 'low':\n",
66+
" calories_needed = 2000 if goal == 'maintain' else (1800 if goal == 'lose' else 2200)\n",
67+
" elif activity_level == 'medium':\n",
68+
" calories_needed = 2200 if goal == 'maintain' else (2000 if goal == 'lose' else 2400)\n",
69+
" elif activity_level == 'high':\n",
70+
" calories_needed = 2500 if goal == 'maintain' else (2300 if goal == 'lose' else 2700)\n",
71+
"\n",
72+
" # Basic diet recommendation\n",
73+
" diet_plan = {\n",
74+
" 'Breakfast': f'Oats with fruits and nuts - {calories_needed * 0.3:.0f} cal',\n",
75+
" 'Lunch': f'Grilled chicken with vegetables - {calories_needed * 0.4:.0f} cal',\n",
76+
" 'Dinner': f'Salad with chickpeas and avocado - {calories_needed * 0.3:.0f} cal'\n",
77+
" }\n",
78+
"\n",
79+
" return {\n",
80+
" 'BMI': round(bmi, 2),\n",
81+
" 'Calories Needed': calories_needed,\n",
82+
" 'Diet Plan': diet_plan\n",
83+
" }\n"
84+
]
85+
},
86+
{
87+
"cell_type": "markdown",
88+
"id": "b1f6fce0-1de5-4f8a-a9ed-609a6ada2da3",
89+
"metadata": {},
90+
"source": [
91+
"# Input user information"
92+
]
93+
},
94+
{
95+
"cell_type": "code",
96+
"execution_count": 15,
97+
"id": "0c51a088-cf5b-45a6-ad3e-7260f3d7ca4a",
98+
"metadata": {},
99+
"outputs": [
100+
{
101+
"name": "stdout",
102+
"output_type": "stream",
103+
"text": [
104+
"Enter age: 20\n",
105+
"Enter weight in kg: 59\n",
106+
"Enter height in cm: 172\n",
107+
"Enter activity level (low, medium, high): medium\n",
108+
"Enter your goal (maintain, lose, gain): gain\n"
109+
]
110+
}
111+
],
112+
"source": [
113+
"age = int(input(\"Enter age: \"))\n",
114+
"weight = float(input(\"Enter weight in kg: \"))\n",
115+
"height = float(input(\"Enter height in cm: \"))\n",
116+
"activity_level = input(\"Enter activity level (low, medium, high): \").lower()\n",
117+
"goal = input(\"Enter your goal (maintain, lose, gain): \").lower()\n",
118+
"\n",
119+
"# Get diet recommendation\n",
120+
"recommendation = get_diet_recommendation(age, weight, height, activity_level, goal)"
121+
]
122+
},
123+
{
124+
"cell_type": "markdown",
125+
"id": "2c119676-3b1d-4929-ba0d-d3da08cf6297",
126+
"metadata": {},
127+
"source": [
128+
"# Display result"
129+
]
130+
},
131+
{
132+
"cell_type": "code",
133+
"execution_count": 18,
134+
"id": "ebeb1765-a75f-4e81-b882-ea76c1efde5f",
135+
"metadata": {},
136+
"outputs": [
137+
{
138+
"name": "stdout",
139+
"output_type": "stream",
140+
"text": [
141+
"\n",
142+
"Your Diet Recommendation:\n",
143+
"BMI: 19.94\n",
144+
"Calories Needed: 2400\n",
145+
"Meal Plan:\n",
146+
"Breakfast: Oats with fruits and nuts - 720 cal\n",
147+
"Lunch: Grilled chicken with vegetables - 960 cal\n",
148+
"Dinner: Salad with chickpeas and avocado - 720 cal\n"
149+
]
150+
}
151+
],
152+
"source": [
153+
"print(\"\\nYour Diet Recommendation:\")\n",
154+
"print(f\"BMI: {recommendation['BMI']}\")\n",
155+
"print(f\"Calories Needed: {recommendation['Calories Needed']}\")\n",
156+
"print(\"Meal Plan:\")\n",
157+
"for meal, details in recommendation['Diet Plan'].items():\n",
158+
" print(f\"{meal}: {details}\")\n"
159+
]
160+
},
161+
{
162+
"cell_type": "code",
163+
"execution_count": null,
164+
"id": "e2208375-2574-4696-9320-601c78fa3ba7",
165+
"metadata": {},
166+
"outputs": [],
167+
"source": []
168+
}
169+
],
170+
"metadata": {
171+
"kernelspec": {
172+
"display_name": "base",
173+
"language": "python",
174+
"name": "python3"
175+
},
176+
"language_info": {
177+
"codemirror_mode": {
178+
"name": "ipython",
179+
"version": 3
180+
},
181+
"file_extension": ".py",
182+
"mimetype": "text/x-python",
183+
"name": "python",
184+
"nbconvert_exporter": "python",
185+
"pygments_lexer": "ipython3",
186+
"version": "3.12.4"
187+
}
188+
},
189+
"nbformat": 4,
190+
"nbformat_minor": 5
191+
}

0 commit comments

Comments
 (0)