A modern fraud detection system using Graph Neural Networks (GNNs), RAG-powered explainability, and multi-agent investigation workflow.
┌─────────────────────────────────────────────────────────────┐
│ User Interface │
│ Network Visualization (Viz.js) + Risk Dashboard + Chat │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ API Layer │
│ FastAPI + WebSocket (real-time updates) │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ Multi-Agent Orchestrator │
│ LangGraph coordinates: Network Analyst + Pattern Matcher │
└─────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ Analysis Layer │
│ ┌─────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ GNN Engine │ │Graph Database│ │ RAG System │ │
│ │(PyG) │ │ (Neo4j) │ │(ChromaDB) │ │
│ └─────────────┘ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
- GNN-based Fraud Detection: GraphSAGE/GAT models for network-aware fraud scoring
- Implicit Link Discovery: Detect hidden connections between entities
- RAG-Powered Explainability: Contextual explanations from historical cases
- Multi-Agent Investigation: Automated dossier generation
- Real-time Processing: <500ms latency per claim
- Privacy-First: GDPR/CCPA compliant by design
cp .env.example .env
docker-compose up -d# Install dependencies
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Start Neo4j (using Docker)
docker run -d \
--name neo4j \
-p 7474:7474 -p 7687:7687 \
-e NEO4J_AUTH=neo4j/ghost123 \
neo4j:5.15-community
# Start ChromaDB
docker run -d --name chromadb -p 8001:8000 chromadb/chroma:0.4.22
# Run API
uvicorn backend.api.main:app --reload# Score a claim
curl -X POST http://localhost:8000/api/v1/claims/score \
-H "Content-Type: application/json" \
-d @data/sample_claim.json
# Get investigation details
curl http://localhost:8000/api/v1/investigation/{claim_id}
# Get network visualization data
curl http://localhost:8000/api/v1/network/{claim_id}Node Types:
- Claim (amount, date, type, status)
- Driver (age, license_hash, risk_score)
- Vehicle (make, model, year, vin_hash)
- Location (lat, lon, geohash)
- RepairShop (name_hash, address, tier)
- Witness (contact_hash, relationship)
Edge Types:
- Claim → Driver (filed_by)
- Claim → Vehicle (involved)
- Claim → Location (occurred_at)
- Claim → RepairShop (assigned_to)
- Driver → Vehicle (owns)
- RepairShop → RepairShop (implicit similarity)
# Unit tests
pytest tests/ -v
# With coverage
pytest tests/ --cov=backend --cov-report=html
# Integration tests
pytest tests/integration/ -v# Format code
black backend/ tests/
ruff check backend/ tests/
# Type check
mypy backend/
# Run Jupyter
docker-compose up jupyter
# Open http://localhost:8888MIT