How piyush314159/gnn-fraudnet works
GNN-FraudNet serves transaction-fraud predictions and analyst investigations through a FastAPI API. An analyst or client submits a transaction node; the investigation agent coordinates prediction, explanation and graph analysis, then optionally retrieves fraud knowledge and generates an LLM report. The repository also includes dataset preparation, model training and evaluation capabilities. The workflow and some subsystem links are documented in the README; implementation excerpts are incomplete, so unverified links are dashed and uncited.
Main entry points: investigation_agent.py Investigation agent · report_generator.py LLM report generation · explainability.py Model explanations · graphsage.py GNN and baselines
Components 19
API and workflow
- FastAPI endpoints
api/main.py - Investigation agent
src/agents/investigation_agent.py - Runtime configuration
src/config.py
Data and models
- Transaction graph data
src/data_loader.py - Graph construction
src/graph_builder.py - GNN and baselines
src/models/graphsage.py
Investigation services
- Fraud prediction
src/services/prediction.py - Model explanations
src/services/explainability.py - SHAP utilities
src/explain.py - Neighborhood analysis
src/services/graph_analysis.py - Investigation context
src/services/investigation.py
Knowledge and reports
- Fraud knowledge base
src/rag/knowledge_base.py - Semantic retrieval
src/rag/retriever.py - LLM report generation
src/llm/report_generator.py - Report prompts
src/llm/prompts.py
Training and evaluation
- Model training
src/train.py - Model evaluation
src/evaluate.py
Other components
- Analyst / client
- LLM provider
Connections 21
- Analyst / client → FastAPI endpoints: submits request
api/main.py - FastAPI endpoints → Investigation agent: routes investigation
api/main.py - Investigation agent → Fraud prediction: predicts node
src/agents/investigation_agent.py - Investigation agent → Model explanations: explains prediction
src/agents/investigation_agent.py - Investigation agent → Neighborhood analysis: analyzes neighborhood
src/agents/investigation_agent.py - Investigation agent → Semantic retrieval: retrieves knowledge
src/agents/investigation_agent.py - Investigation agent → LLM report generation: generates report
src/agents/investigation_agent.py - Fraud prediction → GNN and baselines: runs model
- Model explanations → SHAP utilities: runs SHAP
src/services/explainability.py - Model explanations → GNN and baselines: explains model
src/services/explainability.py - Semantic retrieval → Fraud knowledge base: queries collection
src/rag/retriever.py - LLM report generation → Report prompts: formats prompt
src/llm/report_generator.py - LLM report generation → LLM provider: requests completion
src/llm/report_generator.py - LLM report generation → Semantic retrieval: uses retrieved context
src/llm/report_generator.py - Investigation context → Fraud prediction: requests prediction
src/services/investigation.py - Investigation context → Model explanations: requests explanation
src/services/investigation.py - Investigation context → Neighborhood analysis: requests analysis
src/services/investigation.py - Graph construction → Transaction graph data: prepares graph
- Model training → Transaction graph data: trains on graph
- Model training → GNN and baselines: trains models
- Model evaluation → GNN and baselines: scores models