fix: correct confidence thresholds for 30-89 day range
Bug: 30 days with 29 data points returned 'insufficient' because it fell into the 90+ day branch which requires >= 30 data points. Fix: Changed condition from 'days_requested <= 28' to 'days_requested < 90' so that 8-89 day ranges use the medium-term thresholds: - high >= 18 data points - medium >= 12 - low >= 8 This means 30 days with 29 entries now returns 'high' confidence. Affects: nutrition_avg, and all other medium-term metrics. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a441537dca
commit
ffa99f10fb
|
|
@ -91,7 +91,8 @@ def calculate_confidence(
|
||||||
else:
|
else:
|
||||||
return "insufficient"
|
return "insufficient"
|
||||||
|
|
||||||
elif days_requested <= 28:
|
elif days_requested < 90:
|
||||||
|
# 8-89 days: Medium-term analysis
|
||||||
if data_points >= 18:
|
if data_points >= 18:
|
||||||
return "high"
|
return "high"
|
||||||
elif data_points >= 12:
|
elif data_points >= 12:
|
||||||
|
|
@ -101,7 +102,7 @@ def calculate_confidence(
|
||||||
else:
|
else:
|
||||||
return "insufficient"
|
return "insufficient"
|
||||||
|
|
||||||
else: # 90+ days
|
else: # 90+ days: Long-term analysis
|
||||||
if data_points >= 60:
|
if data_points >= 60:
|
||||||
return "high"
|
return "high"
|
||||||
elif data_points >= 40:
|
elif data_points >= 40:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user