Skip to content

feat: support calculated_measures and .all() in YAML config#206

Open
boringdata wants to merge 2 commits intomainfrom
fix/yaml-calculated-measures
Open

feat: support calculated_measures and .all() in YAML config#206
boringdata wants to merge 2 commits intomainfrom
fix/yaml-calculated-measures

Conversation

@boringdata
Copy link
Owner

Summary

Example

measures:
  total_distance: _.distance.sum()
calculated_measures:
  avg_per_flight:
    expr: _.total_distance / _.flight_count
  pct_of_total:
    expr: _.total_distance / _.all(_.total_distance) * 100

Test plan

  • test_yaml_calculated_measures — calc measures via YAML config
  • test_yaml_calculated_measures_simple_format — simple string format
  • test_yaml_all_window_aggregation.all() percent-of-total in YAML

🤖 Generated with Claude Code

Add `calculated_measures` section to YAML schema for derived metrics
that reference other measures by name. Expressions are evaluated at
runtime against MeasureScope, which also enables `.all()` for
percent-of-total window aggregation patterns.

Closes #202, closes #115

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@boringdata
Copy link
Owner Author

Codex Review Summary

Codex (gpt-5.3-codex) reviewed this PR. The review findings were about proxy fallback code that is not part of this PR (the reviewer's checkout included files from PR #207).

This PR only modifies yaml.py (calculated_measures parsing, .all() support) and tests. No issues found with the actual changes. All 37 YAML tests passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant