Difficulty determining the file type of text database file
Posted
by Joseph Silvashy
on Stack Overflow
See other posts from Stack Overflow
or by Joseph Silvashy
Published on 2010-05-29T02:12:08Z
Indexed on
2010/05/29
2:22 UTC
Read the original article
Hit count: 260
data-formats
So the USDA has some weird database of general nutrition facts about food, and well naturally we're going to steal it for use in our app. But anyhow the format of the lines is like the following:
~01001~^~0100~^~Butter, salted~^~BUTTER,WITH SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
~01002~^~0100~^~Butter, whipped, with salt~^~BUTTER,WHIPPED,WITH SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
~01003~^~0100~^~Butter oil, anhydrous~^~BUTTER OIL,ANHYDROUS~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
~01004~^~0100~^~Cheese, blue~^~CHEESE,BLUE~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
With those odd ~
and ^
separating the values, It also lacks a header row but thats ok, I can figure that out from the other stuff on their site: http://www.ars.usda.gov/Services/docs.htm?docid=8964
Any help would be great! If it matters we're making an open/free API with Ruby to query this data.
Additionally I'm having a tough time posing this question so I've made it a community wiki so we can all pitch in!
© Stack Overflow or respective owner