shopping-cards: Automations for my food shopping

The Problem

I am a big fan of doing groceries every day! The nearest shop is two minutes away from my house, and I like to decide spontaneously what I want to cook. The Corona pandemic changed that, currently I go shopping biweekly to reduce personal interactions. This change was annoying for me so I build shopping-cards for support.

Old process

As you may have guessed, I am a bit obsessed with an efficient grocery process :-). My pre-Corona process looked like this:

New process

I decided to shop less regularly, so I have fewer personal interactions. This means planning upfront what to eat and buying ingredients for multiple dishes. My new process looked like this.

This process took quite long, I decided to automate it and shopping-cards was born.

Shopping Cards

shopping-cards should automate my new shopping process with the following features:

To build shopping-cards I had to overcome three problems, knowing all the ingredients for each recipe I cook, implementing a tool to guide me through the process ,and distribute this tool so I can easily update and use it. Let's take a look at each problem.

Know all ingredients

A Trello card stores all the recipes that I cook regularly. Within this card, most recipes link to external websites and, some recipes are kept in a private Google Drive. I wrote scrapers for all external websites so that I could extract the ingredients. It's quite hard to understand the unit of the ingredient because people tend to use completely different units to measure things and the naming of ingredients is not consistent, e.g. sometimes it's "some crumbled cheese" and in the next recipe it's called "50g grated cheese".

To match the names of the ingredients, I have created a curated list that has all the duplicated names for the same ingredients that I found when I scraped the recipes. I created it manually but I suspect that the recipes will not include an unlimited amount of different names for the same ingredient so after some time I will have created an exhaustive list.

I have not figured out how to handle units yet. I just search for numbers that display all the information I found with minimal formatting in my tool.

Getting the recipes from the private Google Drive turned out to be the most time-consuming task because I could not find a fitting library for the Oauth implementation Clojure, so I had to write my own.

Guiding through the process

I created a web app where you can select the recipes for the next few days and after the selection, an aggregation of all needed ingredients is shown. With this aggregation, I walk around in my kitchen and deselect everything which is in stock.

I wanted to be able to collaborate on the shopping list to add additional shopping items which are not based on recipes. Instead of implementing this system by myself, I integrated Trello into my application. After the recipe & ingredient selection is done a Trello card is created which can be edited and shared easily.

Distribution

To reduce effort I did not want to add authentication but I also did not want that everyone with an internet connection could decide which groceries I buy :-) I usually decide what to cook when I am at home so I decided to run shopping-cards locally in my apartment. It runs on a Raspberry Pi and as long as you're in the WiFi you can access it.

Conclusion

If you read that far you are either a grocery lunatic as well or shocked how much time is spent thinking about groceries :-) For me, building shopping-cards was a lot of fun and I really like it if I can automate something of my everyday life. Besides, deciding to run shopping-cards locally worked out really great and I am slowly growing my own personal app store in my apartment.

Building shopping-cards took me about 40 hours.