diff --git a/spp_mis_demo_v2/README.rst b/spp_mis_demo_v2/README.rst index 3eb276db..d75e0054 100644 --- a/spp_mis_demo_v2/README.rst +++ b/spp_mis_demo_v2/README.rst @@ -161,6 +161,14 @@ Dependencies Changelog ========= +19.0.2.1.3 +~~~~~~~~~~ + +- fix: PHL story registrants map to the curated PSGC p-code area + external IDs introduced by the re-landed spp_demo geodata + (``STORY_AREA_MAP`` still referenced the removed named IDs, silently + dropping area assignments). + 19.0.2.1.2 ~~~~~~~~~~ diff --git a/spp_mis_demo_v2/__manifest__.py b/spp_mis_demo_v2/__manifest__.py index 23a5c313..42a61b39 100644 --- a/spp_mis_demo_v2/__manifest__.py +++ b/spp_mis_demo_v2/__manifest__.py @@ -4,7 +4,7 @@ "name": "OpenSPP MIS Demo V2", "summary": "Demo Generator V2 for SP-MIS programs with fixed stories and volume generation", "category": "OpenSPP", - "version": "19.0.2.1.2", + "version": "19.0.2.1.3", "sequence": 1, "author": "OpenSPP.org", "website": "https://github.com/OpenSPP/OpenSPP2", @@ -20,6 +20,8 @@ "spp_demo", # GIS Reports for geographic visualization "spp_gis_report", + # Demographic dimensions referenced by demo GIS report disaggregation + "spp_metric_service", # Registrant GPS coordinates for QGIS plugin demo "spp_registrant_gis", # Indicators and analytics for demo indicators diff --git a/spp_mis_demo_v2/models/mis_demo_generator.py b/spp_mis_demo_v2/models/mis_demo_generator.py index bc54aa5c..9f87ba7f 100644 --- a/spp_mis_demo_v2/models/mis_demo_generator.py +++ b/spp_mis_demo_v2/models/mis_demo_generator.py @@ -4000,72 +4000,79 @@ def _load_geographic_data(self, stats): # Keys: story_id -> {locale: area_xmlid} STORY_AREA_MAP = { "juan_dela_cruz": { - "fil_PH": "spp_demo.area_phl_calamba", + "fil_PH": "spp_demo.area_phl_ph0403405", # City of Calamba, Laguna "fr_TG": "spp_demo.area_tgo_lome_tokoin", "si_LK": "spp_demo.area_lka_moratuwa", }, "maria_santos": { - "fil_PH": "spp_demo.area_phl_santa_rosa", + "fil_PH": "spp_demo.area_phl_ph0403428", # City of Santa Rosa, Laguna "fr_TG": "spp_demo.area_tgo_aflao", "si_LK": "spp_demo.area_lka_kolonnawa", }, "jose_reyes_multigenerational": { - "fil_PH": "spp_demo.area_phl_san_pablo", + "fil_PH": "spp_demo.area_phl_ph0403424", # San Pablo City, Laguna "fr_TG": "spp_demo.area_tgo_kpalime", "si_LK": "spp_demo.area_lka_kandy_ds", }, "ibrahim_hassan": { - "fil_PH": "spp_demo.area_phl_antipolo", + "fil_PH": "spp_demo.area_phl_ph0405802", # City of Antipolo, Rizal "fr_TG": "spp_demo.area_tgo_sokode", "si_LK": "spp_demo.area_lka_galle_ds", }, "david_sofia_martinez": { - "fil_PH": "spp_demo.area_phl_makati", + "fil_PH": "spp_demo.area_phl_ph1307602", # City of Makati, NCR "fr_TG": "spp_demo.area_tgo_lome", "si_LK": "spp_demo.area_lka_dehiwala", }, "rosa_garcia": { - "fil_PH": "spp_demo.area_phl_quezon_city", + "fil_PH": "spp_demo.area_phl_ph1307404", # Quezon City, NCR "fr_TG": "spp_demo.area_tgo_lome_be", "si_LK": "spp_demo.area_lka_colombo_fort", }, "mary_johnson": { - "fil_PH": "spp_demo.area_phl_pasig", + "fil_PH": "spp_demo.area_phl_ph1307403", # City of Pasig, NCR "fr_TG": "spp_demo.area_tgo_lome_nyekonakpoe", "si_LK": "spp_demo.area_lka_colombo_pettah", }, "ahmed_said": { - "fil_PH": "spp_demo.area_phl_taguig", + "fil_PH": "spp_demo.area_phl_ph1307607", # Taguig City, NCR "fr_TG": "spp_demo.area_tgo_lome_adidogome", "si_LK": "spp_demo.area_lka_dehiwala_gn", }, "nguyen_extended_family": { - "fil_PH": "spp_demo.area_phl_bacoor", + # Bacoor is not in the curated PSGC dataset; Imus is the nearest available city in Cavite. + "fil_PH": "spp_demo.area_phl_ph0402109", # Imus City, Cavite "fr_TG": "spp_demo.area_tgo_baguida_centre", "si_LK": "spp_demo.area_lka_hikkaduwa", }, "amina_osman_household": { - "fil_PH": "spp_demo.area_phl_manila", + "fil_PH": "spp_demo.area_phl_ph1303901", # City of Manila, NCR "fr_TG": "spp_demo.area_tgo_kpalime_centre", "si_LK": "spp_demo.area_lka_mount_lavinia_gn", }, "carlos_elena_morales": { - "fil_PH": "spp_demo.area_phl_dasmarinas", + "fil_PH": "spp_demo.area_phl_ph0402106", # City of Dasmariñas, Cavite "fr_TG": "spp_demo.area_tgo_kpalime_tove", "si_LK": "spp_demo.area_lka_galle_fort", }, "chen_large_family": { - "fil_PH": "spp_demo.area_phl_qc_commonwealth", + # Commonwealth barangay (Quezon City) is not in the municipality-level dataset; + # assigned a distinct NCR city to keep areas spread across the demo map. + "fil_PH": "spp_demo.area_phl_ph1307501", # Caloocan City, NCR "fr_TG": "spp_demo.area_tgo_zio", "si_LK": "spp_demo.area_lka_gampaha", }, "grace_okonkwo": { - "fil_PH": "spp_demo.area_phl_makati_poblacion", + # Poblacion barangay (Makati) is not in the municipality-level dataset; + # assigned a distinct NCR city to keep areas spread across the demo map. + "fil_PH": "spp_demo.area_phl_ph1307603", # City of Muntinlupa, NCR "fr_TG": "spp_demo.area_tgo_ogou", "si_LK": "spp_demo.area_lka_kalutara", }, "luis_fernandez": { - "fil_PH": "spp_demo.area_phl_calamba_real", + # Real barangay (Calamba) is not in the municipality-level dataset; + # assigned a distinct Laguna city to keep areas spread across the demo map. + "fil_PH": "spp_demo.area_phl_ph0403403", # City of Biñan, Laguna "fr_TG": "spp_demo.area_tgo_lacs", "si_LK": "spp_demo.area_lka_matara", }, diff --git a/spp_mis_demo_v2/readme/HISTORY.md b/spp_mis_demo_v2/readme/HISTORY.md index 1b0a35b3..f586c3ff 100644 --- a/spp_mis_demo_v2/readme/HISTORY.md +++ b/spp_mis_demo_v2/readme/HISTORY.md @@ -1,3 +1,7 @@ +### 19.0.2.1.3 + +- fix: PHL story registrants map to the curated PSGC p-code area external IDs introduced by the re-landed spp_demo geodata (`STORY_AREA_MAP` still referenced the removed named IDs, silently dropping area assignments). + ### 19.0.2.1.2 - fix: demo GIS reports use `dimension_ids` + `member_expansion` instead of the removed `disaggregate_by_*` boolean fields (ported from #295, credit @kneckinator; required in lockstep with the spp_gis_report dimension change). diff --git a/spp_mis_demo_v2/static/description/index.html b/spp_mis_demo_v2/static/description/index.html index 1c6547bc..2db4fe63 100644 --- a/spp_mis_demo_v2/static/description/index.html +++ b/spp_mis_demo_v2/static/description/index.html @@ -531,6 +531,15 @@

Changelog

+

19.0.2.1.3

+ +
+

19.0.2.1.2

-
+

19.0.2.1.1

-
+

19.0.2.1.0

  • feat(demo): seed country-appropriate CR document types (≥5 per country @@ -556,7 +565,7 @@

    19.0.2.1.0

    files to a change request without defining them manually (#1102)
-
+

19.0.2.0.0

  • Initial migration to OpenSPP2
  • diff --git a/spp_mis_demo_v2/tests/__init__.py b/spp_mis_demo_v2/tests/__init__.py index 3a19a1f5..566a572f 100644 --- a/spp_mis_demo_v2/tests/__init__.py +++ b/spp_mis_demo_v2/tests/__init__.py @@ -11,3 +11,4 @@ from . import test_mis_demo_generator from . import test_registry_variables from . import test_demo_statistics +from . import test_story_area_map diff --git a/spp_mis_demo_v2/tests/test_story_area_map.py b/spp_mis_demo_v2/tests/test_story_area_map.py new file mode 100644 index 00000000..84ec41e2 --- /dev/null +++ b/spp_mis_demo_v2/tests/test_story_area_map.py @@ -0,0 +1,40 @@ +# Part of OpenSPP. See LICENSE file for full copyright and licensing details. +from odoo.tests.common import TransactionCase + + +class TestStoryAreaMapIntegrity(TransactionCase): + """Every STORY_AREA_MAP external ID must resolve once its country's areas load. + + The map is consumed with ``raise_if_not_found=False``, so a renamed area + external ID silently drops story area assignments instead of failing (this + regressed once, when the PHL areas moved to curated PSGC p-codes). This + guard turns any future rename into a loud test failure. + """ + + _LOCALE_COUNTRY = {"fil_PH": "phl", "fr_TG": "tgo", "si_LK": "lka"} + + def test_all_story_area_xmlids_resolve(self): + generator_model = self.env["spp.mis.demo.generator"] + loader = self.env["spp.demo.area.loader"] + for country in sorted(set(self._LOCALE_COUNTRY.values())): + loader.load_country_areas(country, load_shapes=False) + + missing = [] + unknown_locales = [] + for story_id, locales in generator_model.STORY_AREA_MAP.items(): + for locale, xmlid in locales.items(): + if locale not in self._LOCALE_COUNTRY: + unknown_locales.append((story_id, locale)) + continue + if not self.env.ref(xmlid, raise_if_not_found=False): + missing.append((story_id, locale, xmlid)) + + self.assertFalse( + unknown_locales, + f"STORY_AREA_MAP locales without a country mapping in this test: {unknown_locales}", + ) + self.assertFalse( + missing, + "STORY_AREA_MAP references unresolvable area external IDs " + f"(story registrants would silently lose their area): {missing}", + )