Jump to content

Nutrients handling in Open Food Facts: Difference between revisions

(Added question)
Line 19: Line 19:
=== Data input ===
=== Data input ===


==== Fields sent by the write API ====
==== Fields sent to the write API ====


Apps (+ the OFF web site edit form) send:
Apps (+ the OFF web site edit form) send:


* nutrition_data_per : "100g" or "serving"
* <code>nutrition_data_per</code>: <code>100g</code> or <code>serving</code>
* serving_size (optional, but very useful, in particular if the nutrition facts are specified per serving)
* <code>serving_size</code>: (optional, but very useful, in particular if the nutrition facts are specified per serving)
* for each nutrient:
* for each nutrient:
** nutrient-id (e.g. saturated-fat, energy-kcal) : value for the nutrient, for the size specified in "nutrition_data_per". This is a string ("17.8", "34,7", "< 0.1", etc).
** <code>{nutrient-id}</code> (e.g. <code>saturated-fat</code>, <code>energy-kcal</code>): value for the nutrient, for the size specified in the field  <code>nutrition_data_per</code>. This is a string made of the modifier ("<", ">" or "") and the value without unit ("17.8", "34,7", "< 0.1", etc).
** nutrient-id_unit (e.g. saturated-fat_unit, energy-kcal_unit) : the unit of the value passed (e.g. "g", "mg", "kcal", "kJ", "%", "")
** <code>{nutrient-id}_unit</code> (e.g. saturated-fat_unit, energy-kcal_unit): the unit of the value passed (e.g. "g", "mg", "kcal", "kJ", "%", "")


Notes about the energy fields:
Notes about the energy fields:
72

edits