Unverified Commit d82039ac authored by aryamanpandya's avatar aryamanpandya Committed by GitHub
Browse files

Update MealSuggestion.py

parent 8632d8d1
...@@ -3,22 +3,32 @@ import mysql.connector as mysql ...@@ -3,22 +3,32 @@ import mysql.connector as mysql
#Calculates caloric and macronutrient intake levels based on user information #Calculates caloric and macronutrient intake levels based on user information
#and dependent on the user's goals #and dependent on the user's goals
def suggestedIntake(weight, BMR, goal, ECB): def suggestedIntake(weight, BMR, goal, ECB):
caloricOutput = BMR+ECB caloricOutput = BMR+ECB
if goal == 0: if goal == 0:
caloricIntake = 0.85*caloricOutput caloricIntake = 0.85*caloricOutput
elif goal == 1: elif goal == 1:
caloricIntake = caloricOutput caloricIntake = caloricOutput
elif goal == 2:
elif goal == 2:
caloricIntake = 1.15*caloricOutput caloricIntake = 1.15*caloricOutput
proteinCalories = 0.18*caloricIntake
protein = proteinCalories/4 proteinCalories = 0.18*caloricIntake
carbCalories = 0.55*caloricIntake protein = proteinCalories/4
carbs = carbCalories/4
fatCalories = 0.27*caloricIntake carbCalories = 0.55*caloricIntake
fat = fatCalories/5 carbs = carbCalories/4
fatCalories = 0.27*caloricIntake
fat = fatCalories/5
optimalLevels = [caloricIntake, protein, carbs, fat] #List of intake data optimalLevels = [caloricIntake, protein, carbs, fat] #List of intake data
#calories followed by macronutrients in grams #calories followed by macronutrients in grams
return optimalLevels return optimalLevels
#uses values calculated from above function + allergy data #uses values calculated from above function + allergy data
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment