15 Jun 2026
Background¶
I have been using Nutritionix as my source for ingredient data for this website. However, Nutritionix has stopped giving free API access to the ingredient database.
Changes Completed¶
I have updated the site to use Edamam as the primary source for ingredient data.
- Edamam API Client (
parser/Edamam_api_call.py): Created the new client that formats recipe ingredients and queries Edamam’s REST API, parsing the nested JSON structure (underingredients[0]['parsed'][0]['nutrients']) to build the per-100g database rows. - Switch Fallback Query (
parser/nutrition_labels_creator.py): Updated the parser to callget_edamam_data()when missing ingredients are found, rendering the nutrition facts returned by Edamam. - Recipe Demo Card (
parser/ingredients_string_creator.py): Updated the recipe details footer to point to Edamam's interactive Nutrition Analysis API demo page, keeping the legacy Nutritionix link commented out for future reference. - Global Hoisting (
parser/nutrition_labels_creator.py): Modifiednutrition_labels_creator.pyto read the database CSV files (ingredient_nutrient_db.csvandunit_db.csv) at the module global scope, preventing repetitive file reads on every recipe parsing call. - Caching & Concurrency (
parser/Edamam_api_call.py): Implemented local file-based JSON caching (./parser/db/edamam_cache.json) and concurrent requests inEdamam_api_call.pyusing aThreadPoolExecutor.
It keeps the basic premise same as in when missing ingredients are found using Edamam, I update the ingredients_nutrient_db.csv file to include the new ingredient with its nutritional information thereby reducing API calls in future.