Difference between revisions of "Knowledge panels"

From Open Food Facts wiki
Jump to navigation Jump to search
(add intro and sample urls)
(link to documentation)
Line 2: Line 2:
 
Knowledge panels are json data that describe content to be displayed to the user.
 
Knowledge panels are json data that describe content to be displayed to the user.
  
They are currently used on the [[Project Smoothie|new smoothie flutter application]] and, as an experimental feature, on the [[Product Opener]] web platform.
+
They are currently used on the [[Project Smoothie|new smoothie flutter application]] and on the [[Product Opener]] web platform.
 +
 
 +
Introduction: https://openfoodfacts.github.io/openfoodfacts-server/introduction/knowledge-panels/
 +
 
 +
Reference documentation: https://openfoodfacts.github.io/openfoodfacts-server/reference/api/#get-/api/v2/product/-barcode--fields-knowledge_panels
  
 
== Testing it ==
 
== Testing it ==
To test knowledge panels on the web application:
+
Knowledge panels are already deployed for every body !
 
 
* if you are moderator, they are displayed so that you can report eventual bugs
 
* if you are a normal user, you can add <code>?panels=1</code> at the end of the url (eg: http://world.openfoodfacts.org/product/7804659650035/not-mayo-notco?panels=1
 
  
 
To see the knowledge panels jsons, use the [https://openfoodfacts.github.io/api-documentation/ api], that is, from a product page, you can add <code>/api/v2</code> before /product/, and append <code>fields=knowledge_panels</code> as query parameters.
 
To see the knowledge panels jsons, use the [https://openfoodfacts.github.io/api-documentation/ api], that is, from a product page, you can add <code>/api/v2</code> before /product/, and append <code>fields=knowledge_panels</code> as query parameters.
  
 
Eg: http://world.openfoodfacts.org/api/v2/product/7804659650035/not-mayo-notco?fields=knowledge_panels
 
Eg: http://world.openfoodfacts.org/api/v2/product/7804659650035/not-mayo-notco?fields=knowledge_panels
 +
 +
'''FIXME:''' eventually move this part of this to https://openfoodfacts.github.io/openfoodfacts-server/introduction/api/
  
 
== The flexibility of a static page ? ==
 
== The flexibility of a static page ? ==

Revision as of 11:18, 9 February 2023

Knowledge panels are json data that describe content to be displayed to the user.

They are currently used on the new smoothie flutter application and on the Product Opener web platform.

Introduction: https://openfoodfacts.github.io/openfoodfacts-server/introduction/knowledge-panels/

Reference documentation: https://openfoodfacts.github.io/openfoodfacts-server/reference/api/#get-/api/v2/product/-barcode--fields-knowledge_panels

Testing it

Knowledge panels are already deployed for every body !

To see the knowledge panels jsons, use the api, that is, from a product page, you can add /api/v2 before /product/, and append fields=knowledge_panels as query parameters.

Eg: http://world.openfoodfacts.org/api/v2/product/7804659650035/not-mayo-notco?fields=knowledge_panels

FIXME: eventually move this part of this to https://openfoodfacts.github.io/openfoodfacts-server/introduction/api/

The flexibility of a static page ?

What should we do with the native Wikidata integration on Android ?

  • Move the logic on the server, with caching, and let iOS and other apps benefit as well ?
  • Blend the Wikidata info with our own
  • System to add Wikidata IDs to categories, labels… (working as a special language, using the existing translation system ?)

When should network calls be made ?

  • The apps would attempt to call all labels at setup, and then refresh on some heuristic
  • On demand call when clicking on an attribute or a label

Support for HTML embedding on Android

Support for HTML embedding on iOS

Support for HTML embedding on Flutter