User's Goals

Set user weight-related goals

Use the profileMacroGoalsSettings mutation to determine and set up a user's weight-related goals based on personal information such as weight, height, activity level, etc. Check this information to know which fields are used to calculate a user's caloric daily requirement.

The information is saved and read in the metric unit (kilograms, grams, meters, centimeters, etc). We DO NOT do unit conversions.

You are responsible for Unit Conversion. Make sure your units are correct.

Considerations to calculate your macros

Setup the goals

If goals are set as "on", those will be used. However, If they are not set or are "off" then for meal planning purposes, the meal plan will default to the program's pre-defined goal settings.

The following profile attributes relate to the goals' functionality and can be set directly on the user's profile.

If goals are on and the updateMealPlanSettings mutation is used, all the information will be overwritten.

Define your macro goals to lose weight

If the goal is to lose weight, your targetWeight have to be less than the currentWeight.

Check the following equation:

targetWeight<startingWeighttargetWeight < startingWeight

Then, define the rate to lose weight by choosing a weekly weight-related goal in the weeklyWeightGoalto add calories to the total daily expenditure.

Check this documentation to see the valid values to define for the weeklyWeightGoal

Example:

You will have the following macros:

  • currentWeight: 80kg

  • targetWeight: 60kg

  • weeklyWeightGoal: GOAL_1 (lose 0.5 kg)

This means that the user's goal is to lose 0.5 kg per week until the target weight is reached.

Define your macros goals to gain weight

If the goal is to gain weight, your targetWeight have to be greater than the currentWeight.

Check the following equation:

targetWeight>startingWeighttargetWeight > startingWeight

Then, define the rate to lose weight by choosing a weekly weight-related goal in the weeklyWeightGoalto add calories to the total daily expenditure.

Check this documentation to see the valid values to define for the weeklyWeightGoal

Example:

You will have the following macros:

  • currentWeight: 60kg

  • targetWeight: 80kg

  • weeklyWeightGoal: GOAL_1 (gain 0.5 kg)

This means that the user's goal is to gain 0.5 kg per week until the target weight is reached.

Available Arguments

Available Fields

The following field will be part of the response.

The following fields are the result of the macro goals calculation:

Example

mutation {
  profileMacroGoalsSettings(
    goalsOn: true
    biologicalSex: FEMALE
    birthdate: "1982-01-10"
    height: 158 
    startingWeight: 70
    targetWeight: 58
    weeklyWeightGoal: GOAL_4
    activityLevel: EXERCISE_2
  ) {
    success
    bmr
    bmi 
    tdee 
    cd
    dcig 
  }
}

Execute the myProfile query to check these goals configured.

{
  myProfile {
    id
    age
    birthdate
    biologicalSex
    activityLevel
    startingWeight
    customAttributes
    targetWeight
    height
    weeklyWeightGoal
    goalsOn
    programName
    language
    subscription{
      id
      createdAt
      name
    }
    restrictions {
      name
    }
    dailyCaloricIntakeGoal
		caloricDifference 
		totalDailyEnergyExpenditure
		basalMetabolicRate
		program {
		  databaseId,
		  name
      author
		}
  }
}

PHP Example

<?php

$token = 'TOKEN';
$user = 'USER';

$query = <<<'GQL'
mutation profileMacroGoalsSettings(
    $biologicalSex: BiologicalSex!
    $birthdate: Date!
    $height: Float!
    $startingWeight:Float!
    $targetWeight: Float!
    $weeklyWeightGoal: WeeklyWeightGoal!
    $activityLevel: ActivityLevel!
  ){
    profileMacroGoalsSettings(
      biologicalSex: $biologicalSex,
      birthdate: $birthdate,
      goalsOn: true,
      height: $height,
      startingWeight: $startingWeight,
      targetWeight: $targetWeight,
      weeklyWeightGoal: $weeklyWeightGoal,
      activityLevel: $activityLevel
    ) {
      success
      bmr
      bmi 
      tdee 
      cd
      dcig 
    }
  }
  
GQL;

$variables = array(
    'biologicalSex' => 'FEMALE',
    'birthdate' => '1983-04-09',
    'height' => 179.71,
    'startingWeight' => 83,
    'targetWeight' => 73,
    'weeklyWeightGoal' => 'GOAL_3',
    'activityLevel' => 'NOT_ACTIVE',
);

$json = json_encode(['query' => $query, 'variables' => $variables]);

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://production.suggestic.com/graphql',
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => $json,
    CURLOPT_HTTPHEADER => array(
        'Authorization: Token ' . $token,
        'sg-user: ' . $user,
        'Content-Type: application/json',
    ) ,
));

$response = curl_exec($curl);
$result = curl_close($curl);
echo $result;

Last updated