Skip to content

Aggregation API

Source: /Aggregation-API/

Overview

AdonisJS 5 application that uses DuckDB in-memory to query legacy Parquet files stored at PARQUET_SUMMARIES. Serves as a read-only analytics query service for the legacy pipeline.

The Backend proxies requests to this service via RelayService with x-auth-token header.

Parquet File Schemas

v3/creative/hourly-buckets

16 metric columns defined in BucketValidator.ts (ALL_METRICS):

impressions, interacted, started, continued, creative_actions, link_clicks, header_clicks, background_clicks, reached_end, plays, watched_25, watched_50, watched_75, watched_100, viewable_impressions, seconds_in_view

v3/flow/hourly-buckets

creative_id, object_id, hits

v3/creative/daily-buckets-with-domain-dsp

Same metrics as hourly-buckets plus domain, dsp, day_bucket columns.

Endpoints

EndpointPurposeKey Query
/v5/countsSummary counts (impressions, started, interacted)SUM() from hourly-buckets grouped by resource
/v5/bucketsTime-series data for chartsTime scaffold + LEFT JOIN with COALESCE to 0
/v5/flowFlow node analyticsSUM(hits) per object_id, reconstructed by FlowParser
/v5/domainsDomain/DSP breakdownAll metrics from daily-buckets-with-domain-dsp
/v5/exports/csvCSV export with rate columnsAdds computed rate columns
/v5/activityFirst/last active datesMIN/MAX(day_bucket)
/v5/creativesFilter by impression thresholdHAVING SUM(impressions) > threshold

Rate Formulas (CSV Exports)

RateFormula
rate_interactedinteracted / impressions * 100
rate_creative_actionscreative_actions / impressions * 100
rate_playsplays / impressions * 100
rate_watched_25/50/75/100watched_X / impressions * 100

Key Files

FilePurpose
app/Validators/BucketValidator.tsALL_METRICS array defining valid metric columns
app/Controllers/Http/v5/FlowController.tsFlow analytics with FlowParser
app/Controllers/Http/v5/DomainsController.tsDomain/DSP breakdown
app/Controllers/Http/v5/ExportsController.tsCSV export with computed rates
app/Controllers/Http/v5/ActivityController.tsFirst/last active dates
app/Helpers/FlowParser.tsReconstructs flow tree from flat hits data

Internal documentation