Hub
Pricing About
WorkflowWorkflow

Optimizing Nutrition on a Budget

knime profile image
Draft Latest edits on 
Jul 28, 2026 2:40 PM
Drag & drop
Like
Download workflow
Workflow preview

Optimizing Nutrition on a Budget

You are a data analyst working for nutrition counseling. Your client shared two datasets with you: One containing nutrition facts of various foods (kcal, protein, fat, carbs) per serving size; The other containing a list with food items and their local store prices (in $).

Your client is on a budget but still wants to improve their fitness goal. You were asked to create a budget friendly high protein meal. The meal should consist of four items:

  • one protein item (must be a high-protein (>25g proteins) and low-fat (<5g fats) source),

  • one carbohydrate item (must be a low-carb source with <50g carbs), and

  • two different vegetables (must be less than 100 kcal and ideally as much protein as possible).

Clean and process the two datasets. Your client wants to know:

  1. What are the top 5 foods that offer the best value for money in terms of protein (i.e. with the highest protein per dollar ratio)?

  2. Which 4 food items should they buy for their next meal to get a high protein on a tight budget?

Dataset: Nutrition facts and price list on KNIME Community Hub

---

Solution:

We start by reading both datasets using a CSV Reader each, and then cleaning the food prices dataset. We use a Missing Value node to filter out any food entries that have a missing price value. Then we clean the food names: First, an Expression node to remove underscores from the food names; Second, a String Cleaner node to remove leading or trailing whitespaces.This process is important as we will join the two datasets on the food item column but if the names are not the same they won’t match. Lastly, a Column Renamer node finalizes the data preparation by standardizing column names for consistency.

After cleaning the data, we merge the two datasets using a Joiner node. We perform an inner join based on the "Food Item" columns. 

To calculate the protein-per-dollar ratio, we use an Expression node: We first calculate the protein per 100 grams by dividing each food item's protein content by its serving size; then we divide that value by the price per 100 grams. We then use a Top k Row Filter node to sort the results in descending order and generate a list of the top 5 food items that offer the best value for money in terms of protein.

We add another Expression node to calculate the cost per serving. Simply divide price per 100 grams by 100 to find price per gram and multiply that with the serving size. 

Lastly, to put together our budget friendly meal, we use three Expression Row Filter nodes followed by a Top k Row Filter node each to do the following:

  • The top branch finds the low fat, high protein items and picks the cheapest.

  • The middle branch finds the low carb items and picks the one with the lowest carbs.

  • The bottom branch finds all low calorie, high fiber items of type "Vegetables & Fungi" or "Fruits" and picks the two items with the highest protein content. 

Lastly, we use a Concatenate node to combine all these items in one table (basket), and calculate the basket’s total macros and price with a GroupBy node.

Loading deploymentsLoading manual runs

Used extensions & nodes

Created with KNIME Analytics Platform version 5.12.0
  • Go to item
    KNIME Base nodesTrusted extension

    KNIME AG, Zurich, Switzerland

    Version 5.12.0

    knime profile image
    knime
  • Go to item
    KNIME ExpressionsTrusted extension

    KNIME AG, Zurich, Switzerland

    Version 5.12.0

    knime profile image
    knime

Legal

By using or downloading the workflow, you agree to our terms and conditions.

KNIME
Open for Innovation

KNIME AG
Talacker 50
8001 Zurich, Switzerland
  • Software
  • Getting started
  • Documentation
  • Courses + Certification
  • Solutions
  • KNIME Hub
  • KNIME Forum
  • Blog
  • Events
  • Partner
  • Developers
  • KNIME Home
  • Careers
  • Contact us
Download KNIME Analytics Platform Read more about KNIME Business Hub
© 2026 KNIME AG. All rights reserved.
  • Trademarks
  • Imprint
  • Privacy
  • Terms & Conditions
  • Data Processing Agreement
  • Credits