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

Create placeholder response if the product is present on Open (Beauty/PetFood/Products) Facts #497

Closed
Tracked by #5555 ...
teolemon opened this issue Sep 26, 2016 · 5 comments
Labels
API Read - Product API READ All READ APIs include Product, Search… API Refactor API Issues related to the Open Food Facts API. More specific labels exist & should be used (API WRITE…) Fixed ? This issue might have been fixed. We can close them once we verify that they have. 🧴 Open Beauty Facts Our cosmetic analysis project https://world.openbeautyfacts.org 🎯 P1

Comments

@teolemon
Copy link
Member

teolemon commented Sep 26, 2016

What

Web:

  • Add a link to the product on Open (Beauty/PetFood/Products) Facts
  • Do not make the placeholder indexable

Mobile:

  • Send back a product with title: "Present on Open Beauty Facts" and the OBF url as URL on official site?

Technical decision

Part of

@hangy hangy added the ✨ Feature Features or enhancements to Open Food Facts server label Nov 15, 2016
@hangy
Copy link
Member

hangy commented Nov 15, 2016

Right now, this stuff runs on the same server, so some hacks could make this easy, but for long-term support (and possibly to support other future projects), this would need some "interwiki" like feature/API right? This probably also applies #319 and #320.

@teolemon teolemon modified the milestone: Open Beauty Facts Dec 15, 2016
@teolemon teolemon added the API Issues related to the Open Food Facts API. More specific labels exist & should be used (API WRITE…) label Dec 18, 2016
@teolemon teolemon added the 🧴 Open Beauty Facts Our cosmetic analysis project https://world.openbeautyfacts.org label Jan 24, 2017
@VaiTon VaiTon removed this from the Open Beauty Facts milestone Jun 23, 2019
@teolemon
Copy link
Member Author

teolemon commented Jun 5, 2020

Yes, long term, we need a decent system. But a hack would be very useful to improve the mobile user experience (at the minimum propose to install Open Beauty Facts on iPhone, or even customize behaviour (on Android))

@teolemon
Copy link
Member Author

teolemon commented Jun 5, 2020

Just checking a .sto file exists in the OBF file system and returning cosmetic=true would be enough for the mobile teams to solve the issue.

@teolemon
Copy link
Member Author

This could be a new small new route to avoid breaking anything.

This was referenced Aug 21, 2021
@teolemon teolemon changed the title Create placeholder response if the product is present on Open Beauty Facts Create placeholder response if the product is present on Open (Beauty/PetFood/Products) Facts Aug 7, 2023
@teolemon teolemon moved this to To discuss and validate in 🍊 Open Food Facts Server issues Apr 23, 2024
@teolemon teolemon added API READ All READ APIs include Product, Search… API Read - Product labels Sep 5, 2024
@teolemon
Copy link
Member Author

teolemon commented Sep 9, 2024

I'm adding the technical decision taken a while ago on universal product API @stephanegigandet @hangy @g123k : https://docs.google.com/document/d/1WPD23Jf-GMstjiK2gOZGayqECwxtucFqr7ijuyxDN4Q/edit

@teolemon teolemon added API Refactor and removed ✨ Feature Features or enhancements to Open Food Facts server labels Oct 11, 2024
stephanegigandet added a commit that referenced this issue Nov 18, 2024
…OBF, OPF and OPFF (#10959)

In the last few weeks, we normalized product barcodes and deduplicated
products that existed in multiple flavors (Open Food Facts, Open Beauty
Facts, Open Product Facts and Open Pet Food Facts).

We are now going to merge the directories that contain product and
product revision data (the .sto files) and the product images. We will
keep separate MongoDB databases for each flavor.

This will:
- make it much easier to move products from one product type to another
- remove the possibility of having duplicate products on multiple
flavors
- make it much easier to have read and write APIs that can be used to
retrieve / update products of any type.

Deployment plan:
- stop OBF, OPF, OPFF for the duration of the migration (a couple of
hours)
- update OFF code
- move products and product images dirs from OBF, OPF, OPFF to the OFF
directory structure
- change the links to products and products of images on OBF, OPF, OPFF
to use the OFF dirs
- restart OBF, OPF, OPFF with the new code

In this PR:
- code updates to check product_type when reading / editing a product
for both the website and API. Redirect to the right flavor if the
product type is different than the one of the server the request was
made to.
- changed the product edit form to allow moderators to change the
product_type
- keep support for moderators to put "obf" etc. in the change code field
- tests for the above
- small refactor to put into Config.pm things that are the same for all
flavors and that are currently duplicated in Config_off.pm etc.

Will solve:
- #9221 
- #7539
- #1174
- #497
- #320
very-smartin added a commit that referenced this issue Nov 20, 2024
unit tests

Tackling recipes.t and attributes.t issues

Tackling recipes.t issues

Tackling recipes.t + attributes issues : correcting unit tests

Tackling ingredients.t issues : correcting unit test

Tackling ingredients.t issues : correcting unit test v2

Tackling unit tests for nutrsicore.t/ingredients.t

refactor: merge the products and product images directories for OFF, OBF, OPF and OPFF (#10959)

In the last few weeks, we normalized product barcodes and deduplicated
products that existed in multiple flavors (Open Food Facts, Open Beauty
Facts, Open Product Facts and Open Pet Food Facts).

We are now going to merge the directories that contain product and
product revision data (the .sto files) and the product images. We will
keep separate MongoDB databases for each flavor.

This will:
- make it much easier to move products from one product type to another
- remove the possibility of having duplicate products on multiple
flavors
- make it much easier to have read and write APIs that can be used to
retrieve / update products of any type.

Deployment plan:
- stop OBF, OPF, OPFF for the duration of the migration (a couple of
hours)
- update OFF code
- move products and product images dirs from OBF, OPF, OPFF to the OFF
directory structure
- change the links to products and products of images on OBF, OPF, OPFF
to use the OFF dirs
- restart OBF, OPF, OPFF with the new code

In this PR:
- code updates to check product_type when reading / editing a product
for both the website and API. Redirect to the right flavor if the
product type is different than the one of the server the request was
made to.
- changed the product edit form to allow moderators to change the
product_type
- keep support for moderators to put "obf" etc. in the change code field
- tests for the above
- small refactor to put into Config.pm things that are the same for all
flavors and that are currently duplicated in Config_off.pm etc.

Will solve:
- #9221
- #7539
- #1174
- #497
- #320

Tackling check perl test

taxonomy: Italian for bacon (#11027)

Fix Italian for bacon

fix: apidoc openApi ecoscore mapping (#11009)

- [x] PR title is prefixed by one of the following: feat, fix, docs,
style, refactor, test, build, ci, chore, revert, l10n, taxonomy
- [x] Code is well documented
- [x] Include unit tests for new functionality
- [x] Code passes GitHub workflow checks in your branch
- [x] If you have multiple commits please combine them into one commit
by squashing them.
- [x] Read and understood the contribution guidelines

This PR introduces several improvements to the API documentation and
schema organization:

1. **New Schema File for Country Codes**
- Created a dedicated `country-code.yaml` file to centralize country
code definitions
- Introduced reusable `CountryCode` enum with all supported country
codes
- Added `CountryValues` schema to standardize country-to-number mappings
- Commented out pattern properties in favor of generator-friendly
alternatives

2. **Product Ecoscore Schema Improvements**
- Refactored country-specific properties to use the new `CountryValues`
schema
- Added proper type handling for nullable integer fields
(`transportation_score`)
   - Removed redundant pattern properties in favor of schema references
   - Enhanced type definitions for scores and values

3. **Packaging Schema Enhancements**
   - Added comprehensive examples for packaging properties
   - Added missing fields with proper examples:
     - `number_of_units`
     - `quantity_per_unit` and related fields
     - `recycling`
     - `weight_measured`

4. **Agribalyse Schema Updates**
   - Added `agribalyse_proxy_food_code` field
   - Added `agribalyse_food_code` field
   - Added `co2_agriculture` field

The changes improve code organization, reduce duplication, and enhance
compatibility with OpenAPI code generators while maintaining backward
compatibility with existing data structures.

- Fixes #[ISSUE NUMBER]

This refactoring improves schema maintainability and provides better
type safety through proper enum definitions and standardized patterns
for country-specific data.

feat: openApi refactor fields parameter to support multiple values with enum validation (getProductByBarCode/search) (#11012)

This PR improves the OpenAPI specification for the `fields` parameter in
the product and search endpoint.

The changes make the API specification more accurate and provide better
validation and documentation for the fields parameter, which is critical
for controlling response payload size and structure.

- Improves API documentation accuracy and completeness
- Makes the fields parameter behavior more predictable and better
documented
- Helps API consumers understand available field options

1. Created new file `parameters/product_available-fields.yaml` to house
fields parameter definition
2. Updated main API spec to reference the new parameter definition
3. Removed redundant fields parameter definition from individual
endpoints
4. Added comprehensive enum of available field values
5. Added validation rules and examples

- Verified that the OpenAPI spec validates correctly
- Checked that the parameter definition matches actual API behavior
- Confirmed that examples are valid and helpful

Note: This change is purely to the API specification and does not affect
the actual API implementation.

chore: week47 (#11025)

Mainly pine nuts clean up

---------

Co-authored-by: Arnaud Leene <[email protected]>

Tackling integration test

docs: openapi for requested product type (#11028)

Trying to upate the OpenAPI spec for reading products:
- add new product_type parameter
- add possible response codes (302 and 404)

---------

Co-authored-by: Alex Garel <[email protected]>
@teolemon teolemon added the Fixed ? This issue might have been fixed. We can close them once we verify that they have. label Jan 10, 2025
@github-project-automation github-project-automation bot moved this from To discuss and validate to Done in 🍊 Open Food Facts Server issues Jan 10, 2025
@github-project-automation github-project-automation bot moved this from To do to Done in 📸 Open Products Facts Jan 10, 2025
@github-project-automation github-project-automation bot moved this from To Discuss & Validate to Done in 🧴 Open Beauty Facts Jan 10, 2025
@github-project-automation github-project-automation bot moved this from To do to Done in 🐾 Open Pet Food Facts Jan 10, 2025
@github-project-automation github-project-automation bot moved this from To be triaged to Done in 🛠️ - Server - API Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Read - Product API READ All READ APIs include Product, Search… API Refactor API Issues related to the Open Food Facts API. More specific labels exist & should be used (API WRITE…) Fixed ? This issue might have been fixed. We can close them once we verify that they have. 🧴 Open Beauty Facts Our cosmetic analysis project https://world.openbeautyfacts.org 🎯 P1
Projects
Status: Done
Status: Done
Status: Done
Development

No branches or pull requests

3 participants