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.

circle-exclamation

The most detailed information can be found in the PassioIDAttributes object. To retrieve this object from a given PassioID, simply call

val attributes = PassioSDK.instance.lookupPassioAttributesFor(passioID)
circle-exclamation

PassioIDAttributes

data class PassioIDAttributes(
    var passioID: PassioID,
    var name: String,
    var imageName: String,
    val entityType: PassioIDEntityType,
    var parents: List<PassioAlternative>?,
    var children: List<PassioAlternative>?,
    var siblings: List<PassioAlternative>?,
    val passioFoodItemDataForDefault: PassioFoodItemData?,
    val passioFoodRecipe: PassioFoodRecipe?,
    val condiments: List<PassioFoodItemData>? = null
)

Here we will cover the fields that are not self-explanatory:

  1. imageName - An identifier for the image of the food. To retrieve the Drawablearrow-up-right for the given image name use

The image for a food can also be retrieved using the PassioID and the method

  1. 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.

  2. 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