How jbkc/smartwatch works
Main Components
• Data Collection & Raw Data Source (Smartwatch): Although not explicitly shown as a separate module, the README indicates the smartwatch provides the raw heart rate data.
• Preprocessing Module:
– “gather_raw_data.py” suggests acquisition of unprocessed data.
– “analyse_database.py” indicates subsequent database analysis.
– “peak_detection_qrs.py” is used for QRS complex peak detection (a key step when processing heart rate signals).
• Training Module: Split into two sub-components—
– Activity Model: It likely processes and classifies activity data, with a separate wandb_logger (in training/activity_model) to record experiments.
– Heart Rate Model: Contains scripts like “hr_model.py”, “hr_model_run.py” to define and run the heart rate prediction model, and uses a moving average filter (ma_filter.py, ma_filter_run.py) to smooth signal data; this sub-component also includes its wandb_logger integration.
• Experiment Tracking/Logging: Weights & Biases (wandb) integrations present in both training subdirectories indicate external service dependency for experiment monitoring.
Relationships and Interactions
• Within Preprocessing, raw data is cleaned, stored, and processed (e.g., peak detection) before being forwarded to the training phase.
• After preprocessing, the processed data feeds into two training pipelines:
– The Activity Model: Trained using specific experimental setups and tracked via its dedicated wandb_logger.
– The Heart Rate Model: Involves additional steps like moving average filtering before training. Its run scripts (hr_model_run.py, ma_filter_run.py) indicate the orchestration of sequential operations.
Architectural Patterns and Design Principles
• Modularity: The directory structure clearly indicates separation of concerns – one for preprocessing, another for training with further division by model type.
• Pipeline Architecture: The data flows through a defined sequence—data gathering → preprocessing (signal analysis and filtering) → training models; representing a classic ETL (Extract, Transform, Load) or ML pipeline pattern.
• Extensibility: With separate modules for each training model and external logging components, the design is open to further extensions (e.g., additional models or sensors).
Relevant Technologies, Frameworks, and Libraries
• Python scripts for signal processing and machine learning.
• Weights & Biases (WANDB) for experiment tracking.
• Although not detailed in the file tree, consider that frameworks for data processing (e.g., NumPy, SciPy) or modeling (e.g., TensorFlow, PyTorch) might be used in the model scripts; include notes of their possible involvement if known.
Detail and Clarity
• Be very detailed—capture each module and sub-step represented in the file tree.