Skip to content

Commit 2d149ab

Browse files
committed
chore(spp_area_hdx): promote to Beta, fix pre-commit and tests
1 parent 5f2a54a commit 2d149ab

4 files changed

Lines changed: 54 additions & 40 deletions

File tree

spp_area_hdx/README.rst

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ OpenSPP HDX COD Integration
1414
!! source digest: sha256:cf138e08394d940c78e288afd34fd606ac55ac16203d679b29c392b02aa4bdae
1515
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1616
17-
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
17+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1818
:target: https://odoo-community.org/page/development-status
19-
:alt: Alpha
19+
:alt: Beta
2020
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
2121
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
2222
:alt: License: LGPL-3
@@ -35,17 +35,17 @@ area lookup using PostGIS spatial queries.
3535
Key Capabilities
3636
~~~~~~~~~~~~~~~~
3737

38-
- Sync COD dataset metadata from HDX API by country
39-
- Auto-detect field mappings from GeoJSON (P-code, name, parent P-code)
40-
using HXL tags
41-
- Import admin boundaries with polygons from HDX or manually uploaded
42-
GeoJSON files
43-
- Match imported features to existing areas by P-code or create new
44-
areas
45-
- GPS-based area lookup using PostGIS ``ST_Contains`` for
46-
point-in-polygon queries
47-
- Standardize area identification with HDX P-codes for inter-agency
48-
coordination
38+
- Sync COD dataset metadata from HDX API by country
39+
- Auto-detect field mappings from GeoJSON (P-code, name, parent P-code)
40+
using HXL tags
41+
- Import admin boundaries with polygons from HDX or manually uploaded
42+
GeoJSON files
43+
- Match imported features to existing areas by P-code or create new
44+
areas
45+
- GPS-based area lookup using PostGIS ``ST_Contains`` for
46+
point-in-polygon queries
47+
- Standardize area identification with HDX P-codes for inter-agency
48+
coordination
4949

5050
Key Models
5151
~~~~~~~~~~
@@ -83,10 +83,10 @@ After installing:
8383
UI Location
8484
~~~~~~~~~~~
8585

86-
- **Menu**: Area > Areas > HDX Integration > COD Sources
87-
- **Import**: Area > Areas > HDX Integration > Import COD
88-
- **Area Records**: Extended with HDX P-code field visible in area form
89-
view
86+
- **Menu**: Area > Areas > HDX Integration > COD Sources
87+
- **Import**: Area > Areas > HDX Integration > Import COD
88+
- **Area Records**: Extended with HDX P-code field visible in area form
89+
view
9090

9191
Security
9292
~~~~~~~~
@@ -103,27 +103,22 @@ Security
103103
Extension Points
104104
~~~~~~~~~~~~~~~~
105105

106-
- ``spp.area.find_by_coordinates(latitude, longitude, level=None)`` -
107-
Find area containing GPS point
108-
- ``spp.area.find_all_containing(latitude, longitude)`` - Find all
109-
areas in hierarchy containing point
110-
- ``spp.area.find_by_pcode(pcode)`` - Find area by HDX P-code or
111-
fallback to code field
112-
- Inherit ``spp.hdx.cod.source`` to add country-specific dataset
113-
discovery logic
114-
- Inherit ``spp.hdx.cod.import.wizard._process_features()`` to
115-
customize import behavior
106+
- ``spp.area.find_by_coordinates(latitude, longitude, level=None)`` -
107+
Find area containing GPS point
108+
- ``spp.area.find_all_containing(latitude, longitude)`` - Find all areas
109+
in hierarchy containing point
110+
- ``spp.area.find_by_pcode(pcode)`` - Find area by HDX P-code or
111+
fallback to code field
112+
- Inherit ``spp.hdx.cod.source`` to add country-specific dataset
113+
discovery logic
114+
- Inherit ``spp.hdx.cod.import.wizard._process_features()`` to customize
115+
import behavior
116116

117117
Dependencies
118118
~~~~~~~~~~~~
119119

120120
``spp_area``, ``spp_gis``
121121

122-
.. IMPORTANT::
123-
This is an alpha version, the data model and design can change at any time without warning.
124-
Only for development or testing purpose, do not use in production.
125-
`More details on development status <https://odoo-community.org/page/development-status>`_
126-
127122
**Table of contents**
128123

129124
.. contents::
@@ -150,6 +145,23 @@ Authors
150145
Maintainers
151146
-----------
152147

148+
.. |maintainer-jeremi| image:: https://github.com/jeremi.png?size=40px
149+
:target: https://github.com/jeremi
150+
:alt: jeremi
151+
.. |maintainer-gonzalesedwin1123| image:: https://github.com/gonzalesedwin1123.png?size=40px
152+
:target: https://github.com/gonzalesedwin1123
153+
:alt: gonzalesedwin1123
154+
.. |maintainer-reichie020212| image:: https://github.com/reichie020212.png?size=40px
155+
:target: https://github.com/reichie020212
156+
:alt: reichie020212
157+
.. |maintainer-emjay0921| image:: https://github.com/emjay0921.png?size=40px
158+
:target: https://github.com/emjay0921
159+
:alt: emjay0921
160+
161+
Current maintainers:
162+
163+
|maintainer-jeremi| |maintainer-gonzalesedwin1123| |maintainer-reichie020212| |maintainer-emjay0921|
164+
153165
This module is part of the `OpenSPP/OpenSPP2 <https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_area_hdx>`_ project on GitHub.
154166

155167
You are welcome to contribute.

spp_area_hdx/__manifest__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"author": "OpenSPP.org",
1111
"website": "https://github.com/OpenSPP/OpenSPP2",
1212
"license": "LGPL-3",
13-
"development_status": "Alpha",
13+
"development_status": "Beta",
14+
"maintainers": ["jeremi", "gonzalesedwin1123", "reichie020212", "emjay0921"],
1415
"depends": [
1516
"spp_area",
1617
"spp_gis",

spp_area_hdx/models/hdx_cod_source.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ def action_sync_from_hdx(self):
100100
admin_level = client.detect_admin_level(resource_name)
101101

102102
# Check if resource already exists
103+
_rid, _lvl = resource_id, admin_level
103104
existing_resource = self.resource_ids.filtered(
104-
lambda r: r.hdx_resource_id == resource_id or r.admin_level == admin_level
105+
lambda r, rid=_rid, lvl=_lvl: r.hdx_resource_id == rid or r.admin_level == lvl
105106
)
106107

107108
resource_vals = {

spp_area_hdx/tests/test_hdx_cod_source.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def setUp(self):
1818
self.source = self.env.ref("spp_area_hdx.cod_source_lka")
1919

2020
def test_compute_country_iso3(self):
21-
"""Test ISO3 code computation."""
22-
self.assertEqual(self.source.country_iso3, "LK")
21+
"""Test ISO3 code computation from hdx_dataset_id."""
22+
self.assertEqual(self.source.country_iso3, "LKA")
2323

2424
def test_unique_country_constraint(self):
2525
"""Test that only one source per country is allowed."""
@@ -31,13 +31,13 @@ def test_unique_country_constraint(self):
3131
}
3232
)
3333

34-
@patch("odoo.addons.spp_area_hdx.services.hdx_client.HdxClient.search_cod_datasets")
34+
@patch("odoo.addons.spp_area_hdx.services.hdx_client.HdxClient.get_dataset")
3535
@patch("odoo.addons.spp_area_hdx.services.hdx_client.HdxClient.get_geojson_resources")
3636
@patch("odoo.addons.spp_area_hdx.services.hdx_client.HdxClient.detect_admin_level")
37-
def test_action_sync_from_hdx(self, mock_detect_level, mock_get_resources, mock_search):
37+
def test_action_sync_from_hdx(self, mock_detect_level, mock_get_resources, mock_get_dataset):
3838
"""Test syncing resources from HDX."""
39-
# Mock HDX API responses
40-
mock_search.return_value = {
39+
# Mock HDX API responses — source has hdx_dataset_id set, so get_dataset is called
40+
mock_get_dataset.return_value = {
4141
"name": "cod-ab-lka",
4242
"title": "Sri Lanka Administrative Boundaries",
4343
}

0 commit comments

Comments
 (0)