Fix null value in various places: app, website, documentation, exports #9426
Labels
Data export
We export data nightly as CSV, MongoDB… See: https://world.openfoodfacts.org/data
⭐ top issue
Top issue.
The zero (0) is ambiguous on Open Food Facts:
An empty value is also be ambiguous:
The Null value is solving these ambiguities. It allows to make a clear difference between:
Null can be implemented differently depending on the situation.
User interface
When people are filling product data, it should be easy to express the Null value.
Mobile: see Nutritional values: allow to input an empty value
Web: we have chosen to use the hyphen '-' to express the null value: it is short and language agnostic; it is part of the ASCII and many keyboards should have it, as it is also used to express "minor" in mathematics
completeness
value (to be verified)Exports
CSV export
CSV does have a convention to express
Null
. Currently CSV export does not export hyphens as is. There are deleted. TODO:MongoDB export
In MongoDB, as the main database systems, the null value does exist, represented by
null
. For example:{ "sugar": null }
is valid in MongoDB even ifsugar
is an integer. In our MongoDB export, the hyphen is wrongly interpreted. A field filled with a hyphen produce a new field with a_modifier
suffix. Example: if the user entersfiber: "-"
then the system:fiber
value"fiber_modifier":"-"
(this is the same behavior as for the<
sign)."fiber_modifier":"-"
by"fiber": null
JSONL export
In JSON the null value does exist, represented by
null
. For example:{ "sugar_100g": null }
is valid in JSON even ifsugar_100g
is an integer. In out JSONL export, the hyphen is wrongly interpreted as"fiber_modifier":"-"
. This is not documented"fiber_modifier":"-"
by"fiber": null
API
The API should have the same behavior as the MongoDB and JSONL exports.
The text was updated successfully, but these errors were encountered: