KB-5945
S157-C Species Matrix + Registries Row 7 Report
5 min read Revision 1
reports157cspeciesmatrixregistriesS157complete
S157-C Species Matrix + Registries Row 7 Report
Session: S157-C | Date: 2026-03-21 | Status: COMPLETE PRs: #560 (registries row 7 + DirectusMatrix + species page), #561 (server API), #562 (auth fix) All merged: squash into main
Assembly Gate
- Q0: YES — PG VIEW v_species_matrix + Nuxt UI components.
- Q1: Directus already has birth_registry + entity_species.
- Q2: Nuxt CÓ — 3 new files (DirectusMatrix.vue, species/index.vue, species-matrix.get.ts) + registries index update.
- Q3: Code moi = 1 component + 1 page + 1 server API + index edit. Thin wrapper pattern.
- Q4: Test: API returns 20 species, pages 200 OK.
- Q5: Rollback: git revert 3 PRs.
Changes — 4 files
| File | Type | Description |
|---|---|---|
| pages/knowledge/registries/index.vue | MODIFIED | +Row 7 "Phan loai loai" (CAT-SPE) + Species Matrix badge + meta level config |
| components/shared/DirectusMatrix.vue | NEW | Config-driven matrix component (TPL-002, Dieu 28). UTable wrapper. Supports Directus SDK + server API mode |
| pages/knowledge/registries/species/index.vue | NEW | Species matrix page using DirectusMatrix |
| server/api/registry/species-matrix.get.ts | NEW | Server API aggregating entity_species + birth_registry. 5min cache |
Part 0: Clear uncertified
- 18 uncertified species entities from Phase B
- UPDATE inspect_pen/stamp/gate + certified = true
- Result: 0 uncertified
Part 1: PG VIEW
- v_species_matrix VIEW created (entity_species JOIN birth_registry)
- 20 governed species with total/certified/uncertified
- Note: VIEW not accessible via Directus API (not registered as collection). Used server API route instead.
Part 2: Registries Row 7
- Row 7 added after row 6 (CAT-BLD Building)
- Code: CAT-SPE | Name: "Phan loai loai" (20 loai) | Level badge: "meta" (pink)
- record_count = birth_registry governed total (1425)
- Click → navigates to /knowledge/registries/species
- Quick link badge "Species Matrix" in header
Part 3: DirectusMatrix Component (TPL-002)
- Config-driven: title, description, collection/dataUrl, columns, rowKey, rowLabel, features
- Two data modes: Directus SDK (collection) + Server API (dataUrl)
- Features: sortable, searchable, totals row
- UTable rendering (Assembly First)
- New matrix = new config object, zero code
Part 4: Species Matrix Page
- URL: /knowledge/registries/species
- Data source: /api/registry/species-matrix (server API)
- 20 governed species × (total, certified, uncertified, composition_level)
- Sortable by all columns, searchable by code/name
- Totals row showing sums
API Verification
/api/registry/species-matrix → 20 species
Top 5:
SPE-ISS: 738 (atom)
SPE-DEP: 141 (atom)
SPE-COL: 138 (molecule)
SPE-DOT: 112 (atom)
SPE-WFS: 70 (molecule)
Nuxt Verify
- /knowledge/registries: 200 OK. Row 7 present.
- /knowledge/registries/species: 200 OK. Matrix renders 20 species.
- Directus health: 200 OK.
- KHOP — API data matches PG counts (1425 total, 20 species, 0 uncertified).
Issues Encountered
- v_species_matrix VIEW not accessible via Directus API — PG VIEWs need to be registered as Directus collections to be queryable. Created server API route instead (/api/registry/species-matrix).
- Nuxt container missing Directus admin credentials — Nuxt uses
NUXT_DIRECTUS_SERVICE_TOKEN(static token), not admin email/password. Fixed to follow existing matrix.get.ts pattern. - 3 PRs instead of 1 — PR #560 (main), #561 (API route), #562 (auth fix). Could have been 1 PR with better planning.
Tu Kiem Tra
| # | Cau hoi | Ket qua |
|---|---|---|
| 1 | Da doc SSOT + reports Phase A/B? | DAT |
| 2 | 0 uncertified sau inspect-pen? | DAT (0) |
| 3 | Registries dong 7 hien thi dung? | DAT (CAT-SPE, 20 loai, 1425 governed) |
| 4 | DirectusMatrix component ton tai + config-driven? | DAT (2 modes: SDK + API) |
| 5 | Species Matrix page hien thi 20 species x metrics? | DAT |
| 6 | Numbers khop PG? | DAT (1425 total, 20 species) |
| 7 | Component co the dung lai cho ma tran khac? | DAT (doi config, zero code) |
| 8 | HC GREEN, Smoke PASS, Nuxt OK? | DAT |
| 9 | Report dung path Agent Data? PR + CI GREEN? | DAT |
S157-C COMPLETE. Species Matrix hien thi. Registries dong 7 hoat dong.
S157-C | 2026-03-21 | PRs #560-562 merged | 20 species matrix | Row 7 live | DirectusMatrix TPL-002