Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions spp_mis_demo_v2/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~~~~~~~~

Expand Down
4 changes: 3 additions & 1 deletion spp_mis_demo_v2/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand Down
35 changes: 21 additions & 14 deletions spp_mis_demo_v2/models/mis_demo_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down
4 changes: 4 additions & 0 deletions spp_mis_demo_v2/readme/HISTORY.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
15 changes: 12 additions & 3 deletions spp_mis_demo_v2/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,15 @@ <h2><a class="toc-backref" href="#toc-entry-1">Changelog</a></h2>
</div>
</div>
<div class="section" id="section-1">
<h1>19.0.2.1.3</h1>
<ul class="simple">
<li>fix: PHL story registrants map to the curated PSGC p-code area
external IDs introduced by the re-landed spp_demo geodata
(<tt class="docutils literal">STORY_AREA_MAP</tt> still referenced the removed named IDs, silently
dropping area assignments).</li>
</ul>
</div>
<div class="section" id="section-2">
<h1>19.0.2.1.2</h1>
<ul class="simple">
<li>fix: demo GIS reports use <tt class="docutils literal">dimension_ids</tt> + <tt class="docutils literal">member_expansion</tt>
Expand All @@ -539,15 +548,15 @@ <h1>19.0.2.1.2</h1>
spp_gis_report dimension change).</li>
</ul>
</div>
<div class="section" id="section-2">
<div class="section" id="section-3">
<h1>19.0.2.1.1</h1>
<ul class="simple">
<li>feat(demo): adapt the change-request demo generator to the redesigned
CR flows — Add Member selects an existing individual (#871) and Change
Head of Household uses per-member role lines (#873) (#242)</li>
</ul>
</div>
<div class="section" id="section-3">
<div class="section" id="section-4">
<h1>19.0.2.1.0</h1>
<ul class="simple">
<li>feat(demo): seed country-appropriate CR document types (≥5 per country
Expand All @@ -556,7 +565,7 @@ <h1>19.0.2.1.0</h1>
files to a change request without defining them manually (#1102)</li>
</ul>
</div>
<div class="section" id="section-4">
<div class="section" id="section-5">
<h1>19.0.2.0.0</h1>
<ul class="simple">
<li>Initial migration to OpenSPP2</li>
Expand Down
1 change: 1 addition & 0 deletions spp_mis_demo_v2/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
40 changes: 40 additions & 0 deletions spp_mis_demo_v2/tests/test_story_area_map.py
Original file line number Diff line number Diff line change
@@ -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}",
)
Loading