Open raphael0202 opened 3 months ago
@raphael0202 We're blocked because in off-dart and Smoothie we're only able to autocomplete labels (e.g. 'Tomate'
), and we don't retrieve the matching tags (e.g. 'en:tomatoes'
) and we don't have a way to retrieve the tags from the labels.
In Prices you want the tags...
@raphael0202 @teolemon Besides, that means we cannot do that offline one way or the other. Perhaps a decent minimal map of {tag: label} with standard fruits and stored locally would help.
I think it should be added to the autocomplete API on Product Opener. But we can definitely add support for language-specific tags on Open Prices side.
@raphael0202 I don't know which solution is more pragmatic. Meanwhile, we're blocked here at Smoothie.
@raphael0202 I don't know which solution is more pragmatic. Meanwhile, we're blocked here at Smoothie.
It's definitely the Open Prices addition. It's on my todo list ;)
It's definitely the Open Prices addition. It's on my todo list ;)
@raphael0202 Cool!
Keep in mind that here at Smoothie we use background tasks and "normal" users have no control over them.
If for some reason what I give you is not good enough, what would be your reaction? Ignore the price (without feedback to the user)? Return an error (and I will retry forever)?
Btw there's also the question of the category value you'll return: if you return a tag (e.g. 'en:tomatoes') I'll need a translated label. It means I'll have to call api/v2/taxonomy
with all the tags you'll return from Prices. Not very convenient, that second call. To be investigated.
If for some reason what I give you is not good enough, what would be your reaction? Ignore the price (without feedback to the user)? Return an error (and I will retry forever)?
I think the retry strategy should really depend on the HTTP error code. In case of a 5XX error, it's definitely worth trying again later. If it's a 4XX, I think Smoothie should drop the task.
And users can provide any category (even ones that don't exist in the taxonomy)?
Btw there's also the question of the category value you'll return: if you return a tag (e.g. 'en:tomatoes') I'll need a translated label. It means I'll have to call api/v2/taxonomy with all the tags you'll return from Prices. Not very convenient, that second call. To be investigated.
That's an issue indeed, we should think about adding translations to the output response. ping @raphodn FYI
I think the retry strategy should really depend on the HTTP error code. In case of a 5XX error, it's definitely worth trying again later. If it's a 4XX, I think Smoothie should drop the task.
Sounds fair, except that we don't provide any feedback in Smoothie about background tasks. The user thinks the price is added, and it'll never be. But it's more a problem on the Smoothie side than on the Prices side.
As agreed, I added support for language-specific categories in https://github.com/openfoodfacts/open-prices/pull/548.
We can now submit fr: Abricots
as a category, and it translates it automatically to en:apricots
.
Note that we don't support (yet) extended synonyms, so we should provide the canonical taxonomy ID (or it's direct synonyms) as value, but it shouldn't be an issue, as you will probably use the taxonomy translations for auto-complete.
If the value is not recognized, we save it as-it.
It's available in staging :)
@raphael0202 Cool!
Just checking: should we add a space after the semicolon (fr: Abricots
) or is it a typo (fr:Abricots
instead)?
@raphael0202 Tested this morning and it looks OK for category
, where fr:Pomme de terre de Noirmoutier
was correctly interpreted as en:potatoes-from-noirmoutier
.
Now that you're here, we have the same kind of issue with origins_tags
: could you interpret/translate them as well?
You can add a space or not, both are supported! Oh ok, I will add it next week!
Oh ok, I will add it next week!
@raphael0202 Cool! Please ping me when you're done.
@monsieurtanuki It's deployed in production :)
@raphael0202 Both categories and origins in production, then. Thanks!
fyi I created an issue - https://github.com/openfoodfacts/open-prices/issues/575 - linked to this discussion : adding a new Price.type
field, to clearly seperate price for products with or without barcode
@raphodn Of course you know the impact of making this field mandatory: Smoothie wouldn't be able to create any price, unless all users upgrade their app after a new app version.
That said, this field could be optional when creating a price, and computed (and checked) by Prices server anyway:
Update : the field (optional) is available in staging. And in production tomorrow. It'll be filled & returned for every price.
Problem
Currently, we cannot add the price of a product without barcode (products such as fruit/vegetables that are sold per kg or per unit). It would be great to add it!
For the record, it's available on the web version of Open Prices.