Jump to content

Nutrients handling in Open Food Facts: Difference between revisions

Added reason.
(Added % unit and no unit (for pH, etc).)
(Added reason.)
Line 69: Line 69:
== Possible improvements to make thing (a bit) simpler ==
== 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.
* 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. It also makes clearer where the value is coded.
* Store the energy-kcal values in kcal, without converting them to kJ
* Store the energy-kcal values in kcal, without converting them to kJ
** This is probably what people intuitively expect
** 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)
** 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
** This would be a breaking change if some apps use the energy-kcal_100g/serving or energy-kj_100g/serving fields


== Possible improvements to make thing (a bit) more complex ==
== Possible improvements to make thing (a bit) more complex ==
3,543

edits