Open monsieurtanuki opened 8 months ago
@CharlesNepote There are 47 "nutrients" found in Food.pm that are currently not in off-dart.
For each nutrient, we need to attach a Unit
(KCAL, KJ, G, MILLI_G, MICRO_G, MILLI_L, L, PERCENT).
Would you list the important nutrients you would like to see added, each with their unit?
@monsieurtanuki, I have investigated a little bit and, yes, all your questions' answers are in the Perl code: https://github.com/openfoodfacts/openfoodfacts-server/blob/7d295d10fcc8939cccfd093810cb0edb8a3c9449/lib/ProductOpener/Food.pm#L400
We should ask ourselves if these data shouldn't be provided as data, and not as Perl code, to let any kind of apps reuse it more easily -- a YAML file as it allows comments? Should I open a bug @stephanegigandet ?
@CharlesNepote Developers can already get a JSON version of it with https://world.openfoodfacts.org/cgi/nutrients.pl?lc=fr&cc=fr, easy to reuse, therefore I think we're already almost good here. Except that the unit is missing: that would be helpful for instance to know that vitamin b12 is rather given in µg. Where does the default unit come from?
@monsieurtanuki @CharlesNepote all the nutrients and their default unit are in the nutrients taxonomy: https://github.com/openfoodfacts/openfoodfacts-server/blob/main/taxonomies/nutrients.txt
I can add the units to the output of https://world.openfoodfacts.org/cgi/nutrients.pl?lc=fr&cc=fr
I can add the units to the output of https://world.openfoodfacts.org/cgi/nutrients.pl?lc=fr&cc=fr
@stephanegigandet That would be nice, that's typically the unit:en: µg
info that we need in the current issue.
@monsieurtanuki : FYI, @stephanegigandet has added the units into https://world.openfoodfacts.org/cgi/nutrients.pl?lc=fr&cc=fr
Thank you @CharlesNepote @stephanegigandet!
That means we can now add the unit into our OrderedNutrient
object.
For the record, some stats about the lc=fr&cc=fr
unit repartition:
g
: 65mg
: 26µg
: 11kj
: 3kcal
: 1% vol
: 2 ("acidity", "alcohol") - same as %
or needs to be added?%
: 5mmol/l
: 1 ("water-hardness") - needs to be addedTo be checked, added or edited in off-dart (data from lc=fr&cc=fr
):
Description
cf. @CharlesNepote's https://github.com/openfoodfacts/smooth-app/issues/4943 There are some nutrients in Food.pm and https://world.openfoodfacts.org/cgi/nutrients.pl?lc=fr&cc=fr that we don't deal with in off-dart: they are not in off-dart's
Nutrient
enum
.Expected behavior
We should be able to deal with all nutrients, at least most of them.