A locally hosted, hybrid diet recommendation system that generates realistic Indian weekly meal plans using a combination of Content-Based Filtering (CBF) and Collaborative Filtering (CF).
The system calculates BMI, considers dietary goals and activity levels, and produces a 7-day meal plan (2000–2600 kcal/day) tailored to the user.
This application:
- ✅ Runs entirely on localhost
- ✅ Uses Java + Spring Boot (backend)
- ✅ Uses HTML / CSS / JavaScript (frontend)
- ✅ Uses static Indian food datasets
- ✅ Generates weekly diet plans with calendar toggle UI
- ✅ Works fully offline
| Input | Options |
|---|---|
| Height | cm |
| Weight | kg |
| Dietary Goal | Weight Loss, Maintenance, Muscle Gain |
| Dietary Type | Vegetarian, Non-Vegetarian |
| Activity Level | Sedentary, Moderate, Active |
- Preferred foods
- Disliked foods
BMI is calculated using:
BMI = weight (kg) / (height in meters)²
The system categorizes the user into:
- Underweight (BMI < 18.5)
- Normal (18.5 ≤ BMI < 25)
- Overweight (25 ≤ BMI < 30)
- Obese (BMI ≥ 30)
The daily calorie intake is constrained between 2000 kcal – 2600 kcal.
It varies depending on:
- Dietary goal
- Activity level
- BMI category
Example:
| Goal | Calorie Range |
|---|---|
| Weight Loss | ~2000–2200 kcal |
| Maintenance | ~2200–2400 kcal |
| Muscle Gain | ~2400–2600 kcal |
All recommendations reflect realistic Indian eating habits.
Matches foods based on:
- Calories
- Protein
- Carbs
- Fat
- Dietary type
- Meal type (breakfast/lunch/dinner)
Filters only Indian foods and respects veg/non-veg constraints.
- Uses static
user_interaction.csv - Identifies similar user preferences
- Adjusts ranking scores
Final recommendation score:
Final Score = α × (CBF Score) + (1 - α) × (CF Score)
Where α is configurable (e.g., 0.7), ensuring personalization + nutritional accuracy.
The system generates a 7-day meal plan, with each day including:
- 🌅 Breakfast
- 🍛 Lunch
- 🌙 Dinner
Frontend includes:
- Day-based navigation (Mon–Sun)
- Simple clickable tabs
- Dynamically loads meals for selected day
- No page reload required
src/main/java/com/dietapp/
│
├── controller/
│ ├── UserController.java
│ ├── FoodController.java
│ └── RecommendationController.java
│
├── service/
│ ├── RecommendationService.java
│ ├── ContentBasedFilter.java
│ ├── CollaborativeFilter.java
│ └── MealPlanGenerator.java
│
├── model/
│ ├── UserPreference.java
│ ├── Food.java
│ ├── Meal.java
│ ├── MealPlan.java
│ └── DailyMealPlan.java
│
└── util/
└── DataLoader.java
src/main/resources/static/
│
├── index.html
├── css/
│ └── styles.css
└── js/
└── script.js
{
"id": 101,
"name": "Rajma Chawal",
"calories": 520,
"protein": 18,
"carbs": 85,
"fat": 8,
"dietary_type": "vegetarian",
"meal_type": "lunch"
}user_id,food_id,rating
1,101,5
1,205,4
2,101,3- Java 11+
- Maven
- Web browser
git clone <repository-url>
cd DietRecommendationEnginemvn clean installmvn spring-boot:runhttp://localhost:8080