feat(spp_metric_service): breakdown expansion + SQL column support (re-land from #76)#279
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces demographic breakdown expansion and SQL column compilation support for metric disaggregation. Key changes include updating model names, refining the age group dimension to align with UNICEF/WHO buckets, automatically expanding groups to members for individual-level dimensions, and adding a to_sql_column method to compile dimensions into SQL expressions. The reviewer feedback focuses on performance and code quality optimizations, such as using recordset subtraction instead of lambda filtering, batch-fetching membership IDs to prevent N+1 queries, checking _fields on Odoo recordsets instead of using hasattr, guarding against falsy values early, and removing redundant SQL parameter wrapping.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
gemini-code-assist disposition: Applied (commit 778e037): recordset subtraction for individuals, batched Deferred: the two |
|
Thank you for the detailed disposition. The changes you've implemented, particularly the shift to |
|
Update: the two deferred SQL("%s", default) simplifications are applied (direct parameter passing). Suite 161/0 on the integration state. All gemini findings on this PR are now addressed. |
Code review — PR #279
|
- recordset subtraction instead of lambda filter for individuals - batch individual ids from memberships (avoids N+1) - check _fields membership instead of hasattr on recordsets - early return for falsy raw_value before code search
…ent expansion semantics Addresses the review's two verify-items and its test gap: - two tests assert the CASE WHEN is_group = FALSE/TRUE wrapping for individuals-/groups-scoped dimensions (previously unexercised); - compute_breakdown docstring and HISTORY state the endorsed semantics: all-or-nothing expansion when any individuals dimension is present, and member-counted totals that need not reconcile with group-level scope counts.
65bc87b to
a8b8f08
Compare
|
Review response — completing the three items from your verdict (branch rebased onto current 19.0, which now contains merged #275/#276/#277, and pushed as Sign-off 1 (all-or-nothing expansion): endorsed as intended. Mixing an Sign-off 2 (totals need not reconcile with scope count): endorsed as intended — member-counted totals are the point of the feature; the sole in-repo consumer ( Test gap: closed — The |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 19.0 #279 +/- ##
==========================================
+ Coverage 69.15% 71.85% +2.69%
==========================================
Files 159 245 +86
Lines 14117 19111 +4994
==========================================
+ Hits 9763 13732 +3969
- Misses 4354 5379 +1025
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Re-lands the spp_metric_service portion of reverted PR #76 (revert: #271). Wave 2 — stacked on #275 (spp_cel_domain); merge that first. The base is set to
reland/cel-domainso this diff shows only spp_metric_service; GitHub retargets to 19.0 when #275 merges — wait for CI to re-run green on the retargeted base before merging.Summary
Added on top of #76 (not in the original)
memberships.individual.ids(avoids N+1);_fieldsmembership check instead ofhasattron recordsets; early return for falsyraw_valuebefore code search;defaultpassed directly as a SQL parameter (two sites).Verification
./spp t spp_metric_serviceon an integration state with feat(spp_cel_domain): SQL CASE compiler, read-only smart-op lookup, translator cache tests (re-land from #76) #275 merged: 161 passed, 0 failed