Skip to main content

A library to parse, wrangle and plot Apple Health data.

Project description

ipyhealth

https://img.shields.io/pypi/v/ipyhealth.svg https://github.com/mereldawu/ipyhealth/workflows/ipyhealth%20package/badge.svg Documentation Status

ipyhealth is a Python3 library to parse, wrangle and plot Apple Health data from all Apple devices.

ipyhealth makes it easy for developers to obtain the Apple Health data, saved as four pandas dataframes:

  1. Samples: data that is recorded at a specific time, including HKQuantitySample (height, heart rate, energy consumed, etc.), HKCategorySample (user in bed, asleep, or awake) and HKCorrelation (food and blood pressure).

  2. Workouts: dataframe containing type (Walk, Run, Hike, Yoga, etc.), duration, energy burned and distance of a recorded workout.

  3. Activity Summary: dataframe containing the move, exercise and stand data for a given day.

  4. Routes: dataframe containing the location of the route file (.gpx file exported), the latitude, lonitude and elevation at different points of the route.

© ipyhealth contributors 2020 (see AUTHORS) under the MIT license.

Installation

Install using pip with:

pip install ipyhealth

Or install from Github using:

pip install git+https://github.com/mereldawu/ipyhealth.git

Usage

from ipyhealth.parser import AppleHealthParser

health_data = AppleHealthParser(
      in_file = '/location/to/apple_health_export',
      from_date = None, # date to start parsing, i.e. datetime(2020, 5, 1)
      verbose = True, # print extract progress and success status, i.e. True/False
      nprocs = 4 # number of CPUs to use
)

type(health_data.records) # pd.DataFrame
type(health_data.workouts) # pd.DataFrame
type(health_data.activities) #pd.DataFrame
type(health_data.routes) #pd.DataFrame

To export Apple Health data

Download and extract the Apple Health data to a desired location:

  1. On your iPhone, open Health App.

  2. Click on your avatar > Scroll to the bottom > Export all health data (this takes some time).

  3. Select Save to Files (this is only available for iOS 13 and above, for lower verions of iOS save at a location where you can read it).

  4. Unzip the export.zip folder, which contains apple_health_export folder:

apple_health_export
├── export.xml (the main file that is parsed)
├── export_cda.xml (the Clinical Document Architecture file is not used)
├── workout_routes
├── route_{timestamp}.gpx (the GPS data for the associated workout)
├──route_{timestamp}.gpx (these contain the location information)

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2020-05-14)

  • First release on PyPI.

0.1.1 (2020-05-14)

  • Add readthedocs

  • Add badges on build and docs

0.1.2 (2020-05-14)

  • Fix typo

  • Update example to include other usages

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipyhealth-0.1.2.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ipyhealth-0.1.2-py2.py3-none-any.whl (11.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file ipyhealth-0.1.2.tar.gz.

File metadata

  • Download URL: ipyhealth-0.1.2.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7

File hashes

Hashes for ipyhealth-0.1.2.tar.gz
Algorithm Hash digest
SHA256 56b3f2bfdcf0681495181bbabd5e06db9e13ae607ebb34e675272e8fabc475d3
MD5 94350507eb0059a526dc1765598b19b8
BLAKE2b-256 a12e472d3bdabbbe0db6746c2e09599f7344ec90399c938de2012e49cfd139a0

See more details on using hashes here.

File details

Details for the file ipyhealth-0.1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: ipyhealth-0.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7

File hashes

Hashes for ipyhealth-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f872d8dc06b7b380824521f5e77e069eefa43713924fe2778c19cb690a2063e5
MD5 520a564a29e583c01a6e2c90e5368ddc
BLAKE2b-256 7e813d090cc9e0fcca8c9f4aeb38df3b5b00c2d480129a1221be0429760fe5c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page