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

Clarify the product quantity unit (g or mL) #115

Closed
raphodn opened this issue Jan 1, 2024 · 8 comments · Fixed by #194
Closed

Clarify the product quantity unit (g or mL) #115

raphodn opened this issue Jan 1, 2024 · 8 comments · Fixed by #194

Comments

@raphodn
Copy link
Member

raphodn commented Jan 1, 2024

Story

For each new product we fetch from Open Food Facts its product_quantity, a normalized number in g or mL.

We need to find a way to know if the product is a beverage (mL), or solid (g), so that we can display the information accordingly in the frontend (price per kg or price per L).

Linked to #77

@raphodn
Copy link
Member Author

raphodn commented Jan 16, 2024

@raphael0202 @teolemon any ideas ? maybe if we sync the products' categories ?
and should we store the info in the backend, or manage it instead in the frontend ?

@raphael0202
Copy link
Contributor

In my opinion, we should fetch quantity from OFF and parse it to know whether it's a beverage or not.

@raphodn
Copy link
Member Author

raphodn commented Jan 16, 2024

Isn't this parsing already done in OFF server ? Might be complex to manage all the use cases (kg, g, ml, L, pounds...).

Vs using the current clean and normalised field + a way to differenciate.

But if there is no way to differenciate in the other fields then...

@raphael0202
Copy link
Contributor

It's done but there is no field to indicate the unit. We can also add a new field in Product Opener (but the codebase is in Perl)

@raphodn
Copy link
Member Author

raphodn commented Jan 18, 2024

I'd go with a new field at the source !
It will probably help other projects or reuses

@raphodn
Copy link
Member Author

raphodn commented Jan 25, 2024

Luckily a new field was recently added in Product Opener ! openfoodfacts/openfoodfacts-server#9377
Just need to wait to be able in prod 🙏

@raphodn
Copy link
Member Author

raphodn commented Feb 6, 2024

@raphael0202 actually the new fields were in last month's release : https://github.com/openfoodfacts/openfoodfacts-server/releases/tag/v2.26.0

but i don't see them appearing in the v2 API ? is there some additional code to do ?

@raphael0202
Copy link
Contributor

It's available on newly updated product (ex: https://world.openfoodfacts.org/api/v2/product/0044118115928.json).
To update all products and add the field, a script should be run server-side (update_all_products.pl).

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

Successfully merging a pull request may close this issue.

3 participants