feat(spp_gis_report): metric disaggregation in GIS reports (re-land from #76)#280
Conversation
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
Code Review — PR #280
|
|
The This PR removes the boolean Merge order: #295 depends on this PR (and #277), so it must merge after both and be rebased onto the result. |
kneckinator
left a comment
There was a problem hiding this comment.
Two issues from review worth addressing before merge (plus minor notes left in the summary review). Both concern the boolean→dimension migration path and the member-expansion area attribution.
|
Pushed 3337da9 addressing the migration finding directly (converted the Ran the repo's pre-commit hooks on the changed files — ruff, Odoo-19 compat, bandit, whitespace/EOF all pass. (semgrep couldn't run locally due to a Python 3.14 toolchain crash, unrelated to this change; worth confirming in CI.) Still open for you: the member-expansion area-attribution divergence ( |
65bc87b to
a8b8f08
Compare
3337da9 to
d3c5d23
Compare
…on script The post_init_hook only runs on fresh install (odoo/modules/loading.py gates it on update_operation == 'install'), never on upgrade -- exactly the path where legacy disaggregate_by_* data exists -- so the migration never fired. Its raw INSERT also targeted spp_gis_report_spp_demographic_dimension_rel, but Odoo names implicit m2m tables from the alphabetically sorted table names, so the real table is spp_demographic_dimension_spp_gis_report_rel and the insert would have raised. Move the logic to migrations/19.0.2.1.0/post-migrate.py so it runs on upgrade, and derive the relation/column names from the dimension_ids field metadata so they can't drift from Odoo's canonical naming.
…on tests - _disaggregation_python_expanded now attributes a member to their OWN area, falling back to the group's — parity with the SQL path's COALESCE(ind.area, grp.area), so the same person cannot land in different areas across dimension paths. Regression test proves the divergence (red before fix) plus an SQL-path twin documenting the shared rule. - Regression tests for the 19.0.2.1.0 boolean->dimension migration (linking, rerun idempotency, fresh-install no-op, missing-dimension warning, no-columns no-op).
d3c5d23 to
309894d
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 19.0 #280 +/- ##
==========================================
+ Coverage 71.85% 74.28% +2.43%
==========================================
Files 245 372 +127
Lines 19111 25385 +6274
==========================================
+ Hits 13732 18857 +5125
- Misses 5379 6528 +1149
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Folds the demo_gis_reports.xml adaptation out of draft #295 so this PR merges atomically: removing the disaggregate_by_* booleans while mainline demo data still sets them hard-breaks any install path pulling spp_mis_demo_v2 (caught by test (spp_dci_demo) on the merge ref). #295 retains the STORY_AREA_MAP p-code remap, which is independent (#277 fallout). Co-authored-by: Ken Lewerentz <ken@openspp.org>
…king changes Closes the review's Medium #4: the changelog now states the flat disagg_<dim>_<value> GeoJSON shape (with metadata.disaggregation) and the boolean-field removal with its automatic migration.
…eport schemas The re-lands in #277 and #280 rename the Philippine area external IDs to curated PSGC p-codes and replace the boolean GIS-report disaggregation flags with dimension_ids, which silently broke this module's demo data: PHL story registrants lost their area assignment and the demo GIS reports failed to load. Remap STORY_AREA_MAP to the new p-code IDs (distinct municipalities for stories whose barangay or city is absent from the curated set), switch the demo reports to dimension_ids + member_expansion, and depend on spp_metric_service explicitly.
Re-lands the spp_gis_report portion of reverted PR #76 (revert: #271). Wave 3 — stacked on the spp_metric_service Wave-2 PR (and transitively #275); merge those first. Base is set to
reland/metric-serviceso this diff shows only spp_gis_report.Summary
Verification
./spp t spp_gis_reporton an integration state with feat(spp_cel_domain): SQL CASE compiler, read-only smart-op lookup, translator cache tests (re-land from #76) #275 + Wave 2 merged: 188 passed, 0 failedScope addition (2026-07-14)
Also ports
spp_mis_demo_v2/data/demo_gis_reports.xmltodimension_ids+member_expansion(taken verbatim from draft #295, credit @kneckinator, Co-authored-by preserved). Rationale: removing thedisaggregate_by_*booleans while mainline demo data still sets them hard-breaks any install path pullingspp_mis_demo_v2— CI caught it on this PR's merge ref (test (spp_dci_demo)ParseError). Folding the port makes this merge atomic with no broken-mainline window; #295 retains the independentSTORY_AREA_MAPp-code remap. Verified:./spp t spp_mis_demo_v2272/0 with the ported data.