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

refactor: different taxonomy source files for flavors #9864

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

stephanegigandet
Copy link
Contributor

I think this is the simplest way to allow Product Opener flavors (OFF, OBF, OPF, OPFF) to have some taxonomies that are different.

  • I created /food and /beauty to put taxonomies that are specific to a product type.
  • At this point I moved only the ingredients.txt and categories.txt file, and let all other taxonomies in the root directory (even if they are specific to food). This is to avoid breaking in flight PRs. Similarly, I didn't create a /common directory. We can revisit this later and move more taxonomies.
  • Resulting taxonomies are build and cached as usual (in particular the resuting files will be in /taxonomies/ even for specific taxonomies).

The drawback of this approach is that one instance of Product Opener is tied to a specific product type, it can't load taxonomies for multiple types. If at some point we want to have one Product Opener instance serve multiple product types, we can revisit it as well.

@stephanegigandet stephanegigandet requested a review from a team as a code owner March 5, 2024 13:33
@github-actions github-actions bot added 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies 🧴 Open Beauty Facts Our cosmetic analysis project https://world.openbeautyfacts.org 🐾 Open Pet Food Facts Our pet food analysis project https://world.openpetfoodfacts.org 📸 Open Products Facts Our project to increase the lifespan of objects. https://world.openproductsfacts.org Tags config labels Mar 5, 2024
Copy link

sonarqubecloud bot commented Mar 5, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@alexgarel
Copy link
Member

If at some point we want to have one Product Opener instance serve multiple product types, we can revisit it as well.

Yes it seems to me that in our plans we spoke of having such an instance… to do later :-)

Copy link
Member

@alexgarel alexgarel left a comment

Choose a reason for hiding this comment

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

Great.

Comment on lines +35 to +36
use Module::Load;
autoload("ProductOpener::Config_$flavor");
Copy link
Member

Choose a reason for hiding this comment

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

Nice :-)

@alexgarel
Copy link
Member

BTW @stephanegigandet you should not fear moving file, git will be intelligent enough to follow changes through move if you use git mv.

@stephanegigandet stephanegigandet merged commit 4bc89b7 into flavors Mar 5, 2024
11 checks passed
@stephanegigandet stephanegigandet deleted the flavors-taxonomies branch March 5, 2024 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config 🧴 Open Beauty Facts Our cosmetic analysis project https://world.openbeautyfacts.org 🐾 Open Pet Food Facts Our pet food analysis project https://world.openpetfoodfacts.org 📸 Open Products Facts Our project to increase the lifespan of objects. https://world.openproductsfacts.org Tags 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants