Aggregation options for the Japan Explorer mission
The mission rule needs one number: Japan cities flown in the campaign window. The same rule can get it in three ways. Pick a member to compare.
Option 1: Built-in functions in the BRE
Runs in the BRE on every event
count(member.flownSectors, #.country == "JP" and date(#.flown) >= date(campaign.start) and date(#.flown) <= date(campaign.end))
Japan sectors in window
…
No rule fired
| Maintained by | BU team, in an expression box |
| Freshness | Up to date at each event |
| Data sent per evaluation | … |
| Evaluation time | … |
Option 2: Prepared at source (GCP)
Counted in GCP, sent in the daily sync
gcp.japanCitiesInWindow // computed in GCP from all UO data, // arrives with the daily sync
Japan cities in window
…
No rule fired
| Maintained by | UO data team for the count, BU team for the rule |
| Freshness | As of the last daily sync |
| Data sent per evaluation | … |
| Evaluation time | … |
Option 3: JavaScript function in the BRE
Runs in the BRE on every event
const cities = new Set(sectors
.filter((s) => s.country === "JP"
&& s.flown >= start && s.flown <= end)
.map((s) => s.city));
return { count: { japanCities: cities.size } };Japan cities in window
…
No rule fired
| Maintained by | Developer for the code, BU team for the rule |
| Freshness | Up to date at each event |
| Data sent per evaluation | … |
| Evaluation time | … |
What each option means to maintain
All three feed the same decision table. The difference is where the count lives and who looks after it.
| 1. Built-in functions | 2. Prepared at source | 3. JavaScript function | |
|---|---|---|---|
| Counts different values | No. Count, sum, average, min and max only | Yes, any logic the data team writes | Yes, any logic in code |
| History needed at runtime | Yes, sent with every event | No, one number | Yes, sent with every event |
| Reuse in reports and CDP | No, the count lives inside one rule | Yes, the same figure feeds dashboards and segments | No, the count lives inside one rule |
| Change needs | BU team, test and publish | Data team change in GCP | Developer, code review and test |