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

Add support for Weight of one empty unit (g)and Quantity of product contained per unit #662

Closed
teolemon opened this issue Dec 27, 2022 · 3 comments · Fixed by #665
Closed
Assignees

Comments

@teolemon
Copy link
Member

What

  • Add support for Weight of one empty unit (g)and Quantity of product contained per unit

      > Great for the quick turnaround @monsieurtanuki 👏 Are `Weight of one empty unit (g)`and `Quantity of product contained per unit` causing any issues ?
    

They are not in off-dart.

Originally posted by @monsieurtanuki in openfoodfacts/smooth-app#3475 (comment)

@monsieurtanuki
Copy link
Contributor

Add support for Weight of one empty unit (g)and Quantity of product contained per unit

@stephanegigandet How can we retrieve/set those values from/to the server?

@stephanegigandet
Copy link
Contributor

@monsieurtanuki

for reading, we have the fields in the packagings array: https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/openfoodfacts/openfoodfacts-server/packagings-api/docs/reference/api-v3.yml#tag/Read-Requests/operation/get-product-by-barcode

Array 
number_of_units integerumber of units of this packaging component contained in the product (e.g. 6 for a pack of 6 bottles)
shape object (shape)The shape property is canonicalized using the packaging_shapes taxonomy.
material object (material)The material property is canonicalized using the packaging_materials taxonomy.
recycling object (recycling)The recycling property is canonicalized using the packaging_recycling taxonomy.
quantity_per_unit stringQuantity (weight or volume) of food product contained in the packaging component. (e.g. 75cl for a wine bottle)
quantity_per_unit_value numberValue parsed from the quantity field.
quantity_per_unit_unit stringUnit parsed and normalized from the quantity field.
weight_specified numberWeight (as specified by the manufacturer) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component).
weight_measured numberWeight (as measured by one or more users) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component).
weight_estimated numberWeight (as estimated from similar products) of one unit of the empty packaging component (in grams). (e.g. for a 6 pack of 1.5l water bottles, it might be 30, the weight in grams of 1 empty water bottle without its cap which is a different packaging component).
weight numberWeight of one unit of the empty packaging component.
weight_source_id stringIndicates which field was used to populate the "weight" field. Either "specified", "measured", or "estimated"

For writing, each packaging component has a weight_measured and quantity_per_unit fields:
https://github.com/openfoodfacts/openfoodfacts-server/blob/main/docs/reference/schemas/packagings/packaging_component-write.yaml

@monsieurtanuki
Copy link
Contributor

Thank you @stephanegigandet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants