Health Data Service

Use the Health Data Service to get user data and generated metrics from the Point database.

User Data

Use getUserData() to retrieve basic information about your User.

async getUserData() {
    const user = await PointSDK.getUserData();
}

The User object also contains some information related to their health journey, like their Goal or SpecificGoal, the current GoalProgress, and their last Workout.

Currently, personal information such as name and email are not stored in any of our databases for privacy reasons.

Goals

Goals are used by the Health Data Service to know what is the main objective of your user while working out. This is used to generate recommendations and insights that help the user reach their objectives.

We highly recommend setting a goal. Not setting a goal will greatly decrease the number of insights generated.

Setting a User Goal

Call syncUserGoal(goal:) to set the user Goal.

async setUserGoal() {
    const result = await PointSDK.setUserGoal({ goal: Goal.AthleticPerformance });
}

Currently, the two options are Goal/athleticPerformance and Goal/weightLoss. You are free to use them as you wish, as long one of them is set for each user. You can hardcode the same goal for all users, present them as two options to choose from, or present a larger set of more specific goals that map to one of these two options. Your choice depends on your app's audience.

The SDK also provides a set of SpecificGoals (all values are only aliases to a Goal). Call syncUserSpecificGoal(specificGoal:) to set the user SpecificGoal. If you use the specific goals you don't need to call syncUserGoal.

async setUserSpecificGoal() {
    const result = await PointSDK.setUserSpecificGoal({ specificGoal: SpecificGoal.BuildLeanMuscle });
}

Checking the Goal Progress

You can also check their current GoalProgress, which are scores ranging from 0 to 1, generated by the Point Health Data Service. The goal progress is divided into four different scores: GoalProgress/overall, GoalProgress/endurance, GoalProgress/recovery and GoalProgress/strength.

async getUserData() {
    const user = await PointSDK.getUserData();
    console.log(user.goalProgress.overall.value)
    console.log(user.goalProgress.strength.value)
}

For more information about the goal scoring system, check Point Data Science Overview. Note that you can have your own ways of interpreting the scores and creating an overall score.

User Workouts

Retrieves a list of the User's last 16 Workouts, in descending order. The offset is meant to be used as a pagination, and if no value is passed, it is defaulted to 0.

async getUserWorkouts() {
    const workouts = await PointSDK.getUserWorkouts({ offset: 0 });
}

Retrieves a single Workout for the given id.

async getUserWorkoutById() {
    const workout = await PointSDK.getUserWorkoutById({ workoutId: 5793 });
}

Workout Rating

You can allow users to rate their past workouts. A workout rating is divided in "Difficulty", "Energy" and "Instructor" ratings. Each field can be rated from 1 to 5, defaulting to 0 if a value is not set.

async rateWorkout() {
    const ratings = { difficulty: 4, energy: 5, instructor: 3 }
    const result = await PointSDK.rateWorkout({ id: 5793, ratings });
}

We recommend you to rate a workout only once.

Daily History

Use getDailyHistory(offset) to retrieve a list of the User's last 16 days worth of DailyHistory, in descending order. The DailyHistory is composed of daily total calories, exertion rate and total workout duration.

async getUserDailyHistory() {
    const result = await PointSDK.getDailyHistory({ offset: 0 });
}

Tip: The offset is meant to be used as a pagination, and if no value is passed, it is defaulted to 0.

User Health Metrics

You can get a set of user health metrics, which are a summary of the collected samples. Check HealthMetric to know all kinds of health metrics available.

async getUserHealthMetrics() {
    const result = await PointSDK.getHealthMetrics({});
}

You can filter by type, workout or date.

Insights

As your user goes through their health journey, Point automatically generates actionable health insights that will help your users achieve maximal health and wellness. These insights can be wrapped in custom copy text, so you can recommend helpful actions for them to take in your product or platform, using Point's real-time health intelligence system.

You can get the list of generated Insights using getInsights(types:from:to:offset:). You must provide a list of InsightType. You can also filter the results based on a date interval using the from and to parameters.

Important: The result is limited to 16 insights. You can use the offset parameter for pagination. If not provided, it defaults to 0.

  async getInsights() {
    const result = await PointSDK.getInsights({ types: [InsightType.UsualWorkoutTime]});
  }

To check the insight's content, you will need to parse Insight/additionalFields as a JSON. The JSON keys changes for each insight type. For example, the insight type InsightType/exertionOptimalPm has the keys change and pct_change, while type InsightType/mostEfficientWorkoutType has the keys workout_type and avg_value.

Tip: You can find detailed information about Insights here, including all JSON keys for each type (refer to the 'Metadata' column in each table).

Workout Recommendations

Retrieves a list of WorkoutRecommendation. Workout recommendations are generated weekly on the Point database, based in the user goal. The date parameter defines which week you will get recommendations from.

async getWorkoutRecommendations() {
    const result = await PointSDK.getWorkoutRecommendations({ date: new Date().toISOString() });
}

Tip: Use the current date to get recommendations from the current week.

Saving a Workout Recommendation

You can use HealthDataService/saveWorkoutRecommendation(id:) to let your user choose which workout recommendations they wish to accomplish. By saving it, Point is able to check if the user accomplished this recommendation and use this information to improve the next recommendations given to this user.

async saveWorkoutRecommendation(workoutRecommendation: WorkoutRecommendation) {
   const result = await PointSDK.saveWorkoutRecommendation({id: workoutRecommendation.id});
}

Download our App

Download the app on App Store

Connect with Us

Terms & Conditions | Privacy Policy © 2022 Point® (Key Point Technologies, Inc.)