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

feat: Allow GS1 barcode types to be used in search and read API #9014

Closed
wants to merge 27 commits into from

Conversation

hangy
Copy link
Member

@hangy hangy commented Sep 17, 2023

What

Allows using more barcode types in search and READ API

Related issue(s) and discussion

- Remove redundant `$`
- Fix scope of `$ai_data_str`
- Some regexes
- libzxing-dev requires a the current Debian stable, bookworm.
- libapache2-request-perl is only available via backports for bookworm.
test: Add first unittest for GS1 DataMatrix code

Thanks to @tonycoz (TONYC on cpan) for implementing Imager::zxing!
- Ensure that more GS1 Data Link URI formats can be 'normalized'
- URIs that cannot be a GS1 Data Link should not be treated as an
  product code
Should possibly have a feature flag, depending on the API version
…rom the code to allow query params in GS1 data URI to be present
…nd `decodeURIComponent`, so that a '/' in the code isn't split.
@hangy hangy added barcodes GS1 The producer platform is integrating with the GS1 product data formats. GS1 manages barcodes. labels Sep 17, 2023
@hangy hangy self-assigned this Sep 17, 2023
@github-actions github-actions bot added API Issues related to the Open Food Facts API. More specific labels exist & should be used (API WRITE…) API READ All READ APIs include Product, Search… 🖼️ Images labels Sep 17, 2023
@hangy hangy changed the title Issue/9013 more barcodes in search feat: Allow GS1 barcode types to be used in search and API Sep 17, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 17, 2023

Codecov Report

Merging #9014 (a0a551c) into main (c58b690) will increase coverage by 0.28%.
Report is 16 commits behind head on main.
The diff coverage is 72.85%.

@@            Coverage Diff             @@
##             main    #9014      +/-   ##
==========================================
+ Coverage   46.09%   46.37%   +0.28%     
==========================================
  Files          64       64              
  Lines       19837    19905      +68     
  Branches     4801     4811      +10     
==========================================
+ Hits         9143     9231      +88     
+ Misses       9513     9498      -15     
+ Partials     1181     1176       -5     
Files Changed Coverage Δ
lib/ProductOpener/API.pm 16.81% <0.00%> (ø)
lib/ProductOpener/APIProductRead.pm 25.92% <0.00%> (ø)
lib/ProductOpener/APIProductWrite.pm 12.59% <0.00%> (ø)
lib/ProductOpener/Images.pm 17.31% <65.38%> (+4.58%) ⬆️
lib/ProductOpener/Routing.pm 33.67% <80.00%> (+2.90%) ⬆️
lib/ProductOpener/Products.pm 48.33% <85.71%> (+1.09%) ⬆️

... and 6 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

The dummy number used before does not have a valid checksum.
@github-actions github-actions bot added 📖 Knowledge Panels https://wiki.openfoodfacts.org/Knowledge_panels 🧪 integration tests labels Sep 18, 2023
@hangy hangy marked this pull request as ready for review September 18, 2023 22:04
@hangy hangy requested a review from a team as a code owner September 18, 2023 22:04
@hangy hangy changed the title feat: Allow GS1 barcode types to be used in search and API feat: Allow GS1 barcode types to be used in search and read API Sep 18, 2023
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@stephanegigandet
Copy link
Contributor

This looks great, thanks for adding all the test cases etc. :)

I'm trying to build zxing on stretch (what we have in prod today), no success yet, I'll try harder.

@stephanegigandet
Copy link
Contributor

I tested it in docker, it works great. :)

In production though, as we are still on stretch, I'm unable to build zxing. It needs cmake 3.15 and gcc 7, while we have cmake 3.7.2 and gcc 6.3...

So we would have to wait for the migration of off1 to merge and deploy this unfortunately.. :(

@hangy
Copy link
Member Author

hangy commented Sep 19, 2023

I tested it in docker, it works great. :)

Nice! 😄

In production though, as we are still on stretch, I'm unable to build zxing. It needs cmake 3.15 and gcc 7, while we have cmake 3.7.2 and gcc 6.3...

We could try building zxing-cpp as a static lib, bundle that as a .deb, and try using that? I don't have too much experience with building Debian packages, but cpack -G DEB seems to handle a lot of stuff for you.

@github-actions github-actions bot added the 💥 Merge Conflicts 💥 Merge Conflicts label Sep 21, 2023
@hangy hangy closed this Sep 28, 2023
@hangy hangy deleted the issue/9013-more-barcodes-in-search branch September 28, 2023 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API READ All READ APIs include Product, Search… API v3 API Issues related to the Open Food Facts API. More specific labels exist & should be used (API WRITE…) barcodes GS1 The producer platform is integrating with the GS1 product data formats. GS1 manages barcodes. 🖼️ Images 🧪 integration tests 📖 Knowledge Panels https://wiki.openfoodfacts.org/Knowledge_panels 💥 Merge Conflicts 💥 Merge Conflicts Products 🧪 tests 🧪 unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow GS1 barcode types to be used in search
3 participants