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 simple input for missing tags #2169

Closed
5 of 8 tasks
teolemon opened this issue Jun 5, 2022 · 22 comments
Closed
5 of 8 tasks

Add simple input for missing tags #2169

teolemon opened this issue Jun 5, 2022 · 22 comments
Labels
✏️ Editing Many products are incomplete and don't have Nutri-Score, Eco-Score…so editing is important for users tag picker
Milestone

Comments

@teolemon
Copy link
Member

teolemon commented Jun 5, 2022

Why

What

Screenshots from V1

@teolemon teolemon added the ✏️ Editing Many products are incomplete and don't have Nutri-Score, Eco-Score…so editing is important for users label Jun 5, 2022
@teolemon teolemon changed the title Add simplistic input for missing tags Add simple input for missing tags Jun 5, 2022
@monsieurtanuki
Copy link
Contributor

@teolemon Regarding autocompletion, we're a bit stuck because of openfoodfacts/openfoodfacts-dart#465
How did you guys do with the android or ios app, in order to go beyond the 25 item limit?

@monsieurtanuki monsieurtanuki self-assigned this Jun 6, 2022
@teolemon
Copy link
Member Author

teolemon commented Jun 6, 2022

@monsieurtanuki We never noticed it, and did a query with every key stroke, after the nth first keystrokes

@monsieurtanuki
Copy link
Contributor

Then you're lucky and I'm not. We're both using the same cgi/suggest.pl with the same parameters.

  • what if you type just 'a': do you see all the categories that contain 'a'?
  • what if you type 'soja' (in French): how many "Boissons végétales de soja" do you see?

@teolemon
Copy link
Member Author

teolemon commented Jun 6, 2022

Screenshot_20220606-161601.png
Screenshot_20220606-161535.png

@teolemon
Copy link
Member Author

teolemon commented Jun 6, 2022

aah @monsieurtanuki I believe we use local taxonomies in V1 for those, actually…

@teolemon
Copy link
Member Author

teolemon commented Jun 6, 2022

We only use autosuggest for 2 specific fields (packager codes). Local taxonomies allow for local editing, but they are very heavy

@monsieurtanuki
Copy link
Contributor

@teolemon What shall we do then?

@teolemon
Copy link
Member Author

teolemon commented Jun 6, 2022

I would move ahead without waiting for a server fix, the server fix will only make it work better once it's ready.
I'll raise the issue during the Product Opener meeting tonight with @stephanegigandet and @alexgarel

@teolemon
Copy link
Member Author

teolemon commented Jun 6, 2022

User can input whatever they wish actually. Suggestions are just for convenience, and we do server side parsing and taxonomization over time

@monsieurtanuki
Copy link
Contributor

Ok then.

@monsieurtanuki
Copy link
Contributor

This will be something like that:
Capture d’écran 2022-06-06 à 16 54 30

monsieurtanuki added a commit to monsieurtanuki/smooth-app that referenced this issue Jun 6, 2022
New files:
* `simple_input_page.dart`: Simple input page: we have a list of labels, we add, we remove, we save.
* `simple_input_page_helpers.dart`: Helpers for Simple Input Page.

Impacted files:
* `category_picker_page.dart`: refactored
* `edit_ingredients_page.dart`: refactored
* `edit_product_page.dart`: added an "edit store" button; refactored
* `nutrition_page_loaded.dart`: refactored
* `product_query.dart`: added fields for stores
* `product_refresher.dart`: now we return the saved and refreshed product instead of a mere bool
teolemon pushed a commit that referenced this issue Jun 7, 2022
New files:
* `simple_input_page.dart`: Simple input page: we have a list of labels, we add, we remove, we save.
* `simple_input_page_helpers.dart`: Helpers for Simple Input Page.

Impacted files:
* `category_picker_page.dart`: refactored
* `edit_ingredients_page.dart`: refactored
* `edit_product_page.dart`: added an "edit store" button; refactored
* `nutrition_page_loaded.dart`: refactored
* `product_query.dart`: added fields for stores
* `product_refresher.dart`: now we return the saved and refreshed product instead of a mere bool
monsieurtanuki added a commit to monsieurtanuki/smooth-app that referenced this issue Jun 7, 2022
Impacted files:
* `app_en.arb`: added 5 translations
* `app_fr.arb`: added 5 translations
* `edit_product_page.dart`: added an action for "edit labels"; refactored
* `simple_input_page.dart`: renamed "label" as "term" to avoid confusion; translated; refactored
* `simple_input_page_helpers.dart`: implementation for "labels"; renamed "label" as "term"; translated
* `smooth_alert_dialog.dart`: minor refactoring
teolemon pushed a commit that referenced this issue Jun 7, 2022
Impacted files:
* `app_en.arb`: added 5 translations
* `app_fr.arb`: added 5 translations
* `edit_product_page.dart`: added an action for "edit labels"; refactored
* `simple_input_page.dart`: renamed "label" as "term" to avoid confusion; translated; refactored
* `simple_input_page_helpers.dart`: implementation for "labels"; renamed "label" as "term"; translated
* `smooth_alert_dialog.dart`: minor refactoring
@teolemon
Copy link
Member Author

teolemon commented Jun 7, 2022

Labels and Stores are merged. How about Categories ?

@monsieurtanuki
Copy link
Contributor

Ok for categories. Working on it.

monsieurtanuki added a commit to monsieurtanuki/smooth-app that referenced this issue Jun 7, 2022
Impacted files:
* `app_en.arb`: added 2 translations (and fixed 1)
* `app_fr.arb`: added 2 translations
* `edit_product_page.dart`: added an item for "edit categories"
* `Podfile.lock`: wtf
* `simple_input_page_helpers.dart`: implementation for "categories"; refactored with an "in language" abstraction
monsieurtanuki added a commit that referenced this issue Jun 7, 2022
Impacted files:
* `app_en.arb`: added 2 translations (and fixed 1)
* `app_fr.arb`: added 2 translations
* `edit_product_page.dart`: added an item for "edit categories"
* `Podfile.lock`: wtf
* `simple_input_page_helpers.dart`: implementation for "categories"; refactored with an "in language" abstraction
@monsieurtanuki
Copy link
Contributor

@teolemon I can work on "Packaging", but the following fields do not exist in off-dart products AFAIK:

  • Origins of ingredients
  • Manufacturing places
  • EMB Codes
  • Countries

@teolemon
Copy link
Member Author

teolemon commented Jun 8, 2022

Packaging is the next logical target.
Origins of ingredients is actually just origins

@teolemon
Copy link
Member Author

teolemon commented Jun 8, 2022

Let's file the relevant issues against openfoodfacts-dart

@monsieurtanuki
Copy link
Contributor

To be honest I'm a bit lost regarding "packaging", because of the discrepancies between TEST and PROD on 5010477348630.

PROD:

{
  "code": "5010477348630",
  "product": {
    "packaging": "Etui en carton,Sac en plastique à jeter,Sachet en plastique,Étui en carton à recycler",
    "packaging_tags": ["fr:etui-en-carton", "fr:sac-en-plastique-a-jeter", "fr:sachet-en-plastique", "fr:etui-en-carton-a-recycler"]
  },
  "status": 1,
  "status_verbose": "product found"
}

TEST:

{
  "code": "5010477348630",
  "product": {
    "packaging": "fr:sac en plastique à jeter,fr:étui en carton à recycler,fr:Etui en carton,fr:Sachet en plastique",
    "packaging_tags": ["fr-sac-en-plastique-a-jeter", "fr-etui-en-carton-a-recycler", "fr-etui-en-carton", "fr-sachet-en-plastique"]
  },
  "status": 1,
  "status_verbose": "product found"
}

@teolemon
Copy link
Member Author

teolemon commented Jun 8, 2022

We also have https://world.openfoodfacts.org/api/v2/product/5010477348630?fields=packaging_text_fr which behaves like the ingredients field (multilingual, OCR-compatible)

And it's hairy

"packaging":"Etui en carton,Sac en plastique à jeter,Sachet en plastique,Étui en carton à recycler","packaging_hierarchy":["fr:Etui en carton","fr:Sac en plastique à jeter","fr:Sachet en plastique","fr:Étui en carton à recycler"],

"packaging_lc":"fr",

"packaging_old":"fr:sac en plastique à jeter,fr:étui en carton à recycler,fr:Etui en carton,fr:Sachet en plastique",

"packaging_tags":["fr:etui-en-carton","fr:sac-en-plastique-a-jeter","fr:sachet-en-plastique","fr:etui-en-carton-a-recycler"],

"packaging_text":"",

"packaging_text_fr":"",

"packagings":[{"material":"en:cardboard","recycling":"en:recycle","shape":"en:sleeve"},{"material":"en:plastic","recycling":"en:discard","shape":"en:bag"}]

@monsieurtanuki
Copy link
Contributor

@teolemon Is there any piece of code on the server that could help us understand how we are supposed to read and write packaging?

@stephanegigandet
Copy link
Contributor

Hi @monsieurtanuki , there's no good way to write packaging data currently (the existing packaging tag is deprecated), so I suggest that we wait until we do have a right way and a corresponding API to do it.

There's more details about the current state here: https://wiki.openfoodfacts.org/Packagings_data_structure

@monsieurtanuki monsieurtanuki self-assigned this Jun 23, 2022
monsieurtanuki added a commit to monsieurtanuki/smooth-app that referenced this issue Jun 23, 2022
Impacted files:
* `app_en.arb`: added emb codes and countries translations
* `app_fr.arb`: added emb codes and countries translations
* `edit_product_page.dart`: added emb codes and countries editors
* `Podfile.lock`: wtf
* `product_query.dart`: added emb codes and countries product fields
* `product_refresher.dart`: now using language and country parameters for `saveProduct`
* `pubspec.lock`: wtf
* `pubspec.yaml`: upgraded versions of off-dart and sentry
* `simple_input_page.dart`: added an optional explanation field
* `simple_input_page_helpers.dart`: added emb codes and countries helpers; added an optional explanation field; refactored
teolemon added a commit that referenced this issue Jun 23, 2022
* feat: #2169 - added emb codes and countries

Impacted files:
* `app_en.arb`: added emb codes and countries translations
* `app_fr.arb`: added emb codes and countries translations
* `edit_product_page.dart`: added emb codes and countries editors
* `Podfile.lock`: wtf
* `product_query.dart`: added emb codes and countries product fields
* `product_refresher.dart`: now using language and country parameters for `saveProduct`
* `pubspec.lock`: wtf
* `pubspec.yaml`: upgraded versions of off-dart and sentry
* `simple_input_page.dart`: added an optional explanation field
* `simple_input_page_helpers.dart`: added emb codes and countries helpers; added an optional explanation field; refactored

* Update packages/smooth_app/lib/l10n/app_en.arb

Co-authored-by: Pierre Slamich <pierre.slamich@gmail.com>

* Update packages/smooth_app/lib/l10n/app_en.arb

Co-authored-by: Pierre Slamich <pierre.slamich@gmail.com>

* Update packages/smooth_app/lib/l10n/app_en.arb

Co-authored-by: Pierre Slamich <pierre.slamich@gmail.com>

* Update packages/smooth_app/lib/l10n/app_en.arb

Co-authored-by: Pierre Slamich <pierre.slamich@gmail.com>

Co-authored-by: Pierre Slamich <pierre.slamich@gmail.com>
@teolemon
Copy link
Member Author

teolemon commented Jun 25, 2022

@monsieurtanuki we can clone the ingredients extraction system, the current packaging system on the web works exactly the same way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✏️ Editing Many products are incomplete and don't have Nutri-Score, Eco-Score…so editing is important for users tag picker
Development

No branches or pull requests

3 participants