Changelog

3.1.1-3

  • Now retrieving added sugars nutrients

3.1.1-1

  • "Provide a message parameter to indicate the context of the image as optional for recognizeImageRemote

    recognizeImageRemote(
        imageUri: string,
        message?: string,
        resolution?: PassioImageResolution
      ): Promise<PassioAdvisorFoodInfo[] | null>
    

  • Stop the camera when the view is unmounted for Android

3.1.1

Added API

/**
   * fetch list of possible hidden ingredients for a given food name.
   * @param foodName - query for foodName.
   * @returns A `Promise` resolving to a `PassioFetchAdvisorInfoResult`.
   */
  fetchHiddenIngredients(
    foodName: string
  ): Promise<PassioFetchAdvisorInfoResult>

  /**
   * fetch list of possible visual alternatives for a given food name.
   * @param foodName - query for foodName.
   * @returns A `Promise` resolving to a `PassioFetchAdvisorInfoResult`.
   */
  fetchVisualAlternatives(
    foodName: string
  ): Promise<PassioFetchAdvisorInfoResult>

  /**
   * fetch list of possible ingredients if a more complex food for a given food name.
   * @param foodName - query for foodName.
   * @returns A `Promise` resolving to a `PassioFetchAdvisorInfoResult`.
   */
  fetchPossibleIngredients(
    foodName: string
  ): Promise<PassioFetchAdvisorInfoResult>
  • Added resolution: PassioImageResolution as a parameter of the recognizeImageRemote function. This enables the caller to set the target resolution of the image uploaded to the server. Smaller resolutions will result in faster response times, while higher resolutions should provide more accurate results.

export type PassioImageResolution = 'RES_512' | 'RES_1080' | 'FULL'
  recognizeImageRemote(
    imageUri: string,
    resolution?: PassioImageResolution
  ): Promise<PassioAdvisorFoodInfo[] | null>

3.1.0-3

  • Added volumeDetectionMode prop `DetectionCameraView`

 volumeDetectionMode?: 'auto' | 'dualWideCamera' | 'none'

Example:

   <DetectionCameraView
        style={styles.detectionCamera}
        volumeDetectionMode="auto"
      />

NOTE:

When using startNutritionFactsDetection, ensure that DetectionCameraView has volumeDetectionMode set to 'none.

3.1.0-1

Introduce NutritionAdvisor

/**
   * Configures the Nutrition Advisor with the provided license key.
   * @param licenseKey - The license key to configure the advisor.
   * @returns A Promise resolving to the status of the configuration.
   */
  configure(licenseKey: string): Promise<PassioAdvisorResultStatus | null>

  /**
   * Initiates a conversation with the Nutrition Advisor.
   * @returns A Promise resolving to the status of the conversation initiation.
   */
  initConversation(): Promise<PassioAdvisorResultStatus | null>

  /**
   * Sends a text message to the Nutrition Advisor.
   * @param message - The message to be sent.
   * @returns A Promise resolving to the status of the message sending.
   */
  sendMessage(message: string): Promise<PassioAdvisorMessageResultStatus | null>

  /**
   * Sends an image to the Nutrition Advisor.
   * @param imageURI - The local URI of the image to be sent.
   * @returns A Promise resolving to the status of the image sending.
   */
  sendImage(imageURI: string): Promise<PassioAdvisorMessageResultStatus | null>

  /**
   * Fetches ingredients from the Nutrition Advisor's response.
   * @param response - The response object from the Nutrition Advisor.
   * @returns A Promise resolving to the status of the ingredient fetching.
   */
  fetchIngredients(
    response: PassioAdvisorResponse
  ): Promise<PassioAdvisorMessageResultStatus | null>

How to use API?


import { NutritionAdvisor } from '@passiolife/nutritionai-react-native-sdk-v3'

const status = await NutritionAdvisor.configure(PASSIO_ADVISOR_KEY)

switch (status?.status) {
          case 'Success':
            return
          case 'Error':
            return
        }

// Send Message
await NutritionAdvisor.sendMessage(message)

//Send Image
await NutritionAdvisor.sendImage(imgUrl)

3.0.4

Introduce new API

  • Fetch PassioFoodItem for a v2 PassioID

  fetchFoodItemLegacy(passioID: PassioID): Promise<PassioFoodItem | null>
  • Use this method to fetch PassioAdvisorFoodInfo using Image

  recognizeImageRemote(imageUri: string): Promise<PassioAdvisorFoodInfo[] | null>
  • Use this method to fetch PassioSpeechRecognitionModel using speech

recognizeSpeechRemote(text: string): Promise<PassioSpeechRecognitionModel[] | null>
  • Use this function to detect Nutrition Facts via pointing the camera at Nutrition Facts

startNutritionFactsDetection(
    callback: (detection: NutritionDetectionEvent) => void
  ): Subscription

Refactor

Removed nutritionFact from startFoodDetection

3.0.3

  • Added weightUnit and weightQuantity into PassioNutritionPreview

  • Added refCode as a unique identifier of the food In PassioFoodItem and PassioIngredient

  • Added fetchFoodItemForRefCode API to get PassioFoodItem using refCode.

  /**
   * Look up the food item result for a given refCode.
   * @param refCode - The refCode for the  query.
   * @returns A `Promise` resolving to a `PassioFoodItem` object if the record exists in the database or `null` if not.
   */
  fetchFoodItemForRefCode(refCode: RefCode): Promise<PassioFoodItem | null>
  • Added two functions to fetch a list of meal plans and fetch a meal plan for a certain day.

/**
   * fetch list of all meal Plans
   * @returns A `Promise` resolving to a `PassioMealPlan` array if the record exists in the database or `null` if not.
   */
  fetchMealPlans(): Promise<PassioMealPlan[] | null>

  /**
   * fetch list of all meal Plan item
   * @param mealPlanLabel - query for type of mealPlan.
   * @param day - for which day meal plan is needed
   * @returns A `Promise` resolving to a `PassioMealPlanItem` array if the record exists in the database or `null` if not.
   */
  fetchMealPlanForDay(
    mealPlanLabel: string,
    day: number
  ): Promise<PassioMealPlanItem[] | null>

Refactor API

  • Now use fetchFoodItemForProductCode API instead of fetchAttributesForBarcode and fetchPassioIDAttributesForPackagedFood API.

  /**
   * Look up the food item result for a given by barcode or packagedFoodCode.
   * @param barcode  - barcode for the query.
   * or
   * @param packageFoodCode  - packageFoodCode for the query.
   * @returns A `Promise` resolving to a `PassioFoodItem` object if the record exists in the database or `null` if not.
   */
  fetchFoodItemForProductCode(
    code: Barcode | PackagedFoodCode
  ): Promise<PassioFoodItem | null>
  • getAttributesForPassioID renamed to fetchFoodItemForPassioID

  • fetchAttributesForBarcode and fetchPassioIDAttributesForPackagedFood renamed to fetchFoodItemForProductCode

  • PassioSearchResult object return PassioFoodDataInfo instead of FoodSearchResult

  • fetchSearchResult renamed to fetchFoodItemForDataInfo

  • PassioSearchNutritionPreview renamed to PassioNutritionPreview

  • Removed unnecessary nutrition data while log object of PassioFoodItem or PassioIngredient

3.0.2-3

  • Fix the isOpenFood boolean issue in android.

  • Introduce a new field openFoodLicense.

  • Rename method from fetchNutrientsForPassioFoodItem to getNutrientsOfPassioFoodItem

  • Rename method from fetchNutrientsSelectedSizeForPassioFoodItem to getNutrientsSelectedSizeOfPassioFoodItem

  • Rename method from fetchNutrientsReferenceForPassioFoodItem to getNutrientsReferenceOfPassioFoodItem

3.0.2-2

  • Fixed IOS weight gram value.

3.0.2-1

  • Fixed symbol unit for iOS.

  • Wide Angle camera issue resolved.

3.0.2

Added carbs , protein and fat in PassioSearchNutritionPreview

Added API

  /**
   * fetch a suggestions for particular meal time  'breakfast' | 'lunch' | 'dinner' | 'snack' and returning results.
   * @param mealTime - 'breakfast' | 'lunch' | 'dinner' | 'snack',
   * @returns A `Promise` resolving to a `PassioFoodItem` object if the record exists in the database or `null` if not.
   */
  fetchSuggestions(mealTime: MealTime): Promise<FoodSearchResult[] | null>

  /**
   * Detail of search food with a given search result.
   * @param result - Provide `PassioSearchResult` object get `PassioFoodItem` detail.
   * @returns A `Promise` resolving to `PassioFoodItem` detail.
   */
  fetchFoodItemForSuggestion(
    result: FoodSearchResult
  ): Promise<PassioFoodItem | null>

Added below nutrients in PassioNutrients

zinc, 
selenium, 
folicAcid, 
vitaminKPhylloquinone, 
vitaminKMenaquinone4, 
vitaminKDihydrophylloquinone, 
chromium

3.0.1-2

Deprecated API

getAttributesForPassioID(passioID: PassioID): Promise<PassioIDAttributes | null>

fetchAttributesForBarcode(barcode: Barcode): Promise<PassioIDAttributes | null>

fetchPassioIDAttributesForPackagedFood(packagedFoodCode: PackagedFoodCode): Promise<PassioIDAttributes | null>

fetchSearchResult(result: FoodSearchResult): Promise<PassioIDAttributes | null>

Refactored API

  • getAttributesForPassioID, fetchAttributesForBarcode, fetchPassioIDAttributesForPackagedFood now returns a PassioFoodItem result

getAttributesForPassioID(passioID: PassioID): Promise<PassioFoodItem | null>

fetchAttributesForBarcode(barcode: Barcode): Promise<PassioFoodItem | null>

fetchPassioIDAttributesForPackagedFood(packagedFoodCode: PackagedFoodCode): Promise<PassioFoodItem | null>
  • searchForFood now returns PassioSearchResult and a list of search options. The PassioSearchResult represent a specific food item associated with the search term, while search options provide a list of possible suggested search terms connected to the input term.

searchForFood(searchQuery: string): Promise<PassioSearchResult | null>
  • Now DetectedCandidate have alternatives and croppedImage


New API

  • fetchSearchResult returns a PassioFoodItem object for a given PassioSearchResult

fetchSearchResult(result: FoodSearchResult): Promise<PassioFoodItem | null>
  • To retrieve all macro and micronutrient values using PassioFoodItemNutrients by passing a passioFoodItem, you would typically follow these steps:

   new PassioFoodItemNutrients(passioFoodItem).nutrientsSelectedSize()
   new PassioFoodItemNutrients(passioFoodItem).nutrientsReference()
   new PassioFoodItemNutrients(passioFoodItem).nutrients({
      unit: calculatedWeightUnit,
      value: calculatedWeight,
    })

2.3.15-2

Fixed issue with number format exception on some locales

2.3.15

  • Added fetchNutrientsFor API.

/**
   * fetch a map of nutrients for a 100 grams of a specific food item
   * @param passioID - The Passio ID for the attributes query.
   * @returns A `Promise` resolving to a `PassioNutrient` object if the record exists in the database or `null` if not.
   */
  fetchNutrientsFor(passioID: PassioID): Promise<PassioNutrient[] | null>
export interface PassioNutrient {
  // The name of the nutrient.
  name: string

  // The amount of the nutrient, measured in a specific unit.
  amount?: number

  // The unit in which the nutrient amount is measured (e.g., grams, milligrams).
  unit: string

  // The inflammatory effect score associated with the nutrient.
  inflammatoryEffectScore?: number
}

Models

  • Number of food items recognized via HNN: 4104

  • Nutrition database version: passio_nutrition.4105.0.301

  • Number of products recognized via OCR: 27756

New included HNN foods

corn chowder

Excluded HNN foods

coconut sandwich cookies
mollete
strawberry cream cheese bagel

Last updated