Pipeline for quality control (QC) of Polar heart rate CSVs and zone adherence reporting for the BOOST study. The main entrypoint scans supervised and unsupervised sessions, runs QC checks, computes zone metrics, and writes summary CSVs for reporting.
hr/main.py- Main pipeline entrypoint and orchestration.hr/util/- File discovery and data extraction helpers.hr/qc/- QC checks and output writers.hr/plot/- Helpers for assembling plotting metadata.hr/tests/- Pytest coverage for zone metrics. (excluded from git but available upon request)docs/meta_plot/- Saved plots and HTML outputs.rust-ols-adherence-cli/- Optional Rust CLI for OLS/WLS modeling.environment.yml- Conda environment definition.flake.nix,dev-shells/- Nix-based dev shells.qc_out.csv,zone_out.csv- Output artifacts (generated).variable_dictionary.txt- Metric dictionary (if maintained here).
The pipeline expects the BOOST data tree and file naming conventions below. Paths are derived from system in hr/main.py:
Base paths:
Argon->/Shared/vosslabhpc/Projects/BOOST/Home->/mnt/lss/Projects/BOOST/vosslnx->/mnt/nfs/lss/vosslabhpc/Projects/BOOST/
Expected inputs:
- Zone sheet:
InterventionStudy/1-projectManagement/participants/ExerciseSessionMaterials/Intervention Materials/BOOST HR ranges.xlsx - HR CSVs:
InterventionStudy/3-experiment/data/polarhrcsv/{Supervised,Unsupervised}/sub###/*.csv
File naming pattern used by QC:
- Week extracted from
_wk##in filename. - Session extracted from
_wk##_ses##.
If week or session tokens are missing, the file is skipped and logged.
Conda (recommended):
conda env create -f environment.yml
conda activate boost-hrNix (optional):
nix developRun from the repo root:
python hr/main.py ArgonAllowed system arguments are Argon, Home, and vosslnx. The script logs to main.log and writes outputs to the repo root.
qc_out.csv- QC errors/warnings per file (missing gaps, long NaN runs, bounded time failures).zone_out.csv- Per-session zone metrics (time in allowed zones, time above/below, longest bounded bout, MAZD).main.log- Run log with warnings for skipped or malformed files.
Both CSVs are regenerated on each run.
- Missing data check: gaps > 30 seconds.
- NaN run check: > 30 consecutive NaNs.
- Zone QC: weekly plan rules for supervised weeks 1-6 and unsupervised weeks 7-12.
See hr/qc/sup.py and hr/qc/zone/zone_qc.py for details.
Run from the repo root:
pytest hr/testsThe rust-ols-adherence-cli subproject fits OLS/WLS models for supervised vs. unsupervised adherence. See rust-ols-adherence-cli/README.md for data format and usage.
- If you need to export the master adherence data for the Rust CLI, see the commented
gd.save_for_rust(...)line inhr/main.py. - Plot artifacts in
docs/meta_plot/are static outputs and not regenerated by default.