Git Product home page Git Product logo

apple-health-grafana's Introduction

Apple Health Grafana

Tool to import your Apple Health Data in Influx and visualize them in Grafana.

metrics routes

Export your Apple health Data

From support.apple.com:

Share your health and fitness data in XML format

You can export all of your health and fitness data from Health in XML format, which is a common format for sharing data between apps.

    Tap your profile picture or initials at the top right.

    If you don’t see your profile picture or initials, tap Summary or Browse at the bottom of the screen, then scroll to the top of the screen.

    Tap Export all health data, then choose a method for sharing your data.

This will create a .zip file that can be shared from the iPhone via Airdrop, messages, mail and so on.

Once you've copied/shared the file to your computer, note the path of the file (can be something like /home/me/downloads/export.zip)

Launching the stack

You'll need docker and docker-compose installed.

Clone the repo:

git clone https://github.com/k0rventen/apple-health-grafana.git

Change the following line in the docker-compose.yml:

    volumes:
    - <local_path_to_export.zip>:/export.zip

by replacing the <local_path_to_export.zip> with your actual health data export file path from the previous step, eg /home/me/downloads/export.zip:

    volumes:
    - /home/me/downloads/export.zip:/export.zip

you can also use a relative path (assuming you are in the same directory as the compose file):

    volumes:
    - ./export.zip:/export.zip

Then simply run :

# download or upgrade the images (especially if you've already used the project)
docker-compose pull

# start grafana and influx in the background
docker-compose up -d grafana influx

# start our ingester
docker-compose up ingester

You should see some logs from the ingester container:

apple-health-grafana-ingester-1  | unzipping the export file..
apple-health-grafana-ingester-1  | export file unzipped
apple-health-grafana-ingester-1  | influx is ready
apple-health-grafana-ingester-1  | loading workout routes
apple-health-grafana-ingester-1  | opening Route 2022-01-16 4:19pm
...
apple-health-grafana-ingester-1  | inserted 1940000 records
apple-health-grafana-ingester-1  | Total number of records: 1942310
apple-health-grafana-ingester-1  | All done ! You can now check grafana.
apple-health-grafana-ingester-1 exited with code 0

Wait for a log saying that all the data have been imported.

Note: Depending on the amount of data the export has, it can take a few minutes to work through. As an example, loading nearly 3 years of data (2 millions+ data points, 200+ workout routes) on a 10th gen i5 took 2 minutes and around 11 minutes on a Raspberry Pi 4.

Visualization and next steps

Head to http://localhost:3000, and log in with the grafana creds from the compose file (defaults to admin:health).

You should see some graphs with metrics in them. 3 dashboards are created by default:

  • a generic one displaying every metric available,
  • a more refined one for specific metrics that are probably present , like walking distance, hearth related metrics..
  • a workout routes one, that shows a GPS map of your outdoor routes (walking/running/biking).

Tips on further analyzing the data

Some metrics can be displayed as is, but others might need tweaking in the influx request:

  • adjusting the time interval to 1d to group daily metrics.
  • using sum() instead of mean() to aggregate the metrics for a given interval.

apple-health-grafana's People

Contributors

k0rventen avatar zachschillaci27 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.