This project is a comprehensive crime investigation analysis system designed for advanced investigative intelligence using Call Detail Records (CDR) and Internet Protocol Detail Records (IPDR). It provides deep interconnectivity analysis using a graph database to assist in complex law enforcement and investigative scenarios.
The system utilizes a modern, decoupled architecture consisting of a primary full-stack web application and specialized Python-based backend services for AI tasks.
- Framework: Next.js (App Router) with React, built and optimized for high-performance dashboards and data visualization.
- Styling: Tailwind CSS for a responsive, modern interface.
- Backend APIs: Next.js API Routes handle file uploads, cloud file management, and orchestrating interactions with databases.
- Agent Orchestrator: The core orchestration layer (
agentOrchestrator.ts) drives the agentic workflows. It analyzes natural language queries to detect the investigative intent (such asCoLocationIntent,PhoneToLocationPath,CallActivity, orUnifiedActivity) using strict pattern matching combined with an LLM. It plans queries across multiple strategies (e.g.,shortest_path,all_paths,intermediate_path), securely generating and repairing Cypher queries, enforcing maximum traversal hops (capped at 4) to ensure graph safety, evaluating results, and synthesizing a comprehensive final answer for the user.
- Purpose: Stores and queries highly connected communication data.
- Schema Key Entities:
PhoneNumber,CommunicationEvent,PresenceEvent,Location, andDevice. - Schema Relationships:
INITIATED,TARGET,SEEN_AT,AT_LOCATION, andUSED_DEVICE. - Working Procedure: When a query is made, the orchestrator cap searches at a maximum of 4 hops for performance safety. It retrieves shortest paths bounded paths, or temporal overlap timelines to establish explicit and implicit links.
- Purpose: Handles application metadata, user accounts, and relationships such as "Friends Lists" using JSONB storage capabilities.
- Purpose: Handles the robust data ingestion of various investigative documents into the Neo4j database.
- Architecture: Built as a FastAPI service to provide immediate, high-available data processing.
- Working Procedure: It acts as a dedicated routing layer where specific types of documents are directed to their respective specialized routes. For example, incoming requests are routed to endpoints like
/cpr,/ipdr,/td,/sdr, and/bankdepending on the file type, ensuring tailored parsing and insertion into the graph database.
- Data Ingestion: User uploads raw investigative files (SDR, BANK, CDR, IPDR, TD, PDF, or Images) via the Data Loaders interface.
- Parsing & Routing: The frontend validates initial parsing fields (like
account_numberfor banking records) and passes the data. - Graphing & Ingestion: The Python FastAPI service receives the files via dedicated routes (
/cpr,/ipdr,/td,/sdr,/bank) and processes the structured data, parsing and comprehensively inserting the entities into Neo4j with associated nodes and temporal bounds. - Intelligent Querying: The investigator uses the chat interface. The system captures the query and passes historical context and metadata to the Next.js Agent Orchestrator.
- Intent Resolution & Execution: The LLM Orchestrator deduces the underlying investigative intent through strict validations and LLM reasoning, executes bounded and repaired Cypher queries against Neo4j, retrieves matching patterns (like overlapping activity or communication paths), and finally synthesizes an analytical response detailing the findings.
- Node.js Environment: Uses ES modules, Next.js 16.1.6, and React 19.
- Model Integrations: OpenAI, Groq SDK, and Google Generative AI for core reasoning, Cypher generation.
- Testing & Evaluation: Includes automated LLM-as-a-judge test scripts (
scripts/llm-judge.mjs) to validate query accuracy, orchestrator intent selection, and plotting metrics (scripts/plot_llm_judge.py). - Security: Neo4j credentials and tenant identification are managed via explicit environmental variables rather than hardcoded credentials.
- Install dependencies:
npm install
- Configure
.envwith the necessary environmental keys. You will need to initialize:- Database Credentials:
NEO4J_URI,NEO4J_USER,NEO4J_PASSWORD,POSTGRES_URL - AI Model API Keys:
OPENAI_API_KEY,GOOGLE_GENAI_API_KEY,GROQ_API_KEY
- Database Credentials:
- Start the application:
npm run dev
- Build for production:
npm run build npm run start