I want to write a custom bucketing function for a object set aggregation in a typescript function. Does anyone know if there is a way to do this similar to creating a custom aggregation?
https://www.palantir.com/docs/foundry/functions/create-custom-aggregation#create-a-custom-aggregation
In more detail, I want to segment the orders not by a week or day but into buckets of seven days starting at a base date. E.g., for the base date of Jun 3, I want to have buckets of June 3 - June 9, June 10 - June 16, June 17 - June 23, and so on.
The code I currently have is the following and I want to replace order.date.byWeek()
with the custom bucketing.
let ordersPromises = ordersSet.groupBy(orders => orders.country.topValues())
.segmentBy(orders => orders.date.byWeek())
.sum(orders => orders.quantity)
.then((orders) => {
return ... // Do some stuff on each set of orders
);
});