How fareedkhan-dev/agentic-knowledge-graph works
This repository is a research system for evidence-grounded biomedical question answering over PubMed. Its principal workflow turns PubMed metadata into citation/MeSH graph and abstract-vector indexes, then grounds a question, retrieves and ranks evidence, and returns a supported answer or refuses. The README also documents calibration and adversarial evaluation as important project outcomes. The graph follows documented architecture and sampled agent, traversal, retrieval, and analysis code; several construction and query links rely on README descriptions because their source was not sampled.
Main entry points: kg_agent.py Agent traversal loop · parse_pubmed.py Parquet corpus · kg_traverse2.py Refusal and evidence gates · analyze_fusion.py Posterior and calibration analysis
Components 21
Corpus ingestion
- XML parsing
pipeline/parse_pubmed.py - MeSH and SCR parsing
pipeline/parse_mesh.py - Parquet corpus
pipeline/parse_pubmed.py
Knowledge indexes
- Citation and ontology graph build
pipeline/build_graph1.py - CSR knowledge graph
pipeline/kg_traverse2.py - Abstract embedding
pipeline/embed_corpus3.py - Dense vector index
pipeline/embed_corpus3.py
Evidence answering
- Agent traversal loop
pipeline/kg_agent.py - MeSH grounding
pipeline/kg_ground6.py - Provenance path search
pipeline/kg_traverse2.py - Dense retrieval
pipeline/exp_fusion2.py - Evidence reranking
pipeline/kg_answer.py - Constrained answer generation
pipeline/exp_fusion2.py - Refusal and evidence gates
pipeline/kg_traverse2.py
Evaluation and governance
- Posterior and calibration analysis
analysis/analyze_fusion.py - Error and abstention analysis
analysis/analyze_maybe.py - Governance evaluation
analysis/analyze_governance.py
Other components
- PubMed baseline
- Biomedical question
- Answer with source path
- Refusal
Connections 20
- PubMed baseline → XML parsing: supplies XML
- XML parsing → Parquet corpus: writes articles
- MeSH and SCR parsing → Parquet corpus: writes ontology
- Parquet corpus → Citation and ontology graph build: provides metadata
- Citation and ontology graph build → CSR knowledge graph: builds graph
- Parquet corpus → Abstract embedding: provides abstracts
- Abstract embedding → Dense vector index: writes vectors
- Biomedical question → Agent traversal loop: initiates query
- Agent traversal loop → MeSH grounding: grounds terms
- Agent traversal loop → Provenance path search: searches paths
- Provenance path search → CSR knowledge graph: reads graph
- Agent traversal loop → Dense retrieval: retrieves candidates
- Dense retrieval → Dense vector index: searches vectors
- Agent traversal loop → Evidence reranking: ranks evidence
- Agent traversal loop → Constrained answer generation: requests answer
- Agent traversal loop → Refusal and evidence gates: checks evidence
- Refusal and evidence gates → Answer with source path: permits supported result
- Refusal and evidence gates → Refusal: rejects unsupported result
- Posterior and calibration analysis → Error and abstention analysis: supplies cached posteriors
- Posterior and calibration analysis → Governance evaluation: supplies cached predictions