Current Limitation:
The current “Fix Data” tool uses linear scaling (p(i) = p(i) * scale + offset), which shifts or scales the entire dataset but does not address non-physiological spikes or sensor artifacts where the heart rate jumps unnaturally fast.
Proposed Feature:
Add an automated Spike Filter that identifies anomalies by calculating the rate of change (first derivative) between consecutive data points.
Logic:
- Calculate the Delta: For each point, calculate Delta_HR = abs(HR_n - HR_n-1).
- Threshold: Let the user define a maximum allowable jump per second (e.g. >10 bpm per sec).
- Action: If Delta_HR exceeds the threshold, the anomalous point should be flagged or automatically replaced using linear interpolation between the last “good” point and the next “good” point.
Why it is needed:
This would allow users to clean up “CAD-leak” (when the HR monitor locks onto cadence) or static electricity spikes on chest straps, which are often characterized by a high rate of change rather than just exceeding a Max HR value.