You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ossie.apache.org by "lanvendar (via GitHub)" <gi...@apache.org> on 2026/07/20 09:06:40 UTC

Re: [D] Top level "mertics" vs. dataset-level “measure”s [ossie]

GitHub user lanvendar added a comment to the discussion: Top level "mertics" vs. dataset-level “measure”s

I agree with treating all of these as **Metrics**. A Measure looks more like one way to construct a Metric than a separate, peer-level business object.

If we keep a flat discriminator, I would call the calculation-plus-filter case **`SCOPED_AGGREGATE`**. “Scoped” communicates that the aggregation is evaluated over a constrained data scope. I would also use `AGGREGATE` rather than `CALCULATE` for the calculation-only case.

A direct classification could be:

```text
Metric
├── AGGREGATE          aggregation only
├── FILTERED           an existing Metric plus a filter
├── SCOPED_AGGREGATE   aggregation plus a filter
└── DERIVED            a formula over other Metrics
```

I would prefer the discriminator name `metric_kind` rather than `metric_type`, because `metric_type` may later be useful for business types such as amount, ratio, quantity, or balance.

One important constraint is that a filter alone cannot produce a value, so a `FILTERED` Metric must reference a `base_metric`. Also, these should not be modeled as several unrelated optional fields such as `calculate?`, `filter?`, and `formula?`. That permits both an empty Metric and conflicting definitions. Instead, `Metric.definition` should be required and modeled as a discriminated union—conceptually a JSON Schema `oneOf`.

However, my preferred design is an expression tree rather than introducing a new Metric kind for every combination:

```text
aggregation:              Aggregate(...)
filtered metric:          Filter(MetricRef(...), predicate)
filtered aggregation:     Filter(Aggregate(...), predicate)
derived metric:           Formula(MetricRef(...), MetricRef(...))
```

In that model, “calculation plus filtering” is simply `Filter(Aggregate(...), predicate)`, so `SCOPED_AGGREGATE` is no longer needed as an atomic type.

This structure also scales better. Future operations such as `cumulative(...)`, `period_over_period(...)`, `rank(...)`, and `time_shift(...)` can be added as expression nodes, without creating a new `MetricType` for every combination of capabilities.

GitHub link: https://github.com/apache/ossie/discussions/29#discussioncomment-17698599

----
This is an automatically sent email for dev@ossie.apache.org.
To unsubscribe, please send an email to: dev-unsubscribe@ossie.apache.org