WARNING: This Instructable comes with no guarantees. There are too many factors that are not under my control. It is also not endorsing any specific diet.
This LAZY OLD GEEK went to his MD. She basically said I was pre-diabetic and sent me to a nutritionist. My nutritionist said I should watch my carbohydrates. (She said a lot of other things but I’m OLD so focused on carbs). I should limit myself to 180 grams of carbs per day. Being a GEEK, I decided to write my own nutritional logger.
The USDA has a great nutritional database with lots of information on nutrition:
And they have a nice little program so that you can look up most anything you want and get the nutritional information on it.
This may have all of the information you may need. My problem is that I wanted to know all of the nutrient information for a day. The USDA databases come in different types (and versions). Since I planned to write my program in Visual Basic Express (see GPS for Lazy Old Geeks for more information on VB Express), I chose to use the Microsoft Access version. Now, don’t panic, you shouldn’t need MS Access or know how to use it to use my program.
Step 1: Designing program
PROBLEM: The original database is 107mBytes and hard to work with.
SOLUTION: For anybody familiar with relational databases, you probably know they’re very complex with relationship diagrams and rules and restrictions for entering and modifying data. Well, this SR23.mdb nutritional database is one of them. For my purposes, I removed all of the relationships and tables except for the main one called ABBREV. This is the one included in this Instructable.
In relational database terminology a record is all of the information for an item. In this case a record will be a description of the item and all of the nutrients associated with that item.
For those of you who have access to MS Access, there are over 7000 records in this table. For my use, I went in and removed 1000s of these records for foods that I would probably never eat, like Alcoholic Beverages and Baby Food. I also removed several categories for vitamins and such that I don’t care about. Since everyone's tastes and eating habits are different, I left all the records in the attached database.
The core of the program is just accepting the nutrients for the selected food item, placing them in the four meal categories, then summing them up for a total.
PROBLEM: I decided to export my daily report in CSV format, comma separated values. This makes it easier to be read into MS Excel or OpenOffice or GoogleDocs. Unfortunately, the Short Description field in the database allows commas. This would make the information unusable when read into Excel.
“CHEESE,COTTAGE,NONFAT,UNCRMD,DRY,LRG OR SML CURD”
SOLUTION: There are alternatives to comma separated like semi-colon, but I chose to replace the commas in the description field with colons.
“CHEESE:COTTAGE:NONFAT:UNCRMD:DRY:LRG OR SML CURD”