esnet / esnet/pond

Suggested addition to rollup callendar intervals

Open
#179 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
211
Forks
42
PR merge metrics
No merged PRs in 30d

Description

Pond.js has some fantastic ease of use `TimeSeries` roll-up functions, but it does have support for iso standard weeks (Monday - Sunday), nor it seems the US/Canada non-standard Sunday-Saturday is supported.

From what I've gleaned the most proximate possibility is

```js
const ts = new TimeSeries(data);
const weekly = ts.fixedWindowRollup({ windowSize: '7d', aggregation: { in: { in: sum() } } });
```
But as the unix epoch wasn't on a Monday, nor Sunday for that matter, this splits the data in the middle of the week.

## Suggested interface

Using `fixedWindowRollup` for Monday - Sunday:
```js
const ts = new TimeSeries(data);
const weekly = ts.fixedWindowRollup({ windowSize: 'weekly', aggregation: { in: { in: sum() } } });
```

Using `fixedWindowRollup` for Sunday - Saturday, if such support should be included:
```js
const ts = new TimeSeries(data);
const weekly = ts.fixedWindowRollup({ windowSize: 'weekly-1', aggregation: { in: { in: sum() } } });
```
If non-standard Sunday - Saturday needs to be included, then probably all offsets should be as there's a variety of non-standard first days of the week around the world.

If a `weeklyRollup` method should be included, it's a bit unclear what the interface ought to be, but perhaps only a support of iso-weeks with `TimeSeries.weeklyRollup(options)`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at TimeSeries.fixedWindowRollup, where the issue demonstrates the current 7d behavior, and trace how windowSize values are interpreted. Before coding, settle whether the scope is ISO Monday–Sunday only or configurable week offsets; done means rollups align to the chosen week boundary without splitting a week.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.