Skip to content

xenn0010/Sherlock

Repository files navigation

Sherlock.ai - Investigative Intelligence System

A citation-grounded investigative system that converts raw evidence into actionable intelligence with complete source attribution. Built for detectives, analysts, and prosecutors who need court-ready evidence bundles.

Sherlock.ai Dashboard License

🎯 Core Features

Evidence Processing

  • Multi-source Ingestion: CDR, ALPR, POS, CAD, Sensor, Narrative reports
  • SHA-256 Hashing: Every artifact tracked with cryptographic verification
  • Citation Tracking: Sentence-level source attribution for all extracted data

Intelligence Generation

  • Entity Extraction: Automatic extraction of phones, plates, names, devices, locations
  • Event Timeline: Chronological ordering with clock drift correction and contradiction detection
  • Relationship Linking:
    • Co-presence detection (same location, same time)
    • Co-travel patterns (consecutive tower connections)
    • Rendezvous identification (repeated meetings)
    • Fraud chains (suspicious transaction sequences)

Visual Analytics

  • Crime Scene Mapping: Interactive map with movement routes and polylines
  • Entity Graph: Network visualization with typed relationships
  • Timeline Scrubber: Temporal analysis with citation popovers
  • Lead Scoring: AI-powered ranking of investigative leads

Evidence Packs

  • Court-ready ZIP bundles with:
    • Original artifacts
    • SHA-256 manifest
    • Timeline JSON
    • Graph slice
    • One-page summary
    • Verification hashes

πŸ—οΈ Architecture

Backend: FastAPI + SQLite + Neo4j + Weaviate
Frontend: React + TypeScript + Tailwind CSS (Glassmorphic UI)
AI Stack: LlamaIndex + OpenAI/Gemini/Friendli AI

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Artifacts │─────▢│   Services   │─────▢│   Output    β”‚
β”‚   (Raw)     β”‚      β”‚  (Process)   β”‚      β”‚  (Intel)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚                      β”‚                      β”‚
     β”œβ”€ CDR                β”œβ”€ Ingest              β”œβ”€ Timeline
     β”œβ”€ ALPR               β”œβ”€ Extract Entities    β”œβ”€ Graph
     β”œβ”€ POS                β”œβ”€ Eventize            β”œβ”€ Leads
     β”œβ”€ CAD                β”œβ”€ Link (Rules)        └─ Evidence Pack
     β”œβ”€ Sensor             └─ Score Leads
     └─ Narratives

πŸš€ Quick Start

Prerequisites

  • Python 3.9+
  • Node.js 18+
  • Neo4j 5.x
  • Weaviate 1.x (or Docker)

1. Clone Repository

git clone https://github.com/yourusername/sherlock-ai.git
cd sherlock-ai

2. Setup Backend

cd backend
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt

# Create .env file
cp .env.example .env
# Edit .env with your API keys and database credentials

3. Start Databases

# Using Docker Compose (recommended)
docker-compose up -d neo4j weaviate

# Or start services manually:
# - Neo4j: http://localhost:7474
# - Weaviate: http://localhost:8080

4. Initialize & Run Backend

# Run demo with synthetic data
python demo/run_demo.py

# Or start API server
uvicorn app.main:app --reload --port 8000

5. Setup Frontend

cd ../frontend
npm install
npm run dev

Visit http://localhost:5173 to see the dashboard!

πŸ“Š Demo Walkthrough

The demo script generates a complete investigation with:

  • 2 suspects with phone records (10 CDR entries)
  • 2 vehicles tracked via ALPR (10 location hits)
  • POS theft sequence (DoorOpen β†’ Void transaction)
  • 3 officer narratives with embedded contradictions
  • CAD dispatch events

Expected Results:

βœ“ 25+ artifacts ingested
βœ“ 20+ entities extracted
βœ“ 30+ events created
βœ“ 10-15 relationships found
βœ“ 2 contradictions detected
βœ“ 3+ high-confidence leads generated
βœ“ Evidence pack with SHA-256 verification

Run Demo:

cd backend
python demo/run_demo.py

πŸ”’ Security & Compliance

CJIS-Aligned Patterns

  • βœ… Least privilege access control
  • βœ… Complete audit logging
  • βœ… SHA-256 verification on all artifacts
  • βœ… PII redaction with role-based reveal
  • βœ… Immutable evidence packs
  • βœ… No public internet access (configurable)

Citation Requirements

  • Every entity must have β‰₯1 citation
  • Every event must have β‰₯1 citation
  • Every edge must have β‰₯2 citations
  • Citations include: artifact_id, source_type, text span

πŸ“– API Documentation

Artifact Ingestion

POST /api/artifacts/ingest-json
{
  "artifact_type": "CDR",
  "raw_payload": "{...}",
  "case_id": "CASE_001"
}

Case Analysis

POST /api/cases/{case_id}/analyze
# Returns: edge counts and top leads

Timeline & Routes

GET /api/cases/{case_id}/timeline
GET /api/cases/{case_id}/routes  # GeoJSON

Evidence Pack

POST /api/cases/{case_id}/export
GET /api/packs/{pack_id}/download
GET /api/packs/{pack_id}/verify

🎨 UI Components

Glassmorphic Design System

  • GlassCard: Frosted glass containers with backdrop blur
  • GlassButton: Interactive buttons with hover effects
  • GlassPanel: Titled panels for structured content
  • GlassModal: Overlay modals with blur

Color Palette

  • Background: #0a0e27 (dark navy)
  • Accent Cyan: #00d9ff
  • Accent Purple: #a855f7
  • Glass: rgba(255, 255, 255, 0.1) with backdrop-blur

πŸ§ͺ Testing

# Backend tests
cd backend
pytest

# Frontend tests
cd frontend
npm test

# Integration test (full pipeline)
python backend/demo/run_demo.py

πŸ“ˆ Metrics & Validation

The system tracks:

  • Citation Coverage: % of entities/events with citations
  • Edge Quality: Average confidence scores
  • Contradiction Rate: Temporal impossibilities detected
  • Hash Verification: 100% pass rate on evidence packs
  • Processing Time: Ingest β†’ Lead generation cycle

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow PEP 8 for Python
  • Use ESLint/Prettier for TypeScript
  • Write tests for new features
  • Document API changes
  • Maintain citation requirements

πŸ“ License

MIT License - see LICENSE for details

πŸ™ Acknowledgments

  • FastAPI for the excellent web framework
  • Neo4j for graph database capabilities
  • React-Leaflet for mapping
  • Cytoscape.js for graph visualization
  • LlamaIndex for document processing

πŸ“ž Support


Built with ❀️ for law enforcement and investigative professionals

About

Sherlockai uses weaviet and friendli ai to help law enforcment successfully investage and connect cases

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors