Skip to content

A Python package to calculate Nutri-Score based on the formula of 2024.

License

Notifications You must be signed in to change notification settings

MalteIwanicki/NutriScoreCalculator

Repository files navigation

Algorithm is up to date and unittest succeedes

NutriScoreCalculator

The goal of this project is to provide a simple package that can calculate the Nutri-Score based on the formula of 2024.

Nutri Score logo

What is the Nutri-Score?

The Nutri-Score is a nutrition label that converts the nutritional value of products into a simple code consisting of 5 letters, each with its own color. Each product is awarded a score based on a scientific algorithm. This formula takes into account the nutrients to avoid (energy value and the amount of sugars, saturated fats, and salt) and the positive ones (the amount of fiber, protein, fruit, vegetables, and nuts). You can therefore see at a glance which products are recommended and which should be avoided.

The formulars are sourced from: https://www.bmel.de/SharedDocs/Downloads/DE/_Ernaehrung/Lebensmittel-Kennzeichnung/nutri-score-dt-excel-berechnungstabelle.html

more information here: https://www.bmel.de/DE/themen/ernaehrung/lebensmittel-kennzeichnung/freiwillige-angaben-und-label/nutri-score/nutri-score_node.html

Where to get it

The source code is currently hosted on GitHub at: https://github.com/MalteIwanicki/NutriScoreCalculator

Usage

Install:

cd {projects folder with setup.py}
pip install .

Calculate the Nutri-Score:

from nutri_score_calculator import NutriScoreCalculator, NutriScoreCategory

result = NutriScoreCalculator.calculate_nutri_score(
    category=NutriScoreCategory.ALLGEMEINER_FALL,
    kilokalorien=0,
    gesaettigte_fettsaeuren=4,
    zucker=60,
    proteine=2,
    salz=2,
    ballaststoffe=500,
    anteil_obst_gemuese_huelsen_schalen_raps_walnuss_und_olivenoele=10,
)
print(result) # result: "Nutriscore_D"

License

MIT

Contribution

Feel free to add suggestions, PRs, comments, and bug reports.

Authors

Malte Iwanicki (malteiwa@gmail.com)

About

A Python package to calculate Nutri-Score based on the formula of 2024.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages