Validating tracked versus manual fitness activities using the Health Graph API

One question we receive fairly often from Health Graph (@healthgraphapi) partners is how to validate that fitness activities (runs, walks, bike rides, etc.) read out of the Health Graph platform were GPS-tracked versus manually entered by the user. Rewards partners a la Earndit and GymPact, corporate wellness providers like Virgin HealthMiles, and forward-thinking brands are often keen to differentiate between tracked versus manually entered activities as part of their programs’ anti-fraud efforts.

So how do you tell the difference between GPS and manual activities?

Each item in the Fitness Activity feed has ‘source‘, ‘entry_mode‘, and ‘has_path‘ fields. These let you determine whether the activity was originally submitted as a GPS-tracked activity. For example, a RunKeeper (@runkeeper) mobile app GPS-tracked run should have values of “RunKeeper“, “API“, and “true” for the aforementioned fields, respectively.

Health Graph fitness activity documentation

If you are interested in including GPS-tracked sources from other Health Graph partners’ activity trackers, you can include them in your ‘source‘ filtering. In addition, if you need to differentiate by type of activity (i.e. running, walking, cycling, etc.) you can use the ‘type‘ field.

Using these fields should let you skip any activities for which the user simply entered statistics, or originally entered the route map (path) via the Web. For more details on these fields and their usage, please refer to the Health Graph fitness activities documentation, especially the array structures section.

Caveat: The only reliable way to verify whether a user has subsequently edited the map associated with a saved GPS-tracked activity is to manually check each point’s ‘type‘ (a value of “manual” means it has been edited). For efficiency’s sake, we don’t save that information anywhere else in the Health Graph platform and we retrieve points only when full data for the activity is requested. That said, we have found that most users do not edit maps after the fact.

Bill Day (@billday) is Platform Evangelist & PM for RunKeeper where he helps developers learn about and use the Health Graph.


Sleepy brings Health Graph sleep tracking to Android

Italian developer Massimiliano Fanciulli (@fanciulli) is building his Sleepy Android app on top of the Health Graph (@healthgraphapi). Read our discussion below to learn more about this Health Graph partner and how he’s taking advantage of the Health Graph API to give people a free tool for tracking their sleep.

Bill Day: Please tell us about yourself and your work.

Massimiliano Fanciulli: I’m a Software Engineer and I work in Pisa, Italy, the city with the leaning tower. I like developing Android apps in my spare time and I’m the creator of the sleep tracking app Sleepy.

BD: What is the “elevator pitch” for why someone should use your app?

MF: Sleepy can be used to track your sleep cycle. I made it freely available and as simple to use as possible so that everyone could track their sleep easily.

BD: How did you get started using the Health Graph API?

MF: I started as a RunKeeper user. At first I simply needed to record physical activities and RunKeeper helped me track my running. It was very motivational. As soon as the Health Graph became available I started playing with it. Sleepy is my first app which uses it.

BD: Which portions of the Health Graph API do you use, and why?

MF: I use the Sleep and the Profile portions of the Health Graph API. I use them to store new data and display related data about the user.

BD: What do you like about the Health Graph? What would you like to see changed?

MF: The Health Graph is well structured and covers most of the data that describe your fitness and workouts. It is a powerful tool for building an app, letting you to focus on the logic and not on data storage and management.

I appreciate its attention to diabetic users. It would be great to have new portions of the Health Graph covering other physical aspects and conditions so that new applications could be built allowing users affected by other pathologies to track their workouts and optimize their health in the best way possible.

BD: If you could request any new feature from the Health Graph, what would it be? How would you use it?

MF: Callbacks and push messages should be added to the Health Graph so that apps can be notified by the platform when updates occurs. With these, for example, a developer could build an app which notifies you in case one of your friends starts a running workout near you. Very useful! [Editor’s note: The Health Graph does support a authorization removal callback today, but does not currently provide push notifications of the kind Massimiliano mentions.]

BD: Can you share any future plans for your app? What’s coming next that your users will be excited about? Does the Health Graph play a role in that, and if so, how?

MF: I’m receiving great feedback from the Sleepy Google+ page. People seem to be very interested in the app and they’re joining the page and contributing. I’ll continue to develop some of the features those users are requesting. For instance, I added support for manual posting of data in a recent Sleepy update.

Bill Day (@billday) is Platform Evangelist for RunKeeper where he helps developers learn about and use the Health Graph.