Nutritional Database
Once the food detection process has returned a PassioID, it is time to query the database and see what information Passio has on the detected food.
All the calls to the database are synchronous and are executed on the caller thread. For better performance execute these calls on a background thread.
The most detailed information can be found in the PassioIDAttributes object. To retrieve this object from a given PassioID, simply call
This call may return null if the given PassioID can't be found in the database. Be sure to check the nullability of the return object before proceeding.
PassioIDAttributes
Here we will cover the fields that are not self-explanatory:
imageName - An identifier for the image of the food. To retrieve the Drawable for the given image name use
The image for a food can also be retrieved using the PassioID and the method
parents, children, siblings - All the foods in Passio's Nutritional Database are organized in a tree-like structure with each PassioID being a node in that tree. Let's say we scanned a "mandarin". A child of a "mandarin" is a "tangerine", and its parent is a "whole citrus fruit". We can offer these alternatives to the user in case the user is pointing to a similar food to a mandarin.
passioFoodItemDataForDefault, passioFoodRecipe - The SDK differentiates single food items and food recipes. A single item represents just one particular food like an apple or peas. A food recipe consists of more than one single food item. For example a recipe is a Caprese salad which consists of mozzarella, tomatoes, basil, salt, black pepper and olive oil.
PassioFoodItemData
PassioFoodItemData holds the nutritional information for a food item like calories, carbs, protein, fat etc. It also has a reference weight on which these values are calculated and contains serving sizes and serving units. Serving sizes offer you quick options to select the size of the food with a given quantity and unit.
PassioFoodRecipe
Recipes should be viewed as a collection of PassioFoodItemData objects.
Other useful queries
If you have a PassioID returned from the detection process and you are just interested in the name of the corresponding food, use
To query the names of the foods from the database by a filter use
The returned list contains a PassioID paired with the name of the food.
If at any point you need help from the Passio team, please reach out to us at support@passiolife.com
Last updated