Event Data Integration
Contents
Event Data Integration#
Module: spp_cel_event
Overview#
Integrate event data with CEL expressions for eligibility and entitlement rules
Purpose#
This module is designed to:
Query event data in CEL expressions: Enable CEL expressions to access, filter, and compare values from event data records for eligibility and entitlement rules.
Aggregate event data: Provide count, sum, average, min, and max aggregation functions over event records within CEL expressions.
Support temporal filtering: Allow CEL expressions to filter events by named periods (year, quarter, month, week), relative ranges (within N days/months), and explicit date boundaries.
Module Dependencies#
Dependency |
Purpose |
|---|---|
|
Write simple CEL-like expressions to filter records (Open... |
|
Records and tracks events related to individual and group... |
|
No-code customization interface for OpenSPP |
Key Features#
Event Access Functions#
CEL expressions can access event data using the following functions:
Function |
Description |
Example |
|---|---|---|
|
Get a field value from a registrant's event |
|
|
Check if a matching event exists |
|
|
Count matching events |
|
|
Sum a field across events |
|
|
Average a field across events |
|
|
Minimum field value across events |
|
|
Maximum field value across events |
|
Event Selection Modes#
When multiple events match, the select parameter controls which event is used:
Mode |
Behavior |
|---|---|
|
Uses |
|
Only active events |
|
Most recent event regardless of state |
|
Most recent active event |
|
Oldest event |
|
Any matching event |
Temporal Filters#
Events can be filtered by time using parameters on event functions:
Parameter |
Description |
Example |
|---|---|---|
|
Named period string |
|
|
Events within last N days |
|
|
Events within last N months |
|
|
Events on or after a date |
|
|
Events on or before a date |
|
Period Helper Functions#
Dynamic period generators for use within CEL expressions:
Function |
Returns |
Example Output |
|---|---|---|
|
Current year |
|
|
Previous year |
|
|
Current quarter |
|
|
Previous quarter |
|
|
Current month |
|
|
Previous month |
|
|
N quarters back |
|
|
N months back |
|
Period strings support these formats: YYYY, YYYY-QN, YYYY-HN, YYYY-MM, YYYY-WNN.
CEL Variable Event Aggregation#
Extends the CEL variable configuration UI to support event-based aggregations. Users can create variables that aggregate over event data by selecting an event type, aggregation function, time range, and field.
Optimized Execution#
The executor uses SQL fast paths for supported operations (simple comparisons, standard aggregations) and falls back to Python evaluation for complex cases such as default values or where predicates.
Integration#
spp_cel_domain: Extends the CEL translator and executor to handle event-specific query plan nodes (
EventValueCompare,EventExists,EventsAggregate).spp_event_data: Queries
spp.event.datarecords andspp.event.typeconfiguration for selection mode resolution.spp_studio: Extends the CEL variable form to include event aggregation configuration fields. Auto-installs when all three dependencies are present.
openspp.org