Open alexfauquette opened 2 years ago
The nutrient extraction model was deployed and integrated to Robotoff. For every new image, we run the model on it and generate a prediction. An insight is generated if in the extracted nutrient values, at least one value is not present in the current nutrients.
To get the insights:
GET https://robotoff.openfoodfacts.org/api/v1/insights?insight_types=nutrient_extraction&order_by=popularity
~There are currently no ordering on this endpoint, but I plan to add a order_by={random,popularity}
option.~ Added and deployed
Nutrient values are in insight.data
. It contains:
entities
: a subset of the extracted entities at different processing steps (raw
, aggregated
, postprocessed
). We only have postprocessed
here, it's more useful as debug information. We can ignore this field here.nutrients
: a dictionary mapping nutrient name to a dict containing:
value
: the value to add, without the unitunit
: the unit (can be g
, mg
, µg
or null
). If it's null
, it's because we couldn't extract it from the image (either it's missing, the model was wrong or the OCR result was not good enough). In such case I think we can safely use the "default" unit, which depends on the nutrient (as it's done on Product Opener).score
: the entity score. Maybe not really relevant here, as this score is not calibrated (most values are > 0.98).char_start
, char_end
: start and end character offsets in the original textstart
, end
: start and end word offset in the original text@alexfauquette @raphael0202 since we now have the Nutrition prediction route, I'm bumping this one to P0 (let's be a bit dramatic ;)
Also, here's another route pour single barcode insights: https://github.com/openfoodfacts/openfoodfacts-server/issues/10950
What
Here is the PR that introduced it first time. All the useful information can be found here
Part of
70