Skip to content
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

When deleting all nutrients, some computed values are kept in DB #10933

Closed
raphael0202 opened this issue Oct 24, 2024 · 5 comments
Closed

When deleting all nutrients, some computed values are kept in DB #10933

raphael0202 opened this issue Oct 24, 2024 · 5 comments

Comments

@raphael0202
Copy link
Contributor

raphael0202 commented Oct 24, 2024

When we remove all nutrients from a product using the web version, we still have the following (computed values) in the nutriments field:

{
    "nutriments": {
        "carbon-footprint-from-known-ingredients_100g": 50.336,
        "carbon-footprint-from-known-ingredients_product": 252,
        "carbon-footprint-from-known-ingredients_serving": 27.2,
        "fruits-vegetables-legumes-estimate-from-ingredients_100g": 0,
        "fruits-vegetables-legumes-estimate-from-ingredients_serving": 0,
        "fruits-vegetables-nuts-estimate-from-ingredients_100g": 0,
        "fruits-vegetables-nuts-estimate-from-ingredients_serving": 0,
        "nova-group": 1,
        "nova-group_100g": 1,
        "nova-group_serving": 1,
        "nutrition-score-fr": -7,
        "nutrition-score-fr_100g": -7
    }
}

In Robotoff, I added a special case to consider the product nutrients as missing if there are only these keys: openfoodfacts/robotoff@0e4aff3.

@stephanegigandet
Copy link
Contributor

@raphael0202 We chose to have some computed values in the nutriments field, so this behaviour is normal. It is useful in particular for easing the creation of graphs and search filters. We could decide to do it differently in the future.

@raphael0202
Copy link
Contributor Author

@raphael0202 We chose to have some computed values in the nutriments field, so this behaviour is normal. It is useful in particular for easing the creation of graphs and search filters. We could decide to do it differently in the future.

But as all nutrient values were deleted, I was expected the computed values to be deleted as well. But it's definitely not a major issue.

@stephanegigandet
Copy link
Contributor

nutrition-score-fr and nutrition-score-fr_100g should definitely be removed, but the other ones are computed from ingredients, so they should stay

@stephanegigandet
Copy link
Contributor

ah in fact it's probably a product where nutriments are estimated, that's why we get nutriscore-score-fr

so everything looks normal in this case

@raphael0202
Copy link
Contributor Author

Thank you for the explanations! I'm closing this issue

@github-project-automation github-project-automation bot moved this from To discuss and validate to Done in 🍊 Open Food Facts Server issues Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants