opp-question-generation / README.md

Interrogation Question Generation and Decision-Making Support PoCs for OPP (Oman Public Prosecution)

Interrogation Question Generation and Decision-Making Support PoCs for Oman Public Prosecution

Last updated: 4/16/2026GitHub

Interrogation Question Generation and Decision-Making Support PoCs for OPP (Oman Public Prosecution)

The main goal of this project is to assist the Oman Public Prosecution (OPP) by providing AI-powered tools for interrogation question generation and case decision-making support. These tools aim to improve efficiency, reduce redundancy, and ensure decisions are backed by thorough analysis of available evidence and legal frameworks.


Features

1. Automated Interrogation Question Generation

  • Question Generation:
    • Generates questions based on case data, targeting specific areas for interrogation.
    • Covers unique topics that may have been missed in the actual interrogation process.
    • Supports tailored prompts for different interrogation roles (e.g., suspect, witness) to maximize relevance.
  • Analysis Tools:
    • Ability to interact with the AI about the case data (e.g., "generate the case timeline", "find the conflicts in the statements").
    • Embedding-based clustering to identify topic distribution across questions.

2. Case Decision-Making Support

  • Legal Decision Analysis:
    • Analyzes case data to recommend whether a case should be referred to court or dismissed.
    • Evaluates the strength of evidence, including confessions, witness statements, and physical evidence.
    • Accounts for legal intent and the sufficiency of evidence for prosecution.
  • Bias Mitigation:
    • Reduces over-cautiousness by balancing the need for evidence collection with the sufficiency of available evidence.
    • Incorporates logic for recognizing when confessions or clear physical evidence are decisive.
  • Interactive Features:
    • Provides justifications for decisions, outlining strengths and gaps in evidence.
    • Suggests additional steps if evidence is insufficient (e.g., "collect physical evidence", "interview key witnesses").

Actions Taken by Public Prosecutors

The actions taken by public prosecutors can be translated and categorized as follows:

  • إحالة (Referral) This action occurs when the prosecutor decides to refer the case to court for trial, believing there is sufficient evidence to proceed.

  • حفظ (Archiving or Case Dismissal) This indicates that the case is closed without further action. It can be:

    • Temporary / مؤقت: Due to insufficient evidence or an unknown suspect.
    • Permanent / نهائي: Because the incident is not a crime or lacks a legal basis.
  • أمر جزائي (Penal Order) This refers to the resolution of a case outside of court proceedings. It often involves fines or minor penalties for simple offenses where the evidence is clear.

  • قرار التصرف (Disposition Decision) A general term encompassing any formal decision regarding the case, whether it is:

  • Referral.

  • Archiving.

  • Issuing a penal order.


Project Structure

  • ollam/: Handles LLM inference for both question generation and decision-making.
  • fastapi/: FastAPI service for generating questions and decisions based on case data.
    • main.py: Entry point for the FastAPI application.
    • prompts.py: Contains the logic for question generation and decision-making prompts.
    • utils.py: Utility functions for processing, comparing, and evaluating outputs.
    • generation_analysis.py: is used to generate text based on the data provided by OPP.
    • analyse_dataset.py, embedder.py, datasetset_generator.py: these files are used only in the terminal
  • ocr/: OCR service for processing case-related documents.
  • web/: Streamlit interface for generating questions, visualizing results, and reviewing decision recommendations.
    • app.py: the main page for the app used for generating questions.
    • pages/cases.py: display all interrogation made by the AI
    • pages/decisions.py: display all decisions made by the AI
    • pages/decisions_analysis.py: a dashboard for displaying all decisions results made by the AI with extra analysis.

How to Run

  1. Clone the Repository:

    git clone git@github.com:rihal-om/opp-question-generation.git
    cd opp-question-generation
    
  2. For development:

    docker compose up -d --build
    
  3. Pull Models through Ollama

    ollama pull qwen2.5:32b-instruct
    
  4. Open localhost:8501