Skip to content

Commit 8850d77

Browse files
feat: remove spp_hxl and spp_hxl_area modules
Remove the HXL modules. spp_gis_indicators was the only dependent; keep it installable by dropping the hxl dependency and disabling the indicator-data feature until a replacement source is wired in. - Delete spp_hxl and spp_hxl_area. - spp_gis_indicators manifest: replace spp_hxl_area with spp_cel_domain and spp_hazard (the variable_id/incident_id fields previously reached the module transitively via spp_hxl_area). Bump version 19.0.2.0.0 -> 19.0.3.0.0 (breaking: dependency change + indicator-data feature disabled). - Stub spp.gis.indicator.layer._get_indicator_values() -> [] and get_feature_colors() -> {} with TODOs; color scales, manual-break classification, and legend rendering remain functional. - Rewrite hxl-coupled tests to assert the disabled contract; drop label/ description keys from spp.cel.variable creates (those fields came from spp_studio via the removed hxl->spp_studio dependency, and the module's production code never used them). - Regenerate requirements.txt: drop libhxl (was required only by spp_hxl_area). Note: module readme fragments (DESCRIPTION/USAGE) are intentionally left unchanged here and will be updated in a follow-up, to avoid triggering the readme generator (which needs pandoc, currently missing in CI). See PR #230. Tests: ./spp t spp_gis_indicators -> 84 passed, 0 failed, 0 errors.
1 parent 74516d3 commit 8850d77

70 files changed

Lines changed: 69 additions & 9828 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ httpx
1111
jsonschema
1212
jwcrypto
1313
jwcrypto>=1.5.6
14-
libhxl
1514
numpy>=1.22.2
1615
openpyxl
1716
parse-accept-language

spp_gis_indicators/__manifest__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
{
44
"name": "OpenSPP GIS Indicators",
55
"summary": "Choropleth visualization for area-level indicators",
6-
"version": "19.0.2.0.0",
6+
"version": "19.0.3.0.0",
77
"category": "OpenSPP/GIS",
88
"author": "OpenSPP.org",
99
"website": "https://github.com/OpenSPP/OpenSPP2",
1010
"license": "LGPL-3",
1111
"development_status": "Beta",
1212
"depends": [
1313
"spp_gis",
14-
"spp_hxl_area",
14+
"spp_cel_domain",
15+
"spp_hazard",
1516
"spp_registry",
1617
"spp_security",
1718
],

spp_gis_indicators/models/indicator_layer.py

Lines changed: 14 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -248,35 +248,19 @@ def _compute_legend_html(self):
248248
rec.legend_html = ""
249249

250250
def _get_indicator_values(self):
251-
"""Get indicator values from spp.hxl.area.indicator.
251+
"""Get area-level indicator values for this layer's variable/period/incident.
252252
253253
Returns:
254254
list: List of float values
255+
256+
TODO(remove-hxl): The area-indicator data source (spp.hxl.area.indicator,
257+
formerly provided by spp_hxl_area) has been removed. Until a replacement
258+
source is wired in, no indicator data is available and this returns an empty
259+
list, which disables indicator-driven break and color computation. See
260+
internal plan remove-hxl-modules.md.
255261
"""
256262
self.ensure_one()
257-
258-
if not self.variable_id:
259-
return []
260-
261-
# Build domain for indicator search
262-
domain = [
263-
("variable_id", "=", self.variable_id.id),
264-
]
265-
266-
if self.period_key:
267-
domain.append(("period_key", "=", self.period_key))
268-
269-
if self.incident_id:
270-
domain.append(("incident_id", "=", self.incident_id.id))
271-
272-
# Search indicators
273-
Indicator = self.env["spp.hxl.area.indicator"]
274-
indicators = Indicator.search(domain)
275-
276-
# Extract values
277-
values = [ind.value for ind in indicators if ind.value is not False]
278-
279-
return values
263+
return []
280264

281265
@staticmethod
282266
def _compute_quantile_breaks(values, num_classes):
@@ -346,59 +330,11 @@ def get_feature_colors(self, area_ids):
346330
347331
Returns:
348332
dict: Mapping of area_id (int) to color (str)
333+
334+
TODO(remove-hxl): The area-indicator data source (spp.hxl.area.indicator,
335+
formerly provided by spp_hxl_area) has been removed. Until a replacement
336+
source is wired in, there is no per-area indicator data to colorize, so this
337+
returns an empty mapping. See internal plan remove-hxl-modules.md.
349338
"""
350339
self.ensure_one()
351-
352-
if not self.variable_id or not self.color_scale_id:
353-
return {}
354-
355-
# Build domain for indicator search
356-
domain = [
357-
("variable_id", "=", self.variable_id.id),
358-
("area_id", "in", area_ids),
359-
]
360-
361-
if self.period_key:
362-
domain.append(("period_key", "=", self.period_key))
363-
364-
if self.incident_id:
365-
domain.append(("incident_id", "=", self.incident_id.id))
366-
367-
# Search indicators
368-
Indicator = self.env["spp.hxl.area.indicator"]
369-
indicators = Indicator.search(domain)
370-
371-
if not indicators:
372-
return {}
373-
374-
# Get breaks and colors
375-
if not self.break_values:
376-
return {}
377-
378-
breaks = json.loads(self.break_values)
379-
colors = self.color_scale_id.get_colors()
380-
381-
if not colors:
382-
return {}
383-
384-
# Build color mapping
385-
color_map = {}
386-
num_classes = len(breaks) + 1
387-
num_colors = len(colors)
388-
389-
for ind in indicators:
390-
if not ind.value and ind.value != 0:
391-
continue
392-
# Determine which class this value falls into
393-
class_idx = 0
394-
for i, break_val in enumerate(breaks):
395-
if ind.value >= break_val:
396-
class_idx = i + 1
397-
else:
398-
break
399-
400-
# Map class to color
401-
color_idx = int((class_idx / max(num_classes - 1, 1)) * (num_colors - 1))
402-
color_map[ind.area_id.id] = colors[color_idx]
403-
404-
return color_map
340+
return {}

0 commit comments

Comments
 (0)