web / lib/services/aggregation-service
lib/services/aggregation-service
Service for executing event aggregation queries.
Uses PostgreSQL GROUP BY aggregation for high-performance event counting by catalog or dataset, with support for temporal, spatial, and field filters.
Type Aliases
GroupByField
GroupByField =
"catalog"|"dataset"
Supported groupBy field types.
Functions
executeAggregationQuery()
executeAggregationQuery(
payload,groupBy,filters,accessibleCatalogIds):Promise<{ items: object[]; total: number; groupedBy: string; }>
Execute PostgreSQL aggregation query.
Uses GROUP BY to aggregate event counts by the specified field, applying all filters in the WHERE clause for optimal performance.
When datasets are explicitly filtered, ensures all selected datasets appear in results (with 0 count if no events match in viewport).
Parameters
payload
BasePayload
groupBy
filters
CanonicalEventFilters
accessibleCatalogIds
number[]
Returns
Promise<{ items: object[]; total: number; groupedBy: string; }>