Skip to content

Commit 839f83e

Browse files
authored
Merge pull request #91 from OpenSPP/fix/alpha-to-beta-aggregation-metrics
chore(metrics,aggregation): promote to Beta with coverage tests
2 parents 5ba2bb7 + 90939c5 commit 839f83e

File tree

18 files changed

+2343
-3
lines changed

18 files changed

+2343
-3
lines changed

spp_aggregation/README.rst

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
==========================
2+
OpenSPP Aggregation Engine
3+
==========================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:9951d094574dd68b1d86ae2167e53c5ccea5240188acf11a2b7f619ede6c5b54
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
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_aggregation
21+
:alt: OpenSPP/OpenSPP2
22+
23+
|badge1| |badge2| |badge3|
24+
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.
29+
30+
Key Capabilities
31+
~~~~~~~~~~~~~~~~
32+
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
46+
47+
Key Models
48+
~~~~~~~~~~
49+
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+
+----------------------------+----------+----------------------------+
74+
75+
Configuration
76+
~~~~~~~~~~~~~
77+
78+
- Aggregation scopes: **Settings > Aggregation > Aggregation Scopes**
79+
- Access rules: **Settings > Aggregation > Access Rules**
80+
- Cache cleanup runs daily via scheduled action
81+
82+
Security
83+
~~~~~~~~
84+
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+
+----------------------------------+----------------------------------+
103+
104+
Dependencies
105+
~~~~~~~~~~~~
106+
107+
``base``, ``spp_cel_domain``, ``spp_area``, ``spp_registry``,
108+
``spp_security``, ``spp_metrics_services``
109+
110+
**Table of contents**
111+
112+
.. contents::
113+
:local:
114+
115+
Bug Tracker
116+
===========
117+
118+
Bugs are tracked on `GitHub Issues <https://github.com/OpenSPP/OpenSPP2/issues>`_.
119+
In case of trouble, please check there if your issue has already been reported.
120+
If you spotted it first, help us to smash it by providing a detailed and welcomed
121+
`feedback <https://github.com/OpenSPP/OpenSPP2/issues/new?body=module:%20spp_aggregation%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
122+
123+
Do not contact contributors directly about support or help with technical issues.
124+
125+
Credits
126+
=======
127+
128+
Authors
129+
-------
130+
131+
* OpenSPP.org
132+
133+
Maintainers
134+
-----------
135+
136+
.. |maintainer-jeremi| image:: https://github.com/jeremi.png?size=40px
137+
:target: https://github.com/jeremi
138+
:alt: jeremi
139+
140+
Current maintainer:
141+
142+
|maintainer-jeremi|
143+
144+
This module is part of the `OpenSPP/OpenSPP2 <https://github.com/OpenSPP/OpenSPP2/tree/19.0/spp_aggregation>`_ project on GitHub.
145+
146+
You are welcome to contribute.

spp_aggregation/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"author": "OpenSPP.org",
99
"website": "https://github.com/OpenSPP/OpenSPP2",
1010
"license": "LGPL-3",
11-
"development_status": "Alpha",
11+
"development_status": "Beta",
1212
"maintainers": ["jeremi"],
1313
"depends": [
1414
"base",
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Unified aggregation engine for computing statistics, breakdowns, and fairness metrics over scoped registrant populations. Supports multiple scope types (CEL expressions, areas, spatial queries, explicit IDs) with access control, caching, and privacy enforcement.
2+
3+
### Key Capabilities
4+
5+
- Define reusable aggregation scopes: CEL expression, area, area tag, spatial polygon/buffer, or explicit registrant IDs
6+
- Resolve scopes to registrant sets with union and intersection operations
7+
- Compute statistics (count, Gini) with extensible statistic registry supporting CEL variables
8+
- Role-based access control with per-user scope type restrictions, dimension limits, and area constraints
9+
- Result caching with configurable TTL per scope type and automatic cleanup
10+
- Privacy enforcement via k-anonymity suppression on computed results
11+
- Convenience methods for area-based, expression-based, fairness, and distribution queries
12+
13+
### Key Models
14+
15+
| Model | Type | Description |
16+
| ---------------------------------- | -------- | ------------------------------------------------- |
17+
| `spp.aggregation.scope` | Concrete | Configurable aggregation scope definitions |
18+
| `spp.aggregation.access.rule` | Concrete | Per-user/group access control rules |
19+
| `spp.aggregation.cache.entry` | Concrete | Persistent cache entries with TTL |
20+
| `spp.aggregation.scope.resolver` | Abstract | Strategy-based scope resolution service |
21+
| `spp.aggregation.cache` | Abstract | Cache service with TTL and cleanup |
22+
| `spp.aggregation.statistic.registry` | Abstract | Statistic computation registry (builtins + CEL) |
23+
| `spp.aggregation.service` | Abstract | Main aggregation entry point |
24+
25+
### Configuration
26+
27+
- Aggregation scopes: **Settings > Aggregation > Aggregation Scopes**
28+
- Access rules: **Settings > Aggregation > Access Rules**
29+
- Cache cleanup runs daily via scheduled action
30+
31+
### Security
32+
33+
| Group | Access |
34+
| --------------------------------------- | ----------------------------------------- |
35+
| `spp_aggregation.group_aggregation_read` | Read-only access to scopes and cache |
36+
| `spp_aggregation.group_aggregation_write` | Read/write scopes and access rules |
37+
| `spp_aggregation.group_aggregation_viewer` | Implied by write group |
38+
| `spp_aggregation.group_aggregation_officer` | Implied by viewer group |
39+
| `spp_aggregation.group_aggregation_manager` | Full access, implied by admin |
40+
41+
### Dependencies
42+
43+
`base`, `spp_cel_domain`, `spp_area`, `spp_registry`, `spp_security`, `spp_metrics_services`
15.1 KB
Loading

spp_aggregation/tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@
1212
from . import test_scope_builder
1313
from . import test_scope_resolver
1414
from . import test_statistic_registry
15+
from . import test_coverage

0 commit comments

Comments
 (0)