Imports Apple Health Data into InfluxDB
Python
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docker-compose
healthdata_influx
.dockerignore
.gitignore
Dockerfile
README.md
config_sample.yml
docker-compose.yml
requirements.txt

README.md

healthdata_influx

Imports Apple Health Data into InfluxDB.

Grafana Screenshot Visualizing InfluxDB using Grafana.

How to export iOS Health Data

  1. Go to the Health App
  2. Tap the profile image at the top right
  3. Tap "Export Health Data"
  4. Save the export.zip file and extract its XML contents (export.xml) somewhere accessible by this script.

Running as a complete service with Docker Compose (bonus Grafana Graphs!)

This is the easiest way to get up and running quickly. This will spin up the importer, an InfluxDB database, and Grafana with a default dashboard ready to go.

Requirements:

Installation:

  • Create a data directory at the project root and add the export.xml inside it

Building:

docker-compose build

Running:

  1. docker-compose up (add -d to run in daemon mode)
  2. Access Grafana in your web browser: http://localhost:3000

Username: admin Password: admin

Refreshing data:

  1. Replace data/export.yml with a new version
  2. docker-compose run importer

Running as a Python module or stand-alone script.

Requirements:

Installation:

  • pip install -r requirements.txt
  • Rename config_sample.yml to config.yml

Configuration:

  • Edit config.yml to match your InfluxDB settings (host, auth, etc.)

Usage:

  1. Export Health Data from iOS device
  2. python3 import.py export.xml

See also:

python import.py --help

Running as a stand-alone Docker container

Requirements:

Installation:

  • Create a data directory at the repo root and add the export.xml inside it.
    • (note that this can be anywhere if the volume mount point on the docker run command is changed)

Configuration:

  • Edit config.yml to match your InfluxDB settings (host, auth, etc.)

Building:

docker build . -t twstokes/healthdata_influx

Running (at the repo root):

docker run -v $PWD/data:/data:ro -v $PWD/config.yml:/app/config.yml:ro twstokes/healthdata_influx

Todo / Notes:

  • Does not support "Mindful Sessions"