Design for a Nutrition Calculator

Any queries about vegan diet, nutrition, dieting, bulking and healthy eating in general. Diets and food from vegan perspective.

Moderators: hardcore iv, fredrikw, JP, stateofflux, bronco

Design for a Nutrition Calculator

Postby Fallen_Horse » Thu May 19, 2011 7:29 pm

Hi all! I hope everyone is having a great day. I recently posted this over on VBB (took it to VBB! :D ) and I wanted to share it here as well. I am creating a nutritional calculator to help people figure out what foods are healthy and what foods they should eat for different dietary types. Right now it only takes into account a bodybuilding type diet (AKA emphasis on high protein foods) but I plan on adding more information to enable customization. My VBB post is below, with a few changes. I would rather not have to retype it all!

My formulas currently only take five inputs, total protein, protein score, total calories, total fiber, and nutrient score. These values are taken from the NutritionData website and I have chosen them because I think they are the most accurately calculated scores available and I know exactly how they are formulated. All of my calculations are done using the numbers for 100g of each food.

I have one equation for determining overall protein quality, and that is to take the total protein, multiply by the percentage that is complete protein, and add to that the amount of incomplete protein times 1/2. This is assuming that if a protein is 50% complete, the other 50% is about half complete, which seems to be a good rule of thumb for the foods I have seen. The first formula for this is then:

Amount of Complete Protein = Total Protein * Protein Score / 100

It is divided by 100 because the protein score is in % and I want it unitless so I divide by 100 to get grams = grams * percent / percent.

The second equation for this section is:

Average Useful Protein = Amount of Complete Protein + (Total Protein - Amount of Complete Protein) / 2

So I take the total protein and subtract the complete part, then divide by 2 because of the '50% complete' concept. I then add this to the amount of complete protein to get an average amount of useful protein.

For the last formula (in the protein section) I then take the Average Useful Protein and divide by Calories / 100, or otherwise stated I take the Average Useful Protein * 100 then divide by Calories. This looks like:

Protein Per 100 Calories = Average Useful Protein / Total Calories / 100 = 100 * Average Useful Protein / Total Calories

I added this formula into the equation because I noticed that very high calorie foods were getting overly high scores in my final ranking, and since I want this to be a calculator of getting the most protein and nutrients per calorie, having high calorie foods is contrary to the scoring.

I also have a Fiber Score which is Fiber / Calories / 100, AKA 100 * Fiber / Calories. So that formula is:

Fiber Score = 100 * Total Fiber / Total Calories

Now for the third part of my formula, I am currently only taking into account three variables, the average useful protein, nutrient score, and the fiber score. The healthiness of a food is determined by the nutrient score over the total calories (nutrients per calorie), and the average useful protein is what I just calculated above. This equation is then:

Formula Score = 10 * Average Useful Protein + Nutrient Score / Total Calories + Fiber Score

Now, you might be asking. Why multiply the Average Useful Protein by 10? That's a good question, and I don't have a scientific answer. Essentially it is because I wanted the amount of protein in a food to have a powerful effect on it's Formula Score, because my lifestyle is more geared towards getting a higher protein diet while maximizing the nutrients per calorie I get. The bad thing about this is that it is essentially an arbitrary number that you can change based on what your preferences are (so it's not standardized) but that is also a benefit, because someone that values carbs more, or fiber more, or whatever, could then edit the final formula (once I have all the variables put in) and be able to find healthy foods that are high in protein, or high in fiber, or low in fat, or whatever someone wants.

Currently I am doing this in Excel (ugh) because it has been easy to import and list foods, but the equation editor is a hassle. I can't currently think of anything better though.

I am still playing around with it, and I plan on adding carbs, types of fats, etc. to the spreadsheet and into the Formula Score. I would love to hear feedback and input into the process. Perhaps someone else out there has some ideas I could try to implement! And if anyone knows a better way to post spreadsheet information that would be great!

So I will leave you with a list of foods I have already added to the spreadsheet and their respective scores. Keep in mind that the current Formula Score is for those people looking to add high protein foods to their diet while also adding healthy calories. Thanks to everyone for reading and for contributing!

185.0 Tofu, silken extra firm lite, fresh
144.5 Spinach, cooked
143.5 Spinach, raw
127.9 Tofu, silken extra firm, fresh
117.0 Mushrooms, white, raw
112.0 Tofu, extra firm, fresh
101.8 Beans, soy, boiled
100.2 Cauliflower, boiled
97.8 Cocoa, powder
95.2 Morningstar, grillers
93.2 Cauliflower, raw
92.4 Broccoli, raw
91.8 Edamame, boiled
83.8 Tempeh, cooked
79.3 Lentils, boiled
78.3 Kale, boiled
77.3 Beans, kidney, boiled
76.9 Beans, white, boiled
75.4 Peas, split, boiled
75.0 Beans, black, boiled
74.7 Clif, Builder Bar
69.1 Broccoli, boiled
67.2 Lettuce, red leaf, raw
65.2 Lettuce, romaine, raw
65.1 Celery, raw
64.4 Lettuce, iceberg, raw
63.8 Seeds, pumpkin, dry roasted
63.7 Kale, raw
62.5 Peas, green, boiled
61.6 Cucumber, with peel, raw
60.0 Beans, chickpeas, boiled
57.9 Clif, Luna Bar
57.6 Pepper, green, raw
55.1 Tomatoes, raw
53.0 Soymilk, Silk DHA, fresh
52.3 Tomatoes, cooked
46.1 Garlic, powder
43.7 Pepper, black
43.0 Pepper, green, cooked
42.1 Buckwheat, flour
39.9 Lemons, raw
39.7 Carrots, boiled
38.8 Garlic, raw
37.2 Flax, seeds, raw
36.4 Peanuts, dry roasted
35.7 Quinoa, cooked
35.0 Bread, wheat, fresh
34.9 Potato, with skin, baked
33.7 Nuts, cashews, raw
33.1 Strawberries, raw
32.9 Spaghetti, wheat, boiled
31.9 Bread, wheat, pita
30.6 Carrots, raw
30.2 Nuts, almonds, rawish
30.1 Melon, watermelon, raw
29.1 Corn, yellow, boiled
26.6 Nuts, cashews, dry roasted
25.6 Cereal, Grape Nuts
25.6 Melon, honeydew, raw
25.5 Melon, cantaloupe, raw
24.6 Seeds, sesame, tahini
22.4 Onions, boiled
21.8 Kiwi, raw
21.3 Orange, raw
20.6 Nuts, almond, butter
20.6 Onions, raw
19.1 Nuts, walnuts, raw
17.9 Rice, brown, cooked
17.5 Avocado, raw
16.9 Blueberries, raw
15.3 Juice, orange, commercial
14.5 Mango, raw
13.8 Grapes, red or green, raw
12.4 Banana, raw
10.6 Coconut, milk, canned
9.30 Raisins, fresh
5.20 Apples, raw
0.00 Oil, olive
0.00 Sugar, maple
Lovin' it!
Active Member
Posts: 1788
Joined: Sun Feb 19, 2006 8:07 am
Location: Bakersfield, CA, USA

Re: Design for a Nutrition Calculator

Postby bronco » Fri May 20, 2011 6:06 pm

Hmm, something with a bit of fibres and very little calories would have a healthiness index approaching infinity. Anyone want some sawdust cake :) ?
[quote="JP"]Spirulina is a badass crew, and they often just hang around in street corners looking to beat up proteins.

They oftenget confused by the fact that they are almost half protein themselves.
User avatar
Site Admin
Posts: 9021
Joined: Tue Jan 20, 2004 11:25 am
Location: Vienna, Austria

Re: Design for a Nutrition Calculator

Postby Fallen_Horse » Fri May 20, 2011 6:35 pm

Haha, well tragically this is almost always true. All veggies are loaded with fiber and have very few calories, and they are the healthiest things you can put in your body.

Anyway I have added sugar and ORAC categories for the foods but I don't have ORAC scores for all of the foods on my list, so some of the foods are an estimate (based on the ORAC of a food's 'relatives', etc.). Here is the new list:

185.5 Tofu, silken extra firm lite, fresh
149.7 Spinach, cooked
148.8 Spinach, raw
127.3 Tofu, silken extra firm, fresh
121.7 Tofu, extra firm, fresh
112.0 Mushrooms, white, raw
109.9 Beans, soy, boiled
101.0 Cocoa, powder
95.0 Morningstar, grillers
94.3 Cauliflower, boiled
90.8 Edamame, boiled
90.7 Broccoli, raw
87.1 Cauliflower, raw
84.2 Tempeh, cooked
83.7 Lentils, boiled
83.7 Beans, kidney, boiled
79.2 Beans, white, boiled
78.1 Beans, black, boiled
76.1 Kale, boiled
75.1 Peas, split, boiled
71.3 Clif, Builder Bar
70.7 Broccoli, boiled
67.4 Seeds, pumpkin, dry roasted
64.3 Kale, raw
63.9 Lettuce, red leaf, raw
60.6 Peas, green, boiled
59.6 Beans, chickpeas, boiled
57.4 Lettuce, romaine, raw
56.2 Lettuce, iceberg, raw
54.8 Celery, raw
54.6 Cucumber, with peel, raw
52.8 Clif, Luna Bar
50.2 Soymilk, Silk DHA, fresh
49.8 Garlic, powder
47.7 Pepper, black
46.7 Pepper, green, raw
42.0 Buckwheat, flour
41.4 Tomatoes, raw
41.0 Tomatoes, cooked
40.9 Garlic, raw
37.4 Flax, seeds, raw
36.1 Peanuts, dry roasted
35.7 Potato, with skin, baked
33.8 Quinoa, cooked
33.8 Bread, wheat, fresh
33.4 Spaghetti, wheat, boiled
33.4 Nuts, cashews, raw
32.4 Bread, wheat, pita
32.0 Nuts, almonds, rawish
31.3 Carrots, boiled
30.4 Lemons, raw
30.2 Pepper, green, cooked
29.4 Nuts, cashews, dry roasted
26.5 Corn, yellow, boiled
26.1 Seeds, sesame, tahini
26.1 Cereal, Grape Nuts
24.9 Nuts, almond, butter
21.1 Carrots, raw
20.4 Nuts, walnuts, raw
20.2 Avocado, raw
17.8 Rice, brown, cooked
16.7 Strawberries, raw
14.4 Onions, boiled
12.7 Onions, raw
9.6 Coconut, milk, canned
8.9 Melon, watermelon, raw
8.2 Kiwi, raw
7.4 Melon, honeydew, raw
6.1 Orange, raw
2.9 Melon, cantaloupe, raw
1.9 Oil, olive
0.0 Blueberries, raw
0.0 Banana, raw
-0.3 Juice, orange, commercial
-6.7 Mango, raw
-7.0 Grapes, red or green, raw
-8.9 Raisins, fresh
-9.7 Apples, raw
-23.8 Sugar, maple
Lovin' it!
Active Member
Posts: 1788
Joined: Sun Feb 19, 2006 8:07 am
Location: Bakersfield, CA, USA

Return to Vegan Diets, Nutrition and Healthy Eating

Who is online

Users browsing this forum: No registered users and 3 guests