Saturday, October 10, 2020

App HealthMate on Android Part 3 - Heart Rate, GPS, Steps


Okay, third part of my analysis.

The first part can be found at:

The second part can be found at:

Base folder of the app: /data/data/com.withings.wiscale2 

This post is about the heart rate, step and GPS data tracked. So the detailed data for an activity and actions of a user in general.

Heart Rate

This data can be found in the database Withings-WiScale, table vasistas.

In this table is a field category. If it has the value -16 it is heart rate data.

So I do the following select (w is an alias for the database):
And get the following result:
We already know the format of the timestamp. 
I currently can just guess the meaning of the filed duration. It could be the duration of the measurement in milliseconds. This would mean for the first line, 113 seconds heart rate measuring. But here is double checking necessary, this is only an assumption. 

I just tested the device a few days but I have 1701 HR measurements. Withings says in there technical description that they measure the heart rate every 15 minutes if no activity is actively tracked. 

The field deviceId holds the ID of the source device because it is possible to attach more than one device at the same time.


This data can be found in the database Withings-WiScale, table vasistas.

In this table is a field category. If it has the value 16 it is step data.

So I do the following select (w is an alias for the database):
And get the following result:
Note quite sure what the value in ascent/descent means because the value is quite high for meters. 
But, as you can see, I only do a few steps in 60 seconds. Perhaps I should get more active.


Okay, let's see what we can find about GPS data.
We already see something like coordinates when starting an activity and when ending but not the tracing of it.
This data can be found in the table WorkoutLocation, database room-healthmate.db .

Here you see latitude, longitude, timestamp, altitude etc.
This data is only generated when a GPS device is connected and activity tracking is activated. This means, the watch is connected to a smartphone with GPS activated or the watch itself has GPS and the user explicitly starts an exercise.
In the shown data the device ID is 0, this means GPS data come from the Smartphone. 


HealthMate stores a lot of useful data.
One can use this data and visualize it, see when a person was active (both just walking around or doing an exercise)  or slept. Correlated with the heart rate data it can be possible to say if person person has an irregular heart rate at a specific moment.
GPS is only available if the tracker has a built in GPS function or the device has been connected  to a smartphone and activity tracking for an exercise was activated. 
So, now I would like to visualize the data in a nice way... damn, more stuff to do.
Hope you head a nice read.

App HealthMate on Android Part 2 - Activities

Okay, second part of my analysis.

The first part can be found at:

Base folder of the app: /data/data/com.withings.wiscale2 

This post is about the activity data tracked by the app HealthMate. There will be a third part of my analysis where I will show what is tracked in detail about GPS and heart rate.

First of all, in the first part I only showed data extracted from the database Withings-WiScale in the folder databases. For this post I will also show data from the database room-healthmate.db in the same directory.


Activities - Overview

Activities can be e.g. Walking, Running, Cycling, Sleeping. Okay, Sleeping is a special case, but it is logged in the same location.
First the overview. What activities have been logged and the summary of them.

There are different overviews available.

1. Timeline

The timeline stores the information showed to the user in the app. It stores the user id, the type, the expiration date (and the resulting ttl) and the data itself in JSON-Format.

It is stored in the table timeline of the database Withings-WiScale.

You get different types of information out here. For example the aggregation of steps over the day or the heart rate aggregated for 24 hours.
Also you can see information about a new installed tracker or a new message. The entries will persist in the table after ttl. But I have not tested for how long in total they are stored.

Example content of the field data, here for the entry with id 5:

 2. Tracking

The second source for an overview is the table Track in the database room-healthmate.db.
It stores the data of every tracked activity. This can be manual triggered activities or automatic detected ones.
The following figure shows a few columns. The table has a lot more I will show a bit later.

Again a userId is stored so the activity can be linked to an account. We also have a startDate and endDate in Unix epoch UTC. The field dataJson holds the data of the activity. We will take a look at it in a second.
But I want to highlight two more fields:

 1. category - The number in this field give info what type of activity is tracked. 
              2 = Running
              1 = Walking
              6 = Cycling
        You can find these values in the table activityCategory, database Withings-WiScale

But two values I could not find there. Fortunately it is not so difficult to find out what they mean
                37 = Sleeping
              272 = Activity started on watch, together with an acitivity wiht the exact same startDate and                             endDate one knows that this activity was manually tracked

2. activityRecognitionVersion
This field has a value if the activity was automatically tracked. Except for "sleeping", this is always automatically tracked but the value is NULL.


Okay, let us take a look into the data for a sleeping activity. The one with id 5.
First the content of the field dataJson:
Than the fields startDate and endDate:
I formatted the content to a DateString, UTC.
As you can see it was a good night for me, about 7 hours and 46 mins of sleep.
My heart rate was at 72 in average. A bit high for me but okay.

I double checked the data, it seems to be correct.

There are other additional fields for sleeping in the database. But the most important data I have shown here.


What about the other activities? I will only show one, from the data structure they a similar.
I will show the one with id 2, the running activity.

First the content of the field dataJson:
 Than the fields startDate and endDate:
Okay, the data is from a run on 4th October. The deviceStartDate and deviceEndDate from the JSON is directly stored in the database fields startDate and endDate.
I did 5429 steps - 6479 km (estimated on the average length of a step), I did 136 seconds break (pauseDuration) because of red traffic lights. 643 seconds I was in peak zone, 1475 seconds in intense zone and 32 seconds in moderate zone. My maximum heart rate was 187, minimum 130 and average 164. 
This data is tracked if one manually starts the activity on the watch or the watch itself recognize an activity.          

Activity connected with Smartphone

 If the watch is connected to the Smartphone when tracking there are additional fields filled in the database (here for a walking activity):

This data is filled with the help of the GPS data from the Smartphone. 

A bit problematic is the value for the speed. 2.6 kph maxSpeed? A bit too slow. I think it is mph. 2.6 mph are about 4.8 kph. Seems more realistic. But I did not double check it.

Until now we only have data about activities, when they started and end and what average or total values were generated with this activity. Time to  find the detailed information. But, this I will show in the next post. You can find it here: