Skip to content

nethra0906/Scamlytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ก๏ธ Digital Public Safety AI Platform

AI-powered platform to detect and disrupt digital arrest scams, counterfeit currency, fraud networks, and crime hotspots โ€” built for the "AI for Digital Public Safety" hackathon challenge.

Status Python React License


๐Ÿ“– Overview

India registered 1.14 million cybercrime complaints in 2023, and "digital arrest" scams alone defrauded citizens of over โ‚น1,776 crore in the first nine months of 2024. This platform tackles the problem with five integrated AI modules โ€” shifting law enforcement and citizens from reactive investigation to proactive threat detection.

โœจ Features

Module What it does
๐Ÿšจ Digital Arrest Scam Detection Analyzes call transcripts, WhatsApp/SMS/email text โ†’ scam probability, risk level, explanation, recommended action
๐Ÿ’ต Counterfeit Currency Detection Computer vision analysis of currency note images โ†’ genuine/counterfeit verdict, confidence score, highlighted suspicious regions
๐Ÿ•ธ๏ธ Fraud Network Graph Intelligence Maps phone/device/account linkages from transaction data โ†’ fraud cluster detection, interactive graph visualization
๐Ÿ—บ๏ธ Geospatial Crime Intelligence Plots fraud incidents on a map โ†’ hotspot detection, district-wise risk scoring
๐Ÿค– Citizen Fraud Assistant Multilingual chatbot โ€” explains scams, analyzes suspicious messages, guides reporting to cybercrime.gov.in / 1930

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     React Frontend (Vite)                โ”‚
โ”‚  Dashboard | Scam Checker | Currency Scan | Graph | Map   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚ REST (axios)
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    FastAPI Backend (Uvicorn)              โ”‚
โ”‚  /scam  /currency  /graph  /geo  /chat   routers          โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Scam ML     โ”‚ CV Model  โ”‚ NetworkX  โ”‚ Geo utils โ”‚ LLM API โ”‚
โ”‚ (sklearn)   โ”‚ (OpenCV)  โ”‚ (fraud    โ”‚ (heatmap/ โ”‚ (Groq)  โ”‚
โ”‚             โ”‚           โ”‚  clusters)โ”‚ hotspot)  โ”‚         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚  SQLite (app.db)  โ”‚
                    โ”‚ scams, currency,  โ”‚
                    โ”‚ transactions,     โ”‚
                    โ”‚ incidents         โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿงฐ Tech Stack

Layer Technology Why
Frontend React + Vite + Tailwind CSS Fast dev, minimal config
Backend FastAPI + Uvicorn Async, auto Swagger docs, Python-native
Database SQLite (SQLAlchemy ORM) Zero setup, easy Postgres upgrade path
Scam Detection TF-IDF + Scikit-learn Logistic Regression + keyword rules Lightweight, explainable, fast
Currency Detection OpenCV heuristics (edge/sharpness/color/texture analysis) Explainable, no training data required
Graph Intelligence NetworkX + Pyvis Fraud ring clustering + interactive visualization
Geospatial React-Leaflet + OpenStreetMap Free, no API key required
Chatbot Groq API (Llama 3.1 8B Instant) Fast, free-tier, multilingual

๐Ÿ“ Project Structure

digital-safety-ai/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ”‚   โ”œโ”€โ”€ database.py
โ”‚   โ”‚   โ”œโ”€โ”€ models.py
โ”‚   โ”‚   โ”œโ”€โ”€ routers/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ scam.py
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ currency.py
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ graph.py
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ geo.py
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ chat.py
โ”‚   โ”‚   โ”œโ”€โ”€ ml/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ scam_classifier.py
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ train_scam_model.py
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ currency_model.py
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ graph_engine.py
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ chat_service.py
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ artifacts/          # trained model files
โ”‚   โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ geo_utils.py
โ”‚   โ”‚   โ””โ”€โ”€ static/                 # generated graph HTML
โ”‚   โ”œโ”€โ”€ requirements.txt
โ”‚   โ””โ”€โ”€ .env
โ””โ”€โ”€ frontend/
    โ”œโ”€โ”€ src/
    โ”‚   โ”œโ”€โ”€ App.jsx
    โ”‚   โ”œโ”€โ”€ api.js
    โ”‚   โ””โ”€โ”€ pages/
    โ”‚       โ”œโ”€โ”€ Dashboard.jsx
    โ”‚       โ”œโ”€โ”€ ScamChecker.jsx
    โ”‚       โ”œโ”€โ”€ CurrencyChecker.jsx
    โ”‚       โ”œโ”€โ”€ FraudGraph.jsx
    โ”‚       โ”œโ”€โ”€ GeoIntel.jsx
    โ”‚       โ””โ”€โ”€ CitizenAssistant.jsx
    โ”œโ”€โ”€ package.json
    โ””โ”€โ”€ tailwind.config.js

๐Ÿš€ Getting Started

Prerequisites

  • Python 3.10+
  • Node.js 18+
  • A free Groq API key (for the chatbot module)

1. Clone the repo

git clone https://github.com/<your-username>/digital-safety-ai.git
cd digital-safety-ai

2. Backend setup

cd backend
python3 -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate

pip install -r requirements.txt

Create a .env file in backend/:

GROQ_API_KEY=your_free_groq_key_here
DATABASE_URL=sqlite:///./app.db

Train the scam classifier (one-time):

python -m app.ml.train_scam_model

Run the backend:

uvicorn app.main:app --reload

API docs available at โ†’ http://127.0.0.1:8000/docs

3. Frontend setup

cd frontend
npm install
npm run dev

App available at โ†’ http://localhost:5173

๐Ÿ”Œ API Reference

Method Endpoint Description
POST /scam/analyze Analyze text for scam indicators
GET /scam/history Recent scam analysis history
POST /currency/analyze Upload currency note image for verification
GET /currency/history Recent currency check history
POST /graph/ingest Ingest transaction records
GET /graph/analyze Get fraud clusters
GET /graph/view Interactive fraud network graph (HTML)
POST /geo/ingest Ingest fraud incident coordinates
GET /geo/heatmap Raw incident points
GET /geo/hotspots Detected crime hotspots
GET /geo/district-risk District-wise risk scoring
POST /chat/message Chat with the citizen fraud assistant

๐Ÿงช Testing

Use the Swagger UI at /docs to test each endpoint interactively, or use the frontend pages directly:

Page Route
Dashboard /
Scam Checker /scam
Currency Checker /currency
Fraud Graph /graph
Geo Intelligence /geo
Citizen Assistant /assistant

โš ๏ธ Known Limitations

  • Scam classifier trained on a small synthetic dataset โ€” production use would need a larger labeled corpus of real scam transcripts.
  • Currency detection uses classical CV heuristics (no labeled FICN dataset available) rather than a trained CNN โ€” a documented, explainable trade-off for hackathon scope. Swapping in a fine-tuned CNN is a planned improvement.
  • SQLite is used for simplicity โ€” swap DATABASE_URL for PostgreSQL in production.

๐Ÿ”ฎ Future Improvements

  • Fine-tuned CNN for counterfeit currency detection on labeled FICN datasets
  • Real-time call/voice deepfake detection (speech AI)
  • Direct NCRB / cybercrime.gov.in reporting integration
  • Neo4j/graph database for larger-scale fraud network analysis
  • Mobile app + WhatsApp/IVR integration for the citizen assistant
  • Court-admissible intelligence report export (PDF)

๐Ÿ‘ฅ Team

Built for the AI for Digital Public Safety hackathon challenge โ€” Defeating Counterfeiting, Fraud & Digital Arrest Scams.

๐Ÿ“„ License

MIT License โ€” see LICENSE for details.

About

AI-powered platform for detecting digital arrest scams, counterfeit currency, fraud networks & crime hotspots, built for the "AI for Digital Public Safety" hackathon. FastAPI + React + OpenCV + NetworkX + Groq LLM.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors