Jump to content

Nutrients handling in Open Food Facts: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 38: Line 38:
** for those apps, the energy_unit field is used to populate the corresponding energy-kj or energy-kcal field
** for those apps, the energy_unit field is used to populate the corresponding energy-kj or energy-kcal field


==== Fields stored and computed by Product Opener
==== Fields stored and computed by Product Opener ====


* nutrient-id_value : what was passed in the nutrient-id field
* nutrient-id_value : what was passed in the nutrient-id field
Line 61: Line 61:




=== Possible improvements to make thing (a bit)
== Possible improvements to make thing (a bit) simpler ==
 
* In the API, rename the "nutrient-id" fields (such as energy-kj, saturated-fat) to "nutrient-id_value", so that it matches the name of the field stored.
* Store the energy-kcal values in kcal, without converting them to kJ
** This is probably what people intuitively expect
** It removes unnecessary conversions from kcal to kJ and back (which is not trivial, as some people/apps may choose a different conversion factor, such as 4.2 or 4.185)
** This would be a breaking change if some apps use the energy-kcal_100g/serving or energy-kj_100g/serving fields