@@ -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
3031Key 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
4744Key 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+ | `` | Abstract service: resolves |
62+ | spp.aggregation.scope.resolver`` | scopes to registrant IDs |
63+ +----------------------------------+----------------------------------+
64+ | ``spp. | Abstract service: dispatches |
65+ | aggregation.statistic.registry`` | statistic computation |
66+ +----------------------------------+----------------------------------+
7467
7568Configuration
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
8288Security
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
104107Dependencies
105108~~~~~~~~~~~~
0 commit comments