This is a follow-up to the normalization fix (#3280). The patched logic still reads time_limits.analysis_length_dates in the OVERALL branch of Analysis.calculate_statistics (jetstream/analysis.py:1385), but TimeLimits has no such attribute.
The WEEK branch hardcodes 7 and dodges it; OVERALL hits the bad attribute and every run of a metric carrying normalize_over_analysis_period (e.g. daily_active_users_per_1000_clients_legacy) dies with:
AttributeError: 'TimeLimits' object has no attribute 'analysis_length_dates'.
The fix seems to be to re-derive the length from the window start and end, which are accessible.
I've used this patch on a local Jetstream test run and it did properly apply the normalization to the metric for both the weekly and overall windows.
# jetstream/analysis.py, OVERALL branch (~line 1385)
- analysis_length_dates = time_limits.analysis_length_dates
+ # TimeLimits has no `analysis_length_dates`; derive from the overall window.
+ # start/end are inclusive days since enrollment → length = end - start + 1.
+ overall_window = time_limits.analysis_windows[-1]
+ analysis_length_dates = overall_window.end - overall_window.start + 1
┆Issue is synchronized with this Jira Task
This is a follow-up to the normalization fix (#3280). The patched logic still reads
time_limits.analysis_length_datesin the OVERALL branch ofAnalysis.calculate_statistics(jetstream/analysis.py:1385), butTimeLimitshas no such attribute.The WEEK branch hardcodes 7 and dodges it; OVERALL hits the bad attribute and every run of a metric carrying normalize_over_analysis_period (e.g. daily_active_users_per_1000_clients_legacy) dies with:
The fix seems to be to re-derive the length from the window start and end, which are accessible.
I've used this patch on a local Jetstream test run and it did properly apply the normalization to the metric for both the weekly and overall windows.
┆Issue is synchronized with this Jira Task