Skip to content

Garv767/Crime-Record-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

60 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Crime Record and Pattern Analysis (CRPA)

Dashboard Intelligence
CRPA Analytics Dashboard
Geospatial Hotspot Matrix
CRPA Crime Map
Analytics
Analytics
FIR Lifecycle Tracking
FIR Tracking

Overview

A full-stack crime intelligence system for law enforcement. Officers can track incidents, profile offenders, view crime hotspots on a live map, and file First Information Reports β€” all backed by a PostgreSQL database on Supabase.


Tech Stack

Layer Technology
Database PostgreSQL (Supabase)
Backend Go 1.25 Β· chi router Β· pgx/v5
Frontend Next.js 16 Β· TypeScript Β· Tailwind
Map React-Leaflet (CartoDB dark tiles)
Charts Recharts

Project Structure

Crime-Record-Analysis/
β”œβ”€β”€ api/              # Go backend
β”‚   β”œβ”€β”€ cmd/main.go           # Entry point, route registration
β”‚   β”œβ”€β”€ internal/
β”‚   β”‚   β”œβ”€β”€ database/db.go    # Supabase connection via pgx
β”‚   β”‚   β”œβ”€β”€ handlers/         # One file per endpoint
β”‚   β”‚   └── models/models.go  # Shared struct definitions
β”‚   β”œβ”€β”€ .env.example          # Copy to .env and fill in DATABASE_URL
β”‚   └── go.mod
β”œβ”€β”€ frontend/         # Next.js app
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ components/Sidebar.tsx
β”‚   β”‚   β”œβ”€β”€ crimes/page.tsx
β”‚   β”‚   β”œβ”€β”€ offenders/page.tsx
β”‚   β”‚   β”œβ”€β”€ map/page.tsx + MapView.tsx
β”‚   β”‚   β”œβ”€β”€ fir/page.tsx
β”‚   β”‚   └── page.tsx          # Dashboard
β”‚   └── lib/api.ts            # Centralised Go API client
└── db/
    β”œβ”€β”€ new.sql                # DDL β€” CREATE TABLE statements
    └── insert.sql             # Seed data (10 Chennai locations + crimes)

Setup

1. Database

Run db/new.sql then db/insert.sql in the Supabase SQL Editor.

2. Backend

cd api
cp .env.example .env        # Add your Supabase DATABASE_URL
go run ./cmd/main.go        # Starts on http://localhost:8080

3. Frontend

cd frontend
npm install
npm run dev                 # Starts on http://localhost:3000

API Routes

Method Route Description
GET /health Server health check
GET /api/locations All tracked locations with lat/long + risk level
GET /api/crimes All incidents, joined with location. ?type= filter supported
GET /api/offenders All offenders ordered by repeat-crime count
GET /api/hotspots Crime counts grouped by location (for map)
GET /api/fir Fetch all filed FIRs with joined details
POST /api/fir File a new FIR (runs a DB transaction)
PUT /api/fir/{id} Update FIR investigation status
GET /api/audit View system-wide audit trail

POST /api/fir β€” Request Body

{
  "crime_id":   1,
  "officer_id": 3,
  "status":     "Open",
  "victim_name":    "R. Subramanian",
  "victim_age":     45,
  "victim_contact": "+91 9876543210",
  "victim_address": "Chennai, Tamil Nadu"
}

status must be one of: "Open", "Closed", "Under Investigation".


Technical Accountability (Audit Trail)

The system automatically logs critical actions to ensure transparency and integrity:

  • CREATE_FIR: Logged when a new report is filed, including the officer's name and linked incident.
  • IDENTIFY_OFFENDER: Logged when an offender is linked to a crime.
  • EVIDENCE_LOGGED: Logged when new evidence is registered.

About

πŸ›‘οΈ Law Enforcement Incident Intelligence & Pattern Analysis System (CRPA). High-fidelity management of incidents, offenders, and hotspots with transactional FIR integrity and real-time geospatial analytics.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors