Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

RingNet360

πŸ•΅οΈ RingNet360!

360Β° Financial Crime Detection Engine!
Detect money muling fraud rings from bank transaction data using graph theory algorithms, machine learning, and interactive visualization.

Python FastAPI React Vite D3.js Tailwind License


πŸ“‹ Table of Contents


πŸ” Overview

RingNet360 is a full-stack financial crime detection engine that analyzes bank transaction data to uncover hidden fraud rings, money muling patterns, and shell network structures. Upload a CSV of transactions and instantly get:

  • Interactive graph visualizations of money flow
  • Suspicion scores for every account
  • Detected fraud rings with categorized pattern types
  • Timeline animations of transaction activity
  • ML-powered anomaly detection with model transparency
  • Downloadable HTML investigation reports

✨ Features

Feature Description
πŸ”„ Cycle Detection Finds circular fund routing (Aβ†’Bβ†’Cβ†’A) with leakage rate analysis
πŸ’Έ Smurfing Analysis Detects fan-in/fan-out patterns within 72-hour sliding windows
🏒 Shell Network Detection Identifies pass-through accounts and layered shell chains
🧩 Community Detection Louvain algorithm for dense subgroup identification
πŸ“Š Suspicion Scoring Weighted multi-signal scoring (0–100) with false positive filtering
πŸ•ΈοΈ Interactive Graph D3.js force-directed graph with zoom, pan, and ring highlighting
⏱️ Timeline Animation Chronological transaction replay with play/pause controls
πŸ“ˆ Analytics Dashboard Recharts-powered charts: pattern distribution, score histogram, ring risk
πŸ€– ML Analysis Random Forest classifier with ROC curves, confusion matrix, and feature importance
🧬 Behavioral Similarity Cosine-similarity based behavioral clustering of accounts
πŸ“₯ JSON Export Download or copy-to-clipboard full analysis results
πŸ“„ HTML Reports Generate downloadable investigation reports
βœ… CSV Validation Lightweight pre-upload validation endpoint

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        Frontend                              β”‚
β”‚  React 19 + Vite + D3.js + Recharts + Tailwind CSS v4       β”‚
β”‚                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚
β”‚  β”‚  Hero    β”‚ β”‚  Graph   β”‚ β”‚ Timeline β”‚ β”‚   Analytics      β”‚β”‚
β”‚  β”‚  Upload  β”‚ β”‚  Viz     β”‚ β”‚  Slider  β”‚ β”‚   Charts         β”‚β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
β”‚       β”‚                                                      β”‚
β”‚       β–Ό  Axios (proxy β†’ :8000)                              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                        Backend                               β”‚
β”‚  FastAPI + Python 3.11+                                      β”‚
β”‚                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ Graph Engine β”‚  β”‚ ML Engine     β”‚  β”‚ Report Generator  β”‚ β”‚
β”‚  β”‚  - Cycles    β”‚  β”‚  - Features   β”‚  β”‚  - HTML Template  β”‚ β”‚
β”‚  β”‚  - Smurfing  β”‚  β”‚  - RandomForestβ”‚ β”‚  - PDF-ready     β”‚ β”‚
β”‚  β”‚  - Shells    β”‚  β”‚  - Behavioral β”‚  β”‚                   β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚         β”‚                  β”‚                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚  Community   β”‚  β”‚   Scoring    β”‚  β”‚    Filters        β”‚ β”‚
β”‚  β”‚  Detection   β”‚  β”‚   Engine     β”‚  β”‚  (False Positive) β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                                                              β”‚
β”‚  NetworkX + Pandas + scikit-learn + python-louvain           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Tech Stack

Backend

Technology Purpose
Python 3.11+ Core runtime
FastAPI REST API framework
Uvicorn ASGI server
Pandas Data manipulation & CSV parsing
NetworkX Graph construction & traversal
python-louvain Community detection (Louvain)
scikit-learn Random Forest ML pipeline

Frontend

Technology Purpose
React 19 UI framework
Vite 7 Build tool & dev server
D3.js 7 Force-directed graph visualization
Recharts Analytics charts & histograms
Tailwind CSS 4 Utility-first styling
Lucide React Icon system
Axios HTTP client

πŸš€ Getting Started

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • npm

1. Clone the Repository

git clone https://github.com/heckerr404/CICD.git
cd CICD

2. Backend Setup

cd backend
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --host 0.0.0.0 --port 8000

The API server will start at http://localhost:8000.

3. Frontend Setup

cd frontend
npm install
npm run dev

The development server will start at http://localhost:5173.

4. Open the App

Navigate to http://localhost:5173 β€” the frontend proxies API calls to port 8000.


πŸ“ CSV Format

Upload a CSV file with these required columns:

Column Type Description Example
transaction_id string Unique transaction identifier TXN001
sender_id string Source account ID ACC_101
receiver_id string Destination account ID ACC_202
amount number Transaction amount 4999.00
timestamp datetime When the transaction occurred 2024-01-15 10:30:00

A sample test file is provided at test-data/test_transactions.csv.


πŸ“‘ API Reference

Health Check

GET /api/health

Response:

{ "status": "healthy", "service": "RingNet360" }

Analyze Transactions

POST /api/analyze
Content-Type: multipart/form-data
Body: file=<CSV file>

Returns the full analysis JSON (see JSON Output Format).

Validate CSV

POST /api/validate
Content-Type: multipart/form-data
Body: file=<CSV file>

Lightweight pre-upload validation. Returns { valid, errors, warnings }.

Download Report

GET /api/report?analysis_id=<uuid>

Returns a downloadable HTML investigation report.


πŸ“‚ Project Structure

CICD/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py                  # FastAPI server & API endpoints
β”‚   β”œβ”€β”€ graph_engine.py          # Cycle, smurfing, shell detection
β”‚   β”œβ”€β”€ ml_engine.py             # Random Forest ML + behavioral similarity
β”‚   β”œβ”€β”€ community_detection.py   # Louvain community detection
β”‚   β”œβ”€β”€ scoring.py               # Weighted suspicion scoring
β”‚   β”œβ”€β”€ filters.py               # False positive filters
β”‚   β”œβ”€β”€ validation.py            # CSV validation logic
β”‚   β”œβ”€β”€ report_generator.py      # HTML report generation
β”‚   β”œβ”€β”€ models.py                # Pydantic response models
β”‚   β”œβ”€β”€ requirements.txt         # Python dependencies
β”‚   └── tests/                   # Test suite
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ index.html               # Entry HTML
β”‚   β”œβ”€β”€ package.json             # NPM dependencies
β”‚   β”œβ”€β”€ vite.config.js           # Vite configuration
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ App.jsx              # Root application component
β”‚   β”‚   β”œβ”€β”€ main.jsx             # React entry point
β”‚   β”‚   β”œβ”€β”€ index.css            # Global styles (Tailwind)
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ LandingPage.jsx         # Landing / marketing page
β”‚   β”‚   β”‚   β”œβ”€β”€ HeroUpload.jsx          # CSV upload with drag & drop
β”‚   β”‚   β”‚   β”œβ”€β”€ SummaryCards.jsx        # Key metric cards
β”‚   β”‚   β”‚   β”œβ”€β”€ GraphVisualization.jsx  # D3.js force-directed graph
β”‚   β”‚   β”‚   β”œβ”€β”€ TimelineSlider.jsx      # Transaction timeline replay
β”‚   β”‚   β”‚   β”œβ”€β”€ FraudRingTable.jsx      # Detected rings table
β”‚   β”‚   β”‚   β”œβ”€β”€ SuspiciousTable.jsx     # Suspicious accounts table
β”‚   β”‚   β”‚   β”œβ”€β”€ AnalyticsCharts.jsx     # Recharts analytics dashboard
β”‚   β”‚   β”‚   β”œβ”€β”€ MLAnalysis.jsx          # ML model results viewer
β”‚   β”‚   β”‚   β”œβ”€β”€ DownloadSection.jsx     # JSON/Report export
β”‚   β”‚   β”‚   β”œβ”€β”€ NetworkBackground.jsx   # Animated background
β”‚   β”‚   β”‚   └── Tooltip.jsx             # Reusable tooltip
β”‚   β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”‚   └── useAnalysis.js          # API integration hook
β”‚   β”‚   └── utils/
β”‚   β”‚       └── formatters.js           # Formatting utilities
β”‚   β”‚
β”‚   └── public/                  # Static assets
β”‚
β”œβ”€β”€ test-data/
β”‚   └── test_transactions.csv    # Sample transaction dataset
β”‚
β”œβ”€β”€ docs/                        # Project documentation
β”œβ”€β”€ .gitignore
└── README.md

πŸ”¬ Detection Algorithms

1. Cycle Detection

Identifies circular fund routing patterns (e.g., A→B→C→A) using DFS-based cycle enumeration on the directed transaction graph. Each cycle is analyzed for:

  • Leakage rate: % of funds lost per loop iteration
  • Cycle length: Number of participating accounts
  • Temporal proximity: Whether transactions occurred within a tight window

2. Smurfing Detection

Detects structuring patterns using a 72-hour sliding window:

  • Fan-out: One account distributing to many recipients (splitting large amounts)
  • Fan-in: Many accounts converging funds into one account
  • Threshold proximity: Amounts consistently near reporting thresholds (e.g., $9,999)

3. Shell Network Detection

Identifies intermediary/pass-through accounts:

  • High pass-through ratio: Accounts where inflow β‰ˆ outflow
  • Layered chains: Sequential transfers through 3+ intermediaries
  • Velocity analysis: Rapid receipt-and-forward patterns

4. Community Detection (Louvain)

Groups densely interconnected accounts into communities using the Louvain modularity optimization algorithm. Accounts in communities with high concentrations of flagged members receive a score boost.

5. Suspicion Scoring

Weighted multi-signal scoring algorithm (0–100):

  • Pattern-based signals (cycle, smurfing, shell membership)
  • Temporal clustering signals
  • Amount-based signals (threshold proximity)
  • Community association boost
  • False positive filtering (payroll patterns, recurring bills, etc.)

πŸ€– Machine Learning Pipeline

RingNet360 includes a Random Forest classifier (RingHunter ML) that provides:

Component Details
Model Random Forest with cross-validation
Features In/out degree, transaction volume, temporal spread, amount variance, flow ratio
Outputs Per-account ML confidence scores, ROC curve, confusion matrix, feature importance
Behavioral Analysis Cosine similarity clustering to find behaviorally similar accounts

The ML layer runs alongside the graph-based detection to provide a second independent signal, improving detection confidence.


πŸ“Š JSON Output Format

{
  "suspicious_accounts": [
    {
      "account_id": "ACC_101",
      "suspicion_score": 78.5,
      "detected_patterns": ["cycle", "smurfing"],
      "ring_id": "RING_001",
      "ml_confidence": 0.92
    }
  ],
  "fraud_rings": [
    {
      "ring_id": "RING_001",
      "pattern_type": "cycle",
      "member_accounts": ["ACC_101", "ACC_102", "ACC_103"],
      "risk_score": 85.0
    }
  ],
  "summary": {
    "total_accounts_analyzed": 25,
    "suspicious_accounts_flagged": 8,
    "fraud_rings_detected": 3,
    "processing_time_seconds": 0.45
  },
  "graph_data": {
    "nodes": ["..."],
    "edges": ["..."]
  },
  "timeline_data": ["..."],
  "ml_analysis": {
    "model_type": "RandomForest",
    "cross_val_accuracy": 0.94,
    "precision": 0.91,
    "recall": 0.88,
    "f1_score": 0.89,
    "confusion_matrix": {},
    "roc_curve": {},
    "feature_importance": []
  },
  "analysis_id": "uuid"
}

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


Built with ❀️ for financial crime investigators

About

Detect money muling fraud rings from bank transaction data using graph theory algorithms, machine learning, and interactive visualization.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages