openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
http://openfoodfacts.github.io/openfoodfacts-server/
GNU Affero General Public License v3.0
656 stars 386 forks source link

Store Application Identifier (AI) data string in products #8926

Closed hangy closed 8 months ago

hangy commented 1 year ago

New barcodes like GS1 DataMatrix, GS1 QR Code, and GS1 Digital Link can contain more information than the GTIN (AI (Application Identifier) = 01). For example, they can contain the product weight for variable weight items, and the "best before" date.

Example

(01)3274080005003 # GTIN
(15)230501 # Best before
(3103)000123 # Weight

(The string is split into multiple lines for readability. The AI string returned from libgs1encoders doesn't contain newlines.)

Proposal

  1. Normalize the barcodes to AI strings using GS1::SyntaxEngine::FFI after a successful run of scan_barcode,
  2. Store a list of unique AI strings in the product identified by the GTIN, so that they can be analyzed later.

TBD: API integration

This would only solve product search from images uploaded from the web. (Mobile) apps that use the API need some way to search by the new GS1 barcodes and/or the AI data string.

Part of

Depends on

stephanegigandet commented 1 year ago

In addition, we could just accept AI strings in the API, e.g. /api/v3/product/(01)3274080005003(15)230501(3103)000123 would return the product 3274080005003

hangy commented 1 year ago

I think it could be advantageous for the API to accept other types, too. Otherwise. each app/client would have to be able to parse all the GS1 barcode variations, as well.

hangy commented 8 months ago

I think this will be satisfied by #9791