Jump to content

Nutrients handling in Open Food Facts: Difference between revisions

Line 41: Line 41:
==== Fields entered and computed by the OFF backend (Product Opener) ====
==== Fields entered and computed by the OFF backend (Product Opener) ====


* nutrient-id_value : what was entered and passed in the nutrient-id field
* <code>{nutrient-id}_value</code>: what was entered and passed in the nutrient-id field.
* nutrient-id_unit : what was entered and passed in the nutrient-id_unit field
* <code>{nutrient-id}_unit</code>: what was entered and passed in the nutrient-id_unit field.
* nutrient-id : the value converted in the default unit (currently kJ for all energy fields (including energy-kcal), otherwise gram)
* <code>{nutrient-id}</code>: the value converted in the default unit (currently kJ for all energy fields (including energy-kcal), otherwise gram).
* nutrient-id_[value of nutrition_data_per) is set to nutrient-id (e.g. if nutrition_data_per is "100g", the value of sugars_100g is set to the value of sugars
* <code>{nutrient-id}_(100g|serving)</code>: is set to <code>{nutrient-id}</code> (e.g. if <code>nutrition_data_per = 100g</code>, the value of <code>sugars_100g</code> is set to the value of sugars.
* if the serving size is known, we compute the value for the other field (nutrient-id_100g or nutrient-id_serving) in default unit
* If the serving size is known, we compute the value for the other field (nutrient-id_100g or nutrient-id_serving) in default unit.


=== Data display ===
=== Data display ===
72

edits