Files
compounding-intelligence/scripts/test_citation_tracker.py
Rockachopa c75bd5094f
Some checks failed
Test / pytest (pull_request) Failing after 9s
feat: add citation tracker (7.8)
Implements issue #140 — Citation Tracker.

Added:
- scripts/citation_tracker.py: Core tracker that monitors citation counts,
  identifies citing papers, extracts citation context, and generates monthly reports.
- knowledge/global/citations.yaml: Config file listing key papers to track.
- scripts/test_citation_tracker.py: Basic smoke test.

Uses Semantic Scholar API (free) for citation data.
Outputs facts to knowledge/index.json with high confidence.
Generates monthly markdown reports in metrics/citation_report_YYYY-MM.md.

Acceptance criteria:
[✓] Monitors citation counts
[✓] Identifies citing papers
[✓] Extracts citation context (paper titles, authors, years)
[✓] Monthly report

Closes #140
2026-04-26 09:52:06 -04:00

32 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python3
import sys
sys.path.insert(0, "/Users/apayne/burn-clone/STEP35-compounding-intelligence-140/scripts")
import yaml
from pathlib import Path
KNOWLEDGE_DIR = Path("/Users/apayne/burn-clone/STEP35-compounding-intelligence-140/knowledge")
config_path = KNOWLEDGE_DIR / "global" / "citations.yaml"
with open(config_path) as f:
data = yaml.safe_load(f)
papers = data.get("papers", [])
print(f"Loaded {len(papers)} key papers:")
for p in papers:
print(f" - {p['s2_id']}: {p['title']}")
# Test that citation_tracker module loads
import importlib.util
spec = importlib.util.spec_from_file_location("citation_tracker",
"/Users/apayne/burn-clone/STEP35-compounding-intelligence-140/scripts/citation_tracker.py")
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
print("Module loaded successfully")
# Test fetch functions (with mock/real API)
result = mod.fetch_paper("CorpusId:215715652") # Attention Is All You Need
if result:
print(f"Paper fetched: {result.get('title')}{result.get('citationCount')} citations")
else:
print("Paper fetch failed (may be network issue)")