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

Integrate a food search API into Loop's "Add Carb Entry" screen #2244

Open
taylorpatterson-T1D opened this issue Oct 13, 2024 · 0 comments
Open

Comments

@taylorpatterson-T1D
Copy link

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 find except then we need multiple apps and have to switch between them. We should put this capability right inside Loop!

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant