Skip to content

docs: Create scanning-barcodes.md #12179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 29, 2025
Merged

docs: Create scanning-barcodes.md #12179

merged 9 commits into from
Jul 29, 2025

Conversation

teolemon
Copy link
Member

What

docs: Create scanning-barcodes.MD
Create a tutorial to create great barcode scanning experiences

@teolemon teolemon marked this pull request as ready for review July 28, 2025 10:47
@teolemon teolemon requested a review from a team as a code owner July 28, 2025 10:47
@teolemon teolemon changed the title docs: Create scanning-barcodes.MD docs: Create scanning-barcodes.md Jul 28, 2025
Barcode scanners can return codes in various formats (EAN-8, EAN-13, UPC-A, UPC-E). To ensure a match in the database, you **must normalize the barcode to the EAN-13 format.**

1. **Pad with Zeros:** If the scanned barcode has fewer than 13 digits, pad it with leading zeros until it reaches 13 digits. For example, `12345678` (EAN-8) becomes `0000012345678`.
2. **Calculate the Check Digit (for 12-digit UPC-A):** If you have a 12-digit barcode (common in North America), you must calculate the 13th digit (the EAN-13 check digit) and append it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is false, 12 digit barcodes are not barcodes missing a check digit.

Once you have a barcode string, you must normalize it before querying the correct database.

#### **✔️ Step 3.1: Pre-process the Barcode (Normalization)**
Barcode scanners can return codes in various formats (EAN-8, EAN-13, UPC-A, UPC-E). To ensure a match in the database, you **must normalize the barcode to the EAN-13 format.**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this, clients should not try to normalize barcodes.

Copy link

@github-project-automation github-project-automation bot moved this from Todo to In Progress in 📚 Document Open Food Facts Jul 29, 2025
@github-project-automation github-project-automation bot moved this from To discuss and validate to Done in 🍊 Open Food Facts Server issues Jul 29, 2025
@teolemon teolemon merged commit 8b2ea8e into main Jul 29, 2025
16 checks passed
@teolemon teolemon deleted the scanning-barcodes branch July 29, 2025 08:45
@github-project-automation github-project-automation bot moved this from In Progress to Done in 📚 Document Open Food Facts Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 Documentation Documentation issues improve the project for everyone.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants