Repository navigation
feat(analytic-registry): declarations for every registered routine (RS-W2-1a) - #539
Merged
Merged
Conversation
…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>
…elationships 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 (odpi#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>
…lure 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>
…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>
… 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>
…ensus: 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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RS-W2-1a (Wave 2 delivery step (a), pyegeria half). Every routine in
analytic_registrynow declares what it returns: measures with unit and as-of, the fournothing_found-vocabulary absence sentences, and anoutfield list in the §5 vocabulary. Decisions applied: D1 (declarations stay as Python literals beside each entry), D2 (the model mirrors egeria-trellis-analytics; a cross-validation test checks it), D6 (count_relationships,drl_readiness_gatesandsolution_component_realisationare registered and declared).Census: 0 undeclared of 28 entries (the 24 undeclared ones,
asset_composition, and the 3 newly registered).Model (commit 1)
MeasureDeclaration.completeness_fieldreplacescapped_field.capped_fieldis still read and gives aDeprecationWarning, as in library 0.3.population(viewer|repository) is new. A basis on a share is refused.FieldDeclaration/FieldCompanion(§5Field),AnalyticDeclaration.out, and thecategoriesandlistingblocks the library requires for distribution and list results.ROW_SHAPESholds the row shapes thatdatasetfields name.as_of="run.as_of"names the call's ownas_ofargument (the library'srun.<field>convention), because these results carry no time of their own. A bare-number result declaresvalue_field: value, the keymetric_trendalready uses.test_declarations_match_library.py: every declaration loads as a libraryDeclaration, itsoutloads as a libraryShape, and every row shape registers. It is skipped whentrellis_analyticsisn't installed and passes against 0.3.1 (60 passed). pyegeria-only keys (MeasureDeclaration.population,Declaration.out) are dropped before validation only if the installed library doesn't have that field, so 0.4 checks them too.descriptionorstateson fields. The library'sFieldhas neither and refuses unknown keys. A named state set goes incompanions: [{name: state, valid_values: <set>}]. The cost class is in each spec'sdescription, because neither declaration model has a description.The 28 routines
active_contributorsai_ready_assetsasset_compositionbusiness_value_signalscertifications_summarycontext_readiness_funnelcontextualised_coveragecontrol_implementation_summarycount_elementscount_elements_by_propertycount_relationshipscounts_by_typedrl_readiness_gatesengagement_seriesfeedback_summarygoverned_coveragegrowth_serieskarma_leaderboardmetric_trendorphan_glossary_termsownership_coveragepeople_countssemantic_groundingsolution_component_realisationstale_assetssum_type_countsterm_definition_completenessusage_context_countsOnly the 10.8 data points are measured timings (repository counts 0.2–0.8 s; viewer count of
Process120 s). The other cost classes come from each routine's query shape.genericis unchanged forgrowth_seriesandasset_composition, which areTrue(the brief lists five)._demo()builds each demo spec's description fromgeneric/binding_note, so changing either would break the byte-identical gate.Behaviour: demo specs byte-identical; only failure results change
Snapshot of all 23 demo specs and of all 27 callable routines under fake clients, one run succeeding and one with every query failing, before (
upstream/main3f1fa35) and after:FormatSets identical (model_dump).None. This is the brief's §3.3 fix, made in the same commit as that routine's declaration:ownership_coverageownershipCount 0, ownershipCapped falseNone(asgoverned_coveragealready was)active_contributorsNone;contributors Noneunless every type was readcontext_readiness_funneldocumented 0Noneai_ready_assets{0, 0, false}; alsoaiReadyCount 0when only DataFlow failedNones;total/cappedkept when only DataFlow faileddrl_readiness_gatesNone; ready countsNonewhen only DataFlow failedterm_definition_completenesstotal 0, defined 0Nonestale_assetsstaleCount 0NoneThe Portal's Overview (
overview_handler.py, odpi main) already guards these fields withif x:/try, so it shows no number where it showed 0. Two existing tests pinned the old 0s and now pinNone.exec_report_specuses a declaration only through_absence_for, which needs an envelope. Of these routines onlyasset_compositionreturns one, and its sentences haven't changed.Gaps the declarations expose, not fixed here (the fix would change a signature or a successful result)
governed_coverageandownership_coveragecount elements of any type carrying the classification, and their units say so. The read-back expects "Assets carrying at least one of five classifications over all Assets". Getting that means restricting the find toAsset, which is a code change.count_elements,count_elements_by_property,counts_by_type,sum_type_counts,people_counts,usage_context_counts,growth_series, and the totals insideorphan_glossary_terms,stale_assetsandsemantic_grounding.count_relationships(default path),certifications_summary,active_contributors,engagement_series,term_definition_completeness,context_readiness_funnel.documented,stale_assets.staleCount.contextualised_coverage.assetTotalandsolution_component_realisation.solutionComponentsTotalusetotal or None, so a measured 0 reads as not measured.karma_leaderboardreturns[]both when the find fails and when there's nothing to list.engagement_serieszero-fills a type whose query failed.Tests
uv run -p 3.13 pytest tests/micro-tests/: 1952 passed, 2 skipped (the skips existed before this PR; the cross-validation test is collected and skipped here because the library isn't a dependency).test_rs_w2_1a_routine_declarations.py:test_every_registry_entry_is_declared;test_declared_value_fields_exist, which calls each routine with fake clients and checks that everyvalue_field,completeness_field, basis denominator,as_ofandoutfield resolves in the real result;test_absence_sentences_use_the_four_words; kind blocks; one failure test per 0→None fix.ruff: the new and changed code is clean. Four findings are on untouched lines that were already onupstream/main(overview_metrics.py:32unusedCallable, three intest_overview_metrics.py).No version bump. No Egeria, Postgres or 8813 writes. The live read-back (§5:
exec_report_specas a low-privilege user) hasn't been run; it's the Architect's.🤖 Generated with Claude Code