Skip to content

Commit

Permalink
docs: move dev journey tutorials to a better location (#11187)
Browse files Browse the repository at this point in the history
also fix some links
  • Loading branch information
alexgarel authored Jan 6, 2025
1 parent bf82a79 commit 09f5821
Show file tree
Hide file tree
Showing 17 changed files with 71 additions and 46 deletions.
22 changes: 13 additions & 9 deletions docs/api/tutorial-dev-journey.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
## Tutorials for Common developer journeys

### READ only journeys
- []()Dev Journey 1: <a href="../reference/api-tutorials/comparing-sodas.md">Comparing sodas</a>
- []()Dev Journey 2: <a href="../reference/api-tutorials/finding-healthy-cereals.md">Finding healthy breakfast cereals</a>

- Dev Journey 1: [Comparing sodas](./tutorials/comparing-sodas.md)
- Dev Journey 2: [Finding healthy breakfast cereals](./tutorials/finding-healthy-cereals.md)

### READ and WRITE journeys
- []()Dev Journey 3: <a href="../reference/api-tutorials/adding-missing-products.md">Adding missing products</a>
- []()Dev Journey 4: <a href="../reference/api-tutorials/get-the-nutri-score.md">Get the Nutri-Score</a>
- []()Dev Journey 5: <a href="../reference/api-tutorials/get-the-eco-score.md">Get the Eco-Score</a>
- []()Dev Journey 6: <a href="../reference/api-tutorials/get-ingredient-related-analysis.md">Get ingredient related analysis on new or existing products (Nova, allergens, additives…)</a>
- []()Dev Journey 7: <a href="../reference/api-tutorials/folksonomy-engine.md">Adding non-standard fields to a food product using Folksonomy (coming soon for cosmetics, pet food, and other products)</a>
- []()Dev Journey 8: <a href="../reference/api-tutorials/product-prices.md">Retrieving and adding prices to products using Open Prices</a>

- Dev Journey 3: [Adding missing products](./tutorials/adding-missing-products.md)
- Dev Journey 4: [Get the Nutri-Score](./tutorials/get-the-nutri-score.md)
- Dev Journey 5: [Get the Green-Score](./tutorials/get-the-green-score.md)
- Dev Journey 6: [Get ingredient related analysis on new or existing products (Nova, allergens, additives…)](./tutorials/get-ingredient-related-analysis.md)
- Dev Journey 7: [Adding non-standard fields to a food product using Folksonomy (coming soon for cosmetics, pet food, and other products)](./tutorials/folksonomy-engine.md)
- Dev Journey 8: [Retrieving and adding prices to products using Open Prices](./tutorials/product-prices.md)

## Adding more journeys

* If you feel a developer journey is missing, feel free <a href="https://github.com/openfoodfacts/openfoodfacts-server/tree/main/docs/reference/api-tutorials">to create a Pull Request</a>, or propose it at [email protected]
* If you feel a developer journey is missing, or want to correct one,
feel free <a href="https://github.com/openfoodfacts/openfoodfacts-server/tree/main/docs/api/tutorials">to create a Pull Request</a>, or propose it at [email protected]
3 changes: 2 additions & 1 deletion docs/api/tutorial-uploading-photo-to-a-product.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ Multilingual products have several photos based on the languages present on the

The WRITE operations in the Open Food Facts API require authentication. Therefore you need a valid `user_id` and `password` to write the photo to 100% Real Orange Juice.

> Sign up on the [Open Food Facts App](https://world.openfoodfacts.org/) to get your `user_id` and `password` if you dont have one. For more details, visit the [Open Food Facts Authentication](https://openfoodfacts.github.io/openfoodfacts-server/introduction/api/#authentication).
> Sign up on the [Open Food Facts App](https://world.openfoodfacts.org/) to get your `user_id` and `password` if you dont have one.
For more details, visit the : [Authentication paragraph in our introduction](../index.md#authentication).

## Parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ If you have an app that makes POST calls and you don't want your users to authen
- `user_id`: myappname
- `password`: 123456

* For a complete reference on AUTH, please read: https://openfoodfacts.github.io/openfoodfacts-server/api/#authentication
* For a complete reference on AUTH, please read: [Authentication in our introduction](../index.md#authentication)

---

## Adding images to support your edit, and get machine learning predictions
If you ask your users just one thing, it would be to send photos of the packaging (front, ingredients, nutrition, recycling, the more the better)<br>
<a href="https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/"> Please refer to our comprehensive tutorial on uploading images</a>
Please refer to our [comprehensive tutorial on uploading images](../tutorial-uploading-photo-to-a-product.md)

---

Expand Down Expand Up @@ -57,7 +57,7 @@ You can define one or more parameters to add, for example, the brand and the Kos

- `brands`: Häagen-Dazs
- `labels`: kosher


The call looks like this:

Expand Down Expand Up @@ -94,21 +94,22 @@ It should be structured as: user-agent + user-id.
`comment=Edit by a Healthy Choices 1.2 iOS user - SxGFRZkFwdytsK2NYaDg4MzRVenNvUEI4LzU2a2JWK05LZkFRSWc9PQ`


---
---
## Leveraging Robotoff ML predictions to simplify life for your users

Leveraging Robotoff prediction to simplify life for your users: https://openfoodfacts.github.io/openfoodfacts-server/api/intro-robotoff/
Leveraging [Robotoff prediction](../intro-robotoff.md) to simplify life for your users.
You can get a category prediction from images (useful for Nutri-Score and Eco-Score), you can get quality labels prediction, brand predictions, weight predictions from images.
To achieve this you need the upload image section above. Adding data like product name, ingredients and nutrition can help, but some predictions can be done with just images.

## Getting your users to check ingredients OCR in an autonomous fashion

Getting your users to check ingredients OCR in an autonomous fashion: https://openfoodfacts.github.io/openfoodfacts-server/reference/api-tutorials/get-ingredient-related-analysis/
Getting your users to [check ingredients OCR in an autonomous fashion](./get-ingredient-related-analysis.md)

## Getting your users to input nutrition facts
Getting your users to input nutrition facts: https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-nutrition-data/
[Getting your users to input nutrition facts](../../dev/explain-nutrition-data.md)

## Getting your users to input packaging data
Getting your users to input packaging data: https://openfoodfacts.github.io/openfoodfacts-server/dev/explain-packaging-data/
Getting your users to [input packaging data](../../dev/explain-packaging-data.md)

## Showing the result of their work
- You can then reload the product, potentially using Knowledge Panels, to show the rewarding result of their work.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A local cache is a copy of OFF data stored directly on your system or server. Th

- **FoodVisor Contributed (Python/MongoDB) backend:** The FoodVisor startup contributed a few years ago <a href="https://github.com/openfoodfacts/openfoodfacts-apirestpython">a Python-based backend with a MongoDB export</a>, providing a solid starting point for caching in Python environments.
- **Project-Specific Caches:** Several OFF projects like open-prices and robotoff have implemented local caches for their own needs. While not immediately reusable, they can serve as valuable references.
- **SDKs** We have <a href="https://openfoodfacts.github.io/openfoodfacts-server/api/#sdks">a number of official SDKs</a> that can be leveraged as part of a caching backend. Please leverage and contribute to those 🙏
- **SDKs** We have [a number of official SDKs](../api.md#sdks) that can be leveraged as part of a caching backend. Please leverage and contribute to those 🙏
- **You can start a project within Open Food Facts to solve this**

### Need for Diverse Solutions
Expand All @@ -25,7 +25,7 @@ For applications primarily focused on user-generated requests, a local cache may
### Licensing and Data Sharing

Even when using a local cache, you're still bound by the Open Database License (ODbL). **Do not mix OFF data with external product data**. All additions or modifications made to OFF data must be shared back to OFF, preferably through the WRITE API. Consider incorporating this functionality into your cache implementation.
For more on legal issues, <a href="https://openfoodfacts.github.io/openfoodfacts-server/reference/api-tutorials/license-be-on-the-legal-side/">please read this page</a>
For more on legal issues [please read this page](./license-be-on-the-legal-side.md)

### Challenges of Cache Maintenance

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You can get information about absence or unawareness of the presence of:

## Flow
### The product does not exist
* You can use our [adding products tutorial](https://openfoodfacts.github.io/openfoodfacts-server/reference/api-tutorials/adding-missing-products/)
* You can use our [adding products tutorial](./adding-missing-products.md)

### The product does exist: Get the status of the product and show prompts in case of incomplete ingredients or category (also required for NOVA ultra-processing levels)

Expand All @@ -51,7 +51,7 @@ then "Add ingredients to see the level of food processing and potential additive
* Once the user has entered once of your completion flow, proceed to the next step

### Upload ingredient photo
* [Please follow our dedicated tutorial on photo upload](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/)
* [Please follow our dedicated tutorial on photo upload](../tutorial-uploading-photo-to-a-product.md)
* The DART SDK is offering support for photo upload, and we encourage you to implement it in one of the official Open Food Facts SDKs if it's not supported yet.
* Ensure that your users crop language by language, or take all languages at once, but you perform server side cropping on one specific language before performing the OCR
* We're working on a ML solution to detect languages and performing auto-crops per language ([[email protected]](mailto:[email protected]) to learn more)
Expand All @@ -64,39 +64,55 @@ then "Add ingredients to see the level of food processing and potential additive
* The actions described in this topic do not modify the image, but provide metadata on how to use it (the data of the corners in the case of selection and the data of the rotation). That is, you send an image to the API, provide an id, you define, for example, the cropping and rotation parameters and as a response, the server generates a new image as requested and you can call this new version of the image.

#### Selecting photos
* [Please look at the reference](https://openfoodfacts.github.io/openfoodfacts-server/api/tutorial-uploading-photo-to-a-product/)

* [Please look at the specific tutorial](../tutorial-uploading-photo-to-a-product.md)

#### Rotating a photo

* [Please look at the reference](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v2/#get-/cgi/product_image_crop.pl)

#### Cropping Photos

**Note**: Cropping is only relevant for editing already selected images. You need to upload it first to the system, select it, retrieve its id, and then crop it.
This is a non destructive crop. If there's an issue with the image, you should report it using the dedicated NutriPatrol API.
Moderators will either perform a destructive crop, or more likely delete the image.
* [Please look at the reference](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v2/#post-/cgi/product_image_crop.pl)

#### Unselecting photos

* [Please look at the reference](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v2/#post-/cgi/product_image_unselect.pl)

### Get the Optical Character Recognition (OCR) output of the ingredients photo

Open Food Facts uses optical character recognition (OCR) to retrieve ingredient data and other information (using Robotoff) from the photos of the product labels.
**Notes**:
* The OCR may contain errors. Encourage your users to correct the output using the ingredients WRITE API.
* You can also use your own on-device OCR, especially if you're superconfident about it performing better than the server's cloudvision and if you plan to send a high number of queries.
* Please DO NOT translate and send us the OCR output. We want to store only actual data. If you want translated version of the ingredient list, please send us an email to [email protected]

#### API solution

* [Please look at the reference](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v2/#get-/cgi/ingredients.pl)

#### Dart SDK solution

* [https://openfoodfacts.github.io/openfoodfacts-dart/model_OcrIngredientsResult/OcrIngredientsResult-class.html](https://openfoodfacts.github.io/openfoodfacts-dart/model_OcrIngredientsResult/OcrIngredientsResult-class.html)
* [https://openfoodfacts.github.io/openfoodfacts-dart/utils_OcrField/OcrField-class.html](https://openfoodfacts.github.io/openfoodfacts-dart/utils_OcrField/OcrField-class.html)
* [https://openfoodfacts.github.io/openfoodfacts-dart/utils_OcrField/OcrFieldExtension.html](https://openfoodfacts.github.io/openfoodfacts-dart/utils_OcrField/OcrFieldExtension.html)


### Present the result of the Optical Character Recognition (OCR) output to your user for human review

* Create a UI that encourages careful review, and encourages dropping the output if it's not right
* Create a UI that encourages taking a less blurry, better framed photo to fix the output
* Create a UI that handles multilinguism well

### Send the ingredients

* [Please look at the reference located](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v2/#post-/cgi/product_jqm2.pl)

### Refresh product to display the result to your user

* [Please look at the reference](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v3/#get-/api/v3/product/-barcode-)
![alt_text](images/image1.png "image_tooltip")

Loading

0 comments on commit 09f5821

Please sign in to comment.