Skip to content

Commit 4854031

Browse files
authored
Merge pull request #99 from OpenSPP/fix/graduation-icon-and-precommit
fix(spp_graduation): add web_icon to Graduation menu
2 parents 31cf2d2 + 7f3f047 commit 4854031

7 files changed

Lines changed: 558 additions & 127 deletions

File tree

spp_aggregation/README.rst

Lines changed: 65 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -22,84 +22,87 @@ OpenSPP Aggregation Engine
2222

2323
|badge1| |badge2| |badge3|
2424

25-
Unified aggregation engine for computing statistics, breakdowns, and
26-
fairness metrics over scoped registrant populations. Supports multiple
27-
scope types (CEL expressions, areas, spatial queries, explicit IDs) with
28-
access control, caching, and privacy enforcement.
25+
Unified aggregation service that all consumers (simulation API, GIS API,
26+
dashboards) use to compute population statistics with demographic
27+
breakdowns and privacy enforcement. Resolves a scope (CEL expression,
28+
area, polygon, explicit IDs) to registrant IDs, computes requested
29+
statistics, applies k-anonymity suppression, and caches results.
2930

3031
Key Capabilities
3132
~~~~~~~~~~~~~~~~
3233

33-
- Define reusable aggregation scopes: CEL expression, area, area tag,
34-
spatial polygon/buffer, or explicit registrant IDs
35-
- Resolve scopes to registrant sets with union and intersection
36-
operations
37-
- Compute statistics (count, Gini) with extensible statistic registry
38-
supporting CEL variables
39-
- Role-based access control with per-user scope type restrictions,
40-
dimension limits, and area constraints
41-
- Result caching with configurable TTL per scope type and automatic
42-
cleanup
43-
- Privacy enforcement via k-anonymity suppression on computed results
44-
- Convenience methods for area-based, expression-based, fairness, and
45-
distribution queries
34+
- Single entry point (``spp.aggregation.service.compute_aggregation``)
35+
for all analytics queries
36+
- Scope resolution: CEL expressions, admin areas, area tags, spatial
37+
polygons/buffers, explicit IDs
38+
- Multi-dimensional breakdown (up to 3 dimensions) using demographic
39+
dimensions
40+
- Result caching with configurable TTL and manual invalidation
41+
- Per-user access rules controlling scope types, dimensions, and
42+
k-anonymity thresholds
4643

4744
Key Models
4845
~~~~~~~~~~
4946

50-
+----------------------------+----------+----------------------------+
51-
| Model | Type | Description |
52-
+============================+==========+============================+
53-
| ``spp.aggregation.scope`` | Concrete | Configurable aggregation |
54-
| | | scope definitions |
55-
+----------------------------+----------+----------------------------+
56-
| ``spp | Concrete | Per-user/group access |
57-
| .aggregation.access.rule`` | | control rules |
58-
+----------------------------+----------+----------------------------+
59-
| ``spp | Concrete | Persistent cache entries |
60-
| .aggregation.cache.entry`` | | with TTL |
61-
+----------------------------+----------+----------------------------+
62-
| ``spp.ag | Abstract | Strategy-based scope |
63-
| gregation.scope.resolver`` | | resolution service |
64-
+----------------------------+----------+----------------------------+
65-
| ``spp.aggregation.cache`` | Abstract | Cache service with TTL and |
66-
| | | cleanup |
67-
+----------------------------+----------+----------------------------+
68-
| ``spp.aggreg | Abstract | Statistic computation |
69-
| ation.statistic.registry`` | | registry (builtins + CEL) |
70-
+----------------------------+----------+----------------------------+
71-
| ` | Abstract | Main aggregation entry |
72-
| `spp.aggregation.service`` | | point |
73-
+----------------------------+----------+----------------------------+
47+
+----------------------------------------+----------------------------------+
48+
| Model | Description |
49+
+========================================+==================================+
50+
| ``spp.aggregation.scope`` | Defines what to aggregate (CEL, |
51+
| | area, polygon, explicit IDs) |
52+
+----------------------------------------+----------------------------------+
53+
| ``spp.aggregation.access.rule`` | Per-user/group access level, |
54+
| | scope restrictions, k-threshold |
55+
+----------------------------------------+----------------------------------+
56+
| ``spp.aggregation.cache.entry`` | Cached aggregation results |
57+
+----------------------------------------+----------------------------------+
58+
| ``spp.aggregation.service`` | Abstract service: main |
59+
| | aggregation entry point |
60+
+----------------------------------------+----------------------------------+
61+
| ``spp.aggregation.scope.resolver`` | Abstract service: resolves |
62+
| | scopes to registrant IDs |
63+
+----------------------------------------+----------------------------------+
64+
| ``spp.aggregation.statistic.registry`` | Abstract service: dispatches |
65+
| | statistic computation |
66+
+----------------------------------------+----------------------------------+
7467

7568
Configuration
7669
~~~~~~~~~~~~~
7770

78-
- Aggregation scopes: **Settings > Aggregation > Aggregation Scopes**
79-
- Access rules: **Settings > Aggregation > Access Rules**
80-
- Cache cleanup runs daily via scheduled action
71+
After installing:
72+
73+
1. Navigate to **Settings > Aggregation > Configuration > Scopes** to
74+
define reusable scopes
75+
2. Configure **Access Rules** to set per-user/group privacy levels and
76+
scope restrictions
77+
3. Verify the **Cache Cleanup** scheduled action is active under
78+
**Settings > Technical > Scheduled Actions**
79+
80+
UI Location
81+
~~~~~~~~~~~
82+
83+
- **Menu**: Settings > Aggregation > Configuration > Scopes
84+
- **Menu**: Settings > Aggregation > Configuration > Demographic
85+
Dimensions
86+
- **Menu**: Settings > Aggregation > Configuration > Access Rules
8187

8288
Security
8389
~~~~~~~~
8490

85-
+----------------------------------+----------------------------------+
86-
| Group | Access |
87-
+==================================+==================================+
88-
| ``spp_aggr | Read-only access to scopes and |
89-
| egation.group_aggregation_read`` | cache |
90-
+----------------------------------+----------------------------------+
91-
| ``spp_aggre | Read/write scopes and access |
92-
| gation.group_aggregation_write`` | rules |
93-
+----------------------------------+----------------------------------+
94-
| ``spp_aggreg | Implied by write group |
95-
| ation.group_aggregation_viewer`` | |
96-
+----------------------------------+----------------------------------+
97-
| ``spp_aggrega | Implied by viewer group |
98-
| tion.group_aggregation_officer`` | |
99-
+----------------------------------+----------------------------------+
100-
| ``spp_aggrega | Full access, implied by admin |
101-
| tion.group_aggregation_manager`` | |
102-
+----------------------------------+----------------------------------+
91+
============================= =============================
92+
Group Access
93+
============================= =============================
94+
``group_aggregation_read`` Read scopes and cache entries
95+
``group_aggregation_write`` Full CRUD on scopes and cache
96+
``group_aggregation_manager`` Full CRUD on access rules
97+
============================= =============================
98+
99+
Extension Points
100+
~~~~~~~~~~~~~~~~
101+
102+
- Add new scope types by extending ``spp.aggregation.scope`` and
103+
``spp.aggregation.scope.resolver``
104+
- Register custom statistics via ``spp.aggregation.statistic.registry``
105+
- Override ``_compute_single_statistic()`` for custom computation logic
103106

104107
Dependencies
105108
~~~~~~~~~~~~

spp_api_v2_simulation/README.rst

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
======================
2+
OpenSPP Simulation API
3+
======================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:341a99619ee4fc6dc0669b84803de47b0cf14405275a60681952e5cf1eb6025f
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Production/Stable
16+
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
18+
:alt: License: LGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OpenSPP%2FOpenSPP2-lightgray.png?logo=github
20+
:target: https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_api_v2_simulation
21+
:alt: OpenSPP/OpenSPP2
22+
23+
|badge1| |badge2| |badge3|
24+
25+
FastAPI-based REST endpoints for simulation scenario management,
26+
execution, comparison, and population aggregation. Provides external
27+
systems (dashboards, mobile apps, third-party tools) programmatic access
28+
to the simulation and analytics engine.
29+
30+
Key Capabilities
31+
~~~~~~~~~~~~~~~~
32+
33+
- CRUD operations on simulation scenarios with entitlement rules
34+
- Execute simulations and retrieve run results (distribution, fairness,
35+
geographic data)
36+
- Compare multiple simulation runs side-by-side with overlap analysis
37+
- Compute population aggregation with demographic breakdowns via the
38+
aggregation engine
39+
- List available demographic dimensions and scenario templates
40+
- Convert simulation scenarios to real programs
41+
42+
API Endpoints
43+
~~~~~~~~~~~~~
44+
45+
+--------+-----------------------------+-----------------------------+
46+
| Method | Path | Description |
47+
+========+=============================+=============================+
48+
| GET | ``/simulation/scenarios`` | List scenarios |
49+
+--------+-----------------------------+-----------------------------+
50+
| POST | ``/simulation/scenarios`` | Create scenario |
51+
+--------+-----------------------------+-----------------------------+
52+
| GET | ``/ | Get scenario details |
53+
| | simulation/scenarios/{id}`` | |
54+
+--------+-----------------------------+-----------------------------+
55+
| PUT | ``/ | Update draft scenario |
56+
| | simulation/scenarios/{id}`` | |
57+
+--------+-----------------------------+-----------------------------+
58+
| DELETE | ``/ | Archive scenario |
59+
| | simulation/scenarios/{id}`` | |
60+
+--------+-----------------------------+-----------------------------+
61+
| POST | ``/simula | Mark scenario ready |
62+
| | tion/scenarios/{id}/ready`` | |
63+
+--------+-----------------------------+-----------------------------+
64+
| POST | ``/simu | Execute simulation |
65+
| | lation/scenarios/{id}/run`` | |
66+
+--------+-----------------------------+-----------------------------+
67+
| POST | ``/simulation/scenario | Convert to program |
68+
| | s/{id}/convert-to-program`` | |
69+
+--------+-----------------------------+-----------------------------+
70+
| GET | ``/simulation/runs`` | List runs |
71+
+--------+-----------------------------+-----------------------------+
72+
| GET | ``/simulation/runs/{id}`` | Get run with optional |
73+
| | | details |
74+
+--------+-----------------------------+-----------------------------+
75+
| POST | ``/simulation/comparisons`` | Create run comparison |
76+
+--------+-----------------------------+-----------------------------+
77+
| GET | ``/si | Get comparison |
78+
| | mulation/comparisons/{id}`` | |
79+
+--------+-----------------------------+-----------------------------+
80+
| GET | ``/simulation/templates`` | List scenario templates |
81+
+--------+-----------------------------+-----------------------------+
82+
| POST | ``/aggregation/compute`` | Compute population |
83+
| | | aggregation |
84+
+--------+-----------------------------+-----------------------------+
85+
| GET | ``/aggregation/dimensions`` | List demographic dimensions |
86+
+--------+-----------------------------+-----------------------------+
87+
88+
OAuth Scopes
89+
~~~~~~~~~~~~
90+
91+
====================== ====================================
92+
Scope Operations
93+
====================== ====================================
94+
``simulation:read`` List/get scenarios, runs, templates
95+
``simulation:write`` Create/update/archive scenarios
96+
``simulation:execute`` Run simulations
97+
``simulation:convert`` Convert scenario to program
98+
``aggregation:read`` Compute aggregation, list dimensions
99+
====================== ====================================
100+
101+
UI Location
102+
~~~~~~~~~~~
103+
104+
No standalone menu; API-only module.
105+
106+
Dependencies
107+
~~~~~~~~~~~~
108+
109+
``spp_api_v2``, ``spp_simulation``, ``spp_aggregation``
110+
111+
**Table of contents**
112+
113+
.. contents::
114+
:local:
115+
116+
Bug Tracker
117+
===========
118+
119+
Bugs are tracked on `GitHub Issues <https://github.com/OpenSPP/OpenSPP2/issues>`_.
120+
In case of trouble, please check there if your issue has already been reported.
121+
If you spotted it first, help us to smash it by providing a detailed and welcomed
122+
`feedback <https://github.com/OpenSPP/OpenSPP2/issues/new?body=module:%20spp_api_v2_simulation%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
123+
124+
Do not contact contributors directly about support or help with technical issues.
125+
126+
Credits
127+
=======
128+
129+
Authors
130+
-------
131+
132+
* OpenSPP.org
133+
134+
Maintainers
135+
-----------
136+
137+
.. |maintainer-jeremi| image:: https://github.com/jeremi.png?size=40px
138+
:target: https://github.com/jeremi
139+
:alt: jeremi
140+
.. |maintainer-gonzalesedwin1123| image:: https://github.com/gonzalesedwin1123.png?size=40px
141+
:target: https://github.com/gonzalesedwin1123
142+
:alt: gonzalesedwin1123
143+
.. |maintainer-reichie020212| image:: https://github.com/reichie020212.png?size=40px
144+
:target: https://github.com/reichie020212
145+
:alt: reichie020212
146+
147+
Current maintainers:
148+
149+
|maintainer-jeremi| |maintainer-gonzalesedwin1123| |maintainer-reichie020212|
150+
151+
This module is part of the `OpenSPP/OpenSPP2 <https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_api_v2_simulation>`_ project on GitHub.
152+
153+
You are welcome to contribute.

spp_graduation/views/graduation_menus.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
id="menu_graduation_root"
66
name="Graduation"
77
sequence="60"
8+
web_icon="spp_graduation,static/description/openspp-graduation-menu-icons.png"
89
groups="group_spp_graduation_user"
910
/>
1011

spp_metrics_core/README.rst

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,63 @@ OpenSPP Metrics Core
2222

2323
|badge1| |badge2| |badge3|
2424

25-
Unified metric foundation providing abstract base models for statistics,
26-
simulations, and reporting across OpenSPP modules.
25+
Shared foundation for all metric types in OpenSPP (statistics,
26+
simulation metrics, and custom domain metrics). Provides an abstract
27+
base model with identity, presentation, and categorization fields, plus
28+
a hierarchical category system. Concrete metric modules inherit from the
29+
base and add their own computation fields.
2730

2831
Key Capabilities
2932
~~~~~~~~~~~~~~~~
3033

31-
- Abstract base model for defining reusable metrics with label, unit,
32-
and decimal precision
33-
- Hierarchical metric categories with unique code constraints
34-
- Category tree with parent-child recursion prevention
35-
- Default metric categories for population, coverage, targeting, and
36-
distribution
34+
- Abstract base model (``spp.metric.base``) with shared identity,
35+
presentation, and metadata fields
36+
- Hierarchical metric category system with unique codes
37+
- Default categories: Demographics, Vulnerability, Programs, Geographic,
38+
Economic, Fairness
3739

3840
Key Models
3941
~~~~~~~~~~
4042

41-
+-------------------------+----------+----------------------------+
42-
| Model | Type | Description |
43-
+=========================+==========+============================+
44-
| ``spp.metric.base`` | Abstract | Base fields and logic |
45-
| | | inherited by concrete |
46-
| | | metrics |
47-
+-------------------------+----------+----------------------------+
48-
| ``spp.metric.category`` | Concrete | Hierarchical grouping of |
49-
| | | metrics by domain |
50-
+-------------------------+----------+----------------------------+
43+
+-------------------------+--------------------------------------------+
44+
| Model | Description |
45+
+=========================+============================================+
46+
| ``spp.metric.base`` | Abstract model inherited by all concrete |
47+
| | metric types |
48+
+-------------------------+--------------------------------------------+
49+
| ``spp.metric.category`` | Hierarchical categorization for organizing |
50+
| | metrics |
51+
+-------------------------+--------------------------------------------+
5152

5253
Configuration
5354
~~~~~~~~~~~~~
5455

55-
No configuration required. Default categories are created via data files
56-
on install.
56+
After installing, default metric categories are created automatically.
57+
Add custom categories via **Settings > Technical > Metric Categories**
58+
or in XML data files.
59+
60+
UI Location
61+
~~~~~~~~~~~
62+
63+
No standalone menu; library module consumed by ``spp_statistic``,
64+
``spp_simulation``, and other metric modules.
65+
66+
Security
67+
~~~~~~~~
68+
69+
===================== =======================
70+
Group Access
71+
===================== =======================
72+
``base.group_user`` Read categories
73+
``base.group_system`` Full CRUD on categories
74+
===================== =======================
75+
76+
Extension Points
77+
~~~~~~~~~~~~~~~~
78+
79+
- Inherit ``spp.metric.base`` to create domain-specific metric models
80+
- Add custom categories via XML data records referencing
81+
``spp.metric.category``
5782

5883
Dependencies
5984
~~~~~~~~~~~~

0 commit comments

Comments
 (0)