health_tracking package

Submodules

health_tracking.constants module

health_tracking.workouts module

class health_tracking.workouts.Workouts(zip_dump_path: str = '../data/raw/export.zip', unzip_path: str = '../data/interim/apple_health_export', force_unzip: bool = False)[source]

Bases: object

Parse and gives access to Workout data of a Apple Health App dump data. Provides plotting functionalities.

Parameters:
  • zip_dump_path (str, optional) – Path to the zipped data dump. Defaults to constants.ZIP_PATH.
  • unzip_path (str, optional) – Path to the unzipped data dump. Defaults to constants.UNZIP_PATH.
  • force_unzip (bool, optional) – Flag to force unzipping the data again. Can be useful for new data. Defaults to False.
plot(x: str, y: str, plot_type: str, workout_type: str = 'runnings', outlier: (<class 'int'>, <class 'int'>) = None, z: str = None, kind: str = 'reg', xlim: (<class 'int'>, <class 'int'>) = 0.01, show_new_years: bool = True, legend: str = 'brief')[source]
health_tracking.workouts.calc_minutes_per_km(row: pandas.core.frame.DataFrame) → pandas.core.series.Series[source]

Helper function that calculates the pace as minutes per kilometer. Apply via: data_frame.applyc(alc_minutes_per_km, axis=1).

Parameters:row (pd.DataFrame) – Row of workouts pd.DataFrame as pd.Series
Returns:New column for workflow DataFrame
Return type:pd.Series
health_tracking.workouts.get_new_years_offsets(workout_data_frame: pandas.core.frame.DataFrame) → list[source]

Helper function that computes the offsets for new years since the first workout, in days.

Parameters:workout_data_frame (pd.DataFrame) – Workouts pd.DataFrame
Returns:elements are the offsets for new years in days
Return type:list

Module contents

class health_tracking.AppleHealthParser(zip_dump_path: str = '../data/raw/export.zip', unzip_path: str = '../data/interim/apple_health_export', force_unzip: bool = False)[source]

Bases: object

Parse and gives access to Apple Health App dump data.

Parameters:
  • zip_dump_path (str, optional) – Path to the zipped data dump. Defaults to constants.ZIP_PATH.
  • unzip_path (str, optional) – Path to the unzipped data dump. Defaults to constants.UNZIP_PATH.
  • force_unzip (bool, optional) – Flag to force unzipping the data again. Can be useful for new data. Defaults to False.
extract_activity_summaries() → pandas.core.frame.DataFrame[source]

Returns ActivitySummary elements.

Returns:of type ActivitySummary or None if empty
Return type:pd.DataFrame
extract_clinical_records() → pandas.core.frame.DataFrame[source]

Returns ClinicalRecord elements.

Returns:of type ClinicalRecord or None if empty
Return type:pd.DataFrame
extract_correlations() → pandas.core.frame.DataFrame[source]

Returns Correlation elements.

Returns:of type Correlation or None if empty
Return type:pd.DataFrame
extract_me() → pandas.core.frame.DataFrame[source]

Returns Me elements.

Returns:of type Me or None if empty
Return type:pd.DataFrame
extract_records() → pandas.core.frame.DataFrame[source]

Returns Record elements.

Returns:of type Record or None if empty
Return type:pd.DataFrame
extract_workouts() -> (<class 'pandas.core.frame.DataFrame'>, <class 'set'>)[source]

Returns Workout elements and set of all workout existing types. Shortens the workout types.

Returns:of type Workout or None if empty and set of available workout types
Return type:(pd.DataFrame, set)
get_export_date() → pandas._libs.tslibs.timestamps.Timestamp[source]

Returns the pd.Timestamp of exporting.

Returns:Export timestamp
Return type:pd.Timestamp
class health_tracking.Singleton[source]

Bases: type

Is used as metaclass to achieve a singleton pattern.