Prerequisites
Before generating a meal plan:Generating a plan deactivates any existing active plan and replaces it with the new 7-day menu.
How Meal Plans Are Generated
Step 1: Recipe Filtering
The system identifies compatible recipes based on: Diet Type Matching- Recipes tagged with your selected diet types (vegan, vegetarian, high protein, etc.)
- For vegan/vegetarian diets, AI verification ensures ingredients comply
- Breakfast, lunch, dinner, and snack categories
- Each recipe is pre-tagged for appropriate meal times
- Recipes within acceptable calorie ranges for each meal type
- Ranges calculated based on your daily target and number of meals
- AI-powered ingredient analysis checks each recipe against your restrictions
- Only recipes that pass validation are included
Step 2: Calorie Distribution
Your daily calories are distributed across meals based on optimal eating patterns: 3 Meals per Day- Breakfast: 30%
- Lunch: 40%
- Dinner: 30%
- Breakfast: 25%
- Lunch: 30%
- Snack: 15%
- Dinner: 30%
- Breakfast: 20%
- Morning Snack: 10%
- Lunch: 30%
- Afternoon Snack: 10%
- Dinner: 30%
- Breakfast: 20%
- Morning Snack: 10%
- Lunch: 25%
- Afternoon Snack: 10%
- Dinner: 25%
- Evening Snack: 10%
Step 3: Recipe Selection
For each meal of each day, the algorithm:- Identifies candidates: Gets all recipes matching the meal type and diet
- Checks recent usage: Excludes recipes used in the past 6 days
- Validates calorie range: Ensures the recipe fits the meal’s target (within 50-130% of target)
- Selects optimal match: Chooses the recipe closest to the target calories
- Tracks usage: Records the recipe to prevent near-term repetition
Step 4: Plan Creation
Once all 7 days are populated:- Current plan deactivated: Your existing active plan is marked inactive
- New plan created: A new plan record is generated with all daily menus
- Meals scheduled: Each meal is assigned a schedule order (1-6) within its day
- Status initialized: All meals start with “pending” status (0)
Generating Your Plan
POST /api/plan
Content-Type: application/json
Authorization: Bearer <token>
{
"daily_menus": [
{
"day_of_week": 1,
"meal_details": [
{
"recipe_id": 123,
"schedule": 1,
"status": 0,
"meal_type": "breakfast"
}
]
}
]
}
What Happens During Generation
AI-Powered Filtering
For users with vegan/vegetarian diets or specific restrictions:- Initial database query: Retrieves up to 100 candidate recipes per meal type
- AI validation: Each recipe’s ingredients are analyzed by the LLM
- Compliance check: Only recipes that comply with all restrictions proceed
- Limit application: Up to 50 validated recipes per meal type are used
AI filtering ensures accuracy but increases generation time. Plans typically generate in 10-30 seconds.
Variety Optimization
The 6-day repetition prevention ensures:- You won’t see the same recipe twice in one week
- Diverse nutrient intake across the week
- More enjoyable eating experience
Nutritional Balance
Each recipe contributes:- Calories: Tracked against daily target
- Protein: Supports muscle maintenance/growth goals
- Carbohydrates: Provides energy based on activity level
- Fat: Supplies essential fatty acids and hormones
Viewing Your Generated Plan
Troubleshooting Plan Generation
”No recipes available that meet restrictions”
Cause: Insufficient recipes match your diet, restrictions, and calorie ranges. Solutions:- Remove or reduce dietary restrictions
- Add more diet type options
- Adjust your calorie targets (may be too narrow)
- Contact support if the recipe database needs expansion
”Could not generate plan (not enough recipes)”
Cause: Fewer than 7 days could be populated with non-repeating recipes. Solutions:- Increase acceptable diet types
- Reduce the number of restrictions
- Adjust your meals per day setting
Plan Generated but Lacking Variety
Cause: Limited recipe pool for your specific criteria. Solutions:- Consider being more flexible with food preferences
- Accept a broader calorie range
- Add more cuisines to your taste preferences
Plan Lifecycle
- Generation: New plan created and marked active
- Active: Currently in use, displayed to user
- Deactivated: Replaced when a new plan is generated
Only one plan can be active at a time per user. Previous plans are preserved but marked inactive.
Best Practices
- Review before starting: Check your plan before beginning the week
- Generate weekly: Create new plans regularly for continued variety
- Use the chat: Ask the AI to modify individual meals instead of regenerating entire plans
- Track compliance: Mark meals as completed as you go
- Adjust as needed: Use the AI to swap meals that don’t fit your schedule
Next Steps
After generating your plan:- Track your nutrition as you complete meals
- Use the AI chat to make adjustments
- Update your profile if your goals or measurements change
