2,567 bytes added
, 19:18, 12 March 2020
Contains the latest version of the proposals for data types to be agreed on between this project and the Open Food Facts core team. These proposals are being actively discussed in the Open Food Facts Slack channel [https://app.slack.com/client/T02KVRT1Q/C0A1SE6Q7 #expirydates].
== On-product data ==
Multiple recordings of the data printed on individual product items should be recordable. That prevents having to introduce versioning for the whole product data records, and makes such data more accessible compared to versions. Namely, all recordings are accessible as a set, which makes it simpler to make automatic calculations (maximum observed expiration period etc.).
The proposed data type would be a hierarchy like this:
* <code>'''expiration_type'''</code> (options: best_before, use_by, no_date)
* <code>'''item_info'''</code> (because this is about information relating to individual items rather than the product type)
** <code>'''0'''</code> (array start, recording no. 0)
*** <code>'''entry_date'''</code> (when the information recorded below was entered; filling fields below meant for derived content later would not change its value)
*** <code>'''itemtext_picture'''</code> (a picture of the text contained on a product, similarly to pictures of ingredient lists etc.)
*** <code>'''itemtext_prefix'''</code> (the text that is part of the packaging print and introduces the print-on information, such as "Best before:")
*** <code>'''itemtext_fulltext'''</code> (verbatim text as contained in <code>itemtext_picture</code>)
*** <code>'''production_date'''</code> (derived from a part of <code>itemtext_fulltext</code>, normalized to a date datatype)
*** <code>'''expiration_date'''</code> (derived from a part of <code>itemtext_fulltext</code>, normalized to a date datatype)
*** <code>'''expiration_period'''</code> (derived from a part of <code>itemtext_fulltext</code>, normalized to a duration datatype)
*** <code>'''expiration_period_calculated'''</code> (taken over from <code>expiration_period</code> if available, otherwise calculated from <code>entry_date</code> and <code>expiration_date</code>)
*** (later, various fields for [https://en.wiki.openfoodfacts.org/Food_Traceability_Codes food traceability codes] would also be added here, each decoding a part of <code>itemtext_fulltext</code> just as the other fields above do)
** <code>'''1'''</code>
*** …
** …
== Metadata related to storage life ==
[TODO; relates mostly to per-category articles about storage life, edibility assessment, storage conditions, use after expiry etc.]