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.
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.
| 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 |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 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 โ
โโโโโโโโโโโโโโโโโโโโโ
| 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 |
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
- Python 3.10+
- Node.js 18+
- A free Groq API key (for the chatbot module)
git clone https://github.com/<your-username>/digital-safety-ai.git
cd digital-safety-aicd backend
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txtCreate a .env file in backend/:
GROQ_API_KEY=your_free_groq_key_here
DATABASE_URL=sqlite:///./app.dbTrain the scam classifier (one-time):
python -m app.ml.train_scam_modelRun the backend:
uvicorn app.main:app --reloadAPI docs available at โ http://127.0.0.1:8000/docs
cd frontend
npm install
npm run devApp available at โ http://localhost:5173
| 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 |
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 |
- 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_URLfor PostgreSQL in production.
- 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)
Built for the AI for Digital Public Safety hackathon challenge โ Defeating Counterfeiting, Fraud & Digital Arrest Scams.
MIT License โ see LICENSE for details.