Passio Nutrition-AI
  • Nutrition-AI SDK Overview
  • Guides
    • Nutrition AI SDK
      • SDK Key and minimum requirements
      • Installation
      • Configure the SDK
      • Use Cases
        • Food recognition
        • Nutrition data
        • Barcode scanning
        • Nutrition Facts scanning
        • Search, Food Icons, RefCode
        • Speech recognition
        • Nutrition Advisor
        • Suggestions and Meal Plans
        • User created foods and reports
    • iOS SDK Docs
      • Before getting started
      • Getting the ml models to the device
      • Run the demos first
      • Adding Passio SDK into your project
      • Initialize and configure the SDK
      • Start/Stop food detection
      • Food Recognition Delegate
      • Migration from SDK 1.4.X to 2.x
      • SDK API
      • Quick Start Guide
        • Installation
        • Configure the SDK (UIKit)
        • Recognise food using image
        • Food Details
    • Android SDK Docs
      • Getting started
        • Include the library
        • Camera
        • SDK Initialization and Configuration
        • Food detection session
        • Visual, Barcode and Packaged Food detection
        • Nutritional Database
        • Sandbox app
      • Troubleshooting on Android
      • Migration from SDK version 1.4.x to 2.x
      • Quick Start Guide
        • Importing the Android SDK to a project
        • Configure SDK and handle the result
        • RecognizeImageRemote
        • Food Details
    • React Native SDK Docs
      • Getting Started
        • Installation
        • SDK Initialization and Configuration
      • API Reference
        • configure & requestCameraAuthorization
        • recognizeImageRemote
        • searchForFood & searchForFoodSemantic
        • startFoodDetection
          • FoodDetectionEvent
        • fetchFoodItemForProductCode
        • fetchFoodItemForRefCode
        • fetchFoodItemForDataInfo
        • startNutritionFactsDetection
        • fetchFoodItemForPassioID
        • recognizeSpeechRemote
        • Fetch Nutrients
        • onDowloadingPassioModelCallBacks
        • detectFoodFromImageURI
        • addToPersonalization
        • updateLanguage
        • fetchHiddenIngredients
        • fetchVisualAlternatives
        • fetchPossibleIngredients
      • Properties
        • PassioFoodItem
        • PassioFoodDataInfo
        • PassioFoodAmount
        • PassioIngredient
        • PassioNutrients
        • UnitMass
        • ServingUnit
        • ServingSize
        • PassioSearchResult
        • NutritionFacts
        • PassioNutritionPreview
        • PassioSpeechRecognitionModel
        • PassioLogAction
        • PassioAdvisorFoodInfo
        • FoodCandidates
        • FoodDetectionEvent
        • NutritionDetectionEvent
        • DetectedCandidate
        • BarcodeCandidate
        • PackagedFoodCode
        • AmountEstimate
        • ImagesInfo
        • PassioStatus
        • FoodDetectionEvent
        • NutritionFacts
        • PassioMealPlan
        • PassioMealPlanItem
      • Nutriton Advisor
        • initConversation
        • sendMessage
        • sendImage
        • Guide
          • useNutritionAdvisor
        • Properties
          • PassioAdvisorResponse
          • PassioAdvisorMessageResultStatus
          • PassioAdvisorResultStatus
      • Quick Start Guide
        • Installation
        • Configure the SDK
        • RecognizeImageRemote
        • Food Detail
      • Guide
        • Integrate SDK Setup
        • Integrate Quick Scan
        • Integrate Food Search
        • Integrate Food Editor with Recipe
        • Integrate MealPlan
        • Integrate Suggestions
        • Integrate recognizeImageRemote
      • Components
        • DetectionCameraView
        • PassioIconView
      • Changelog
      • More
        • Display Macro Chart
          • MockFood
          • Utils PassioNutrient
        • Display Micro Progress
        • Getting nutrition value for a FoodItem
        • Getting nutrition value for a Recipe
        • Recalculate the nutrition value based on serving size options.
      • Migrations
        • Migrating from SDK 2.X to version 3.X
        • Structure Migrations From SDK 3.X to SDK 2.X
        • [Deprecated] Migrating from SDK 1.X to version 2.X
        • [Deprecated] Getting Started (v1)
          • Installation
          • SDK Initialization and Configuration
          • Start food detection
          • FoodDetectionEvent
          • Nutritional Database
      • Troubleshooting on RN
      • V2
        • Getting Started
          • Installation
          • SDK Initialization and Configuration
          • Start food detection
          • FoodDetectionEvent
        • RN SDK API
          • Properties
            • PersonalizedAlternative
            • FoodSearchResult
            • PassioNutrient
            • FoodDetectionEvent
            • DownloadModelCallBack
            • UPCProduct
            • ServingUnit
            • PassioStatus
            • PassioIDAttributes
            • PassioIDEntityType
            • PassioFoodItem
            • PassioRecipe
            • ServingSize
            • Measurement
            • UnitMass
            • NutritionFacts
        • Food Image
        • Search Food Item
        • Quick Scan
        • Multi Scan
        • MealPlan
        • Recipe
      • How do I Integrate a Passio SDK in EXPO?
    • Flutter SDK Docs
      • Getting Started
    • Before You Continue
    • Setup For Android
    • Initialize and configure the SDK
  • Fundamentals
    • Nutrition-AI Developer FAQ
      • Nutrition Data
      • Supported Phones
      • Security
      • Testing Volume Estimation
      • Testing Nutrition-AI SDK
      • Nutrition-AI Test Methodology
    • Nutrition API - Mobile SDK interoperability
      • JSON Response parsing
  • Versions
    • 3.2.4
      • SDK Key and minimum requirements
      • Installation
      • Configure the SDK
      • Use Cases
        • Food recognition
        • Nutrition data
        • Barcode scanning
        • Nutrition Facts scanning
        • Search, Food Icons, RefCode
        • Speech recognition
        • Nutrition Advisor
        • Suggestions and Meal Plans
        • User created foods and reports
    • 3.2.2
      • SDK Key and minimum requirements
      • Installation
      • Configure the SDK
      • Use Cases
        • Food recognition
        • Nutrition data
        • Barcode scanning
        • Nutrition Facts scanning
        • Search, Food Icons, RefCode
        • Speech recognition
        • Nutrition Advisor
        • Suggestions and Meal Plans
        • User created foods and reports
    • 3.2.0
      • SDK Key and minimum requirements
      • Installation
      • Configure the SDK
      • Use Cases
        • Food recognition
        • Nutrition data
        • Barcode scanning
        • Nutrition Facts scanning
        • Search, Food Icons, RefCode
        • Speech recognition
        • Nutrition Advisor
        • Suggestions and Meal Plans
    • 3.1.4
      • SDK Key and minimum requirements
      • Installation
      • Configure the SDK
      • Use Cases
        • Food recognition
        • Nutrition data
        • Barcode scanning
        • Search, Food Icons, RefCode
        • Speech recognition
        • Nutrition Advisor
        • Suggestions and Meal Plans
Powered by GitBook
On this page
Export as PDF
  1. Guides
  2. React Native SDK Docs
  3. Migrations
  4. [Deprecated] Getting Started (v1)

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.

The most detailed information can be found in the PassioIDAttributes object. To retrieve this object from a given PassioID or name or barcode or ocrCode and searchQuery.

/**
     * Look up the nutrition attributes for a given Passio ID.
     * @param passioID - The Passio ID for the attributes query.
     * @returns A `Promise` resolving to a `PassioIDAttributes` object if the
     *   record exists in the database or `null` if not.
     */
    getAttributesForPassioID(passioID: PassioID): Promise<PassioIDAttributes | null>;
    /**
     * Look up the nutrition attributes for the given name of a food item. This is
     * most often used with a string received from the `searchForFood` function.
     * @param name - The name of the item you'd like to query.
     * @returns A `Promise` resolving to a `PassioIDAttributes` object if the
     *   record exists in the database or `null` if not.
     */
    getAttributesForName(name: string): Promise<PassioIDAttributes | null>;
    /**
     * Query Passio's UPC web service for nutrition attributes of a given barcode.
     * @param barcode - The barcode value for the attributes query, typically
     * taken from a scanned `BarcodeCandidate`.
     * @returns A `Promise` resolving to a `PassioIDAttributes` object if the
     *   record exists in the database or `null` if not.
     */
    fetchAttributesForBarcode(barcode: Barcode): Promise<PassioIDAttributes | null>;
    /**
     * Query Passio's web service for nutrition attributes given an OCR identifier.
     * @param ocrCode - The OCR identifier for the attributes query, taken from
     *   the list of OCR candidates on a `FoodDetectionEvent`.
     * @returns A `Promise` resolving to a `PassioIDAttributes` object if the
     *   record exists in the database or `null` if not.
     */
    fetchAttributesForOCR(ocrCode: OCRCode): Promise<PassioIDAttributes | null>;
    /**
     * Search the local database of foods with a given search term.
     * @param searchQuery - The search term to match against food item names.
     * @returns A `Promise` resolving to an array of food item names.
     */
    searchForFood(searchQuery: string): Promise<string[]>;
    convertUPCProductToAttributes(product: UPCProduct, entityType: PassioIDEntityType): Promise<PassioIDAttributes | null>;

PassioIDAttributes: Information associated with an item in the nutritional database. Check the entityType field to determine the type of the item.

    export interface PassioIDAttributes {
    /**
     * The ID of the item in the database
     */
    passioID: PassioID;
    /**
     * The name of the item
     */
    name: string;
    /**
     * The name of the image for this item. Provide this value to a `PassioIconView`
     * in order to display the image.
     */
    imageName: string;
    /**
     * The entity type of the item
     */
    entityType: PassioIDEntityType;
    /**
     * The nutritional data for this item in the database
     */
    foodItem?: PassioFoodItem;
    /**
     * The recipe data for this item in the database
     */
    recipe?: PassioRecipe;
    /**
     * Related items above this item in the food heirarchy (more generic)
     */
    parents: PassioAlternative[];
    /**
     * Related items below this item in the food heirarchy (more specific)
     */
    children: PassioAlternative[];
    /**
     * Related items at the same level as this item in the food heirarchy
     */
    siblings: PassioAlternative[];
}

PassioFoodItem: Nutritional information for an item in the food database

export interface PassioFoodItem {
    /**
     * The ID of the item in the database
     */
    passioID: PassioID;
    /**
     * The name of the item
     */
    name: string;
    /**
     * The name of the image for this item. Provide this value to a `PassioIconView`
     * in order to display the image.
     */
    imageName: string;
    /**
     * The default serving quantity
     */
    selectedQuantity: number;
    /**
     * The default serving unit
     */
    selectedUnit: string;
    /**
     * The entity type of the item
     */
    entityType: PassioIDEntityType;
    /**
     * The serving units available for this recipe
     */
    servingUnits: ServingUnit[];
    /**
     * The serving sizes available for this recipe
     */
    servingSizes: ServingSize[];
    /**
     * The mass of the serving size, in grams
     */
    computedWeight: Measurement;
    /**
     * Related items above this item in the food heirarchy (more generic)
     */
    parents?: PassioAlternative[];
    /**
     * Related items below this item in the food heirarchy (more specific)
     */
    children?: PassioAlternative[];
    /**
     * Related items at the same level as this item in the food heirarchy
     */
    siblings?: PassioAlternative[];
    /**
     * Calories, in kcal
     */
    calories?: number;
    /**
     * Carbohydrates, in grams
     */
    carbs?: number;
    /**
     * Fat, in grams
     */
    fat?: number;
    /**
     * Protein, in grams
     */
    protein?: number;
    /**
     * Saturated fat, in grams
     */
    saturatedFat?: number;
    /**
     * Transfat, in grams
     */
    transFat?: number;
    /**
     * Monounsaturated fat, in grams
     */
    monounsaturatedFat?: number;
    /**
     * Polyunsaturated fat, in grams
     */
    polyunsaturatedFat?: number;
    /**
     * Cholesterol, in milligrams
     */
    cholesterol?: number;
    /**
     * Sodium, in milligrams
     */
    sodium?: number;
    /**
     * Dietary fiber, in grams
     */
    fiber?: number;
    /**
     * Total sugars, in grams
     */
    sugar?: number;
    /**
     * Added sugar, in grams
     */
    sugarAdded?: number;
    /**
     * Vitamin D, in milligrams
     */
    vitaminD?: number;
    /**
     * Calcium, in milligrams
     */
    calcium?: number;
    /**
     * Iron, in milligrams
     */
    iron?: number;
    /**
     * Potassium, in milligrams
     */
    potassium?: number;
    /**
     * Vitamin A, in IU
     */
    vitaminA?: number;
    /**
     * Vitamin C, in milligrams
     */
    vitaminC?: number;
    /**
     * Alcohol, in grams
     */
    alcohol?: number;
    /**
     * Sugar alcohol, in grams
     */
    sugarAlcohol?: number;
    /**
     * Vitamin B12, in micrograms
     */
    vitaminB12?: number;
    /**
     * Added Vitamin B12, in micrograms
     */
    vitaminB12Added?: number;
    /**
     * Vitamin B6, in milligrams
     */
    vitaminB6?: number;
    /**
     * Vitamin E, in milligrams
     */
    vitaminE?: number;
    /**
     * Added Vitamin E, in milligrams
     */
    vitaminEAdded?: number;
    /**
     * Magnesium, in milligrams
     */
    magnesium?: number;
    /**
     * Phosphorus, in milligrams
     */
    phosphorus?: number;
    /**
     * Iodine, in micrograms
     */
    iodine?: number;
    /**
     * The ingredients listed on the product packaging, if any
     */
    ingredientsDescription?: string;
    /**
     * The UPC code for this food product, if available
     */
    barcode?: string;
}

PassioRecipe

export interface PassioRecipe {
    /**
     * The ID of the recipe in the database
     */
    passioID: PassioID;
    /**
     * The name of the recipe
     */
    name: string;
    /**
     * The name of the image for this recipe. Provide this value to a
     * `PassioIconView` in order to display the image.
     */
    imageName: string;
    /**
     * The serving sizes available for this recipe
     */
    servingSizes: ServingSize[];
    /**
     * The serving units available for this recipe
     */
    servingUnits: ServingUnit[];
    /**
     * The default serving unit
     */
    selectedUnit: string;
    /**
     * The default serving quantity
     */
    selectedQuantity: number;
    /**
     * The food items in this recipe
     */
    foodItems: PassioFoodItem[];
}

If at any point you need help from the Passio team, please reach out to us at support@passiolife.com

PreviousFoodDetectionEventNextTroubleshooting on RN

Last updated 1 year ago