Skip to content

Say why an analytic result is absent instead of returning it as data (ISSUE-171) - #518

Merged
dwolfson merged 5 commits into
odpi:mainfrom
dwolfson:feat/state-aware-report-spec
Oct 31, 2026
Merged

dwolfson merged 5 commits into
odpi:mainfrom
dwolfson:feat/state-aware-report-spec

Conversation

@dwolfson

@dwolfson dwolfson commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Stacked on #517 (ISSUE-170) — merge that first; until then this PR's diff also shows its commit.

When an analytic function's result is not a measured value, exec_report_spec now says so instead of returning it as ordinary data or empty (pyegeria/view/format_set_executor.py):

  • not_established / not_applicable results return {"kind": "absent", "content": <sentence>, "absence": {...}, "envelope": {...}} on every output format. There is no top-level data; a partial result rides under detail.
  • nothing_found results keep their data or chart (real zeros) and gain the same absence block; a declared chart's subtitle is the measured_nothing sentence.
  • measured results, and results with no envelope, are unchanged.

absence holds the state, the sentence, the reason and declared. The sentence comes from the function's registered declaration.absence (ISSUE-170), looked up by registry name or by dotted path. A function with no declaration gets words built from its own reason, with declared: False. not_established becomes not_permitted only when the result says so ("absence": "not_permitted"); the reason text is never parsed.

Consumers: Egeria Advisor (trellis) should handle kind: "absent" explicitly; its fallback already shows content.

Tests: tests/micro-tests/test_issue_171_state_aware_report_spec.py (9 tests running each branch end to end), plus three ISSUE-140 tests updated to the new shape. 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>
…(ISSUE-171)

A not_established or not_applicable result now comes back from
exec_report_spec as kind "absent" with the function's declared absence
sentence (ISSUE-170), on every output format, with no top-level data; a
partial result rides under "detail". nothing_found keeps its data or
chart and carries the measured_nothing sentence. A function with no
declaration gets words built from its own reason, marked declared=False.
not_permitted is used only when the result claims it.

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
…-spec

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

# Conflicts:
#	PYEGERIA_ISSUES.md
…port-spec

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