WOLFRAM

Should I Eat That? Food Safety with Wolfram Language

Should I Eat That? Food Safety with the Wolfram Language

Foodborne illness, or food poisoning, is something many of us have experienced. According to the World Health Organization, almost 1 in 10 people in the world fall ill each year after eating contaminated food. Luckily, by following recommended food safety practices, we can do our best to avoid getting sick.

September is Food Safety Education Month. To highlight the importance of food safety, we have introduced two new properties in Wolfram Language that can help users make smart choices about food storage:

Engage with the code in this post by downloading the Wolfram Notebook
EntityValue
&#10005


“I Bought Ground Beef on Tuesday for a Family Cookout on Saturday. Can I Keep the Ground Beef in the Refrigerator until Then?”

Let’s use this new property in Wolfram Language to check:

EntityValue
&#10005


Based on the data, sourced from the U.S. Department of Agriculture (USDA), you should keep raw ground beef a maximum of two days in the refrigerator before it is cooked. In this case, it’s best to go ahead and freeze the ground beef the day you bought it. You also can query the Wolfram Language for how long the ground beef can be kept in the freezer before use:

EntityValue
&#10005


We can use TimelinePlot to check the maximum refrigerated and frozen storage times for a variety of raw and cooked meats:

refrigeratedStorageTimesAssoc =  EntityValue
&#10005


styleStorageTimeLabel
&#10005


frozenStorageTimesAssoc =  EntityValue
&#10005


styleStorageTimeLabel
&#10005


“I Shop at My Favorite Fish Market Once a Month. How Long Can I Keep the Fish in the Freezer?”

You can check maximum frozen storage times for a wide range of raw fish and seafood, including these examples:

fishAndSeafood =  Interpreter
&#10005


Did you notice the shorter frozen storage times for fish with higher levels of omega-3 fatty acids, such as salmon and mackerel? See the comparison with other fish like halibut and snapper:

rawFish =  Interpreter
&#10005


“It’s Lunchtime on Monday. I Have Leftover Pizza in the Fridge from Friday Night. Should I Eat That?”

You can get answers about popular leftovers, including your Friday-night pizza delivery. Since it’s been only three days (and assuming the leftover pizza was stored in the refrigerator within two hours), you can go ahead and enjoy it for Monday’s lunch:

leftovers =  Interpreter
&#10005


As you can see, most cooked leftovers that are refrigerated promptly can be stored three to four days.

“Turkey Sandwiches, Turkey Tetrazzini, Turkey Pot Pie. No More Turkey, Please.”

You can plan for safe storage of those inevitable Thanksgiving Day leftovers. A side-by-side comparison can help you decide whether to refrigerate or freeze that extra food:

ThanksgivingLeftovers =  Interpreter
&#10005


Gone overboard with your baking? Use to check how long you can freeze "cookie dough", "brownies", "fudge" and "cheesecake" before they lose freshness and quality.

“I Love Bringing Home a Basket of Colorful Produce from the Farmers’ Market.”

ListPlot can chart the maximum refrigerated storage times that will maintain freshness of those vibrant veggies, as well as fresh fruits and herbs:

farmersMarketProduce =  Interpreter
&#10005


Evaluate the following cell to run the necessary initialization code to retrieve images for the foods:

getFoodImage
&#10005


Plot the data! The y axis displays the number of days, and the vertical lines indicate the range of how many days that food can be refrigerated before it loses freshness. Hover over the images to see larger versions and enjoy the colorful harvest:

produceImagesAndStorageTimes = KeyMap
&#10005


A Look Ahead

We’re looking ahead to how we can give the Wolfram community even more ways to explore food safety. By utilizing the synergies of food data and biology data, we are working to bring you the tools to investigate food sources of foodborne-illness pathogens. Stay tuned!

foodborneBacteriaList = {Entity
&#10005


Want to Learn More?

For more information about Food Safety Education Month and foodborne illness, you can visit these sites for free downloads, teacher resources, children’s activity sheets and current food recalls:

Bonus Viz: How to Build a Food Image Bar Chart

Here’s how you can build the food bar chart we featured in the introduction:

farmersMarketProduceStrings = {"raw shrimp", "pie", "lasagna",  "squash", "spinach", "melon", "cake", "peppers", "pepperoni",  "cheddar cheese"};farmersMarketProduce =  Interpreter
&#10005


getFoodImage
&#10005


BarChart
&#10005


Get full access to the latest Wolfram Language functionality with a Mathematica or Wolfram|One trial.

Comments

Join the discussion

!Please enter your comment (at least 5 characters).

!Please enter your name.

!Please enter a valid email address.

2 comments

  1. I have read almost all of your new posts on food solutions and the utilization of artificial intelligence. It is truly the future, especially when such solutions become readily available. Perhaps through a smartphone camera, we will be able to assess food and even determine its calorie content based on its size, type, and color (as in the case of bananas, where the composition changes significantly with ripeness). These are wonderful possibilities.

    Reply