- Create an interactive dashboard to visualize running data alongside other health metrics, and be able to do some exploratory data analysis with personal health data.
- Extract health data from exported Apple Health (XML) file and store them on a local database.
- Use Plotly Dash to generate a dashboard.
- Time series plots across one year, binned weekly and monthly.
- Total Distance (sum)
- Total Duration (sum)
- Total Energy Burned (mean)
- Total Elevation Ascended (mean)
- Avg. Pace
- Avg. VO2Max (if available)
- Avg. Weight (labeled as 'BodyMass')
- Avg. METs
- Avg. Resting Heart Rate
- Avg. Heart Rate Variability SDNN
- Avg. Respiratory Rate
- Avg. Blood Pressure Diastolic
- Avg. Blood Pressure Systolic
- Avg. Menstrual Flow
- Total distance run per day across one week.
- Histograms (number of runs across a year/years) and a line plot of their associated avg. distance per run.
- Day of the Week
- Hour of run start time
- Total run distance
- Daily total distance, duration, avg METs
- Various running/health metrics against temperature and humidity (for days with outdoor runs).
- Clone this repository under your chosen directory
git clone https://github.com/nadinetab/runnersdash.git
- Navigate to the project directory and install dependencies
pip install -r requirements.txt
Relevant file(s): exporthealthdata.py
-
Under the Health app settings (click on your profile picture), there will be a link to 'Export All Health Data'. This will download the file
export.zipto your device. -
Move this file to the same directory you cloned this repository to and open it to extract. This will create a new folder called
apple_health_exportwhere all your health data reside. -
To run
exporthealthdata.py:-
If you want to extract all entries within export.xml:
$ python exporthealthdata.py -
If you already have a database (.db) file of a previous export and just need to add new entries since the last export:
$ python exporthealthdata.py --appendassuming there is an existing db file within the
data/subdirectory.
-
```
python exporthealthdata.py [-o --open-file </path/to/export.xml>]
[-a --append] [-v --version]
[-w --workouts] [-r --records]
OPTIONAL ARGUMENTS:
-o --open-export </path/to/export.xml> :
Determine export.xml file to read.
-a --append (bool) :
If passed in, script will find the latest version of a db file within the 'data/' subdirectory and append to the database any data with 'startDate' >= latest export date of the .db file. For use if you have previous exports already stored in a database and just need to add new data entries since your last export.
Default is --no-append.
-v --version (bool) :
If true, the version number of extractapplehealth.py is appended to the name of the resulting database .db file.
Default is --no-version.
-w --workouts <list of Workout names> :
List (space-separated) of table names (as it appears) in the database file of type Workout to process.
Default: Running
Note: Tables that are not listed in the default list have not yet been implemented within the data processing routines.
Example Workout tables:
- Running
- Barre
- Flexibility
- Walking
- Other
- Skiing
-r --records <list of Record names> :
List (space-separated) of table names of type Record to process.
Default:
MenstrualFlow RestingHeartRate VO2Max BodyMass HeartRateVariabilitySDNN StepCount RespiratoryRate BloodPressureDiastolic BloodPressureSystolic
Note: Tables that are not listed in the default list have not yet been implemented within the data processing routines.
Example Record tables:
- HeartRateVariabilitySDNN
- VO2Max
- StepCount
```
This step will produce the following things within data/ subdirectory:
- A database (.db file) containing data from export.xml organized and stored into tables.
- A set of five CSV files, containing daily/weekly/monthly aggregates as well as resampled running data, given default arguments for
--workoutsand--recordsparameters.
Related file(s): app.py
Launch the Dash app with the following:
python app.py
All health data is stored locally (and remains local).
- 'Sandbox' page with customizeable and extensive graph options and all available metrics to plot.
- Compatibility with Google Fit and Samsung Health datasets?
- A heatmap-view page, with calendar days on the y-axis and months of the year on the x-axis. Each cell represents that day's data. Clicking on the cell will produce visualization of that day's (assuming there is only one run/day) route and other run details (temp, humidity, plots of heart rate during run, etc.).
