A scenario the readers might be familiar with: food items hiding around in our refrigerator way past their expiry date. Once discovered, these are quickly transferred to the bin with promises to self that next time it will be different for sure OR worse yet we stuff the items in our freezer!
Estimates of waste range from 20% to 50% (in countries like USA). This is a big shame given the fact that hundreds of millions of people around the world don’t have any form of food security and face acute shortage of food.
What can we do about this?
One solution is to help people be a bit more organised by reminding them of the expiry dates of various items. The registration of items has to be automated and smart.
If we insist on manual entry of items with their expiry date – people are likely to not want to do this especially right after a long shop! Instead, as the items are checked out at the shop, an option should be available to email the receipt which should also contain an electronic record of the expiry date of the purchased items. This should include all groceries as well as ‘ready to eat’ meals. Alternatively, one can also provide different integration options using open APIs with some sort of a mobile app.
Once we have the expiry dates we need to ensure we provide the correct support and advice to the users of the app. To make it more user-friendly we should suggest recipes from the purchased groceries and put those on the calendar to create a ‘burn-down’ chart for the groceries (taking inspiration from Agile) which optimises for things like freshness of groceries, minimising use of ‘packaged foods’ and maintaining the variety of recipes.
Steps are as follows:
- When buying groceries the expiry and nutrition information are loaded into the system
- Using a matrix of expiry to items and items to recipes (for raw groceries) we get an optimised ordering of usage dates mapped to recipes
- With the item consumption-recipe schedule we can then interleave ready to eat items, take-away days and calendar entries related to dinner/lunch meetings (all of these are constraints)
- Add feedback loop allowing users to provide feedback as to what recipes they cooked, what they didn’t cook, what items were wasted and where ‘unscheduled’ ready to eat items were used or take-away called for
- This will help in encouraging users to buy the items they consume and warn against buying (or prioritise after?) items that users ‘ignore’
I provide a dummy implementation in Python using Pandas to sketch out some of the points and to bring out some tricky problems.
The output is a list of purchased items and a list of available recipes followed by a list of recommendations with a ‘score’ metric that maximises ingredient use and minimises delay in usage.
butter_chicken: Score:30 Percentage items consumed:36% chicken_in_white_sauce: Score:26 Percentage items consumed:27%
Not enough ingredients for mince_pie
fish_n_chips: Score:20 Percentage items consumed:27% veg_pasta: Score:26 Percentage items consumed:27% chicken_noodles: Score:28 Percentage items consumed:36% veg_soup: Score:20 Percentage items consumed:27%
The recommendation is to start with ‘butter chicken’ as we use up some items that have a short shelf life. Here is a ‘real’ recipe – as a thank you for reading this post:
There are some tricky bits that can be solved but will need some serious thinking:
- Updating recommendations as recipes are cooked
- Updating recommendations as unscheduled things happen (e.g. item going bad early or re-ordering of recipes being cooked)
- Keeping track of cooked items and other interleaved schedules (e.g. item being frozen to use later)
- Learning from usage without requiring the user to update all entries (e.g. using RFID? Deep Learning – from images taken of your fridge with the door open)
- Coming up with innovative metrics to encourage people to eat healthy and eat fresh – lots of information can be extracted (E.g. nutrition information) if we have a list of purchased items
- Scheduling recipes around other events in a calendar or routine items (e.g. avoiding a heavy meal before a scheduled gym appointment)