11% of people around the world suffer from chronic hunger and undernourishment. In this same world, it is estimated that 1.3 billion tonnes of food, about one third of the world's food supply, is wasted each year. The effects of food wastage include the loss of biodiversity, an increased blue water footprint, an increased carbon footprint, the acceleration of climate change, and needless starvation, the vast majority of which is experienced by those in developing countries.

One of the main causes of food waste is a consumer’s lack of planning. Often, people will make trips to the grocery store and buy a large amount of food without thinking about how and when the food will be prepared and eaten. Due to poor planning, some of the food will inevitably go bad before the consumer gets the chance to use it, and thus into the garbage it goes.

What it does

Rationality aims toward reducing the large amounts of food waste - that often end up in landfills and combustion facilities - with the help of an app that allows the user to plan out what meals they would like to have in the course of week. The user selects recipes and assigns them to a date in the calendar. Then, a shopping list is generated with all the ingredients needed to prepare the meals- no more, no less. The user can also input ingredients they already have in the inventory page. That way, an ingredient is only added to the shopping list if it is not already in the inventory. Once an item is checked off of the shopping list, it is automatically added to the inventory. Rationality also offers a recipe page where the user can explore new foods and get a better idea of what they would like to eat. If the user finds a recipe they love, they can add it to their favorites for easy access.

How we built it

We decided to build our app with Ionic and React Native as we wanted our app to be compatible with both Android and iOS devices. The backend of the app was built first with Python and Flask, and we decided to go with MongoDB as our database.

Login system: The app uses the POST method to send the user’s username and password to the API to have it verified. Passwords are stored as salted hash and the bcrypt library is used to check if plaintext passwords match the salted password. When the user logs in, their data (favorite recipes, schedules, shopping lists, inventory) are stored on their device’s temporary storage for the app to use so the app doesn’t have to use the API over and over again when it needs user data.

Search/recipe system: The API uses BeautifulSoup to scrape recipes off of Wikibooks’ open-sourced Cookbook. There are many recipe APIs out there already, but these APIs placed limits on how many requests we could make and that would have slowed our development. This system would not only get the recipes, but also the ingredients since the user needs to know what to buy from their shopping lists.

Favorites/scheduling system: Because the app doesn’t have a complete database of all the possible recipes, it scrapes the recipe page on every search. Forcing the user to add recipes to favorites helps because the recipe would be stored as the user’s data so it can be retrieved without having to web scrape again. It also allows us to show featured recipes!

Deploying app/App website: Since publishing an app on the Apple Store costs quite a lot of money, we decided to just upload the app’s source on Github along with instructions on how to build and run the project! We also made a website for the app to highlight the purpose of the app.

Challenges we ran into

For this hackathon, we decided to try and learn something new: making an app. None of us had done it before and one specific challenge we faced during the course of this hackathon was that we didn’t have a platform in which we could see each other’s changes directly. Previously we had all used in order to collaborate as a team together on making a website however since this app was to be made with React and Typescript, there was no way for us to do that. Instead, our group decided to learn how to collaborate through GitHub for us to be able to see what changes our other team members were making. Another really challenging part of creating the app was the process of scraping recipe pages for recipes and especially for ingredients since many of these pages had different formats/styling. Implementing the calendar page in our app was also especially difficult. Our team had tried over five calendars and spent an entire day on it before finding one that had the features we wanted. From there on we had to pull out hidden classes in the react calendar in order to better style and edit the calendar in our favor.

Accomplishments that we're proud of

First of all, we are very proud that we were able to successfully create an app without any prior experience in app development within a week. In terms of specific features, we are proud of our multifunctional calendar that allows the user to plan out what meals they would want to have on a certain day. We are also proud of extra enhancements that help take the app to the next level, such as the featured recipes section in the recipes page and the ability to heart a recipe to add it to your favorites.

What we learned

None of us have ever built an app before, so the entire process was a learning experience. We had also never before used GitHub as extensively as we did for this project, so we learned a lot of new Git commands in the terminal. We also learned a new language: Typescript.

From our research, we learned a lot about the socioeconomic issue of food waste, as well as its major causes and effects. We reflected deeply upon our own habits and came to realize how common and overlooked food waste really is, especially in the United States.

What's next for Rationality

One feature that we would like to implement in the future is the option to input your grocery budget in order to receive recipe recommendations that fit your budget. We would also like to add the ability to track an item’s expiration date or shelf-life in the inventory and send notifications when an item is about to go bad. In addition, we would like to enhance the recipe page by allowing the user to input custom recipes.

When adding items to inventories the app requires the user to type out an ingredient verbatim, and we hope to make this feature more user friendly through fuzzy matching.

The transitions between tabs and between states (for instance: when the notification pops up and disappears) are not exactly smooth as of now, so this will hopefully be improved in the future.

To help prevent food waste from leftovers, we will also attempt to implement a "reverse search" where given the ingredients from leftovers, the user can search for recipes with these ingredients.

In order to help users maintain a balanced diet, even on a budget, we would also like to add a nutrition tracker page that displays data such as calories per day, amount of proteins, carbs, fat, vitamins, and minerals consumed.

Want to try it out?

Check out Rationality on Github! Instructions to build and run the app are also on the repository.

Share this project: