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

Understanding JSON taxonomy fields #892

Closed
Tracked by #5523
aleene opened this issue Sep 15, 2017 · 6 comments
Closed
Tracked by #5523

Understanding JSON taxonomy fields #892

aleene opened this issue Sep 15, 2017 · 6 comments
Labels
API Issues related to the Open Food Facts API. More specific labels exist & should be used (API WRITE…)

Comments

@aleene
Copy link
Contributor

aleene commented Sep 15, 2017

The API allows to inspect how OFF interprets taxonomy based fields. A taxonomy based field consist of one or more tags (one or more words tied together). This information could be used by the user to suggest improvements to taxonomies. I would like to support this in my app, but before that it must be clear what information the API offers.

Any taxonomy based field presents its data in the json in three variants. An example for categories:

"categories":"Boissons,Boissons gazeuses,Eaux,Eaux minérales,Eaux gazeuses,Eaux minérales gazeuses,Boissons non sucrées"
"categories_tags":["en:beverages","en:carbonated-drinks","en:waters","en:mineral-waters","en:carbonated-waters","en:carbonated-mineral-waters","en:non-sugared-beverages"]
"categories_hierarchy":["en:beverages", "en:carbonated-drinks", "en:waters", "en:mineral-waters", "en:carbonated-waters", "en:carbonated-mineral-waters", "en:non-sugared-beverages"]

These three fields are in this example very similar. I (want to) interpret them as:

  • Without postfix (categories): These are the tags as entered by the user. If there is no language prefix, the tags are assumed to be in the main language of the product. If the user wants to add tags in another language than the main product language, he should use a language prefix, like "en:Beverages". In this categories example, OFF probably has added tags that the user did not specify, like "Boissons non sucrées".
  • _tags-postfix (categories_tags): This field shows how the OFF interpreted the tags specified by the user. Tags that are recognised are converted to the keys found in the taxonomy. If a tag is not recognised, it will be shown with the language prefix of the main product language. If the main product language is english, then it is unclear whether it is a recognised tag. Why is in this example the tag "en:non-sugared-beverages" in the list?
  • _hierarchy-postfix (categories_hierarchy): In the current implementation it is unclear what this field adds. It would be nice if this field shows the 'derived' tags. These could be parents of tags, such as "en:beverages" of calculated tags "en:non-sugared-beverages" (based on other fields, such as ingredient "sugar")

In my app I support the viewing of these different fields. By double tapping you can cycle through them. It would be nice if these fields have actual meaning.

@stephanegigandet
Copy link
Contributor

categories_hierarchy is a re-ordering of categories_tags, with the "level" of the entries as the sort key. The level is how deep the category is from one of the roots.

categories is what the user entered last in the form, but what is shown on the form to the user when the page is edited is the content of categories_hierarchy, in the language of the interface.

@aleene
Copy link
Contributor Author

aleene commented Sep 22, 2017

The difference between _hierarchy and _tags seems not very useful, especially when it is not possible to identify the tops of the trees. I like to know how off uses to interpret and extend what has been entered by the user. This can be used to give suggestions to the editors of taxonomies.

@aleene
Copy link
Contributor Author

aleene commented Sep 22, 2017

I will have to incorporate the taxonomies and do my own processing.

@teolemon teolemon added the API Issues related to the Open Food Facts API. More specific labels exist & should be used (API WRITE…) label Sep 24, 2017
@stephanegigandet
Copy link
Contributor

The new taxonomy exports may help: #1126

@aleene
Copy link
Contributor Author

aleene commented Mar 2, 2018

I will play wiith the json-versions.

@aleene
Copy link
Contributor Author

aleene commented Nov 13, 2024

to \o old

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Issues related to the Open Food Facts API. More specific labels exist & should be used (API WRITE…)
Development

No branches or pull requests

3 participants