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

Support code with prefixes #7806

Open
alexgarel opened this issue Dec 6, 2022 · 7 comments
Open

Support code with prefixes #7806

alexgarel opened this issue Dec 6, 2022 · 7 comments
Labels
Ambiguous barcodes ✨ Feature Features or enhancements to Open Food Facts server ⏰ Stale This issue hasn't seen activity in a while. You can try documenting more to unblock it. ✅ Task

Comments

@alexgarel
Copy link
Member

alexgarel commented Dec 6, 2022

In:

We talk about supporting code with a prefix like: plu-66745

For this to happen:

  • we have a function to normalize codes, it should be changed (see normalize_code in Products.pm) to support prefixes (ideally those prefixes should be validated against a list provided in configuration, see Config_off.pm)
  • there might also be some cgi and scripts that does transformation manually (search for code + ""), while they should call the normalization function
  • a search on the code without prefix should return the item (search for 4015 must return "plu-4015")
  • write some integration test, because there might be some cgi file not using it (while they should). (see tests/integration there are some example test)
    • search a product with plu-xxxx code
    • search a product with xxxx code and get plu-xxxx
    • display a product with plu-xxxx code
    • edit a product with plu-xxxx code
      testing the API should be enough
@alexgarel
Copy link
Member Author

@stephanegigandet on sure I'm not sure is if we want to populate the code_tags field, and how we should do that.

@teolemon teolemon added the ✨ Feature Features or enhancements to Open Food Facts server label Dec 9, 2022
@FoodCoach-App
Copy link

@stephanegigandet @alexgarel

Based on the below example of the code-tags, I'd propose that the first code-tag should say PLU, price look up, or PLU-Commodity.

I don't understand the use of the cascading number of UPC digits in the example and can offer no suggestion there.

image

@alexgarel
Copy link
Member Author

@FoodCoach-App is there some hierarchy coding in plu code ? (like a meaning for first, or second, etc. digits)

@FoodCoach-App
Copy link

FoodCoach-App commented Dec 14, 2022 via email

@alexgarel
Copy link
Member Author

If we have a list of suche zone, I think it's worth having the zone thing in the tags, coded as "plu-start-end".

For code 3241, we would have:

"code_tags": ["plu", "plu-3100-3300", "plu-3241"]

Otherwise just ["plu", "plu-3241"]

@FoodCoach-App
Copy link

@alexgarel

Each commodity has a different amount 4 digit number associated with them and start on different values.

The range was provided for background and to explain that there is no significance on a a digit-by-digit basis.

I would argue to move forward with: ["plu", "plu-3241"]

@github-actions
Copy link
Contributor

This issue is stale because it has been open 90 days with no activity.

@github-actions github-actions bot added the ⏰ Stale This issue hasn't seen activity in a while. You can try documenting more to unblock it. label Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ambiguous barcodes ✨ Feature Features or enhancements to Open Food Facts server ⏰ Stale This issue hasn't seen activity in a while. You can try documenting more to unblock it. ✅ Task
Projects
Status: To discuss and validate
Development

No branches or pull requests

3 participants