Skip to content

feat(overview-metrics): population= is the count keyword; scope= deprecated - #538

Merged
dwolfson merged 1 commit into
odpi:mainfrom
dwolfson:feat/population-keyword
Nov 7, 2026
Merged

dwolfson merged 1 commit into
odpi:mainfrom
dwolfson:feat/population-keyword

Conversation

@dwolfson

@dwolfson dwolfson commented Nov 7, 2026

Copy link
Copy Markdown
Member

The owner chose population (viewer | repository) as the word for which elements a count reads (RS-W1-1 §5, 2026-11-06). scope already means result level (resource, container, member, field) in the declaration model, so it couldn't be reused. The cells already carry population, and now the keywords match:

  • Count helpers: count_elements, count_elements_by_property, count_relationships, counts_by_type, business_value_signals, people_counts, feedback_summary and usage_context_counts take population=.
    • scope= still works but raises a DeprecationWarning.
    • Passing both with different values raises ValueError.
  • asset_composition: takes populations=, with scopes= kept as a deprecated alias. The result has a "populations" key, and keeps "scopes" with the same value.
  • Registry: asset_composition's parameter is now populations.

Every internal call uses population=, so pyegeria doesn't warn from inside its own code: the count tests pass with -W error::DeprecationWarning. There are 4 new micro-tests. On Python 3.13, 1,846 micro-tests run, with 0 failures.

There's no version bump; this ships in the next release with #537. After that release, the Portal's overview_handler.py switches from scopes=/countScope to the new words.

🤖 Generated with Claude Code

…ecated

The owner chose `population` ("viewer" | "repository") for which elements a
count reads (RS-W1-1 §5, 2026-11-06), because `scope` already means result
level (resource, container, member, field) in the declaration model. The
cells already carried `population`; the keywords now match:

- count_elements, count_elements_by_property, count_relationships,
  counts_by_type, business_value_signals, people_counts, feedback_summary
  and usage_context_counts take population=. scope= still works and warns
  (DeprecationWarning); passing both with different values is a ValueError.
- asset_composition takes populations=; scopes= is a deprecated alias.
  The result carries "populations" and keeps "scopes" with the same value.
- The registry declares asset_composition's parameter as `populations`.

Internal calls use population=, so nothing warns from inside pyegeria (the
count tests pass with -W error::DeprecationWarning). Four new micro-tests.
Micro-tests on 3.13: 1846 collected, 0 failed.

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
@dwolfson
dwolfson merged commit 3f1fa35 into odpi:main Nov 7, 2026
6 checks passed
dwolfson added a commit that referenced this pull request Nov 7, 2026
…S-W2-1a) (#539)

* feat(analytic-registry): mirror the library's §5 field vocabulary in the declaration model

RS-W2-1a step 1 (decision D2: trellis-analytics authors the vocabulary, pyegeria mirrors it).

- MeasureDeclaration: completeness_field replaces capped_field (still read, with a
  DeprecationWarning, as the library did in 0.3); population (viewer | repository);
  a basis on a share is refused, as in the library.
- FieldDeclaration / FieldCompanion (name, label, kind data|cell|representation|dataset,
  type, unit, companions, ...), AnalyticDeclaration.out, plus the categories and listing
  blocks the library requires for distribution/graph and list results.
- ROW_SHAPES: the row shapes built-in declarations name from a dataset field.
- asset_composition: categories (rows overlap), population and completeness on its
  measures, and an out field list.
- test_declarations_match_library.py: every built-in declaration loads as a library
  Declaration, its out as a library Shape; skipped when trellis_analytics is absent.
  Passes against egeria-trellis-analytics 0.3.1.

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

* feat(analytic-registry): declare the count routines; register count_relationships

RS-W2-1a, routines: count_elements, count_elements_by_property, count_relationships
(newly registered, decision D6), counts_by_type, sum_type_counts.

Each declares its measure (unit, as_of, value_field), the four nothing_found-vocabulary
absence sentences and its out fields; the count routines also list their population=
parameter (#538) and a cost class in the description, for W2-2's tile_safe.

What the functions return, worth knowing:
- count_elements / count_elements_by_property / counts_by_type return 0 when a count
  fails unless strict=True (ISSUE-123, by design, overview_metrics.py:383); sum_type_counts
  runs non-strict, so a failed type adds 0 to its total. Not changed here: strict= is the
  documented switch and the Portal relies on the default. Named in the PR.
- count_relationships' default path is one get_relationships page (DEFAULT_CAP): a type
  with more relationships than a page reads the page size, with no completeness flag
  (overview_metrics.py:499). Named in the PR.
- A bare-number result declares value_field "value", the key metric_trend already uses
  for a non-dict result.

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

* feat(analytic-registry): declare the coverage routines; ownership failure is None, not 0

RS-W2-1a, routines: governed_coverage, ownership_coverage, business_value_signals,
certifications_summary, semantic_grounding.

Fix in this commit: ownership_coverage used _find, which turns a failed query into an
empty list, so an outage reported ownershipCount 0 ("nothing owned") with
ownershipCapped False (overview_metrics.py:693 before this change). It now uses
_find_or_none and returns None for both, as governed_coverage already did. The Portal
assigns ownershipCount before dividing and catches the TypeError, so it shows no
number instead of 0; a successful call is unchanged.

What the functions return, worth knowing:
- governed_coverage and ownership_coverage are not restricted to Asset: they count
  elements of any type carrying the classification. The declarations say so ("elements
  of any type ..."); restricting them to Assets is a code change, named in the PR.
- certifications_summary's counts are each one get_relationships page with no
  completeness flag, like count_relationships.
- semantic_grounding's groundingPct is links per hundred Assets (capped at 100), not
  the share of Assets with a link; its unit says that.

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

* feat(analytic-registry): declare the people and engagement routines; contributors failure is None

RS-W2-1a, routines: people_counts, feedback_summary, usage_context_counts,
active_contributors, karma_leaderboard.

Fix in this commit: active_contributors turned a failed relationship query into an empty
set, so an outage read as 0 contributors for that type and a smaller union overall
(overview_metrics.py:1811 before this change). A failed type is now None in byType and
contributors is None unless every type was read, the rule feedback_summary's total
already follows. test_active_contributors_degrades_per_type_on_failure pinned the old 0
and now pins the None. Not called by the Portal's Overview.

What the functions return, worth knowing:
- people_counts and usage_context_counts run non-strict by default: a failed count is 0
  unless strict=True (ISSUE-123). Named in the PR, not changed.
- karma_leaderboard returns [] both when the find fails and when nobody has karma, so
  not_measured and nothing_found are indistinguishable in its result (overview_metrics.py:1480).
  Changing [] to None would change a list routine's shape for the Portal; named in the PR.
- active_contributors counts users from relationship audit headers (createdBy), viewer
  population, one capped page per type.

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

* feat(analytic-registry): declare the readiness routines; register drl and realisation; failures are None

RS-W2-1a, routines: context_readiness_funnel, ai_ready_assets, drl_readiness_gates
(newly registered, D6), contextualised_coverage, solution_component_realisation (newly
registered, D6).

Fixes in this commit, each a failed query that read as a measured 0:
- context_readiness_funnel: `documented` came from _find, which never raises, so its
  try/except never fired and a failed Asset find gave documented 0
  (overview_metrics.py:999 before). Now None.
- ai_ready_assets: a failed Asset find gave {aiReadyCount 0, total 0, capped False}, and a
  failed DataFlow query gave aiReadyCount 0 ("no asset is lineage-traced")
  (overview_metrics.py:1061/1075 before). Now None, keeping total/capped when only the
  DataFlow query failed. test_ai_ready_assets_lineage_query_failure... pinned the 0 and
  now pins the None.
- drl_readiness_gates: the same two failures (overview_metrics.py:1182/1196 before).
  Now every field None on an Asset-find failure; aiReadyCount/aiReadyRecentCount None on
  a DataFlow failure, keeping total, capped and byModality.
The Portal's ai-context endpoint already guards each of these with `if x:` / try, so it
shows no number instead of 0; successful calls are unchanged.

What the functions return, worth knowing:
- context_readiness_funnel's four stages are independent counts over different
  populations (Assets, elements of any type, relationships), not nested stages, and its
  `documented` stage has no completeness flag although it comes from one capped find.
- contextualised_coverage and solution_component_realisation turn a measured 0 total into
  None (`total or None`, overview_metrics.py:1381/1438): a real zero reads as unmeasured,
  the inverse bug. Not changed (it would change a success result); named in the PR.

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

* feat(analytic-registry): declare the series and attention routines; census: 0 undeclared

RS-W2-1a, routines: growth_series, engagement_series, metric_trend,
term_definition_completeness, orphan_glossary_terms, stale_assets,
control_implementation_summary. With these every one of the 28 registry entries
declares its results.

Fixes in this commit, each a failed find that read as a measured 0:
- term_definition_completeness: _find turned a failed find into an empty glossary,
  {total 0, defined 0} (overview_metrics.py:1757 before). Now all three fields None.
- stale_assets: staleCount 0 on a failed find (overview_metrics.py:926 before). Now None.
Neither is read by the Portal's Overview in a way that changes: staleAssetCount was
already None when the routine raised.

What the functions return, worth knowing:
- growth_series and metric_trend carry no per-point as-of time, only the formatted
  `date`/`label`; the series measures name `date`. growth_series' counts are non-strict,
  so a failed snapshot reads 0 per series.
- engagement_series zero-fills a type whose query failed, so an outage reads as a
  flat zero line (overview_metrics.py:1564). Changing that changes a list shape; named
  in the PR.
- stale_assets' staleCount comes from one capped find and its assetTotal from a native
  count, so they are not a part and its whole; no basis is declared between them.
- orphan_glossary_terms' termTotal is a non-strict count: a failed count is 0, and
  orphanCount then floors at 0 (overview_metrics.py:871/893). Named in the PR.

Also: every description now ends with its cost class ("Cost: ..."), so W2-2 can set
tile_safe from evidence. Only the 10.8 points are measured (repository counts
0.2-0.8 s; viewer count of Process 120 s); the rest are read from each routine's
query shape.

Tests (test_rs_w2_1a_routine_declarations.py): test_every_registry_entry_is_declared,
test_declared_value_fields_exist (each routine called with fake clients; every
value_field, completeness_field, basis denominator, as_of and out field resolves in
its real result), test_absence_sentences_use_the_four_words, kind blocks present, and a
failure test per 0 -> None fix.

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

---------

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
dwolfson added a commit that referenced this pull request Nov 7, 2026
Ships #537 (five link methods sent a properties class Egeria lacks),
#538 (population= is the count keyword; scope= deprecated), #539
(declarations for every registered routine), #540 and #541 (client
support and Dr.Egeria commands for Egeria 6.3 report specs,
measurements and dashboards), #542 (built-in declaration tests scoped to
pyegeria's own routines) and #543 (report_spec passed through the
MetadataExpert find methods).

Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
@dwolfson
dwolfson deleted the feat/population-keyword branch November 20, 2026 19:14
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