Skip to main content

A command-line tool to generate recipes based on available ingredients.

Project description

QuickBite: Recipe Generator

Modern Data Structures - Fall 2023

Columbia University QMSS

Hafsah T. Shaik

About

QuickBite is a Python-based command-line application that generates cooking recipes based on user-inputted ingredients. It aims to promote cooking with available resources, reduce food waste, and simplify meal planning by utilizing data from various recipe and nutritional databases.

This project is the final project for the Modern Data Structures class at Columbia University for Fall 2023.

Features

  • Fetch and display recipes from a vast collection using the Spoonacular API.
  • Gather and present nutritional data for ingredients using the Edamam API.
  • Generate recipes based on user-provided ingredients and dietary preferences.
  • Offer the ability to exclude certain ingredients from the recipe search.
  • Provide summary statistics about the recipes such as calorie count and preparation time.

Installation

To install QuickBite, you will need Python 3.8 or later.

From PyPI

Once QuickBite is available on PyPI, you can install it using pip:

pip install quickbite

For Development

If you wish to install QuickBite for development purposes, follow these steps:

  1. Clone the repository:
git clone https://github.com/<your-username>/QuickBite.git
  1. Navigate to the project directory:
cd QuickBite
  1. Install the package along with its dependencies:
poetry install

This will create a virtual environment with all the necessary dependencies installed.

Usage

To use QuickBite, run the following command in your terminal:

quickbite

You will be prompted to enter the ingredients you have on hand, separated by commas:

Enter ingredients you have, separated by commas (e.g., eggs, flour, sugar):

Next, you can specify any ingredients you wish to exclude from the recipe suggestions:

Enter ingredients you want to exclude, separated by commas (e.g., nuts, dairy):

QuickBite will then display a list of recipes that match your ingredients, and you can select one to see more details, including the recipe's nutritional information and a list of all needed ingredients.

Here's an example of command usage:

$ quickbite
Welcome to the Recipe Generator!

Enter ingredients you have, separated by commas (e.g., eggs, flour, sugar): chicken, rice

Enter ingredients you want to exclude, separated by commas (e.g., nuts, dairy):

Searching for recipes...

Available recipes:
1. Chicken and Rice Casserole
2. Spicy Chicken Stir Fry
3. Simple Chicken Biryani
4. Chicken Fried Rice

Enter the number of the recipe to get more information, or 'exit' to finish: 2

Fetching details for recipe: Spicy Chicken Stir Fry...

Nutritional Information:
Calories: 300
Protein: 25g
...

Ingredients List:
- Chicken breast: 2 pieces
- Rice: 1 cup
- Bell pepper: 1
- ...

Would you like to start over? (yes/no): no

Development Setup

To set up a development environment for QuickBite:

  1. Clone the repository:
    git clone https://github.com/<your-username>/QuickBite.git
    
  2. Navigate to the project directory:
    cd QuickBite
    
  3. Install dependencies using Poetry:
    poetry install
    
  4. Activate the virtual environment:
    poetry shell
    
  5. Set up environment variables: Copy .env.example to .env and populate it with your API keys.

Functions

The application includes the following defined functions:

  • search_recipes_by_ingredients: Search for recipes based on a list of ingredients.
  • search_recipes_excluding_ingredients: Filter recipes by excluding certain ingredients.
  • get_nutritional_data: Retrieve nutritional information for a given ingredient.
  • get_recipe_details: Fetch detailed information about a specific recipe.
  • get_user_ingredients: Interactively get ingredients from the user.
  • get_user_exclusions: Interactively get ingredient exclusions from the user.
  • display_recipes: Display a list of recipes to the user.
  • print_ingredients_list: Print out a formatted list of ingredients.
  • get_ingredients_for_recipe: Extract and format ingredients for a specific recipe.
  • format_nutritional_data: Format and display nutritional data.

Challenges Faced and Solutions

Throughout the development of QuickBite, several technical challenges were encountered:

  1. API Rate Limiting: Both Spoonacular and Edamam APIs have rate limits which initially hindered the ability to collect large amounts of data continuously. To overcome this, I implemented a caching system that stores API responses, thereby reducing the number of necessary calls for repeated data requests.

  2. Data Inconsistency: The data retrieved from the APIs had inconsistencies in formatting, especially with units of measurement for ingredients. I created a normalization function that standardizes the units and formats the ingredient data into a consistent structure.

  3. Error Handling: Various exceptions and errors such as timeouts and HTTP errors were frequent during API interaction. I utilized try-except blocks to handle these exceptions gracefully and ensure the application could continue running without crashing.

  4. Environment Management: Managing API keys securely while allowing the application to be used on different machines was a concern. I used environment variables to handle API keys, making the application more secure and portable.

These challenges were met with a focus on robustness and user experience, ensuring that the final product was not only functional but also reliable and easy to use.

Contributing

Contributions are welcome. Please open an issue to discuss your ideas or submit a Pull Request.

License

QuickBite is open-sourced under the MIT License, which provides a permissive free software license that allows for reuse within proprietary software provided all copies of the licensed software include a copy of the MIT License terms and the copyright notice.

For the full license text, see the LICENSE file.

Acknowledgements

This project is submitted as a part of the final coursework for the Modern Data Structures class under the guidance of Dr. Thomas Brambor, Columbia University QMSS, Fall 2023.

Data provided by:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quickbite-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quickbite-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file quickbite-0.1.0.tar.gz.

File metadata

  • Download URL: quickbite-0.1.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Darwin/21.6.0

File hashes

Hashes for quickbite-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6780b8b59e58e0e186c266f6adad56c73b1d49f5a75684f9c711e9ed39090b1f
MD5 7b7c7ec145fc4cf04e879ab62685633d
BLAKE2b-256 2e69f137bb3a817d85fd6e05c78b2e728ebec50538b6296bcab7ae0ac9b5b02f

See more details on using hashes here.

File details

Details for the file quickbite-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: quickbite-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Darwin/21.6.0

File hashes

Hashes for quickbite-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e567fb09a3b8be8d1a011d2acf3614e0def9d4a7f9cb5c383f4c1cd3cf6ffe59
MD5 6dac09e3172e40fe44ff2f0645f0b14b
BLAKE2b-256 9a32cf69fe448b2499b2b1cc66ad20ad166a657546aed5f1a467e5f5eecb60d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page