CSIS is a full-stack AI platform for criminal risk prediction and Tunisian legal assistance. It integrates an XGBoost-based risk prediction engine with a RAG-powered legal chatbot, offering real-time analytics, source-cited legal answers, and an interactive dashboard built with FastAPI and React.
# CSIS — Criminal Study Intelligent System
AI-powered criminal behavior risk assessment & Tunisian legal intelligence platform
---
## What is CSIS?
CSIS (Criminal Study Intelligent System) is a full-stack web platform that combines two AI engines to assist law enforcement professionals and legal researchers in Tunisia. It turns raw socio-behavioral data into actionable criminal risk intelligence and enables natural-language querying of Tunisian law.
| Engine | Description |
|--------|-------------|
| **Risk Predictor** | XGBoost model trained on 10,000 records — predicts criminal behavior risk (%) and likely crime type from 18 socio-behavioral features |
| **Legal Chatbot** | RAG pipeline over 1,485+ Tunisian law articles — answers legal questions with cited sources, powered by Groq LLaMA 3.3 / Gemini Flash |
---
## Platform Description
### Risk Assessment Engine
The risk assessment module accepts a 18-field profile describing an individual's socio-demographic and behavioral background. It outputs:
- **Risk percentage** (0–100%) — how likely this profile leads to criminal behavior
- **Binary decision** — "Futur criminel" or "Non criminel" (threshold: 20% probability)
- **Predicted crime type** — one of 21 crime categories (e.g. "Vol avec violence", "Trafic de drogue")
The prediction runs in real time via a REST API, with results displayed on an interactive dashboard with visual indicators, risk gauges, and history tracking per user session.
### Legal Intelligence Chatbot
The chatbot provides natural-language access to Tunisian law. Users type questions in French (or Arabic) and receive direct answers with source citations drawn from actual legal texts. The pipeline works as follows:
1. The user's query is vectorized using a TF-IDF model (bigrams, 1,485+ chunks)
2. Top-k most relevant article chunks are retrieved via cosine similarity
3. The retrieved context + question are sent to the LLM (Groq LLaMA 3.3 70B)
4. The LLM generates a ground …