fix: temp_circadian fabricated 0.0 on flat series - #76
Conversation
…lat series _nonparam divided by varTot/diffN without the zero-variance guard that circadian_np.dart already has, so a flat or heavily-quantized skin-temp window reported interdailyStability=0.0 / intradailyVariability=0.0 as if measured, instead of null. Matches the sibling file's existing `if (ssTot == 0) return absent` discipline. Also marked the dormant zero-baseline ratio fallback in ewma_baselines.dart with a ponytail comment — unreachable today since every metricCfg has minVal > 0, but worth flagging before a future metric legitimately crosses zero.
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 3 days and 23 hours by commenting @sourcery-ai review. Upgrade to get a review now.
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change treats flat temperature data as undefined for nonparametric circadian metrics, adds regression coverage, and documents zero-baseline behavior in EWMA calculations. ChangesMetric handling
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 GuideThe PR fixes temp circadian analysis so flat or quantized windows produce an absent nonparametric result rather than fabricated IS/IV values of 0.0, adds regression coverage, and documents an unrelated dormant zero-baseline fallback for future review. Flow diagram for flat temperature circadian handlingflowchart TD
A[Temperature window] --> B["_nonparam()"]
B --> C[Compute total variance and difference energy]
C --> D{varTot == 0 or diffN == 0?}
D -- Yes --> E[Return absent CircadianNonparam]
D -- No --> F[Compute IV and IS]
F --> G[Return CircadianNonparam]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
found during a full-codebase pass. _nonparam() in temp_circadian.dart was
missing the zero-variance guard circadian_np.dart already has — a flat or
heavily-quantized skin-temp window came back with IS=0.0/IV=0.0 like a real
"perfectly stable" reading instead of absent.
also left a ponytail comment on a dormant zero-baseline fallback in
ewma_baselines.dart — unreachable today (no metric has minVal <= 0) so not
worth a real fix, just flagged for later.
660 passing locally (dart test), one new regression test added.
🤖 Generated with Claude Code
Summary by Sourcery
Prevent flat temperature windows from being misreported as valid zero-valued circadian stability metrics.
Bug Fixes:
Tests:
Chores:
Summary by CodeRabbit
Bug Fixes
Documentation