Food Log Guide

A general guide on how to do food logging with the Suggestic API

A log or logbook is a record of important information and it's comprised of a series of entries associated with a date and time. In the same way, a food log is a series of log entries that represent the consumption of different types of foods.

It is important to understand that an entry in the food log doesn't represent the food itself but represents an "event" of food being consumed. As such, it must include at least the following elements: date, time, food that was consumed, and the consumed quantity.

To add a new entry in the food log, for all cases, the createMealLog mutation should be used.

Understanding meal types (mealType)

The first step to a successful implementation of food logging with the Suggestic API is understanding the different types of "loggable" objects defined under the concept of a mealType

mealType

Description

RECIPE

USDA_MEAL

A meal or food from the USDA database

MENU_ITEM

A restaurant menu item

OWN_RECIPE

A recipe or meal created by the user

OWN_ITEM

An individual food added/created by the user

Since each mealType is fundamentally different, the logging of each of these items will require a different set of parameters.

Logging Recipes

To log a RECIPE you should use the createMealLog mutation, making sure you use the correct mealType. In this case, the mealType would be RECIPE.

Please note that you'll be using the quantity and customServingEquivalent fields and not the serving field.

Example

mutation {
    createMealLog(
        mealType: RECIPE,
        mealTime: DINNER,
        mealDatabaseId: "a281aa17-e746-4780-b69b-b4c3597bb783",
        customServingEquivalent: 122.53701305389404,
        date: "2020-04-02",
        quantity: 1,
        time: "20:00"
    ) {
        success
        databaseId
    }
}

Logging USDA Items

To log a USDA_MEAL you should use the createMealLog mutation, making sure you use the correct mealType.

Please note that you'll be using the serving field, not the customServingEquivalent field.

Logging Menu Items

To log a MENU_ITEM you should use the createMealLog mutation, making sure you use the correct mealType.

Logging "Own Recipes"

To log an OWN_RECIPE you should use the createMealLog mutation, making sure you use the correct mealType.

Logging "Own Items"

To log an OWN_ITEM you should use the createMealLog mutation, making sure you use the correct mealType.

Last updated