[Atlas] Analysis-to-KG impact scoring
Goal
Compute world model impact per analysis: new edges contributed, new entities introduced, centrality change, gaps resolved. Store as kg_impact_score on analyses table. Acceptance: all analyses scored; recalculated on KG changes; visible and sortable on /analyses/.
Acceptance Criteria
☐ Implementation complete and tested
☐ All affected pages load (200 status)
☐ Work visible on the website frontend
☐ No broken links introduced
☐ Code follows existing patterns
Approach
Read relevant source files to understand current state
Plan implementation based on existing architecture
Implement changes
Test affected pages with curl
Commit with descriptive message and pushWork Log
2026-04-25 - Implementation complete
- Added
kg_impact_score column to analyses table (REAL, default 0.0) via migration 126
- Created
calculate_kg_impact() function in post_process.py:
- 1 pt per edge contributed (from knowledge_edges where analysis_id matches)
- 2 pts per unique entity introduced (source_id or target_id from those edges)
- 0.5 pts per high-degree node connection (>5 connections)
- 10 pts bonus if analysis addressed a gap (status resolved/partially_addressed)
- Created
update_all_kg_impact_scores() function to recalculate all scores
- Updated
regenerate_dashboard() to:
- Include kg_impact_score in SELECT query (COALESCE to 0 for nulls)
- Sort analyses by kg_impact_score DESC, then by created_at DESC
- Display score as purple "KG: X.X" tag on each analysis card
- All 419 analyses scored (173 with nonzero scores, range: 0.0 to 651.0)
- Top scoring analysis: "SDA-2026-04-01-gap-20260401-225149" (651.0)
- Committed as 201bf5fa1 to branch orchestra/task/2382f69a-analysis-to-kg-impact-scoring
2026-04-01 - Starting implementation
- Assigned to slot 4
- Reading current codebase to understand analyses table, KG structure, and /analyses page
- Will implement kg_impact_score calculation and display
2026-04-01 - Implementation complete (prior attempt)
- Added kg_impact_score column to analyses table (REAL, default 0.0)
- Created calculate_kg_impact() function in post_process.py:
- 1 point per edge contributed
- 2 points per unique entity introduced
- 10 points bonus if analysis addressed a gap (status=partially_filled/resolved)
- 0.5 points per high-degree node connection (>5 connections)
- Created update_all_kg_impact_scores() function to recalculate all scores
- Updated regenerate_dashboard() to:
- Include kg_impact_score in SELECT query
- Sort analyses by kg_impact_score DESC
- Display score as purple tag on each analysis card
- All 21 analyses scored (range: 0.0 - 91.0)
- API endpoint /api/analyses automatically includes score (uses SELECT a.*)
- Tested: /analyses/ page loads correctly (200) with KG impact scores visible
- Top scoring analysis: "Selective vulnerability of entorhinal cortex layer II neurons in AD" (91.0)