yes, it very much did. Here's what I was able to do with it
I'm playing with a program to make it easier to calculate food values.
Here's a very rough output, and if you can read through the code, you can
figure out what's going on. I need to put a user interface on it and I will
do so as soon as I have time and available money to spend on it but I just
thought you might like to know what's cooking in the background of my
mind.
----
I hate food. As a diabetic I completely and totally hate food because I
can't put anything in my mouth without doing a mental calculation of
carbohydrates, where I am in my daily plan, and how this is going to
affect my blood sugar.
At the same time, I love food, I love preparing it and sharing it with
friends and loves. there's nothing better than making my love
a stewed chicken apple and mushroom dish Using red wine and Ginger. Then in
the candlelight, feed her small spoons full between kisses. really, food
does not get any better than that.
So how do I resolve the two? Paper and pencil? Calculator? Food book?
Oh bloody hell, if that is my future, I'm not eating.But then my inner geek got
the better of me and created a skeleton of a program that solves my
problem. I don't have the money right now to finish it but, with the right
user interface, it will make a huge difference in people's lives.
;; < - my comments
>>> < - actual code, you can mostly ignore this
< - output from the program. This is where the good stuff is
;; start of program run
>>> import food_calculator
>>> foods = food_calculator.food_database()
>>> recipe = food_calculator.recipe_summation(foods.food_db)
;; this is how we create a recipe definition. The food item and the mass in grams.
>>> recipe.add("onions", 161 )
>>> recipe.add("red pepper",181)
>>> recipe.add("chicken breast",231)
>>> recipe.add("peanut oil",28*0.5)
;; do we dump the recipe in its entirety showing the breakdown of
;; some major food components. at the end you'll notice a factor
;; called "calories per carb". You should calculate how may calories per
;; carbohydrate you should be consuming every day. That gives you
;; a way to evaluate a food as to whether or not you should eat it. For
;; me, I need an average of 18 calories per carb so this meal would be
;; great.
;; note: the protein values are incorrect because I didn't put the right
;; data in the database
>>> recipe.dump()
calories 473.9, fats 16.8, carbohydrates 24.5, protein 1.6, 19.3 calories per carb
>>> print
;; the two questions I find myself asking are how much can I eat? That's
;; limited by calories and carbohydrates. So let's look at both limits and
;; see what's for dinner
;; let's serve up 400 calories of this meal and see how much we can have.
>>> recipe.dump_serving(400, "cal")
serving_size 495.5 grams
calories 400.0
fats 14.1
carbohydrates 20.7
protein 1.4
;; 400 calories is 495 g and we get 20.7 Carbs out of the meal. A little high
;; but most livable.
>>> print
>>> recipe.dump_serving(20, "carbs")
serving_size 479.3 grams
calories 387.0
fats 13.7
carbohydrates 20.0
protein 1.3
;; a slightly smaller meal with the right amount of carbohydrates but
;; notice the difference in calories. 15 g of food or 0.7 carbs creates a 12 calorie
;; difference (not surprising from the 19 calories per gram rating).
eventually, it should be possible to, with a good food database and recipe
database, create customized
mea.ls of the right size, the right proportions
for your individual needs. No longer will you need to go through recipe
after recipe trying to figure out how much to eat and whether or not it
will meet your needs. This calculator will do that work for you and give
you a quick and accurate answer.
Those with foresight will see one additional factor here. With proper food
values going into the system, we can create diets that are limited
according to sodium, protein, fat, whatever the diet requires and balance
different aspects. We can accommodate almost any dietary constraints and
come up with food that works.
I really need a sugar daddy to make this real. :-)