Monday, October 31, 2011

Alpha Review

Just a quick recap video of the work I have done so far.


(Note: I said that calories were notably absent from the USDA database... calories are a unit of measurement for ENERGY doh... Turns out if you actually look for "energy", its there [in kcals])

Friday, October 14, 2011

Relearning Databases

Unfortunately, I didn't get too much done over the short school week. After rechecking though, I noticed that there is an MS Access version of the USDA database. While I think that Access databases are backed by SQL, I will still need to convert to a raw SQL database (I think). The database is fairly large (120 MBs), so for the final product I can't store the entire database locally (I didn't really expect to be able to either). In the end, I will like just have to keep frequently used items local, and look up everything else through a server. But for now, assuming it doesn't make uploading to my dev phone impossible, I will probably just work with the entire database locally and work out remote access once I have a working prototype.

The WP database interface is Linq to SQL which is an Object Relation Mapping framework. Basically what this means is that I can look up a food by its ID and automatically I get the entire food object with any of its references loaded from the database automatically. Essentially if I have a table for food and a table for manufacturers, when I load a food with a reference to a manufacturer, the manufacturer will be loaded as an object as well. All you need to do is define the object structure and Linq does the queries for you. This works well, but for the nutritional information I want to have dynamic nutrient information (some foods have long lists of vitamins and minerals while some foods have very little nutritional information). I will need to figure out the best way to design my classes for dynamic tables. The way it is currently set up in the USDA database is that there is a table with non-unique id entries. The ID corresponds to a particular food, and each entry tracks a specific nutrient, and so in order to find all the nutritional information you can simply search for all entries with the foods id.

Sunday, October 9, 2011

Preliminary Review Thoughts

After discussing my progress and thoughts with Norm and Joe, I come up with some new priorities for my work for the semester. Rather than attempting to do a lot of things okay, I plan on picking a few features and doing those very well. The features that I want to focus on that I have not seen done well from competing nutrition apps will involve nutrition visualization and meal recommendations.

Most apps that I have seen either track only calorie counts (ie. Live Strong), or ignore nutrition in general and give a rating or point value for each food item (ie. Weight Watchers). What is clearly missing is any tracking of other nutrient values. What I aim to do is provide an robust but clear interface for observing how much of each nutrients you can get from a particular food. For instance, I might have a bar chart, having one bar for each nutrient. The bars would show how much, in terms of daily recommended value, he food provides. I guess a good way to think about this style of visualization would be in relation to RPG games that have weapon statistics. The weapons have statistics that on their own are completely meaningless, but because they are shown with some features, such as filling up a portion of the bar and thus showing how close to optimal that stat is. Being able to compare directly to another item can really help to see how it matches up relative to everything else.
I'm looking for a visualization system that makes comparison easy and simple. Video games  may be a good inspiration.
Once this visualization system is in place, a helpful addition would be to give food recommendations. The user will be able to see how much nutrients he is eating and whether he has too much or too little. What the user might find tough at that point is that he now needs to find food that will help to fill in the gaps in his diet. My next goal will be to automatically observe what is missing in the average daily meals, and provide a recommendation on what should be added to the users diet.

What this will require is having a large database of different food items (its hard to make recommendations if you don't know any foods). Fortunately, I found that the USDA website has a large database of food items. The database has what looks to be a reasonable structure, but its not very human readable. What I will look at for the next few days is the format of the database and likely writing a quick python script to make sure that I know how the database is built and that it really has the information taht I think it does.

My plans for Fall Break will mostly include getting an inputted food item stored into a local database, and parsing the USDA nutrient database and finding a reasonable format to store it in-app.