k0rventen / apple-health-grafana

Visualise your Apple Health export in Grafana
390 stars 28 forks source link

Numbers don't match. Example: steps count per day #7

Closed metawops closed 1 year ago

metawops commented 1 year ago

I just imported all my health data successfully. 😊

However, something seems to be not quite right with the numbers. 🤔

Here's a screenshot of the "steps per day" graph from the preset Grafana dashboard "Apple health specific metrics" where I added screenshots from the Fitness App that shows the steps data from three days.

Screenshot 2023-04-30 at 22 15 18

The steps curve in the Grafana dashboard always shows much higher values. – Why?

k0rventen commented 1 year ago

Hey, I think I figured it out.

For some metrics, both the iPhone and the watch are creating records at roughly the same time. That can lead to multiple entries for the same activity.

I guess Apple has some kind of logic for detecting such case, so they don't add up both informations. But I didn't, so for the number of steps, the number of km walked, both of your devices counts were added up, meaning around double the correct value.

I updated the ingester to differentiate multiple sources, and the dashboards can show this info as well. Here is an example where both my iPhone and watch are counting my steps, therefore the total was completely off.

Screenshot 2023-05-01 at 11 33 33

I tweaked the dashboards on the Apple health specific metrics dashboard to show the average value of all series, meaning you should have a more realistic graph now.

I just pushed ba60f8b; to update, git pull the repo to grab the new dashboard then docker compose down/docker compose pull/docker compose up !

metawops commented 1 year ago

Very interesting! Much better numbers now! 👍 The question remains, though, what number the Fitness app reports and how/if we can get that exact same number of steps for a day from Grafana ... 😳

k0rventen commented 1 year ago

I checked the numbers from my export, and it seems that for most of the walk/run/steps data, both the Health app and Fitness app is reporting data only from my watch. I guess the iPhone data is only used to fill the blanks when you're not wearing the watch ?

To produce the same results on Grafana, you can select only your watch as the "source" variable. That seems to give me the right amount of steps:

Screenshot 2023-05-01 at 13 13 25