Skip to content

Latest commit

ย 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿšจ KSP Crime Intelligence Platform

AI-Powered Crime Analytics, Hotspot Detection & Explainable Risk Intelligence

Built for Karnataka State Police Datathon 2026 โ€” Challenge 2

Live Demo GitHub Team


Co-authored by: Akash T


๐Ÿ“Œ Overview

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.


๐ŸŽฏ The Problem

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 Solution

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.


โœจ Key Features

๐Ÿ—บ๏ธ Geospatial Crime Analytics

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

๐Ÿšจ Emerging Red-Zone Detection

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.

๐Ÿ•ธ๏ธ Criminal Network Analysis

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.

๐Ÿ”ฎ Explainable Crime Risk Prediction

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?


๐Ÿ—๏ธ System Architecture

Crime Records
      โ”‚
      โ–ผ
Data Processing & Feature Engineering
      โ”‚
      โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
      โ–ผ              โ–ผ               โ–ผ
 Geospatial       Network         ML Risk
 Analytics        Analysis        Prediction
      โ”‚              โ”‚               โ”‚
   PostGIS      MO Similarity    XGBoost + SHAP
      โ”‚              โ”‚               โ”‚
      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ”‚
                     โ–ผ
               FastAPI Backend
                     โ”‚
                     โ–ผ
               React Dashboard

๐Ÿง  Machine Learning Pipeline

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.


๐Ÿงช Validation & Model Rigor

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

Validation-Driven Improvements

The validation process also identified two implementation issues:

  1. 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.

  2. 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.


๐Ÿงฐ Tech Stack

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

๐Ÿš€ Run Locally

1. Clone the Repository

git clone https://github.com/kkeerthanaaaa/KSP-Hackathon-Deploy.git
cd KSP-Hackathon-Deploy

2. Setup PostgreSQL

PostgreSQL 14+ with PostGIS is required.

createdb ksp_crime
psql -U postgres -d ksp_crime -f backend/schema.sql

3. Setup Backend

cd backend
python -m venv venv

Windows

venv\Scripts\activate

Linux / macOS

source venv/bin/activate

Install dependencies:

pip install -r requirements.txt

Generate synthetic crime data:

python generate_data.py

Start FastAPI:

uvicorn main:app --reload --port 8000

4. Setup Frontend

cd frontend
npm install
npm run dev

Open:

http://localhost:5173

โ˜๏ธ Deployment

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.


๐Ÿ”ญ Future Scope

  • 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

๐Ÿ‘ฅ Team

Team Lalala

Keerthana K

Akash T


๐Ÿ”— Project Links

Live Demo: Launch KSP Crime Intelligence Platform

Source Code: GitHub Repository


๐Ÿšจ From Crime Records โ†’ Crime Intelligence

Built for Karnataka State Police Datathon 2026 โ€” Challenge 2

AI-Driven Crime Analytics & Visualization Platform

About

An AI-driven crime intelligence platform built for the KSP Datathon 2026 that helps police analyze crime hotspots, uncover repeat-offender networks, and predict station-level crime risk. It combines geospatial analytics, network analysis, XGBoost-based risk prediction, and SHAP explainability to support proactive, data-driven policing.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages