02 — Live Substrate Map (verified counts + REUSE verdicts)
title: 02 — Live Substrate Map date: 2026-05-31 note: all counts live-verified read-only this session against directus.public; zero mutation
02 — Live Substrate Map
Fresh query_pg reads (2026-05-31). Counts are the current numbers; some diverge from KB-rendered snapshots (drift is real and is itself a design subject — doc 05).
A. Pivot / counting engine — REUSE
| Object | Live | Role |
|---|---|---|
pivot_definitions |
37 (35 active) | pivot specs; cols incl code, source_object, filter_spec/group_spec/metric_spec/matrix_spec, registry_group, composition_level, species, parent_code, is_active, superseded_by |
pivot_results |
126 | refreshed pivot snapshots (cron + trigger, Đ26 §1F every 10 min) |
pivot_count / pivot_query / pivot_matrix |
fn | counting methods; pivot_count('PIV-001')→169, ('PIV-019')→980,234, ('PIV-007')→309; returns [code,name,source,value] |
refresh_meta_catalog_from_pivot, refresh_pivot_results, trg_pivot_def_refresh |
fn/trg | keep meta_catalog + results current |
v_pivot_by_level, v_pivot_species_by_level, v_pivot_dot_by_category, v_registry_counts_compat |
view | drill/rollup views (pivot-backed) |
v_registry_counts |
base table (169) | snapshot table |
Live pivots: PIV-001..021 (PIV-020 inactive), PIV-101..106 (cross-table), PIV-201..206 (l2-drill by composition_level), PIV-207 (approvals), MTX-L1-OVERVIEW, MTX-L2-ATOM, MTX-TEST(inactive). parent_code NULL on all 37 → drill hierarchy unwired (EXTEND, doc 04). |
B. Catalog / accounting — REUSE (+ 1 EXTEND)
meta_catalog = 169 rows. Columns: record_count, actual_count, orphan_count, baseline_count, active_count, species_count, last_scan_date, composition_level, layer, identity_class, atom_group, code_column, name_column, display_order. No phantom_count → EXTEND (doc 05). Orphan refresh fns live: fn_refresh_orphan_col/_dot/_species (+trg_*), check_registry_coverage.
C. Species / composition / grouping — REUSE / EXTEND
| Object | Live | Note |
|---|---|---|
entity_species |
42 | parent_id+depth (3-tier tree designed); composition_level, management_mode, species_code |
species_collection_map |
164 | discriminator_field/value/operator → grouping dimension |
collection_groups |
9 | data_tier grouping |
composition_levels table |
— | DATA_MISSING (6 layers are enum values, no table) |
D. Label / taxonomy — REUSE (Đ24)
| Object | Live | Note |
|---|---|---|
taxonomy |
58 | tree, depth, parent_id, replaced_by, scope[] |
taxonomy_facets |
10 | cardinality, max_labels_per_entity |
taxonomy_matrix |
36 | facet × composition_level → requirement |
label_rules |
38 | condition jsonb → result_label, priority, status, skip_wide_warning (wide-list concept already exists) |
entity_labels |
718,744 | applied labels (heavily used) |
E. Identity / birth — REUSE
birth_registry = 980,234 (was 980,221 ~40 min earlier → +13: the universal counter is live-growing; drift is real-time). The grand-total anchor.
F. Issue / event spine — REUSE (Đ31, Đ45)
| Object | Live | Note |
|---|---|---|
system_issues |
179,074 | issue_type, severity, status, coalesce_key, violation_hash, occurrence_count, evidence_snapshot json; live types incl thiếu_quan_hệ/thiếu_mã_định_danh (orphan halves), apr_phantom_applied, hardcode_violation/`hc_finding_sql |
event_outbox |
170,498 | Đ45 queue (signal-not-data) |
event_type_registry |
40 | register-before-emit |
G. Object registries counted by pivots — REUSE
collection_registry 168 · table_registry 21 · modules 5 · workflows 2 · workflow_steps 70 · dot_tools 309 · ui_pages 37 · agents 6 · tasks 10 · approval_requests 211 · entity_dependencies 142 · trigger_registry 107 · entity_audit_queue 1.
H. IU / KG — REUSE (leaf substrate for IU-bound objects)
information_unit 219 · iu_relation 60 · dot_iu_command_catalog 54 · v_kg_edges_all 2,259 (2,199 universal + 60 iu-relation edges). IU/KG totals are PIVOT_MISSING (no pivot rows yet).
I. Display layer — REUSE (Đ28)
design_templates (registered templates: DirectusTable, DirectusMatrix, TabPivot, DynamicEntityList) + template_statuses (status reference table) + fn_template_lifecycle_guard() + DOT-template-coverage scanner. /knowledge/pivot is the live render-shell pattern to reuse.
J. NOT present → NEW
registry_pin(pin/ghim) — no pin/favorite/watchlist table exists → NEW (doc 08).v_count_integrity+fn_count_integrity_check()— no system-wide reconciliation surface → NEW (doc 05).meta_catalog.phantom_countcolumn → EXTEND.- Pivots PIV-500 (grand total) / orphan / phantom / drift / label / pin → PIVOT_MISSING.