campcooking - a recipe builder for camps
2022-12-17
Christian holiday camps that I've been part of in the past often have to cater for a large number of people, each of whom have a different set of food allergies and intolerances. As a result, before each camp somebody needs to work out a full recipe book, including substitutions for the main recipes. This takes a very long time, but could be largely automated by a simple program.
This program would, for a given set of people with dietary restrictions and a given recipe, allow a set of recipes to be constructed that could cater for everyone. These recipes should be as close to each other as possible, so that everyone has nearly the same food. The number of recipes should also be minimised to save cooking effort.
The simplest possible version of this will simply highlight which ingredients in the main recipe require substituting. More advanced versions could consider substitution suggestions, calculations to scale quantities, and calculating a procedure to share common elements between the recipes, saving effort.
I could see this more advanced web application being a possible startup idea, since this would add value in food preparation contexts such as camps and schools where the same people are often served.
The MVP requires a recipe builder library that can perform the necessary calculation, alongside some sort of front end to run the script. This could look like a simple web API, or alternatively JSON or CSV processing script. The currently open problems are:
a recipe representation
This could take the form of a reduced schema.org recipe. This could be encoded as a Pydantic model, and represented in a database through an ORM such as sqlalchemy.
an allergen representation
This would specify which number of people have which allergens.
a map of ingredients to allergens
This maps ingredients, such as "apple", to the allergen food group, e.g. "fruit". Needless to say, this should be based on open data. If sufficiently complete, it would allow a trivial search through the recipe ingredients to determine which allergens are present. However, the problem is non-trivial due to ingredients that themselves have sub-ingredients; for example, "apple sauce" contains "apple", and is therefore in allergen food group "fruit".
Unfortunately an open database for this doesn't seem to exist, or at least it's not easy to find. The most relevant is this open dataset on food allergens, but it's Swiss and not particularly complete. This StackOverflow post searching for some open data didn't recieve a satisfactory response.
Some databases exist which go really deep into allergen protein structures, but are not really useful to this project, e.g. https://foodb.ca
Several proprietary offerings exist, including:
- https://developer.edamam.com
- https://esha.com/products/nutrition-database-api/
- https://spoonacular.com/food-api
- https://www.bon-api.com
A good first step would be building this map out.