openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
http://openfoodfacts.github.io/openfoodfacts-server/
GNU Affero General Public License v3.0
664 stars 392 forks source link

Handling of 0 and < in nutritional values #8163

Open aleene opened 1 year ago

aleene commented 1 year ago

Describe the bug

The graphs and stats created by the advanced feature, now treat values with 0 and values with limits (< 0.5) like normal data. This results in strange graphs and stats.

Screenshot 2023-03-06 at 16 14 55

The graph above for example presents the protein values for the category apple nectars. The values around 0.5 and 0.1 are due limits on the package. The zeros ar no actual values either, but rounding errors mad by the producers. Only the values between 0 and 0.1 are actual measurements.

To Reproduce

For instance this graph and stats: https://world.openfoodfacts.org/cgi/search.pl?action=process&tagtype_0=categories&tag_contains_0=contains&tag_0=apple-nectars&sort_by=unique_scans_n&page_size=20&axis_x=energy&axis_y=proteins&graph=1

Expected behavior

The maxima (<) and 0 should be treated as special values:

Number of products impacted

Any product with 0 or maxima.

Part of

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 90 days with no activity.