Alternative Recipe#

Jenny Lee, May 2023

Note

Kindly note that this web page solely offers a synopsis of the Alternative Recipe project. The comprehensive set of scripts and codes used in the project is available in the corresponding GitHub repository.

Project Outline#

Alternative Recipe is a dedicated project aimed at heightening awareness about the escalating concerns associated with global climate change. Notably, it has been honored with the esteemed Best of Rest Award at the 2023 Climate Change-Makers Challenge—an international hackathon with more than 350 participants focused on devising innovative solutions to address the pressing dilemma of climate change.

In the course of this project, I have successfully implemented an alternative recipe generator designed to replace the primary ingredient responsible for the highest greenhouse gas emissions with a more environmentally friendly substitute. The application harnesses the capabilities of the Streamlit library, offering a user-friendly web-based interface for seamless accessibility and interaction.

Overall Process#

Data Preprocessing#

Firstly, we obtain data that delineates the greenhouse gas (GHG) emission factor per fixed amount of food in kilograms, as outlined by Poore, J., & Nemeck, T. (2018) [1] Concurrently, nutritional information per food is sourced from Statistics Canada [2]. In the case where the food item is labeled with non-standard units such as cases and packages, additional steps are necessary to convert them into standard units.

Please open the following cell to view the flowchart illustrating the data preprocessing process.

Hide code cell outputs
_images/55ff537e8a4af94755f94d1ea3b445ff90c6b708ad9ef6d16931c8e843b0fdd9.svg

Finding the Closest Alternative#

Let’s take a look at a sample row of the nutrition.csv dataset used in this project.

name serving_size calories total_fat saturated_fat cholesterol sodium choline folate folic_acid ... fat saturated_fatty_acids monounsaturated_fatty_acids polyunsaturated_fatty_acids fatty_acids_total_trans alcohol ash caffeine theobromine water
0 Beef, raw, all grades, trimmed to 0" fat, sepa... 100 g 125 3.5g 1.4g 62mg 54.00 mg 64.5 mg 4.00 mcg 0.00 mcg ... 3.50 g 1.353 g 1.554 g 0.244 g 62.00 mg 0.0 g 1.11 g 0.00 mg 0.00 mg 72.51 g

1 rows × 76 columns

The most suitable alternatives to replace ingredients with high greenhouse gas (GHG) emissions are determined using the mean standard error (MSE), a commonly utilized error metric in regression analysis.

\[\sum_{i=1}^{D}(x_i-y_i)^2\]

A more effective replacement for an ingredient is indicated by a smaller MSE value compared to the original ingredient. It’s important to note that not all nutritional information from the dataframe above has been considered. The detailed rationale for selecting specific nutritional information and excluding others is elaborated further on the project’s GitHub repository.

Total Emission Calculation with User Input#

After gathering user inputs for the recipe, we proceed to calculate the total greenhouse gas (GHG) emissions incurred by the user’s recipe. Should the total GHG emission surpass a predefined threshold, we propose alternative ingredients to replace existing ones known for high GHG emissions. The user has the flexibility to substitute as many ingredients as desired.

Following the substitutions, the user can finalize the new recipe with the replaced ingredients. If the new recipe succeeds in reducing GHG emissions compared to the original recipe, the user is informed of the total GHG reduction. This reduction is then correlated with the number of mature trees that need to be planted to offset the environmental impact.

If the user desires to receive the new recipe via email, the program will facilitate this by sending an email containing the details of the revised recipe to the user’s specified email address.

Please open the following cell to view the flowchart illustrating the total emission calculation and the process of suggesting an alternative recipe.

Hide code cell outputs
_images/d4997728aad1adb345e41104494181947daeaca564a694366dfa7069e3589d33.svg

Final Deliverable#

_images/alternative-recipe.png

Fig. 1 Alternative Recipe application start page#

Alternative Recipe is a web-based application designed to assess the carbon footprints associated with various food categories and calculate the total kilograms of CO2-equivalent emissions a meal would generate. The distinctive feature of the application lies in its ability to propose a more sustainable recipe. Users can modify their original recipes by incorporating environmentally friendly ingredients, and the application suggests alternatives by comparing nutritional values. These suggested alternatives aim to reduce the overall CO2 emissions produced by the meal.

Moreover, the application offers a practical feature allowing users to request their modified recipes to be sent directly to their emails, enhancing convenience and user experience.

Conclusion#

As a next step, we can broaden our analysis beyond \(\text{CO}^2\) emissions to encompass other greenhouse gases, such as nitrogen dioxide and methane, originating from food production. By integrating the footprints of these gases, our application can offer users the flexibility to choose their focus, allowing them to select a specific greenhouse gas like nitrogen dioxide. Consequently, the application will provide alternative suggestions aimed at minimizing emissions of the chosen gas.

On the technical front, we can introduce a login page, enabling users to maintain records of their emission reductions achieved through the Alternative Recipe platform. Additionally, recognizing the current instability of the Send Email button attributed to the use of a free API version, upgrading to a professional version with enhanced functionality can ensure the stability and reliability of the email notification feature. This enhancement would contribute to a more seamless user experience.

References#