Jump to content

Nutrients handling in Open Food Facts: Difference between revisions

explanation
(explanation)
Line 47: Line 47:
* <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.
* <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.
* The value of <code>energy_(100g|serving)</code> is calculated from <code>energy-kJ_(100g|serving)</code> if available, otherwise it is calculated from <code>energy-kcal}_(100g|serving)</code>. This field is in <code>kJ</code>.
* The value of <code>energy_(100g|serving)</code> is calculated from <code>energy-kJ_(100g|serving)</code> if available, otherwise it is calculated from <code>energy-kcal}_(100g|serving)</code>. This field is in <code>kJ</code>. Note however that the kJ and kcal can be different according to the regulation, so do not assume a factor of 4.2 between the values.


=== Data display ===
=== Data display ===
3,543

edits