openfoodfacts / openfoodfacts-androidapp

(Legacy) Native version of Open Food Facts on Android - Coders & Decoders welcome 🤳🥫
https://android.openfoodfacts.org
Apache License 2.0
773 stars 446 forks source link

Put ingredients warnings on Open Beauty Facts #2056

Open teolemon opened 5 years ago

teolemon commented 5 years ago

What

This bug requires using the OBF ingredient taxonomy.

https://world.openbeautyfacts.org/api/v0/product/3282779063234.json?fields=ingredients,code

  1. Get the ingredient list for the product

    {"status_verbose":"product found","code":"3282779063234","status":1,"product":{"code":"3282779063234","ingredients":[{"text":"WATER","rank":1,"id":"water"},{"text":"AQUA","rank":2,"id":"aqua"},{"text":"SODIUM LAURETH SULFATE","rank":3,"id":"sodium-laureth-sulfate"},{"text":"POLYSORBATE 20","rank":4,"id":"polysorbate-20"},{"text":"CETEARETH-60 MYRISTYL GLYCOL","rank":5,"id":"ceteareth-60-myristyl-glycol"},{"text":"COCAMIDE MIPA","rank":6,"id":"cocamide-mipa"},{"text":"PROPYLENE GLYCOL","rank":7,"id":"propylene-glycol"},{"text":"CARAMEL","rank":8,"id":"caramel"},{"text":"CETRIMONIUM CHLORIDE","rank":9,"id":"cetrimonium-chloride"},{"text":"DISODIUM EDTA","rank":10,"id":"disodium-edta"},{"text":"FRAGRANCE","rank":11,"id":"fragrance"},{"text":"PARFUM","rank":12,"id":"parfum"},{"text":"GREEN 3","rank":13,"id":"green-3"},{"text":"CI 42053","rank":14,"id":"ci-42053"},{"text":"METHYLISOTHIAZOLINONE","rank":15,"id":"methylisothiazolinone"},{"text":"METHYLPARABEN","rank":16,"id":"methylparaben"},{"text":"PHENOXYETHANOL","rank":17,"id":"phenoxyethanol"},{"text":"POLYQUATERNIUM-22","rank":18,"id":"polyquaternium-22"},{"text":"PROPYLPARABEN","rank":19,"id":"propylparaben"},{"text":"SODIUM CHLORIDE","rank":20,"id":"sodium-chloride"},{"text":"SODIUM HYDROXIDE","rank":21,"id":"sodium-hydroxide"},{"text":"URTICA DIOICA","rank":22,"id":"urtica-dioica"},{"text":"NETTLE","rank":23,"id":"nettle"},{"text":"EXTRACT","rank":24,"id":"extract"}]}}
  2. If an ingredient which is on the warnlist (presented at the end of the bug) is inside (or has a parent on the blacklist), display it using the Ingredient taxonomy

    excerpt from the product data
    {"text":"PHENOXYETHANOL","rank":17,"id":"phenoxyethanol"}

    Ingredient taxonomy https://static.openbeautyfacts.org/data/taxonomies/ingredients.json

    excerpt from the ingredient taxonomy
    "en:phenoxyethanol":{"name":{"fr":"Phénoxyéthanol","en":"Phenoxyethanol"}}
    With {name_en}
    With Phenoxyethanol
  3. If it is not present, display:

    Without {name_en}
    Without Phenoxyethanol
  4. Full list of ingredients to flag https://static.openbeautyfacts.org/data/taxonomies/special_ingredients.json

    - Without Parabens
    - Without Formaldehyde releasers
    - With Allergenic fragrances
    - Without Silicones
    - Without Phenoxyethanol
    - Without Triclosan
    - Without Cetrimonium bromide
    - Without Methylisothiazolinone
    - Without Aluminum salts
jaindiv26 commented 5 years ago

@teolemon I'll be working on this.

teolemon commented 5 years ago

Okay, assigned

teolemon commented 4 years ago

@jaindiv26 I'm clearing you from the assignees. Feel free to reclaim the issue if you'd like to work on it. I'm also putting a P1 because this is the only thing blocking a native release of Open Beauty Facts (we want feature parity with the Cordova release)