SOUGUR /
GraphRAG
🚀 CodeGraphAI: Advanced GraphRAG system for Python codebases. Uses AST parsing, Neo4j Knowledge Graphs, and Hybrid Vector Search to enable deep, context-aware AI reasoning over entire repositories.
Loading repository data…
jmponcebe / repository
GraphRAG system for querying drug interactions and adverse events using FDA data. Combines Neo4j knowledge graph + ChromaDB vector search + Gemini LLM, served via FastAPI and Streamlit.
GraphRAG system for querying drug interactions and adverse events using FDA data.
A production-ready question-answering system that combines a pharmaceutical knowledge graph (Neo4j) with Retrieval-Augmented Generation (RAG) to answer natural language questions about drug interactions and adverse events — grounded in real FDA FAERS data and DailyMed drug labels.
💬 Chat Interface — Multi-Agent Mode with Model Selector
🔗 Graph Visualization
📊 Source Evidence
⚡ FastAPI Swagger
"What are the side effects of ibuprofen?" · "Does metformin interact with other drugs?" · "Compare the safety profiles of aspirin and clopidogrel" · "What drugs cause liver damage?"
| Component | Status | Details |
|---|---|---|
| Data Pipeline | ✅ Complete | FAERS (2024Q3+Q4): 816K reports, 3.9M drug entries. DailyMed: 88 drugs |
| Knowledge Graph | ✅ Complete | 4,998 Drugs, 6,863 AdverseEvents, 365K CAUSES, 193 INTERACTS_WITH |
| Vector Store | ✅ Complete | 5,654 text chunks, 384-dim embeddings, cosine similarity search |
| Query Engine | ✅ Complete | Entity extraction (exact + fuzzy), dual retrieval, prompt assembly |
| LLM Integration | ✅ Complete | Gemini API + Ollama with automatic fallback |
| REST API | ✅ Complete | FastAPI: POST /query, POST /agent/query, POST /agent/multi, GET /drug/{name}, GET /health |
| Chat UI | ✅ Complete | Streamlit: chat, graph visualization, sources panel, drug explorer, clickable follow-ups, confidence tooltips, pipeline steps |
| Docker Compose | ✅ Complete | Neo4j + API + UI + Ollama (optional profile) |
| CI/CD | ✅ Complete | GitHub Actions: lint, test matrix (3.11/3.13), Docker build |
| Agent Mode | ✅ Complete | LangGraph ReAct agent with 9 tools, conversation memory, structured output, multi-agent supervisor, nested reasoning |
| Evaluation | ✅ Complete | RAGAS 0.4.3 (Faithfulness, Relevancy, Precision, Recall, Correctness) + agent tool accuracy (P/R/F1) |
| Tests | ✅ 263 passing | Data (29) + vectors (35) + engine (37) + LLM (14) + API (18) + UI (14) + agent (61) + observability (13) + evaluation (42) |
The diagram below shows the Classic Mode pipeline. In Agent and Multi-Agent modes, the Query Engine is replaced by a LangGraph ReAct agent that autonomously selects tools from the same knowledge storage layer.
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ffffff', 'edgeLabelBackground':'#ffffff', 'tertiaryColor': '#f4f7f6', 'fontFamily': 'Helvetica, Arial, sans-serif', 'fontSize': '14px'}}}%%
graph TB
%% --- PROFESSIONAL COLOR PALETTE & STYLES ---
classDef interface fill:#fff3e0,stroke:#ff9800,stroke-width:2px,color:#e65100,rx:8,ry:8;
classDef llm fill:#ede7f6,stroke:#673ab7,stroke-width:2px,color:#4527a0,rx:8,ry:8;
classDef engine fill:#e3f2fd,stroke:#2196f3,stroke-width:2px,color:#0d47a1,rx:8,ry:8;
classDef storage fill:#e8f5e9,stroke:#4caf50,stroke-width:3px,color:#1b5e20,rx:5,ry:5;
classDef ingestion fill:#eceff1,stroke:#607d8b,stroke-width:2px,color:#37474f,rx:5,ry:5;
classDef userNode fill:#263238,stroke:#263238,stroke-width:2px,color:#ffffff,rx:50,ry:50,font-weight:bold;
%% ======== LAYER 1: USER INTERFACE (TOP) ========
subgraph TopLayer ["⚡ INTERFACE LAYER"]
direction TB
USER(("👤 User")):::userNode
subgraph App ["Application"]
direction LR
UI["💬 Streamlit<br/><i>Chat UI + Graph Viz</i>"]:::interface
API["⚡ FastAPI<br/><i>REST API</i>"]:::interface
end
end
%% ======== LAYER 2: PROCESSING CORE (MIDDLE) ========
subgraph MiddleLayer ["🧠 PROCESSING (RAG & LLM)"]
direction TB
%% Query Engine Components
subgraph QE ["Query Engine"]
direction TB
NER["🔍 Entity Extraction<br/><i>exact + fuzzy matching</i>"]:::engine
subgraph Ret ["Retrieval"]
direction LR
GR["📊 Graph Retrieval<br/><i>Cypher queries</i>"]:::engine
VR["📄 Vector Retrieval<br/><i>semantic search</i>"]:::engine
end
CTX["🧩 Context Assembly<br/><i>merge graph + vector</i>"]:::engine
end
%% LLM Components placed next to context assembly
subgraph Brain ["LLM Inference"]
direction LR
GEMINI["✨ Gemini API<br/><i>primary</i>"]:::llm
OLLAMA["🦙 Ollama<br/><i>fallback</i>"]:::llm
end
end
%% ======== LAYER 3: KNOWLEDGE BASE (FOUNDATION) ========
subgraph StorageLayer ["💾 KNOWLEDGE STORAGE"]
direction LR
NEO4J[("🔷 Neo4j<br/>Knowledge Graph<br/><i>11.9K nodes · 381K rels</i>")]:::storage
CHROMA[("🟢 ChromaDB<br/>Vector Store<br/><i>5,654 chunks · 384 dims</i>")]:::storage
end
%% ======== LAYER 4: DATA INGESTION (BOTTOM) ========
subgraph BottomLayer ["📚 DATA INGESTION PIPELINE"]
direction TB
CLEAN["🔧 Cleaning & Normalization<br/><i>Parquet files</i>"]:::ingestion
subgraph Sources ["Raw Data Sources"]
direction LR
FAERS["🏥 FDA FAERS<br/><i>816K adverse event reports</i>"]:::ingestion
DM["💊 DailyMed<br/><i>88 drug labels</i>"]:::ingestion
end
end
%% ======== CONNECTIONS ========
%% Flow: User -> App -> Engine
USER <--> UI
UI <--> API
API --> NER
%% Flow: Engine Internals
NER --> GR & VR
GR & VR --> CTX
%% Flow: Engine <-> Storage (The Bridge)
GR <--> NEO4J
VR <--> CHROMA
%% Flow: Engine -> LLM -> App
CTX --> GEMINI
GEMINI -.->|fallback| OLLAMA
GEMINI --> API
OLLAMA -.-> API
%% Flow: Ingestion (Bottom Up)
FAERS & DM --> CLEAN
CLEAN --> NEO4J & CHROMA
%% Styling links for a cleaner look
linkStyle default stroke:#78909c,stroke-width:2px,fill:none;
In Agent Mode, the LLM autonomously decides which tools to call:
| Component | Technology |
|---|---|
| Language | Python 3.13 (compatible 3.11+) |
| Package Manager | uv (Rust-based, fast) |
| Knowledge Graph | Neo4j 5 Community (Docker) |
| Vector Store | ChromaDB (embedded, SQLite-backed) |
| Embeddings | sentence-transformers (all-MiniLM-L6-v2, 384 dims) |
| LLM Primary | Google Gemini API (configurable per query: Flash / Pro models) |
| LLM Backup | Ollama + Llama 3 / Mistral (local) |
| Agent Framework | LangGraph + LangChain (ReAct agent) |
| Observability | Langfuse (LLM tracing, token tracking, latency monitoring) |
| NLP | rapidfuzz (fuzzy entity matching) |
| API | FastAPI + Pydantic v2 |
| UI | Streamlit + streamlit-agraph (graph visualization) |
| Containers | Docker Compose (multi-stage, non-root, healthchecks) |
| CI/CD | GitHub Actions (CI: lint + test matrix; CD: v* tags → Cloud Build → Cloud Run) |
| Testing | pytest (263 tests, mocked services) |
| Linting | ruff (check + format) |
| Source | Content | Scale |
|---|---|---|
| FDA FAERS | Adverse e |
Selected from shared topics, language and repository description—not editorial ratings.
SOUGUR /
🚀 CodeGraphAI: Advanced GraphRAG system for Python codebases. Uses AST parsing, Neo4j Knowledge Graphs, and Hybrid Vector Search to enable deep, context-aware AI reasoning over entire repositories.