This project provides a command-line interface (CLI) for processing and exporting Polar user data from .zip
files. The CLI extracts training sessions, activities, and heart rate data, and saves the processed data in CSV or Excel formats.
- Parses
.zip
files containing Polar user data. - Extracts training session summaries, activity summaries, and heart rate samples.
- Saves processed data in CSV, Excel, or both formats.
- Allows filtering data by date range.
- Python 3.8 or higher
- Required Python libraries:
pandas
tqdm
openpyxl
isodate
Install the dependencies using:
pip install -r requirements.txt
To run the CLI, use the following command:
python main_cli.py [OPTIONS]
Option | Type | Default | Description |
---|---|---|---|
--input-dir |
str |
../input |
Path to the directory containing .zip files. |
--output-dir |
str |
../output |
Path to the directory where output files will be saved. |
--start-date |
str |
None |
Start date for processing data (format: YYYY-MM-DD ). |
--end-date |
str |
Current date | End date for processing data (format: YYYY-MM-DD ). |
--save-format |
str |
csv |
Format for saving data: csv , excel , both , or none . |
python main_cli.py
- Input directory:
../input
- Output directory:
../output
- Saves data in CSV format.
python main_cli.py --input-dir "m:/TTK/input" --output-dir "m:/TTK/output"
python main_cli.py --start-date "2025-01-01" --end-date "2025-03-31"
python main_cli.py --save-format "both"
python main_cli.py --save-format "none"
- Processed data is saved in the specified output directory.
- Each user's data is saved in a separate folder, named based on their user ID.
- Files include:
training_summary.csv
or.xlsx
training_hr_samples.csv
or.xlsx
activity_summary.csv
or.xlsx
step_series.csv
or.xlsx
activity_hr.csv
or.xlsx
- If the input directory does not exist, the script will raise an error.
- If invalid date formats are provided, the script will display an error message and exit.
This project is licensed under the MIT License.