Built for Karnataka State Police Datathon 2026 โ Challenge 2
Co-authored by: Akash T
The KSP Crime Intelligence Platform is an AI-driven crime analytics and visualization system designed to help police teams move from reactive policing to proactive, data-driven decision-making.
Instead of relying on disconnected spreadsheets and manual analysis, the platform combines:
- ๐บ๏ธ Geospatial crime intelligence
- ๐ฅ Hotspot & anomaly detection
- ๐ธ๏ธ Criminal network analysis
- ๐ค Machine learning risk prediction
- ๐ Explainable AI using SHAP
- ๐ Ground-truth model validation
Turn raw crime records into actionable intelligence for officers and analysts.
Crime records are often distributed across independent Excel-based datasets and jurisdictions, making it difficult to identify larger patterns.
Key challenges include:
- Detecting emerging crime hotspots early
- Identifying abnormal crime spikes
- Discovering repeat offenders across stations
- Understanding suspectโvictimโstation relationships
- Forecasting station-level crime risk
- Explaining why an area is classified as high-risk
Traditional reporting explains what happened.
This platform focuses on:
Where is crime increasing, who is connected, what patterns are emerging, and why is an area becoming risky?
The platform combines three connected intelligence layers:
| Intelligence Layer | Capability |
|---|---|
| ๐บ๏ธ Geospatial Intelligence | Interactive crime maps, heatmaps, district drill-down and emerging red-zone detection |
| ๐ธ๏ธ Network Intelligence | Suspectโvictimโstation relationship analysis and repeat-offender ring detection |
| ๐ฎ Predictive Intelligence | Weekly station risk forecasting using XGBoost with SHAP explainability |
Together, these layers provide a unified crime intelligence system for both station officers and state-level analysts.
Analyze crime geographically across districts and police stations.
- Crime density and hotspot analysis
- District โ station drill-down
- Crime-type filtering
- Day vs night pattern analysis
- Weekday vs weekend comparison
Uses z-score-based statistical anomaly detection to identify unusual recent increases in specific crime categories.
The system distinguishes between persistent hotspots and newly emerging crime spikes, allowing different patterns to be analyzed separately.
Analyzes relationships between:
- Suspects
- Victims
- Police stations
- Modus operandi patterns
MO similarity is calculated using cosine-similarity clustering, helping surface potential repeat-offender groups without manual cross-referencing.
An XGBoost model predicts weekly station-level crime risk.
Instead of providing only a black-box risk score, SHAP explanations identify the factors contributing to each prediction.
This helps answer:
Why is this station considered high-risk?
Crime Records
โ
โผ
Data Processing & Feature Engineering
โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโ
โผ โผ โผ
Geospatial Network ML Risk
Analytics Analysis Prediction
โ โ โ
PostGIS MO Similarity XGBoost + SHAP
โ โ โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโ
โ
โผ
FastAPI Backend
โ
โผ
React Dashboard
Historical Crime Data
โ
โผ
Feature Engineering
โ
โผ
Chronological Train/Test Split
โ
โผ
XGBoost Regression
โ
โผ
Weekly Risk Prediction
โ
โผ
SHAP Explainability
โ
โผ
Ground-Truth Validation
A chronological train/test split is used instead of a random split to reduce future-information leakage.
The synthetic dataset contains 7 deliberately injected crime patterns, allowing the analytics and ML components to be tested against known ground truth.
| Validation | Result |
|---|---|
| Risk Prediction | Test MAE 5.00 vs naive baseline 6.66 |
| Feature Importance | Seasonal + hotspot signals correctly ranked as strongest predictors |
| Burglary Night Pattern | Observed 2.28ร vs injected 2.2ร |
| Vehicle Theft Night Pattern | Observed 1.89ร vs injected 1.9ร |
| Robbery Night Pattern | Observed 1.5ร vs injected 1.5ร |
| MO Ring Detection | Correctly identified all 5 injected repeat offenders |
| Red-Zone Detection | Correctly isolated the injected recent crime spike |
The validation process also identified two implementation issues:
-
Night-time crime multiplier logic โ crime-specific night multipliers were not correctly connected to the hour-assignment logic. The issue was identified through unexpectedly similar observed ratios and corrected.
-
Red-zone baseline logic โ the original detector allowed recent spike weeks to influence their own baseline. This was corrected by comparing a recent window against a clean earlier baseline.
This validation-first approach ensures that the platform's analytical claims are tested rather than simply visualized.
Frontend
- React
- Vite
- React Leaflet
- React Force Graph 2D
- Recharts
Backend
- Python
- FastAPI
- Uvicorn
AI / Machine Learning
- XGBoost
- SHAP
- Scikit-learn
- Pandas
- NumPy
Database & Geospatial
- PostgreSQL
- PostGIS
- Supabase
Deployment
- Zoho Catalyst
- Catalyst AppSail
- Docker
git clone https://github.com/kkeerthanaaaa/KSP-Hackathon-Deploy.git
cd KSP-Hackathon-DeployPostgreSQL 14+ with PostGIS is required.
createdb ksp_crime
psql -U postgres -d ksp_crime -f backend/schema.sqlcd backend
python -m venv venvWindows
venv\Scripts\activateLinux / macOS
source venv/bin/activateInstall dependencies:
pip install -r requirements.txtGenerate synthetic crime data:
python generate_data.pyStart FastAPI:
uvicorn main:app --reload --port 8000cd frontend
npm install
npm run devOpen:
http://localhost:5173
React Frontend
โ
โผ
Zoho Catalyst Client
โ
โผ
FastAPI Backend
โ
โผ
Catalyst AppSail
โ
โผ
Supabase PostgreSQL + PostGIS
PostgreSQL is hosted externally using Supabase because Catalyst's native Data Store does not provide the PostGIS capabilities required by the geospatial analytics layer.
- Real CCTNS/FIR data ingestion
- NLP extraction from FIR narrative text
- Production authentication and role-based access control
- Real-time crime hotspot monitoring
- Socio-economic and demographic overlays
- Crime-type-specific forecasting
- Mobile interface for field officers
- Automated anomaly alerts
- English + Kannada multilingual support
Keerthana K
Live Demo: Launch KSP Crime Intelligence Platform
Source Code: GitHub Repository