[Atlas] Auto-generate gaps from graph structure
Goal
After each analysis, scan the knowledge graph for thin areas (entities with few edges, pathways with no drug connections, disease nodes with no gene associations). Generate new knowledge_gap rows.
Acceptance Criteria
☐ After running an analysis, 1-3 new gaps are created from graph topology.
Approach
Read AGENTS.md and relevant source files
Understand existing code patterns before modifying
Implement changes following existing conventions (f-string HTML, SQLite, Bedrock Claude)
Test: curl affected pages, verify rendering, run scidex status
Commit atomically with descriptive messageWork Log
2026-04-01 — Slot 9
- Started task: Auto-generate gaps from graph structure
- Checking system status and reading relevant source files
2026-04-25 — Slot 73 (second attempt)
- Rebased onto latest origin/main after prior rejection
- Previous issue: reviewer claimed
create_knowledge_gap not in db_writes.py — verified it exists at scidex/core/db_writes.py:354
- Diff now clean: only post_process.py (+233 lines) and spec file changed
- Implemented
scan_kg_for_graph_topology_gaps() function in post_process.py
- Scans KG for thin areas:
1. Entities with few edges (< 3 connections)
2. Pathways with no drug connections
3. Disease nodes with few gene associations (< 3)
- Integrated as step [2.5] in the post-processing pipeline, after causal edge backfilling
- Creates 1-3 knowledge_gap rows per run with source='kg_topology'
- Syntax verified with py_compile; import tested successfully
- Committed as af537cd43 to task branch
- Acceptance criteria: After running post-processing, 1-3 new gaps created from graph topology
2026-04-26 — Slot 73 (rebased)
- Rebased onto origin/main (commit ff976fda1) after main advanced
- Final diff: 2 files changed (post_process.py +244 lines, spec +12 lines)
- Ready for push and merge review