Skip to content

update user and ordering in KPI dashboard#955

Merged
calellowitz merged 3 commits intomainfrom
ce/user-kpi-updates
Feb 2, 2026
Merged

update user and ordering in KPI dashboard#955
calellowitz merged 3 commits intomainfrom
ce/user-kpi-updates

Conversation

@calellowitz
Copy link
Copy Markdown
Collaborator

@calellowitz calellowitz commented Feb 2, 2026

Technical Summary

This handles the simple ordering changes and calculation issues from https://dimagi.atlassian.net/browse/CI-481

I did not finish removing the old calculations, just the display, but will do so in a followup with the rest of the ticket. However, the work in this PR is high priority to get out as we need to pull these numbers for January.

Safety Assurance

Safety story

Internal only page

Labels & Review

  • The set of people pinged as reviewers is appropriate for the level of risk of the change

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 2, 2026

Walkthrough

get_connectid_user_counts_cumulative in commcare_connect/reports/helpers.py now returns a single dict; HQ SSO query was changed to filter on has_sso_on_hq_app__isnull=False, ordered by month_group, and per-month counts are computed then accumulated into a cumulative dict. Per-month visit data keys were updated to use activated_commcare_users, activated_connect_users, and activated_personalid_accounts. In commcare_connect/reports/tables.py, AdminReportTable columns were reorganized: connectid_users renamed to "PersonalID Accounts", several columns removed, and activated_commcare_users added. A test assertion for non_preregistered_users was removed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • pxwxnvermx
  • sravfeyn
  • hemant10yadav
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'update user and ordering in KPI dashboard' is directly related to the changeset, which updates user metrics and adds ordering to the KPI dashboard as shown in the PR objectives.
Description check ✅ Passed The description explains the changes relate to ordering and calculation issues for the KPI dashboard (CI-481), matches the actual modifications to user metrics and ordering in the helpers and tables files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ce/user-kpi-updates

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@commcare_connect/reports/helpers.py`:
- Around line 213-224: The current manual cumulative loop builds
hq_sso_users_data only for months that have new SSO users, causing months with
zero new users to return 0; replace that logic by calling the existing
_get_cumulative_count helper to produce a cumulative mapping across the full
month series (use the visit_data_dict month keys as the time series input) and
then use the returned dict for lookups of activated_commcare_users (keep
references to hq_sso_users, hq_sso_users_data, visit_data_dict, and month_group
when making the change).
🧹 Nitpick comments (1)
commcare_connect/reports/tables.py (1)

21-21: Consider whether SumColumn is appropriate for an average metric.

Using SumColumn means the footer will sum all monthly averages together. Summing averages is not statistically meaningful—if the intent is to show a "total" in the footer, this may be confusing for users viewing "Average Earned by Top FLWs."

Consider using a regular columns.Column or a custom column that computes a weighted average or leaves the footer blank.

Comment thread commcare_connect/reports/helpers.py Outdated
@calellowitz calellowitz merged commit 699fb8f into main Feb 2, 2026
7 checks passed
@calellowitz calellowitz deleted the ce/user-kpi-updates branch February 2, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants