YQL Nutritional Data

My todo list has been telling me to play with Yahoo’s YQL for far too long now, so last night I did something about it.  YQL is a Yahoo SQL-like language that allows developers to easily aggregate data from various disparate data sources without having to go through the rigmarole of writing their own API.  There is a large selection of base tables that allow the developer to work with e.g. Flickr or Upcoming.  There is also a community contributed selection of tables (see datatables.org).  You can contribute to the project by forking the GitHub project and sending a pull request once you’ve committed changed to your tree.

That’s exactly what I did last night.  I did some digging and found the UK government’s data source for nutritional information, the “Composition of Foods” report.  To use the data, I had to apply for a free Click-Use license.  I didn’t have to specify what data I was using or how I was going to use it; it seemed more the case that I had to have my name added to a list of people who use government data in some way, shape or form.  Once I’d munged the data a bit, I created a CSV, and corresponding XML file as described by the DataTables documentation.

You can use my DataTable by querying YQL (or in the YQL-console) like this for example:

use "http://maxmanders.co.uk/lab/nutritionals/nutritionals.xml";
select * from nutritionals where name = 'banana';