Updated Nutrient Database to Release 23

Monday, October 11, 2010

We are please to announce updated release 23 of our Nutrient Database. Here are some of the products that have been added in this new release:

Cheese, dry white, queso seco Restaurant, Latino, pupusas con frijoles (pupusas, bean)
Cheese, fresh, queso fresco Restaurant, Latino, pupusas con queso (pupusas, cheese)
Cheese, white, queso blanco Restaurant, Latino, pupusas del cerdo (pupusas, pork)
Millet flour Restaurant, Latino, tamale, corn
Sorghum flour Restaurant, Latino, tamale, pork
DIGIORNO Pizzas Restaurant, Latino, black bean soup
Ground turkey Restaurant, Latino, tripe soup
Bread, blue corn, somiviki (Hopi) Restaurant, Latino, arepa (unleavened cornmeal bread)
Tea, herbal, brewed, Hohoysi (Hopi) Restaurant, Latino, bunuelos (fried yeast bread)
Tortilla, blue corn, Sakwavikaviki (Hopi) Restaurant, Chinese, beef and vegetables
Papaya, canned, heavy syrup, drained Restaurant, Chinese, lemon chicken
Nance, canned, syrup, drained Restaurant, Chinese, general tso's chicken
Nance, frozen, unsweetened Restaurant, Chinese, kung pao chicken

A complete list of changes can be found in Composition of Foods Raw, Processed, Prepared USDA National Nutrient Database for Standard Reference, Release 23.

William Li: Can we eat to starve cancer?

Tuesday, May 18, 2010

Excellent talk about cancer-fighting foods. See also Food Prints notes for Tomatoes and Spinach.

Food and Addiction

Thursday, May 6, 2010

This week NPR had also an interesting story - Soda In America: Taxes And A Debate Over Health. Check out also this funny cartoon that I saw in Google Reader.

Web Services

Tuesday, May 4, 2010

There has been multiple requests to add web services to Food Prints, that's why I created RESTful Web Services to allow developers access to nutrition data stored in Google App Engine. The URL for this is http://food-prints.appspot.com/ws. You'll need to add query string (q) to this to get the results. For instance http://food-prints.appspot.com/ws?q=cheese returns this JSON result:
{
   "Cheese, brie":334.0,
   "Cheese, camembert":300.0,
   "Cheese, brick":371.0,
   "Cheese, cheddar":403.0,
   "Cheese, blue":353.0,
   "Cheese, colby":394.0,
   "Cheese, cottage, creamed, large or small curd":98.0,
   "Cheese, caraway":376.0,
   "Cheese, cheshire":387.0,
   "Cheese, cottage, creamed, with fruit":97.0
}
The strings here are first 10 food names found in the database, and values are calories per 100g of serving. You can get the next 10 results, if any, by passing offset parameter. For instance, http://food-prints.appspot.com/ws?q=cheese&offset=10 returns next 10 results. You can also get serving size for a given food in grams by sending w (for weight) parameter with the exact name of a food. For instance, http://food-prints.appspot.com/ws?w=Cheese, brie returns:
{
   "cubic inch":17.0,
   "cup: sliced":144.0,
   "cup: melted":240.0,
   "oz":28.35,
   "package (4.5 oz)":128.0
}
If you are calling this from javascript, you can also pass callback parameter that will be called when you get the data. I had to use JSONP for cross-site Callbacks to avoid same origin problem with XMLHttpRequest.
This is how I did this in server-side Python code:
def generate(self, object=None):
    callback = self.request.get('callback')
    if callback:
        self.response.out.write(callback + "("+ simplejson.dumps(object)+");")
    else:
        self.response.out.write(simplejson.dumps(object))
The following example shows a complete code that you can copy/paste inside html body tag.
<script type="text/javascript">
function handler(jsonData) { 
 var tableStr = "<table><thead><tr><th>Name</th><th>Quantity</th></tr></thead>";
 for (var food in jsonData) {
  tableStr +="<tr><td><a href='http://food-prints.appspot.com/facts/"+food+"'>"+food+"</a></td><td>"+jsonData[food]+"</td></tr>"; 
 }
 tableStr += "</table>";
 document.getElementById("result").innerHTML = tableStr;
}
var wsURL="http://food-prints.appspot.com/ws?callback=handler&q=";
var script = document.createElement("script");        
script.setAttribute("src",wsURL+"cheese");
document.body.appendChild(script);
function find(){
 document.getElementById("result").innerHTML = "Searching...";
 var script = document.createElement("script");        
 script.setAttribute("src",wsURL+escape(document.getElementById('query').value));
 document.body.appendChild(script);
}
</script>
<input type="text" id="query" value="cheese"/>
<input type="button" onclick="find()" value="Search" />
<div id="result"></div>
Here is how it renders




If you use this in your own app, please consider adding a link back to http://food-prints.appspot.com to acknowledge the source. Here is a sample image you can use:


Updated Nutrient Database to Release 22

Friday, March 19, 2010

I've updated Nutrient Database to Release 22. Restaurant Foods is added as a new group under Browse menu. Around 225 new foods were added to the database and 104 removed (no longer in the market). Here is a list of some of the new foods:
As part of the American Indian/Alaska Native database, data for 7 food items (ringed seal liver, stinging nettles, caribou, wocas (yellow pond lily) dried seeds and tubers, beaked hazelnuts, and piki bread) were added.

As part of an ongoing effort to expand the number of Latino food items in the database, profiles for tostada shells, sweet breads, cakes, cookies, muffins, horchata, fried green and fried yellow plantains, and dulce de leche have been added.

See SR22 documentation for a detailed list of changes. I've also changed the default weight unit in Nutrition Facts from gram (g) to whatever unit comes first in the database. For instance, the default unit for the goat milk is now 1 cup instead of 100g. All comments and suggestions are welcome.

Latest Feeds from Food Politics

Food Prints Blog Copyright © 2009 Designed by Ipietoon Blogger Template for Bie Blogger Template Vector by DaPino