Nutrition in Common Thanksgiving Foods
The purpose of publishing this story is to identify, compare and contrast the nutritional value of the most common thanksgiving foods. It is important to know such so that we can make better decisions that would help us achieve certain health goals. The data used to provide information regarding this issue is an API (Application Programming Interface) coming from the Food Data website provided by the United States Department of Agriculture. One can gain access to the API in the API guide section of the website. This website is relevant because it provides nutritional information about any foods one can search for on the website, which can make individuals more concerned about what they eat and in turn, make them more aware about their health.
I used requests module in Python to retrieve the data by using the API key, the API endpoint and a variable where a specific Thanksgiving food would be searched. A list was made to go through food searches using a for-loop command as all the items in the list were iterated to extract nutritional information for each food search and be inserted into a data frame, using the averages of the nutritional values is used as the basis of analysis.
The purpose is to identify the nutritional value of common Thanksgiving foods in order to make better choices about what foods to indulge in for the sake for one’s health. For example, if an individual wants to engage in Thanksgiving activities but wants to be more aware of his/her protein intake in order to reach their health goals, a question that can be asked if which of these common Thanksgiving foods has high enough protein for me to reach my goals?
Here, we can see that turkey and ham have the highest protein content, therefore it would be wise for an individual to focus on those foods in their Thanksgiving meals.
The same could be asked for individuals who maybe lacking some fiber in their system, for example, after a quick health check with a doctor earlier in the day, then a good question would be what foods have the most fiber in them to indulge in?
Here, mashed potatoes, sweet potato souffle and pecan pie are good options to have to not only enjoy your meal but also increase one’s fiber intake.
A bug that I encountered was during the iteration process, and this occurred due to the large number of copies I would have to go through to get as much information as I need. The way I coded it at first, it would only get one copy and an error would occur. Therefore, I had to make to make a list that would iterate through all the copies of a food search, then make sure the primary iterator goes through that list of copies.
The “L” variable represents the list of copies that were iterated in order for the code to work
In order to make the data easier to use, I had to select only a few macronutrients like Protein, Carbs, Fat etc as well as rename them to make it simpler to read. As stated earlier, I had to make sure to get the averages of copies of each food to get a general sense of value across each macronutrient selected.
A limitation to this analysis is that based on the numbers given through the data, it might not be straightforward for them to determine what foods are healthy or not, therefore people have to be careful with selecting what is right for them, instead of leaning on someone else’s recommendation towards the food.