Skip to content
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

Typo in EAN, how to handle ? #409

Open
serpico opened this issue Aug 31, 2024 · 6 comments
Open

Typo in EAN, how to handle ? #409

serpico opened this issue Aug 31, 2024 · 6 comments

Comments

@serpico
Copy link

serpico commented Aug 31, 2024

Problem

Might be related to #182

I noticed/realized 3564700010546 was in fact 3564700010846 it'd be nice if the prices could be connected to the correct EAN, maybe some kind of merging process.

What would be/will be the process in such case ?

@raphael0202
Copy link
Contributor

I implemented on openfoodfacts-python library a function that verifies the checksum of the EAN: https://github.com/openfoodfacts/openfoodfacts-python/blob/develop/openfoodfacts/barcode.py#L20
It could be used to display an error message when the barcode is invalid.

@raphodn
Copy link
Member

raphodn commented Oct 24, 2024

Would you go as far as not allowing any prices for barcodes that don't validate the EAN rule ?

It could be easily implemented. Or we could run checks afterwards and flag "wrong" products.

By the way there is already a warning message in the frontend price addition form. But nothing in the mobile. I would tend to keep it on the user side, no ?

@raphael0202
Copy link
Contributor

It could be easily implemented. Or we could run checks afterwards and flag "wrong" products.

Why not preventing price addition completely.

By the way there is already a warning message in the frontend price addition form. But nothing in the mobile. I would tend to keep it on the user side, no ?

I agree, digit checksum is easy to compute, it can be done client-side.

@raphodn
Copy link
Member

raphodn commented Nov 3, 2024

Why not preventing price addition completely.

Just to be sure, is this check already done in Product Opener ?
I fear the edge cases where some (local) producers have "wrong" barcodes.

@raphael0202
Copy link
Contributor

Just to be sure, is this check already done in Product Opener ?

It's not!

I fear the edge cases where some (local) producers have "wrong" barcodes.

That's a valid point, but is it possible to generate a barcode image that's recognized by barcode scanners and not valid with respect to the checksum?

ping @teolemon

@serpico
Copy link
Author

serpico commented Nov 6, 2024

@raphael0202 I had a real life case just yesterday , I squinted beyond reason to finally decipher 3450970151458 from a picture I took the same day, but I did a quick duckduckgo search to firm it up using a description of the product and the brand which returned 3450970151153 ( the correct one ). I was wondering how the openfoodfacts-python library would fare in that case ? and what would be displayed to the user ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

3 participants