The problem and who has it
Heart-rate and rhythm features in low-cost wearables, open-hardware ECG boards and student projects start with one step: finding each heartbeat (R-peak). Detectors are easy to write and easy to get subtly wrong, and many projects never say how often theirs fails. Builders, students and researchers need a detector they can read and a failure rate they can trust.
Method
A Pan-Tompkins style detector (1985) written from the paper: 5–15 Hz band-pass, derivative, squaring, 150 ms moving-window integration, adaptive signal/noise thresholds with a 200 ms refractory period, and search-back for missed beats. Each detection is then moved onto the R wave. No training data and no learned parameters. Baseline: XQRS from the wfdb package, same lead and rules.
Evaluation
- Task: mark every beat in a 30-minute single-lead ECG.
- Data: all 48 records of the MIT-BIH Arrhythmia Database (PhysioNet, ODC-By 1.0), channel 0, 109,494 annotated beats.
- Metric: beat-by-beat sensitivity (TP/(TP+FN)) and positive predictive value (TP/(TP+FP)), F1; a detection counts if within 150 ms of a reference beat, matched one to one (EC57-style, not a certified EC57 run).
- Results: Se 0.9970, PPV 0.9899, F1 0.9935 (327 missed, 1,110 false). XQRS: Se 0.9919, PPV 0.9930, F1 0.9924. 42 of 48 records reach F1 ≥ 0.99. Worst: record 114 (V5 lead, T waves counted, PPV 0.777) and 207 (ventricular flutter, PPV 0.826).
- Reproduce:
pip install -e .thenpulsemark bench(downloads ~90 MB). Raw output is committed indocs/results/.
Who benefits, and who could be harmed
Benefits: students, researchers and builders of low-cost heart-rate tools; anyone who wants to score another detector with the same harness. Could be harmed: patients, if it were used for diagnosis (it is not a medical device). It over-counts beats in ventricular flutter and on leads with tall T waves, so heart rate would read too high exactly when the rhythm is abnormal. The data is 47 adults recorded in the 1970s at one hospital; children, other populations and wearable recordings are not represented. The README shows a failure case and the full statement is in docs/IMPACT.md.
Limitations
Single lead, fixed channel 0, no artefact or pacing handling, gross statistics only.
How it was built / AI use
This project was built with AI-assisted coding. The detector is classical signal processing; every number comes from pulsemark bench in the repository.
Team
Solo — Prafull Joshi