Skip to content

feat: add plant-based / dietary preference filters to nutrition module #2217

Closed
wger-project/flutter
#1124

Description

@samtuckerdavis

Feature Request

Problem

wger's nutrition module allows tracking meals and nutritional plans, but doesn't support filtering by dietary preference. Users following plant-based diets cannot easily:

  • Filter the ingredient database by dietary suitability
  • Identify which nutritional plans are plant-based compatible
  • Find plant-based alternatives when building meal plans

Proposed Solution

  1. Dietary flags on ingredients — mark ingredients as vegan, vegetarian, or containing specific allergens. Many ingredient databases (e.g., Open Food Facts) already include this metadata and could be used to bulk-populate flags.

  2. Nutritional plan dietary filter — when creating/browsing nutritional plans, filter by dietary preference

  3. Plant-based alternative suggestions — when viewing an ingredient, suggest plant-based alternatives with similar nutritional profiles

Context

Plant-based diets are one of the fastest-growing dietary trends globally. Fitness tracking apps that support dietary preferences (Cronometer, MyFitnessPal) see high engagement from this demographic. Adding this to wger would serve an underserved user group in the open-source fitness tracking space.

Implementation Notes

The simplest approach would be a dietary category tag on the Ingredient model, with bulk population from Open Food Facts API data. The filtering can then be added to existing API endpoints and UI components.

Happy to discuss or contribute.

Activity

  1. rolandgeider commented on Feb 25, 2026

    @rolandgeider
    Member

    hey!

    this is a good idea. I also think adding two flags to the ingredient model is a good solution, the only "difficulty" is the Open Food Facts import, their data model can be sometimes a bit weird with their tag system. The filtering etc can happen later

  2. rolandgeider commented on Feb 25, 2026

    @rolandgeider
    Member

    oh you had already submitted a pr

  3. samtuckerdavis commented on Feb 25, 2026

    @samtuckerdavis
    ContributorAuthor

    Thanks @rolandgeider — appreciate the endorsement on the approach. The PR is up at #2218 with the two nullable boolean fields on the Ingredient model, extraction from OFF's ingredients_analysis_tags, API filtering, and test coverage.

    You mentioned OFF's data model can be a bit weird with their tag system — the PR currently handles their known tag variants (en:vegan, en:non-vegan, en:maybe-vegan, en:vegan-status-unknown, and the vegetarian equivalents), mapping uncertain states to NULL. Is there anything specific about the OFF import behavior you've seen that you'd want addressed in this PR, or would you prefer to handle edge cases as a follow-up?

  4. moved this from Backlog to In progress in Release 2.5on Feb 26, 2026
  5. moved this from In progress to In review in Release 2.5on Feb 27, 2026
  6. moved this from In review to Done in Release 2.5on Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions