Skip to content

Commit a9c2e5e

Browse files
committed
feat(spp_demo): add geographic demo data for Philippines, Sri Lanka, and Togo
- Add curated area hierarchies (region, province, municipality) per country - Add GeoJSON boundary shapes for choropleth visualization - Add demo area loader model and wizard for on-demand area data loading - Conditionally load GIS shapes when spp_gis is installed - Integrate geographic areas into demo story generation
1 parent 3258a93 commit a9c2e5e

26 files changed

Lines changed: 1723 additions & 568 deletions

spp_demo/README.rst

Lines changed: 73 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ OpenSPP Demo
1717
.. |badge1| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
1818
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
1919
:alt: License: LGPL-3
20-
.. |badge2| image:: https://img.shields.io/badge/github-OpenSPP%2FOpenSPP2-lightgray.png?logo=github
21-
:target: https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_demo
22-
:alt: OpenSPP/OpenSPP2
20+
.. |badge2| image:: https://img.shields.io/badge/github-OpenSPP%2Fopenspp--modules-lightgray.png?logo=github
21+
:target: https://github.com/OpenSPP/openspp-modules/tree/19.0/spp_demo
22+
:alt: OpenSPP/openspp-modules
2323

2424
|badge1| |badge2|
2525

@@ -32,42 +32,42 @@ for large datasets.
3232
Key Capabilities
3333
~~~~~~~~~~~~~~~~
3434

35-
- Generate random registrants using Faker library with locale-specific
36-
providers (Kenya, Laos, Sri Lanka)
37-
- Create fixed demo stories with memorable names for repeatable demos
38-
(e.g., "Maria Santos", "Juan Dela Cruz")
39-
- Generate IDs from regex patterns with validation and error logging
40-
- Batch process large datasets using queue_job (configurable threshold)
41-
- Configure percentages for IDs, GPS coordinates, and bank accounts
42-
- Track generation failures with diagnostic logging
43-
- Extend ``res.country`` with Faker locale and GPS boundaries
44-
- Create demo user accounts (viewer, officer, supervisor, manager,
45-
admin)
35+
- Generate random registrants using Faker library with locale-specific
36+
providers (Kenya, Laos, Sri Lanka)
37+
- Create fixed demo stories with memorable names for repeatable demos
38+
(e.g., "Maria Santos", "Juan Dela Cruz")
39+
- Generate IDs from regex patterns with validation and error logging
40+
- Batch process large datasets using queue_job (configurable threshold)
41+
- Configure percentages for IDs, GPS coordinates, and bank accounts
42+
- Track generation failures with diagnostic logging
43+
- Extend ``res.country`` with Faker locale and GPS boundaries
44+
- Create demo user accounts (viewer, officer, supervisor, manager,
45+
admin)
4646

4747
Key Models
4848
~~~~~~~~~~
4949

50-
+----------------------------------+-----------------------------------+
51-
| Model | Description |
52-
+==================================+===================================+
53-
| ``spp.demo.data.generator`` | Main generator with configuration |
54-
| | and batch controls |
55-
+----------------------------------+-----------------------------------+
56-
| ``spp.demo.data.generation.log`` | Logs failed generation attempts |
57-
| | with diagnostics |
58-
+----------------------------------+-----------------------------------+
59-
| ``spp.demo.data.id.types`` | ID type configuration for |
60-
| | individual/group generation |
61-
+----------------------------------+-----------------------------------+
62-
| ``spp.demo.data.bank.types`` | Bank type configuration for |
63-
| | account generation |
64-
+----------------------------------+-----------------------------------+
65-
| ``spp.apps.wizard`` | Wizard for installing missing |
66-
| | demo modules |
67-
+----------------------------------+-----------------------------------+
68-
| ``spp.missing.module`` | Transient model for tracking |
69-
| | missing modules |
70-
+----------------------------------+-----------------------------------+
50+
+----------------------------------+----------------------------------+
51+
| Model | Description |
52+
+==================================+==================================+
53+
| ``spp.demo.data.generator`` | Main generator with |
54+
| | configuration and batch controls |
55+
+----------------------------------+----------------------------------+
56+
| ``spp.demo.data.generation.log`` | Logs failed generation attempts |
57+
| | with diagnostics |
58+
+----------------------------------+----------------------------------+
59+
| ``spp.demo.data.id.types`` | ID type configuration for |
60+
| | individual/group generation |
61+
+----------------------------------+----------------------------------+
62+
| ``spp.demo.data.bank.types`` | Bank type configuration for |
63+
| | account generation |
64+
+----------------------------------+----------------------------------+
65+
| ``spp.apps.wizard`` | Wizard for installing missing |
66+
| | demo modules |
67+
+----------------------------------+----------------------------------+
68+
| ``spp.missing.module`` | Transient model for tracking |
69+
| | missing modules |
70+
+----------------------------------+----------------------------------+
7171

7272
Configuration
7373
~~~~~~~~~~~~~
@@ -77,9 +77,9 @@ After installing:
7777
1. Navigate to **Settings > General Settings > SPP Demo Data Generator
7878
Settings** to set defaults:
7979

80-
- Number of groups
81-
- Members per group range
82-
- Batch size and queue job threshold
80+
- Number of groups
81+
- Members per group range
82+
- Batch size and queue job threshold
8383

8484
2. Access generator via action ``spp_demo.action_demo_data_generator``
8585
(no standalone menu)
@@ -90,46 +90,47 @@ After installing:
9090
UI Location
9191
~~~~~~~~~~~
9292

93-
- **Action**: ``spp_demo.action_demo_data_generator`` (no standalone
94-
menu item)
95-
- **Configuration**: Settings > General Settings > SPP Demo Data
96-
Generator Settings
97-
- **Form tabs**: Generated Groups, Generated Individuals, ID Types, Bank
98-
Types, Generation Logs
93+
- **Action**: ``spp_demo.action_demo_data_generator`` (no standalone
94+
menu item)
95+
- **Configuration**: Settings > General Settings > SPP Demo Data
96+
Generator Settings
97+
- **Form tabs**: Generated Groups, Generated Individuals, ID Types,
98+
Bank Types, Generation Logs
9999

100100
Security
101101
~~~~~~~~
102102

103-
+----------------------------------------+----------------------------------+
104-
| Group | Access |
105-
+========================================+==================================+
106-
| ``base.group_system`` | Full CRUD on all models |
107-
+----------------------------------------+----------------------------------+
108-
| ``spp_registry.group_registry_read`` | Read access to all models |
109-
+----------------------------------------+----------------------------------+
110-
| ``spp_registry.group_registry_write`` | Read/Write on generator and logs |
111-
| | (delete ID/Bank types) |
112-
+----------------------------------------+----------------------------------+
113-
| ``spp_registry.group_registry_create`` | Read/Create access (delete |
114-
| | ID/Bank types) |
115-
+----------------------------------------+----------------------------------+
103+
+----------------------------------+----------------------------------+
104+
| Group | Access |
105+
+==================================+==================================+
106+
| ``base.group_system`` | Full CRUD on all models |
107+
+----------------------------------+----------------------------------+
108+
| ``sp | Read access to all models |
109+
| p_registry.group_registry_read`` | |
110+
+----------------------------------+----------------------------------+
111+
| ``spp | Read/Write on generator and logs |
112+
| _registry.group_registry_write`` | (delete ID/Bank types) |
113+
+----------------------------------+----------------------------------+
114+
| ``spp_ | Read/Create access (delete |
115+
| registry.group_registry_create`` | ID/Bank types) |
116+
+----------------------------------+----------------------------------+
116117

117118
Extension Points
118119
~~~~~~~~~~~~~~~~
119120

120-
- Override ``_create_individual_story()``, ``_create_farmer_story()``,
121-
``_create_household_story()`` for custom story generation
122-
- Add custom stories to ``models/demo_stories.py`` (``DEMO_STORIES`` or
123-
``BACKGROUND_STORIES`` lists)
124-
- Extend ``res.country`` with ``faker_locale`` field for custom locale
125-
providers
126-
- Use utility methods:
121+
- Override ``_create_individual_story()``, ``_create_farmer_story()``,
122+
``_create_household_story()`` for custom story generation
123+
- Add custom stories to ``models/demo_stories.py`` (``DEMO_STORIES`` or
124+
``BACKGROUND_STORIES`` lists)
125+
- Extend ``res.country`` with ``faker_locale`` field for custom locale
126+
providers
127+
- Use utility methods:
127128

128-
- ``create_individual_from_params(name, gender, age, extra_vals)`` -
129-
Create individual without full generator session
130-
- ``create_group_from_params(name, extra_vals)`` - Create group from
131-
parameters
132-
- ``lookup_gender_id(gender)`` - Look up gender vocabulary code ID
129+
- ``create_individual_from_params(name, gender, age, extra_vals)`` -
130+
Create individual without full generator session
131+
- ``create_group_from_params(name, extra_vals)`` - Create group from
132+
parameters
133+
- ``lookup_gender_id(gender)`` - Look up gender vocabulary code ID
133134

134135
Dependencies
135136
~~~~~~~~~~~~
@@ -147,10 +148,10 @@ External Python dependency: ``faker``
147148
Bug Tracker
148149
===========
149150

150-
Bugs are tracked on `GitHub Issues <https://github.com/OpenSPP/OpenSPP2/issues>`_.
151+
Bugs are tracked on `GitHub Issues <https://github.com/OpenSPP/openspp-modules/issues>`_.
151152
In case of trouble, please check there if your issue has already been reported.
152153
If you spotted it first, help us to smash it by providing a detailed and welcomed
153-
`feedback <https://github.com/OpenSPP/OpenSPP2/issues/new?body=module:%20spp_demo%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
154+
`feedback <https://github.com/OpenSPP/openspp-modules/issues/new?body=module:%20spp_demo%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
154155

155156
Do not contact contributors directly about support or help with technical issues.
156157

@@ -182,6 +183,6 @@ Current maintainers:
182183

183184
|maintainer-jeremi| |maintainer-gonzalesedwin1123| |maintainer-reichie020212| |maintainer-emjay0921|
184185

185-
This module is part of the `OpenSPP/OpenSPP2 <https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_demo>`_ project on GitHub.
186+
This module is part of the `OpenSPP/openspp-modules <https://github.com/OpenSPP/openspp-modules/tree/19.0/spp_demo>`_ project on GitHub.
186187

187188
You are welcome to contribute.

spp_demo/__manifest__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@
2121
- Sample user data
2222
- Demo stories for realistic test scenarios
2323
- Configuration settings for demo generation
24+
- Geographic demo data with curated areas for Philippines, Sri Lanka, and Togo
2425
2526
Features:
2627
- Locale providers for Kenya (en_KE, sw_KE), Laos (lo_LA), Sri Lanka (si_LK, ta_LK)
2728
- Configurable demo data generation
29+
- Country-specific geographic areas (Region, Province, Municipality, etc.)
30+
- Conditional GIS shape loading (when spp_gis is installed)
31+
- Demo stories with real geographic area assignments
2832
2933
This module provides the foundation for domain-specific demo modules:
3034
- spp_base_farmer_registry_demo (farmer-specific demo data)
@@ -40,6 +44,7 @@
4044
"spp_vocabulary",
4145
"queue_job",
4246
"spp_security",
47+
"spp_area",
4348
],
4449
"external_dependencies": {
4550
"python": ["faker"],
@@ -56,6 +61,7 @@
5661
"views/demo_data_generator_view.xml",
5762
# Wizards
5863
"wizard/apps_wizard_view.xml",
64+
"wizard/demo_area_loader_view.xml",
5965
],
6066
"assets": {},
6167
"demo": [],
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<odoo noupdate="1">
3+
<!-- Sri Lanka 4-Level Administrative Hierarchy
4+
Province -> District -> Divisional Secretariat (DS) Division -> Grama Niladhari (GN) Division
5+
-->
6+
7+
<record id="area_kind_lka_province" model="spp.area.type">
8+
<field name="name">Province</field>
9+
</record>
10+
11+
<record id="area_kind_lka_district" model="spp.area.type">
12+
<field name="name">District</field>
13+
<field name="parent_id" ref="area_kind_lka_province"/>
14+
</record>
15+
16+
<record id="area_kind_lka_ds_division" model="spp.area.type">
17+
<field name="name">DS Division</field>
18+
<field name="parent_id" ref="area_kind_lka_district"/>
19+
</record>
20+
21+
<record id="area_kind_lka_gn_division" model="spp.area.type">
22+
<field name="name">GN Division</field>
23+
<field name="parent_id" ref="area_kind_lka_ds_division"/>
24+
</record>
25+
</odoo>

0 commit comments

Comments
 (0)