openfoodfacts / smooth-app

🤳🥫 The new Open Food Facts mobile application for Android and iOS, crafted with Flutter and Dart
https://world.openfoodfacts.org/open-food-facts-mobile-app?utm_source=off&utf_medium=web&utm_campaign=github-repo
Apache License 2.0
786 stars 271 forks source link

🌅 GS1 "Sunrise 2027" - 2D Barcodes, GS1 Element String, and GS1 Digital Link URI support #5131

Open hangy opened 5 months ago

hangy commented 5 months ago

What

Smooth App should support 2D barcodes - more specifically "GS1 DataMatrix" and "GS1 QR Code".

This includes support for barcodes that contain the GTIN in more formats than the current barcode.

Why

GS1 has plans to replace the current EAN/UPC barcodes by DataMatrix and QR Code barcodes to support storing more data in the barcode. Traditional and 2D barcodes will be used in parallel for a while after this, but GS1 apparently intends to stop issuing new non-2D codes starting 2027.

GS1 links

Who for

All users of Smooth App will profit from this. Users of ProductOpener have already spotted products in the wild that did not have a traditional EAN barcode on the box mid-2023.

How

Different GS1 barcode types have been implemented in the search API already. Internally, they're normalized to the EAN. It would be great if the app could search for products using the full barcode, so that the server API can extract values from the AIs. However, the value of barcodes with a lot of Application Identifiers is not easily human-readable, so it's probably better to show the GTIN to end-users, and potentially extract data from the AIs (ie. best before, lot number) as human-readable additional information separately.

GS1 provides official parsers for validation of barcodes. The engine is provided as a C library, and can probably integrated as a native library in Dart/Flutter similarly to zxing.

### Tasks
- [ ] Ensure the current scanner can scan QRcodes, but only GS1 QRcodes
- [ ] Create or find a Dart package to validate GS1 QrCodes payload - https://pub.dev/packages?q=gs1 - https://pub.dev/packages/gs1_barcode_parser
- [ ] Pass the barcode part to the current API
- [ ] (Product addition) Prepopulate Weight on product addition using the GS1 Qr Code payload
- [ ] (Product addition) Prepopulate Best Before on product addition using the GS1 Qr Code payload
- [ ] (Product addition) Prepopulate regular barcode on product addition using the GS1 Qr Code payload
- [ ] (Product addition) Prepopulate official product url on product addition using the GS1 Qr Code payload
- [ ] (Product addition) Prepopulate Batch/Lot on product addition using the GS1 Qr Code payload
- [ ] (Product addition) Prepopulate Serial Number on product addition using the GS1 Qr Code payload
- [ ] (Product addition) Prepopulate Net Weight on product addition using the GS1 Qr Code payload
- [ ] (Product addition) Mention the GS1 QR Code as data source in the edit comment
- [ ] (Product addition) Add a label or a folksonomy engine property mentionning the product has a GS1 QR code
teolemon commented 5 months ago

@hangy from my understanding of what you wrote, and what we can do / should do on mobile Question: "weight in kg with three decimals points (3103)" how does that work for light products ?

### Tasks
- [ ] Ensure the current scanner can scan QRcodes, but only GS1 QRcodes
- [ ] Create or find a Dart package to validate GS1 QrCodes payload
- [ ] Pass the barcode part to the current API
- [ ] (Product addition) Prepopulate Weight on product addition using the GS1 QrCodes
- [ ] (Product addition) Prepopulate Best Before on product addition using the GS1 QrCodes
- [ ] (Product addition) Prepopulate regular barcode on product addition using the GS1 QrCodes
- [ ] (Product addition) Prepopulate official product url on product addition using the GS1 QrCodes
- [ ] (Product addition) Prepopulate Batch/Lot on product addition using the GS1 QrCodes
- [ ] (Product addition) Prepopulate Serial Number on product addition using the GS1 QrCodes
- [ ] (Product addition) Prepopulate Net Weight on product addition using the GS1 QrCodes
hangy commented 5 months ago

@hangy from my understanding of what you wrote, and what we can do / should do on mobile Question: "weight in kg with three decimals points (3103)" how does that work for light products ?

The GS1 has way, ways more AIs available. We can/have to choose which to use client-side. If it's lighter than can be described by those decimals, they might use 3105, which is defined as n.nnnnn kg.

In your task list, you write about GS1 QR Codes. I think it's important to note that GS1 DataMatrix is at least as important as QR Code, if not more important.

teolemon commented 3 months ago

https://pub.dev/packages/gs1_barcode_parser

hangy commented 3 months ago

https://pub.dev/packages/gs1_barcode_parser

Appears to be pretty limited. I think it doesn't support GS1 Data URIs