Skip to content

taxonomy: Move vitamins out of ingredients.txt #11807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

Freso
Copy link
Collaborator

@Freso Freso commented Apr 19, 2025

Vitamins being in food/ingredients.txt is causing some issues with parsing and translations and splitting translation/synonym lists.

This moves all the specific vitamins out of the food/ingredients.txt file and into the vitamins.txt file, attempting to consolidate/merge the differences.

See also Slack discussion:
https://openfoodfacts.slack.com/archives/C02VDSWHT/p1743770992700109

B₆ vitamins have also been split up into individual chemical compounds. Previously, some vitamin B₆ synonyms would be compound names, and some compounds might even have other, different compounds associated with them.

Other small things:

  • some normalisation of casing
  • some xx entries added
  • some wikidata entries added

@github-actions github-actions bot added 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies 🥗🔍 Ingredients analysis https://wiki.openfoodfacts.org/Ingredients_Extraction_and_Analysis labels Apr 19, 2025
@github-project-automation github-project-automation bot moved this to To discuss and validate in 🍊 Open Food Facts Server issues Apr 19, 2025
@Freso Freso force-pushed the taxonomy/vitamins branch 2 times, most recently from 952254f to b4c174b Compare April 19, 2025 22:48
@Freso Freso force-pushed the taxonomy/vitamins branch 2 times, most recently from ca5b866 to 3a7d91c Compare April 20, 2025 00:11
@Freso Freso marked this pull request as ready for review April 20, 2025 00:11
@codecov-commenter
Copy link

codecov-commenter commented Apr 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.60%. Comparing base (e8deee5) to head (a7fb8b9).
Report is 107 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11807      +/-   ##
==========================================
- Coverage   49.88%   45.60%   -4.29%     
==========================================
  Files          83       83              
  Lines       22984    23036      +52     
  Branches     5508     5519      +11     
==========================================
- Hits        11466    10506     -960     
- Misses      10121    11233    +1112     
+ Partials     1397     1297     -100     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Freso Freso force-pushed the taxonomy/vitamins branch from 3a7d91c to dc6c112 Compare April 20, 2025 09:13
@Freso Freso requested a review from a team as a code owner April 20, 2025 09:13
@Freso Freso force-pushed the taxonomy/vitamins branch from dc6c112 to be7dd19 Compare April 20, 2025 10:51
Vitamins being in food/ingredients.txt is causing some issues with
parsing and translations and splitting translation/synonym lists.

This moves all the specific vitamins out of the
`food/ingredients.txt` file and into the `vitamins.txt` file,
attempting to consolidate/merge the differences.

See also Slack discussion:
https://openfoodfacts.slack.com/archives/C02VDSWHT/p1743770992700109

B₆ vitamins have also been split up into individual chemical compounds.
Previously, some vitamin B₆ synonyms would be compound names, and
some compounds might even have other, different compounds associated
with them.

Other small things:
- some normalisation of casing
- some xx entries added
- some wikidata entries added
@Freso Freso force-pushed the taxonomy/vitamins branch from be7dd19 to a7fb8b9 Compare April 20, 2025 12:39
Copy link

@Freso
Copy link
Collaborator Author

Freso commented Apr 22, 2025

Looks like the only tests that are still failing are ones related to vegan/vegetarian status. @stephanegigandet previously mentioned an ingredients_classes.txt file, but I haven’t been able to locate such a file anywhere in the codebase.

I did copy the vegan and vegetarian properties to the vitamins entry in additives_classes.txt (and also kept them in food/ingredients.txt’s vitamin entry). Based on the (failing) tests, this doesn’t seem to work for carrying the properties through to individual vitamins. 😕

Is there some way somewhere to apply properties to all vitamins at once like the normal inheritance? (Other than adding a vitamins entry in vitamins.txt that allllll the other vitamins can inherit from… 🙃)

@benbenben2
Copy link
Collaborator

All vitamins are not vegetarian/vegan.

See for example: https://en.wikipedia.org/wiki/Vitamin_B12

I would suggest to
1- remove

vegan:en: yes
vegetarian:en: yes

from vitamins in ingredients.txt

2-update the expected test result

(optional, if you want to go further)
3-add vegan/vegetarian for each ingredients. Vitamin A is usually from vegetables, but not always.

@Freso
Copy link
Collaborator Author

Freso commented Apr 22, 2025

All vitamins are not vegetarian/vegan.

Yep, but that’s part of what will be addressed with #11669 and is out of scope for what this PR aims to do, unless we decide to just remove the vegan/vegetarian from all vitamins as we move them out of ingredients.txt – but that is not a call I’m willing to make on my own.

3-add vegan/vegetarian for each ingredients.

Some individual vitamins already have their own vegan/vegetarian declarations, if they differ from the default inherited from vitamins. E.g., riboflavin: https://github.com/openfoodfacts/openfoodfacts-server/pull/11807/files#diff-19ea7daf6c5782b6b576081df6436cba9c2932e989e45f2f6a6c4c11593b7319R1268-R1270

All vitamins are not vegetarian/vegan.

See for example: https://en.wikipedia.org/wiki/Vitamin_B12

I’m… not sure how that shows that B₁₂ is not vegan? The page says the compound is synthesised via a variety of bacteria cultures, not via any exploitation of other conscious, sentient, feeling beings.

@stephanegigandet
Copy link
Contributor

@Freso for the failing tests, I think the issue is that individual vitamins are not under the en:vitamins parent anymore. I'm trying to see if it solves the issue with this PR: #11816 (I also moved the en:vitamins entry to additives_classes.txt , we had 2 en: vitamins entries)

@Freso Freso changed the title taxonomy: Move specific vitamins out of ingredients.txt taxonomy: Move vitamins out of ingredients.txt Apr 24, 2025
@Freso Freso moved this to Needs review in Product Opener Weekly Review Apr 24, 2025
@Freso Freso moved this from Needs review to In Progress in Product Opener Weekly Review Apr 24, 2025
@Freso Freso moved this from In Progress to To be discussed in Product Opener Weekly Review Apr 24, 2025
stephanegigandet added a commit that referenced this pull request May 12, 2025
Continuation of
#11807 by
@Freso

---------

Co-authored-by: Frederik “Freso” S. Olesen <[email protected]>
Co-authored-by: Open Food Facts Bot <[email protected]>
Co-authored-by: benbenben2 <[email protected]>
@github-actions github-actions bot added the 💥 Merge Conflicts 💥 Merge Conflicts label May 12, 2025
@stephanegigandet
Copy link
Contributor

@Freso I just merged a PR based on your PR: #11816

@Freso
Copy link
Collaborator Author

Freso commented May 12, 2025

That one included the commit from here, right?

@Freso Freso closed this May 12, 2025
@github-project-automation github-project-automation bot moved this from To discuss and validate to Done in 🍊 Open Food Facts Server issues May 12, 2025
@github-project-automation github-project-automation bot moved this from In progress to Done in Ingredient analysis May 12, 2025
@github-project-automation github-project-automation bot moved this from To be discussed to Done in Product Opener Weekly Review May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧪 additives 🥗🔍 Ingredients analysis https://wiki.openfoodfacts.org/Ingredients_Extraction_and_Analysis 💥 Merge Conflicts 💥 Merge Conflicts 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies 🧪 tests
Projects
Status: Done
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants