Configuration

This page displays the parameters configured in the config.json file for calculating nutrient targets, identifying user medical information, and data mining for daily meal plans. To modify the parameters, please update the config.json file.

MET and EER Formula

This formula is for MET (Metabolic Equivalent of Task) and EER(Estimated Energy Requirement) calculation.

Name Formula
MET 1 if level == 1 else 1.11 if gender == '1' and level == 2 else 1.25 if gender == '1' and level == 3 else 1.48 if gender == '1' and level == 4 else 1.48 if gender == '1' else 1.12 if gender == '2' and level == 2 else 1.27 if gender == '2' and level == 3 else 1.45 if gender == '2' and level == 4 else 1.45
EER 662 + -9.53 * age + met*( 15.91* weight + 5.396 * height) if gender == '1' else 354 + -6.91 * age + met*( 9.36 * weight + 7.26 * height)

Nutrition Target Calculation Logic

This table is for nutrition target calculation.

Nutrition Conditions Formula
calorie
  • default
  • EER
fiber
  • opioid_misuse
  • low_density_lipoprotein
  • user_high_fiber
  • default
  • 38 if gender == '1' and age <= 50 else 25 if gender == '2' and age <= 50 else 31 if gender == '1' else 21
  • 38 if gender == '1' and age <= 50 else 25 if gender == '2' and age <= 50 else 31 if gender == '1' else 21
  • 38 if gender == '1' and age <= 50 else 25 if gender == '2' and age <= 50 else 31 if gender == '1' else 21
  • INFINITY
carb
  • diabetes
  • user_low_carb
  • default
  • EER * 0.65 / 4.0
  • EER * 0.65 / 4.0
  • EER * 0.45 / 4.0
protein
  • default
  • math.ceil(weight * 0.8)
saturated_fat
  • default
  • math.ceil(EER / 2000.0 * 13.0)
sugar
  • over_weight
  • diabetes
  • opioid_misuse
  • user_low_sugar
  • default
  • 36 if gender == '1' else 25
  • 36 if gender == '1' else 25
  • 36 if gender == '1' else 25
  • 36 if gender == '1' else 25
  • 50
cholesterol
  • low_density_lipoprotein
  • user_low_cholesterol
  • default
  • 200
  • 200
  • 300
sodium
  • blood_pressure
  • diabetes
  • opioid_misuse
  • user_low_sodium
  • default
  • 1500
  • 1500
  • 1500
  • 1500
  • 2300
phosphorus
  • user_low_phosphorus
  • default
  • 700
  • 4000 if gender == '1' else 3000
potassium
  • blood_pressure
  • default
  • 2600 if gender == '2' else 3400
  • 5000
iron
  • anemia
  • default
  • 18 if gender == '2' else 8
  • 45
calcium
  • osteoporosis
  • default
  • 1200 if gender == '2' else 1000
  • 2500 if gender == '1' else 2000
folic_acid
  • anemia
  • default
  • 400
  • 1000
vitamin_c
  • default
  • 2000
vitamin_d
  • osteoporosis
  • default
  • 20 if gender == '2' else 15
  • 100
vitamin_b12
  • anemia
  • default
  • 0
  • 2.4

Nutrition Impact by Conditions

This section represents nutrition impacts on medical condition or user preference.

health

No specific nutrition.

under_weight

No specific nutrition.

over_weight

  • sugar

blood_pressure

  • sodium
  • potassium

low_density_lipoprotein

  • fiber

blood_urea_nitrogen

No specific nutrition.

diabetes

  • sugar
  • sodium

anemia

  • iron
  • vitamin_c
  • folic_acid
  • vitamin_b12

osteoporosis

  • calcium
  • vitamin_d
  • vitamin_c

opioid_misuse

  • fiber
  • sugar
  • sodium

user_low_phosphorus

  • phosphorus

user_low_saturated_fat

No specific nutrition.

user_low_carb

No specific nutrition.

user_low_calorie

No specific nutrition.

user_low_cholesterol

No specific nutrition.

user_low_sugar

  • sugar

user_high_calorie

No specific nutrition.

user_low_protein

No specific nutrition.

user_low_sodium

  • sodium

user_high_potassium

  • potassium

user_high_protein

No specific nutrition.

user_high_fiber

  • fiber

user_high_folate_acid

  • folic_acid

user_high_iron

  • iron

user_high_vitamin_b12

  • vitamin_b12

user_high_calcium

  • calcium

user_high_vitamin_c

  • vitamin_c

user_high_vitamin_d

  • vitamin_d

Nutrition Target Range Setting Logic

This table represents nutrition target range setting logics.

Nutrition Conditions Formula
calorie
  • over_weight
  • under_weight
  • user_low_calorie
  • default
  • [0, math.ceil(EER * 1.1 / 100) * 100]
  • [math.floor(calc_EER(gender, age, height, weight, 1) * 0.9 / 100) * 100, math.ceil(EER * 1.1 / 100) * 100]
  • [0, math.ceil(EER * 1.1 / 100) * 100]
  • [math.floor(calc_EER(gender, age, height, weight, 1) * 0.9 / 100) * 100, math.ceil(EER * 1.1 / 100) * 100]
fiber
  • opioid_misuse
  • low_density_lipoprotein
  • user_high_fiber
  • default
  • [38, 99999] if gender == '1' and age <= 50 else [25, 99999] if gender == '2' and age <= 50 else [31, 99999] if gender == '1' else [21, 99999]
  • [38, 99999] if gender == '1' and age <= 50 else [25, 99999] if gender == '2' and age <= 50 else [31, 99999] if gender == '1' else [21, 99999]
  • [38, 99999] if gender == '1' and age <= 50 else [25, 99999] if gender == '2' and age <= 50 else [31, 99999] if gender == '1' else [21, 99999]
  • [0, INFINITY]
carb
  • diabetes
  • user_low_carb
  • default
  • [0, math.ceil((EER * 0.65 / 4.0) / 50) * 50]
  • [0, math.ceil((EER * 0.65 / 4.0) / 50) * 50]
  • [math.floor((EER * 0.45 / 4.0) / 50) * 50, math.ceil((EER * 0.65 / 4.0) / 50) * 50]
protein
  • blood_urea_nitrogen
  • opioid_misuse
  • user_low_protein
  • user_high_protein
  • default
  • [0, math.ceil((weight * 0.8) / 10) * 10]
  • [math.ceil((weight * 0.8) / 10) * 10, INFINITY]
  • [0, math.ceil((weight * 0.8) / 10) * 10]
  • [math.ceil((weight * 0.8) / 10) * 10, INFINITY]
  • [0, math.ceil((weight * 0.8) / 10) * 10]
saturated_fat
  • over_weight
  • user_low_saturated_fat
  • default
  • [0,math.ceil((EER / 2000.0 * 13.0) / 5) * 5]
  • [0,math.ceil((EER / 2000.0 * 13.0) / 5) * 5]
  • [0, INFINITY]
sugar
  • over_weight
  • diabetes
  • opioid_misuse
  • user_low_sugar
  • default
  • [0, 36 if gender == '1' else 25]
  • [0, 36 if gender == '1' else 25]
  • [0, 36 if gender == '1' else 25]
  • [0, 36 if gender == '1' else 25]
  • [36 if gender == '1' else 25, 50]
cholesterol
  • low_density_lipoprotein
  • user_low_cholesterol
  • default
  • [0, 200]
  • [0, 200]
  • [0, 300]
sodium
  • blood_pressure
  • diabetes
  • opioid_misuse
  • user_low_sodium
  • default
  • [0, 1500]
  • [0, 1500]
  • [0, 1500]
  • [0, 1500]
  • [1500, 2300]
phosphorus
  • user_low_phosphorus
  • default
  • [0, 700]
  • [700, 4000 if gender == '1' else 3000]
potassium
  • blood_pressure
  • default
  • [2600 if gender == '2' else 3400, 5000]
  • [0, 5000]
iron
  • anemia
  • default
  • [18 if gender == '2' else 8, 45]
  • [0, 45]
calcium
  • osteoporosis
  • default
  • [1200 if gender == '2' else 1000, 2500 if gender == '1' else 2000]
  • [0, 2500 if gender == '1' else 2000]
folic_acid
  • anemia
  • default
  • [400, 1000]
  • [0, 1000]
vitamin_c
  • anemia
  • osteoporosis
  • user_high_vitamin_c
  • default
  • [90 if gender == '1' else 75, 2000]
  • [90 if gender == '1' else 75, 2000]
  • [90 if gender == '1' else 75, 2000]
  • [0, 2000]
vitamin_d
  • osteoporosis
  • default
  • [20 if gender == '2' else 15, 100]
  • [0, 100]
vitamin_b12
  • anemia
  • default
  • [0, 2.4]
  • [0, 2.4]

Medical Conditions and Nutrition tags

This table represents medical condition setting logic and nutrition tags based on medical conditions.

Condition Condition Details Tags
over_weight BMI>=25 and (WAIST >=102 if gender ==1 else WAIST>=88)
  • over_weight
  • low_calorie
under_weight BMI<18.5
  • under_weight
  • high_calorie
blood_pressure systolic >= 130 or diastolic >= 80
  • low_sodium
  • high_potassium
  • blood_pressure
low_density_lipoprotein ldl and ldl>3.3
  • low_cholesterol
  • high_fiber
  • low_saturated_fat
  • low_density_lipoprotein
blood_urea_nitrogen blood_urea_nitrogen>=7.1
  • low_protein
  • blood_urea_nitrogen
opioid_misuse
  • Active User: (heroin.isin([4,-1])==False) | (meth.isin([4,-1])==False)| (cocaine.isin([4,-1])==False)
  • Multum Drug Therapeutic Category: level_one==57 and level_two==58 and (level_three==60 or level_three==191)
  • Opioid Used: (drunk_days > 90) and ( (used==1 and drug_id in multum_drug_therapeutic_categories ) or (icd_code=='F11.2' or icd_code=='F11.23') )
  • Condition: user in active_user or user in opioid_used
  • low_sugar
  • high_protein
  • high_fiber
  • opioid_misuse
diabetes glucose >= 7.0 and glycohemoglobin >= 6.5
  • low_sugar
  • high_fiber
  • diabetes
anemia red_blood_cell_count<= 4 and (hemoglobin<13.2 if gender ==1 else hemoglobin<11.6)
  • high_iron
  • high_vitamin_c
  • high_folate_acid
  • high_vitamin_b12
  • anemia
osteoporosis osteoporosis==1
  • high_calcium
  • high_vitamin_d
  • high_vitamin_c
  • osteoporosis