Skip to content

Add an optional declaration to AnalyticFunctionSpec (ISSUE-170) - #517

Merged
dwolfson merged 2 commits into
odpi:mainfrom
dwolfson:feat/analytic-declaration
Oct 31, 2026
Merged

dwolfson merged 2 commits into
odpi:mainfrom
dwolfson:feat/analytic-declaration

Conversation

@dwolfson

Copy link
Copy Markdown
Member

Adds an optional declaration to AnalyticFunctionSpec, so an analytic function can say what its results mean (pyegeria/view/analytic_registry.py):

  • result_kind, from the fixed vocabulary RESULT_KINDS
  • measures, each with unit, as_of, value_field, optional basis (denominator field and label) and capped_field. Required for measure/series/distribution/graph.
  • absence: all four sentences (not_measured, not_permitted, not_applicable, measured_nothing)

This is the minimum of trellis-analytics' Declaration, with the same field names and vocabulary. Trellis's richer blocks (extents, confidence, answers, ...) are ignored, not refused. All 42 declarations in Resource Explorer's analysis_catalog.yaml validate. trellis's StepManifest already overrides the field with its own Declaration, which still works. The field is optional, so every existing entry loads unchanged.

Tests: tests/micro-tests/test_issue_170_analytic_declaration.py (10 tests: round-trip, registry payload, richer blocks accepted, five incomplete declarations refused with a sentence, unmeasured kinds). All micro-tests pass.

Note: this is one of four related PRs (ISSUE-169..172). Each adds an entry near the top of PYEGERIA_ISSUES.md, so whichever merges later needs a trivial conflict resolution there.

🤖 Generated with Claude Code

https://claude.ai/code/session_015pdMuPkqttD1yKAKJLS9Fc

An analytic function can now say what its results mean: result kind,
measures with unit, as-of and basis, and the four absence sentences.
It is the minimum of trellis-analytics' Declaration, with the same field
names, so trellis declarations validate here (all 42 in Resource
Explorer's analysis catalog do). Optional; existing entries unchanged.

Claude-Session: https://claude.ai/code/session_015pdMuPkqttD1yKAKJLS9Fc
Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
…ration

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>

# Conflicts:
#	PYEGERIA_ISSUES.md
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