Read Apple Watch Data¶
Extracting Apple Watch Health Data
-
class
AppleWatchLib.read_apple_watch_data.AppleWatchData(xml_data_file_path, source_name, tag_name='Record')¶ Bases:
objectObject to contain all relevant data access calls for Apple Watch health data.
-
load_basal_energy_data()¶ Returns: data frame of basal kilocalories burned and respective timestamps
-
load_distance_data()¶ Returns: data frame of miles walked/ran and respective timestamps
-
load_heart_rate_data()¶ Returns: data frame of instantaneous beats per minute and respective time stamps
-
load_heart_rate_variability_data()¶ Returns: data frame of average standard deviation of NN (beat-to-beat) intervals and instantaneous heart rate measures (BPM) used to derive this estimate
-
load_resting_heart_rate_data()¶ Returns: data frame of average resting heart rate (BPM) per diem
-
load_stand_hour_data()¶ Returns: data frame of stand hour labels (i.e. stood vs idle) per hour
-
load_step_data()¶ Returns: data frame of step data and respective timestamps
-
load_walking_heart_rate_data()¶ Returns: data frame of average walking heart rate (BPM) per diem
-
parse_record(record)¶ For a given record pull and start timestamp, end timestamp, and health data value.
Parameters: record – xml object with tag name of Record Returns: Record’s start timestamp, end timestamp, and biometric data
-
parse_record_list(record_list)¶ Generate array of timestamps and data values returned by multiple records.
Parameters: record_list – list of xml objects with tag name Record Returns: array of timestamps and data values returned by parse_record()
-
parse_tag(attribute)¶ Filter for records in Health Data matching attribute name.
Parameters: attribute – attribute name of xml Record tag Returns: a list of all records matching class’s source name and attribute name
-
Plot Apple Watch Data¶
Visualizing Apple Watch Health Data w/ Bokeh
-
AppleWatchLib.plot_apple_watch_data.plot_basal_energy(apple_watch)¶ Generate grid heat map of basal Calories burned for a given hour and date, grouped by start timestamp.
Parameters: apple_watch – instance of apple watch data object Returns: None
-
AppleWatchLib.plot_apple_watch_data.plot_distance(apple_watch)¶ Generate grid heat map of miles walked or ran for a given hour and date, grouped by start timestamp.
Parameters: apple_watch – instance of apple watch data object Returns: None
-
AppleWatchLib.plot_apple_watch_data.plot_heart_rate(apple_watch)¶ Superpostion multiple time series plots of heart data
Parameters: apple_watch – data frame of heart rate data Returns: None
-
AppleWatchLib.plot_apple_watch_data.plot_heart_rate_variability(apple_watch)¶ Generate swarm-like plots of heart rate variability measures for multiple days
Parameters: apple_watch – data frame of heart rate variability data Returns: None
-
AppleWatchLib.plot_apple_watch_data.plot_resting_heart_rate(apple_watch)¶ Generate simple time series plot of resting heart rate
Parameters: apple_watch – data frame of daily resting heart rate estimates Returns: None
-
AppleWatchLib.plot_apple_watch_data.plot_stand_hour(apple_watch)¶ Generate grid heat map of stand hour labels for a given hour and date, grouped by start timestamp.
Parameters: apple_watch – instance of apple watch data object Returns: None
-
AppleWatchLib.plot_apple_watch_data.plot_steps(apple_watch)¶ Generate grid heat map of step counts for a given hour and date, grouped by start timestamp.
Parameters: apple_watch – instance of apple watch data object Returns: None
-
AppleWatchLib.plot_apple_watch_data.plot_walking_heart_rate(apple_watch)¶ Generate simple time series plot of walking heart rate
Parameters: apple_watch – data frame of daily walking heart rate estimates Returns: None
-
AppleWatchLib.plot_apple_watch_data.run(apple_watch, start_date, end_date, show_plots)¶
-
AppleWatchLib.plot_apple_watch_data.save_plot(plot, title)¶ Saves plot in local directory as file_name
Parameters: - plot – bokeh plot object
- title – file name for plot
Returns: None