Intelligent transaction monitoring using Machine Learning, RAG, and Gemini AI β with Human-in-the-Loop review.
Every year, over $2 trillion is laundered globally. Financial institutions spend $274 billion on compliance, yet 95% of money laundering goes undetected. Current compliance systems rely on static, rule-based thresholds (e.g., "flag transactions over $10,000") that criminals easily evade through structuring and smurfing. When alerts do trigger, human analysts spend 30β45 minutes per case manually reviewing transactions, cross-referencing policies, and writing reports β creating massive backlogs and fatigue.
ComplianceAI replaces the entire manual compliance pipeline with an end-to-end AI-powered system:
A Random Forest classifier trained on 15 engineered features β including transaction velocity, cross-currency flags, implied exchange rates, and temporal patterns. Achieves 99% accuracy on the IBM AML dataset, catching patterns that rule-based systems miss.
Every flagged transaction gets a professional compliance explanation from Google Gemini 2.5 Flash, grounded in real AML policy documents via Retrieval-Augmented Generation (RAG) using ChromaDB. No hallucinations β every explanation is backed by actual regulatory policy.
AI recommends, humans decide. Compliance officers can Resolve or Escalate flagged violations with notes, creating a complete audit trail. The AI reduces analyst workload from 30 minutes to a quick review.
Celery task workers with MongoDB Atlas as the broker enable asynchronous batch processing. Each transaction is analyzed in ~3-5 seconds β ML prediction, policy retrieval, and LLM explanation β all in the background.
ββββββββββββββββ REST API ββββββββββββββββββββ
β React + TW β βββββββββββββββββββ β FastAPI Server β
β Frontend β β (Python) β
ββββββββββββββββ ββββββββββ¬ββββββββββ
β
.delay() β
(queue tasks) β
ββββββββββββββββββββ
β MongoDB Atlas β
β (DB + Broker) β
ββββββββββ¬ββββββββββ
β
picks up β messages
β
ββββββββββββββββββββ
β Celery Worker β
β β
β 1. ML Predict β
β 2. RAG Retrieve β
β 3. Gemini API β
β 4. Save Results β
ββββββββββββββββββββ
| Layer | Technology |
|---|---|
| Frontend | React, Tailwind CSS, Recharts, Lucide Icons |
| Backend | FastAPI (Python) |
| ML Model | Random Forest β scikit-learn (150 trees, 15 features) |
| LLM | Google Gemini 2.5 Flash |
| RAG | ChromaDB + Sentence-Transformers + Gemini Embeddings |
| Task Queue | Celery (solo pool) |
| Database | MongoDB Atlas |
- Dataset: IBM AML Transaction Dataset (
HI-Small_Patterns.txt) - Algorithm: Random Forest Classifier (150 estimators, max depth 20)
- Accuracy: 99.07% | Precision: 0.99 / 0.98 | Recall: 0.99 / 0.98
| Feature | Type |
|---|---|
Log_Amount_Paid / Log_Amount_Received |
Log-transformed amounts |
Implied_Exchange_Rate |
Received / Paid ratio |
Is_Cross_Currency |
Boolean β different currencies |
Same_Bank_Transfer |
Boolean β same bank sender/receiver |
Sender_Tx_Frequency / Receiver_Tx_Frequency |
Account velocity |
DayOfWeek, Is_Weekend, Time_of_Day |
Temporal features |
From_Bank, To_Bank, Payment_Currency, Receiving_Currency, Payment_Format |
Label-encoded categoricals |
ComplianceAI/
βββ backend/
β βββ agents/ # AI agents (monitoring, detection, explanation, RAG, reporting)
β βββ api/routes/ # FastAPI endpoints (violations, agents, predictions, RAG)
β βββ config/ # Settings and environment config
β βββ core/ # Celery app and startup logic
β βββ datasets/ # Transaction data files
β βββ ml/ # Random Forest model + predictor
β βββ models/ # Pydantic schemas
β βββ notebooks/ # Training notebooks
β βββ rag/ # Vector store + embedding model
β βββ scripts/ # Data loading utilities
β βββ security/ # Encryption helpers
β βββ database.py # MongoDB connection layer
β βββ tasks.py # Celery task definitions
β βββ main.py # FastAPI application entry
β βββ requirements.txt # Python dependencies
βββ secure-ai-dashboard/
β βββ src/
β βββ pages/ # React pages (Dashboard, Agents, Violations, etc.)
β βββ components/ # Reusable UI components
β βββ services/ # API service layer
βββ .gitignore
βββ README.md
- Python 3.10+
- Node.js 18+
- MongoDB Atlas account (or local MongoDB)
- Google Gemini API Key
git clone https://github.com/abhay-2108/ComplainceAI.git
cd ComplainceAI# Create virtual environment
cd backend
python -m venv venv
# Activate (Windows)
venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtCreate backend/.env:
MONGODB_URL=mongodb+srv://<user>:<password>@<cluster>.mongodb.net/?appName=Cluster0
DATABASE_NAME=compliance_ai
SECRET_KEY=<your-secret-key>
ENCRYPTION_KEY=<your-encryption-key>
GOOGLE_API_KEY=<your-gemini-api-key>
GEMINI_MODEL_NAME=gemini/gemini-2.5-flash
GEMINI_EMBEDDING_MODEL=models/gemini-embedding-001
CELERY_BROKER_URL=mongodb+srv://<user>:<password>@<cluster>.mongodb.net/celery_db
CELERY_RESULT_BACKEND=mongodb+srv://<user>:<password>@<cluster>.mongodb.net/celery_dbCreate secure-ai-dashboard/.env:
VITE_API_BASE_URL=http://localhost:8000cd ..
python -m uvicorn backend.main:app --reload --port 8000backend\venv\Scripts\celery -A backend.core.celery_app worker --loglevel=info -P solocd secure-ai-dashboard
npm install
npm run devNavigate to http://localhost:5173 in your browser.
- Dashboard β Real-time KPIs, risk trends, violation charts
- AI Agents β 5 specialized agents + batch processing controls
- Violations β Flagged transactions with AI explanations
- Human Review β Resolve or Escalate with audit trail
- RAG Policies β Policy-grounded AI explanations
- Predictions β ML model output and confidence analysis
- Audit Logs β Complete activity history
-
Mohita - Full Stack Developer & AI Engineer
-
Abhay Tiwari - Full Stack Developer & AI Engineer
This project was built for HackFest 2.0.