Loop icon indicating copy to clipboard operation
Loop copied to clipboard

[FEATURE REQUEST] Integrate a food search API into Loop's "Add Carb Entry" screen

Open taylorpatterson-T1D opened this issue 1 year ago • 0 comments

Getting precise carb counts for the servings we're consuming is hard. Guessing is unproductive at helping us better manage sugar levels. We should make it simple and easy to get the exact carbs and servings data into the "Add Carb Entry" screen which will improve Loop's performance for people.

The search would return carbs per serving, serving sizes and serving type (oz., grams, bar, bag, etc) and the screen modification would let me to modify the serving size which would recalculate the carbs needed to correctly bolus.

Let's add the ability to lookup foods from a publicly available food database. It would be really cool if you could lookup by typing in the food, scanning a barcode, or even dictating it to Loop, in the same exact way it works in Glooko. For example here is Glooko's food entry screen:

AddFood

Using Glooko works well. The goal of this user story is to add the same capability right into Loop so we have less apps to refer to in order to manage our disease.

Additional information Additional research uncovered this free open source Food API: https://world.openfoodfacts.org/ Hitting a sample URL for Coke Zero with the barcode in the URL (https://world.openfoodfacts.org/api/v0/product/5449000131805.json) results in a very usable response.

Add barcode camera capture button in carb entry form, scanned barcode puts code in a preformed URL, response is read and the carbohydrates and serving sizes extracted, plugged into the carb entry screen, can be adjusted and recalculated by chaning the serving size, press the give insulin button and bob's your uncle!

More API documentation and options: https://world.openfoodfacts.org/data

Here is a wireframe: Screenshot 2024-10-13 at 3 59 59 PM

Scanning, dictating or entering a barcode number manually into the search bar hits the OpenFoodFacts API and returns the Description (product_name), Serving Size (nutriments:carbohydrates_serving) and Carbs Per Serving (nutriments:carbohydrate) and automatically enters them into the UI for fine tuning by user.

The following URL format using v3 of the API results in just the information we want (product name, carbohydrates per serving, the serving size, and a thumbnail image: https://world.openfoodfacts.org/api/v3/product/894700010045&fields=product_name,carbohydrates_serving,serving_size,image_front_thumb_url

229319675-d0504652-4acc-4759-ace6-b8c83642df6d

As the user adjusts the serving count, Loop automatically updates Amount Consumed until the user is satisfied with the entry and then hits Continue for injection.

Example URL for Kirkland Soft & Chewy Granola Bar: https://world.openfoodfacts.org/api/v0/product/096619313952.json

taylorpatterson-T1D avatar Oct 13 '24 23:10 taylorpatterson-T1D