fix: relativeOdi gap segmentation - #69
Conversation
same bug cvhr_apnea already fixed once: analyzedHours used the raw tsSec.last-first span, so a charging/off-wrist gap in the middle dilutes odiPerHour and burdenPct. the rolling AC/DC/baseline windows were also plain index windows with no gap awareness, so they could blend pre-gap and post-gap samples across a hole (perfusion jump scored as a fake dip at the boundary). ported the same fix: split at gaps > maxGapSec, window/score each segment on its own, sum only observed spans into analyzedHours, fix burdenPct's denominator the same way. no callers yet so no wiring/ kAlgoVersion change.
There was a problem hiding this comment.
Sorry @abdulsaheel, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 6 days and 7 hours by commenting @sourcery-ai review. Upgrade to get a review now.
|
Warning Review limit reachedNext included review available in 31 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideFixes relativeOdi to mirror cvhr_apnea’s gap-aware processing: recording gaps are segmented before windowing and scoring, observed segment spans drive ODI and burden denominators, and regression tests cover dilution, boundary artifacts, and gap-free compatibility. Flow diagram for gap-aware relative ODI processingflowchart TD
A["Input red, IR, and timestamps"] --> B["Split at gaps greater than maxGapSec"]
B --> C["Process each gap-free segment"]
C --> D["Compute segment-scoped AC/DC windows"]
D --> E["Compute segment-scoped rolling baseline"]
E --> F["Detect qualifying dips"]
F --> G["Accumulate dip metrics and observed span"]
G --> H["Calculate ODI per hour and burdenPct"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…nflict combined #68's per-sample trustedCoverage scaling with #69's gap segmentation: each segment now computes its own trustedCoverage and scales its own hours contribution before summing into analyzedHours, instead of one global scale applied after the fact. odiPerHour and burdenPct both key off that combined analyzedHours.
relativeOdi was missing the same gap-segmentation fix cvhr_apnea already has. analyzedHours used the raw first-to-last ts span, so a charging/off-wrist gap dilutes odiPerHour and burdenPct — same failure mode a 2h charging break already caused once in cvhr_apnea (80.0/h -> 53.3/h on identical beats).
worse here: the rolling AC/DC and baseline windows are index-windowed with zero ts awareness, so they could blend samples across a real gap and score a perfusion-baseline jump as a fake desaturation right at the boundary.
fix mirrors cvhr_apnea.dart: split at gaps > maxGapSec (default 30s), window and score each segment on its own, sum only observed spans into analyzedHours, fix burdenPct's denominator the same way.
no callers yet (dormant, confirmed via grep), so no kAlgoVersion bump needed.
test plan:
Summary by Sourcery
Segment relative ODI recordings at substantial timestamp gaps and base scoring on trusted observed time.
New Features:
Bug Fixes:
Enhancements:
Tests: