openfoodfacts / contributor-quality-issues

Report data quality issues due to contributing apps/users
1 stars 0 forks source link

[eatshalal] wrong language for ingredient list #1

Closed raphael0202 closed 11 months ago

raphael0202 commented 1 year ago

eatshalal app replaces a valid French ingredient list by an english one, breaking ingredient analysis and NOVA computation. This affects very popular products, such as: https://world-fr.openfoodfacts.org/produit/3017620422003/nutella-ferrero?rev=544

raphael0202 commented 1 year ago

I sent a warning email:

Hello, We've noticed that your app "eatshalal" sends incorrect data to the Open Food Facts database. It replaces a valid French ingredient list by an English one (still using the field ingredients_text_fr), breaking ingredient analysis and NOVA computation. This affects very popular products, such as: https://world-fr.openfoodfacts.org/produit/3017620422003/nutella-ferrero?rev=544

We opened an issue on our data quality issue Github tracker, you can either reply to this mail or comment on the Github issue directly if it's more convenient to you.

Sincerely,

raphael0202 commented 1 year ago

Response received today, saying this is going to be fixed ASAP.

MohamedFBoussaid commented 1 year ago

@raphael0202, Thanks you for reporting this. Is there a way to get the product current language ? My app by default scan the product and get the ENGLISH lang using the configuration : ProductQueryConfiguration configuration = ProductQueryConfiguration(barcode, language: OpenFoodFactsLanguage.ENGLISH, version: ProductQueryVersion.v3);

That is why I am sending by default all the updates using the ENGLISH version.

In the past, I have tried to extract dynamically the product lang, but it didn't work :

try { if (product.frontImageUrl != 'Unknown') { lang = product.frontImageUrl .split('/front')[1] .replaceAll('_', '') .substring(0, 2); } else if (product.ingredientsImageUrl != 'Unknown') { lang = product.ingredientsImageUrl .split('/ingredients')[1] .replaceAll('_', '') .substring(0, 2); } else { lang = '-'; } return OpenFoodFactsLanguageUtils.getOpenFoodFactsLanguage(lang); } on Exception { return OpenFoodFactsLanguage.ENGLISH; }

And this is how I am setting the updated product lang :

`Product product = Product(
  barcode: _product.barcode,
  productName: _productNameController.text,
  lang: _openFoodFactsLanguage,
  brands: _productBrandsController.text,
  ingredientsText: _productIngredientsController.text,
);

OpenFoodAPIClient.saveProduct(ApplicationUtils.PROD_USER, product,
        queryType: QueryType.PROD)`
MohamedFBoussaid commented 1 year ago

I am seeing Smooth App is using this : OpenFoodFactsLanguage getLanguage() => LanguageHelper.fromJson(languageCode); I will try this one.

raphael0202 commented 1 year ago

I'm not really familiar with the flutter SDK, maybe @g123k can help you on this. But on the API, the lang field is the product main language (see https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v2/#cmp--schemas-product-base).

raphael0202 commented 1 year ago

Another thing, do you also own the app described in this issue? https://github.com/openfoodfacts/contributor-quality-issues/issues/2 It's also a halal app with a language field issue.

MohamedFBoussaid commented 1 year ago

@raphael0202, no I have only this app (Halal & Healthy) that is updating OFF DB

I guess I have found the issue, I was setting the lang for the product, but not on the saveProduct() call. I have updated the code, but it is still not working, I guess I am missing something. Maybe @g123k can help me ?

In meantime, and until I fix this, I have disabled the possibility for users to update products, I will release it now.

g123k commented 1 year ago

@raphael0202, no I have only this app (Halal & Healthy) that is updating OFF DB

I guess I have found the issue, I was setting the lang for the product, but not on the saveProduct() call. I have updated the code, but it is still not working, I guess I am missing something. Maybe @g123k can help me ?

In meantime, and until I fix this, I have disabled the possibility for users to update products, I will release it now.

Could you share the full code to ensure we can reproduce your issue? The better place to have feedback is to directly post on the dedicated repo

g123k commented 1 year ago

I think @monsieurtanuki or also can help you with this

MohamedFBoussaid commented 1 year ago

@g123k , @raphael0202 , I have found the issue and fix it. I will saveProduct using productNameInLanguages and ingredientsTextInLanguages instead of productName and ingredientsTextInLanguages

I have pushed a release, and this should be fixed.

I have test it with : https://fr.openfoodfacts.org/produit/3017620422003/nutella-ferrero. (updating the product for EN and AR lang) https://sa.openfoodfacts.org/mountaj/8595229909286/granola-honey-nuts (updating the product for ES and AR lang) https://sa.openfoodfacts.org/mountaj/20724696/californian-almond-alesto (updated product for AR, without impacting other lang) https://sa.openfoodfacts.org/mountaj/8001505005592/nocciolata-p%C3%A2te-%C3%A0-tartiner-au-cacao-et-noisettes-rigoni-di-asiago (updated product for AR, without impacting other lang)

raphael0202 commented 1 year ago

Ok perfect! Thank you for your reactivity :)