I am requiring my students to keep a 3 day food log. I want to use that data to display on their personalize web dashboard and will be bringing that info in as a JSON. The primary data I'll display is the date, food they ate, calories from fat, protein, carbs and total calories.
What would be the best way to structure my database? Set up a table with a JSON data type?
Here is a sample of the JSON data I'll need to store. This is one food item but I'll be saving 3 days worth:
{
"foods":[
{
"isFavorite":true,
"logDate":"2011-06-29",
"logId":1820,
"loggedFood":{
"accessLevel":"PUBLIC",
"amount":132.57,
"brand":"",
"calories":752,
"foodId":18828,
"mealTypeId":4,
"locale":"en_US",
"name":"Chocolate, Milk",
"unit":{
"id":147,
"name":"gram",
"plural":"grams"
},
"units":[226,180,147,389]
},
"nutritionalValues":{
"calories":752,
"carbs":66.5,
"fat":49,
"fiber":0.5,
"protein":12.5,
"sodium":186
}
}
],
"summary":{
"calories":752,
"carbs":66.5,
"fat":49,
"fiber":0.5,
"protein":12.5,
"sodium":186,
"water":0
},
"goals":{
"calories": 2286
}
}
Thanks in advance for any recommendations.
Tim