Difference between revisions of "Bots"

From Open Food Facts wiki
Jump to navigation Jump to search
 
(10 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
{{Box
 
{{Box
  | channel    =  bots
+
  | 1    =  Slack channel
 +
| 2     =  [https://openfoodfacts.slack.com/messages/bots/ #bots]
 
}}
 
}}
=Checkbot=
+
 
 +
The bots are written in Perl or in Ruby, but it's relatively independent of the Product Opener code base, similar scripts could be written in pretty much any language.
 +
The bot uses both the mongodb database and the perl binary files that stores the product data, but you could just use the mongodb data only, it's the same.
 +
 
 +
== Writing bots in Perl ==
 +
== Writing bots in Ruby ==
 +
<pre>
 +
gem install openfoodfacts
 +
</pre>
 +
* Example that adds parent brands: https://github.com/openfoodfacts/openfoodfacts-corrector
 +
== Writing bots in Python ==
 +
== Testing bots ==
 +
* Please test bots on world.openfoodfacts.net
 +
* Please ask for permission to use the bot on Slack before you switch to .org
 +
 
 +
== Active bots ==
 +
=== Checkbot ===
 
Checkbot is a little bot that will check Open Food Facts for obvious errors and report them on Slack, in the [https://openfoodfacts.slack.com/messages/bots/ #bots] channel.
 
Checkbot is a little bot that will check Open Food Facts for obvious errors and report them on Slack, in the [https://openfoodfacts.slack.com/messages/bots/ #bots] channel.
 +
==== Code ====
 +
* Language: Perl
 +
* [https://bitbucket.org/openfoodfacts/product-opener/src/3f2b4c2790d19ad559fb68376001d4dbc7cd34a5/cgi/checkbot.pl?at=master Code on bitbucket]
 +
==== Current checks ====
 +
* It checks if one of the nutrients has a value higher than 105g for 100g / 100ml.
 +
* It checks if sugar+starch > carbohydrates etc.
 +
* We'll be able to add rules like:  sum of nutrients per 100g > 105g,
  
== Current checks ==
+
==== Ideas ====
* sugars () + starch () > carbohydrates ()
+
* Checkbot pingue sur Slack les personnes qui ont ajouté les produits (ou leur envoyer un mail d'ailleurs)
* carbohydrates = 106g / Product size = 100g
+
* version live de checkbot qui pingue en continu
*  salt = 107g / 100g
+
* écart à la moyenne de plus d'un facteur 9 (erreur de virgule)
 +
* What about a label we could add on the products that have a verified erroneous label like the ajolix-chili above? We could tag them "error on label" and have checkbot skip them. What would you think of that @stephane?
 +
[http://world.openfoodfacts.org/label/incorrect-nutrition-facts-on-label incorrect-nutrition-facts-on-label]
  
=Infobot=
+
=== Infobot ===
 +
[http://world.openfoodfacts.org/contributor/infobot Infobot user profile]
 
Infobot will add some information on requests on many products
 
Infobot will add some information on requests on many products
  
=UPCBot=
+
== Retired bots ==
 +
=== Fixbot ===
 +
[http://world.openfoodfacts.org/contributor/fixbot Fixbot user profile]
 +
Fixbot removed bogus countries that appeared at some point in the products, due to a Product Opener bug
 +
Product http://world.openfoodfacts.org/product/8414606446629 (miel-quot-esencia-andalusi-quot / esencia-andalusi) : removing bogus countries, replacing with Spain
 +
==== Code ====
 +
* Language: Perl
 +
==== Ideas ====
 +
<pre>
 +
tacite [12:53 AM]
 +
ça permettrait aussi de fusionner quand on a un "leclerc drive" comme magasin au lieu de "leclerc", c'est plus pertinent de laisser que "leclerc" vu que leclerc fait du picking dans son magasin
 +
 
 +
stephane [10:38 AM]
 +
C'est une idée intéressante. Pour l'instant dans magasins, on met en général seulement le magasin où la personne qui a ajouté le produit l'a acheté, mais c'est vrai que ça serait intéressant. Après le problème c'est que ça change tout le temps.
 +
 
 +
vince [2:55 AM]
 +
​_"quand on a un "leclerc drive" comme magasin au lieu de "leclerc", c'est plus pertinent de laisser que "leclerc" vu que leclerc fait du picking dans son magasin"_​
 +
Je ne suis pas sûr : Leclerc rend-il disponible ​*tous*​ ses produits via le drive? Tous les distributeurs le font-ils? Si certains distributeurs ne mettent à disposition qu'une partie de leurs produits en drive, il pourrait être intéressant de savoir lesquels. En résumé et comme souvent, je suis partisan de laisser l'utilisateur saisir l'information la plus granulaire possible, quitte à ​*afficher*​ une info simplifiée aggrégée, mais en continuant à ​*stocker*​ l'info détaillée.
 +
 
 +
Après, je serais prudent quant à l'ajout ​*automatique*​ du magasin sur la simple base de la marque distributeur : l'épicerie de quartier en bas de chez moi est bourrée de produits de marques distributeurs (françaises et allemandes à Paris, anglaises et polonaises à Liverpool)... au double du prix, mais en bas de chez moi :wink:
 +
 
 +
tacite [1:21 PM]
 +
Tout les produits Leclerc Drive peuvent être trouvés dans Leclerc mais l'inverse pas forcément
 +
</pre>
 +
=== Scanbot ===
 +
[http://world.openfoodfacts.org/contributor/scanbot Scanbot user profile]
 +
Scanbot will look for the IP of scanned products, and will add the matching countries in the country field.
 +
Runs on demand. Not really reliable because of the IP system.
 +
 
 +
=== UPCBot ===
 +
[http://world.openfoodfacts.org/contributor/upcbot UPCbot user profile]
 
UPCBot was used to normalize UPC codes. Since we now normalize them in Product Opener, it should not be used anymore.
 
UPCBot was used to normalize UPC codes. Since we now normalize them in Product Opener, it should not be used anymore.
 
[[Category:ProductOpener]][[Category:Bots]]
 
[[Category:ProductOpener]][[Category:Bots]]
 +
==== Code ====
 +
* Language: Perl
 +
 +
= Ideas for new bots =
 +
* tacite [10:10 PM]  New bot idea : Getting notifications for new complete products by contributors that have less than 5 completed products. That way we know we have to control it thoroughly

Latest revision as of 16:28, 31 May 2019

Slack channel

The bots are written in Perl or in Ruby, but it's relatively independent of the Product Opener code base, similar scripts could be written in pretty much any language. The bot uses both the mongodb database and the perl binary files that stores the product data, but you could just use the mongodb data only, it's the same.

Writing bots in Perl

Writing bots in Ruby

gem install openfoodfacts

Writing bots in Python

Testing bots

  • Please test bots on world.openfoodfacts.net
  • Please ask for permission to use the bot on Slack before you switch to .org

Active bots

Checkbot

Checkbot is a little bot that will check Open Food Facts for obvious errors and report them on Slack, in the #bots channel.

Code

Current checks

  • It checks if one of the nutrients has a value higher than 105g for 100g / 100ml.
  • It checks if sugar+starch > carbohydrates etc.
  • We'll be able to add rules like: sum of nutrients per 100g > 105g,

Ideas

  • Checkbot pingue sur Slack les personnes qui ont ajouté les produits (ou leur envoyer un mail d'ailleurs)
  • version live de checkbot qui pingue en continu
  • écart à la moyenne de plus d'un facteur 9 (erreur de virgule)
  • What about a label we could add on the products that have a verified erroneous label like the ajolix-chili above? We could tag them "error on label" and have checkbot skip them. What would you think of that @stephane?

incorrect-nutrition-facts-on-label

Infobot

Infobot user profile Infobot will add some information on requests on many products

Retired bots

Fixbot

Fixbot user profile Fixbot removed bogus countries that appeared at some point in the products, due to a Product Opener bug Product http://world.openfoodfacts.org/product/8414606446629 (miel-quot-esencia-andalusi-quot / esencia-andalusi) : removing bogus countries, replacing with Spain

Code

  • Language: Perl

Ideas

tacite [12:53 AM] 
ça permettrait aussi de fusionner quand on a un "leclerc drive" comme magasin au lieu de "leclerc", c'est plus pertinent de laisser que "leclerc" vu que leclerc fait du picking dans son magasin

stephane [10:38 AM] 
C'est une idée intéressante. Pour l'instant dans magasins, on met en général seulement le magasin où la personne qui a ajouté le produit l'a acheté, mais c'est vrai que ça serait intéressant. Après le problème c'est que ça change tout le temps.

vince [2:55 AM] 
​_"quand on a un "leclerc drive" comme magasin au lieu de "leclerc", c'est plus pertinent de laisser que "leclerc" vu que leclerc fait du picking dans son magasin"_​
Je ne suis pas sûr : Leclerc rend-il disponible ​*tous*​ ses produits via le drive? Tous les distributeurs le font-ils? Si certains distributeurs ne mettent à disposition qu'une partie de leurs produits en drive, il pourrait être intéressant de savoir lesquels. En résumé et comme souvent, je suis partisan de laisser l'utilisateur saisir l'information la plus granulaire possible, quitte à ​*afficher*​ une info simplifiée aggrégée, mais en continuant à ​*stocker*​ l'info détaillée.

Après, je serais prudent quant à l'ajout ​*automatique*​ du magasin sur la simple base de la marque distributeur : l'épicerie de quartier en bas de chez moi est bourrée de produits de marques distributeurs (françaises et allemandes à Paris, anglaises et polonaises à Liverpool)... au double du prix, mais en bas de chez moi :wink:

tacite [1:21 PM] 
Tout les produits Leclerc Drive peuvent être trouvés dans Leclerc mais l'inverse pas forcément

Scanbot

Scanbot user profile Scanbot will look for the IP of scanned products, and will add the matching countries in the country field. Runs on demand. Not really reliable because of the IP system.

UPCBot

UPCbot user profile UPCBot was used to normalize UPC codes. Since we now normalize them in Product Opener, it should not be used anymore.

Code

  • Language: Perl

Ideas for new bots

  • tacite [10:10 PM] New bot idea : Getting notifications for new complete products by contributors that have less than 5 completed products. That way we know we have to control it thoroughly