Court backlogs in India now run into tens of millions of pending cases, but court staff have very few tools that show which of those cases are likely to drag on, why, and what to look at first. In this paper we present NyayaAI, a web-based decision-support prototype that brings gradient-boosted machine learning, explainable AI and text retrieval together in one workflow. Given a case record, it classifies the delay risk as LOW, MEDIUM or HIGH using an XGBoost classifier, estimates the delay in days with an XGBoost regressor, explains each prediction through SHAP feature contributions, finds similar cases using TF-IDF vectors and cosine similarity, and suggests administrative actions through a set of rules; the Google Gemini API can optionally restate these findings in plain language.
The system is built with React, Node.js/Express, FastAPI and MongoDB, and it pulls real judgment records from the Indian Kanoon API. On 600 held-out cases from a synthetic corpus of 3,000 historical cases, the classifier reached 71.7% accuracy with a macro F1-score of 0.724, and the regressor had a mean absolute error of 97.69 days. These numbers should be read with care, since the training labels are synthetic and the procedural fields of the 89 Indian Kanoon records we ingested are derived, not observed. They show that the pipeline works; they do not measure accuracy on real court outcomes. Testing on independently sourced docket data is the most important next step.
Introduction
India faces a huge backlog of pending court cases, with approximately 4.98 crore (49.8 million) cases pending in district and subordinate courts as of July 2026. Although digital platforms provide access to court records and judgments, administrators still struggle to identify cases at risk of long delays, understand the reasons behind delays, and find similar past cases.
NyayaAI is an AI-powered web application designed to help court administrators, registry staff and legal researchers identify and manage potential procedural delays. It combines machine learning, natural language processing and explainable AI to provide delay-risk predictions, estimated delays, explanations, similar cases and administrative recommendations.
1. Problem Statement
Court delays depend on several factors, including case type, hearings, adjournments, court workload and case stage.
Relevant information is scattered across different sources.
Predictions without explanations are difficult to trust.
Similar-case searches alone cannot identify which cases need urgent attention.
NyayaAI addresses these problems by presenting all relevant information in one dashboard. It focuses only on procedural delays, not on predicting case judgments or deciding who will win.
2. Motivation
The Indian Kanoon API provides access to real court judgments, making it possible to demonstrate the system using genuine legal records. However, publicly available datasets containing actual case-delay histories are limited.
Therefore, NyayaAI uses synthetic data for model training and real legal judgments to demonstrate its functionality. The system is designed so that it can later be retrained using verified court data.
3. Proposed Approach
NyayaAI consists of four main components:
React: Frontend user interface.
Node.js and Express: Backend API, authentication and access control.
MongoDB: Database for storing cases and prediction records.
Python FastAPI: Machine-learning service.
Its main technologies include:
XGBoost: Predicts delay-risk categories (LOW, MEDIUM and HIGH) and estimates delay in days.
SHAP: Explains which factors increase or decrease predicted delay risk.
TF-IDF and Cosine Similarity: Finds similar historical cases.
Gemini API: Generates optional explanations in simple language.
4. Data Sources
NyayaAI uses three types of data:
Data source
Records
Purpose
Synthetic historical dataset
3,000
Model training, testing and similarity search
Indian Kanoon judgments
89
Displaying real legal records
Analyst-entered cases
Variable
User-created case records
Out of the 3,000 synthetic cases, 2,400 are used for training and 600 for testing.
An important limitation is that procedural details such as hearings, adjournments and case stages are derived during ingestion for real judgments. They are not obtained from official live court histories. Therefore, predictions for these judgments are demonstrations rather than actual assessments of their delay risk.
5. Main Contributions
The major contributions of NyayaAI are:
Combines delay-risk classification, delay estimation, explanations and similar-case retrieval in one application.
Uses shared feature extraction for consistent model training and prediction.
Implements SHAP for understandable AI explanations.
Automatically retrieves real judgments through the Indian Kanoon API.
Provides secure, role-based access to the dashboard.
Continues to support basic functionality even if the ML service or Gemini API becomes unavailable.
6. Related Work
Previous research has explored several areas:
Court delay prediction: Earlier studies used machine learning to predict delays in Indian lower courts.
Legal judgment prediction: Research such as PredEx focuses on predicting court decisions and explaining them.
Explainable AI: SHAP explains how individual features influence machine-learning predictions.
Similar-case retrieval: TF-IDF and cosine similarity identify documents with similar words and descriptions.
Open legal data: Indian Kanoon and NJDG provide access to judgments and court pendency statistics.
NyayaAI differs by combining these capabilities into one integrated application focused on procedural delay management.
7. Proposed Methodology
The methodology includes the following stages:
System architecture: A React frontend communicates with the Express backend, MongoDB and Python ML service.
Data ingestion: Real judgments are retrieved from Indian Kanoon and stored in MongoDB.
Feature engineering: Fifteen features are extracted, including case age, number of hearings, adjournments, court, state, case type and current stage.
Delay-risk classification: XGBoost classifies cases into LOW, MEDIUM or HIGH risk.
Delay estimation: An XGBoost regression model estimates the expected delay in days.
Explainability: SHAP identifies the features contributing positively or negatively to the predicted risk.
Similar-case retrieval: TF-IDF and cosine similarity find comparable historical cases.
Recommendations: A rule-based engine suggests suitable administrative actions.
Dashboard: Results are displayed together for easier case monitoring and decision support.
Conclusion
NyayaAI is an integrated decision-support prototype for judicial administration. It predicts the delay-risk class of a case, estimates the delay in days, explains the prediction with SHAP, retrieves similar cases with TF-IDF and cosine similarity, and proposes administrative actions. It runs as a secured React, Express, FastAPI and MongoDB application and ingests real judgments from the Indian Kanoon API. On the held-out synthetic test set the classifier achieved 71.7% accuracy and a macro F1-score of 0.724, and the regressor a mean absolute error of 97.69 days. These results show that the workflow is technically sound; they do not yet show predictive accuracy on real court data. Before any institutional use, the models must be trained and validated on independently sourced, properly licensed docket records.
References
[1] M. Bhatnagar and S. S. Huchhanavar, “Predicting delays in Indian lower courts using AutoML and decision forests,” in Computing, Internet of Things and Data Analytics (ICCIDA 2023), Studies in Computational Intelligence, vol. 1145. Cham, Switzerland: Springer, 2024.
[2] M. Bhatnagar and S. S. Huchhanavar, “Hybrid machine learning modelling with explainability for predicting case delays and durations in Indian lower courts,” Journal of Big Data, vol. 13, no. 4, pp. 1–30, 2026.
[3] S. K. Nigam, A. Sharma, D. Khanna, N. Shallum, K. Ghosh, and A. Bhattacharya, “Legal judgment reimagined: PredEx and the rise of intelligent AI interpretation in Indian courts,” in Findings of the Association for Computational Linguistics: ACL 2024, Bangkok, Thailand, 2024, pp. 4296–4315, doi: 10.18653/v1/2024.findings-acl.255.
[4] T. Chen and C. Guestrin, “XGBoost: A scalable tree boosting system,” in Proc. 22nd ACM SIGKDD Int. Conf. Knowledge Discovery and Data Mining, 2016, pp. 785–794.
[5] S. M. Lundberg and S.-I. Lee, “A unified approach to interpreting model predictions,” in Advances in Neural Information Processing Systems, vol. 30, 2017.
[6] S. M. Lundberg et al., “From local explanations to global understanding with explainable AI for trees,” Nature Machine Intelligence, vol. 2, no. 1, pp. 56–67, 2020.
[7] G. Salton and C. Buckley, “Term-weighting approaches in automatic text retrieval,” Information Processing & Management, vol. 24, no. 5, pp. 513–523, 1988.
[8] F. Pedregosa et al., “Scikit-learn: Machine learning in Python,” Journal of Machine Learning Research, vol. 12, pp. 2825–2830, 2011.
[9] IKanoon Software Development Pvt. Ltd., “Indian Kanoon API.” [Online]. Available: https://api.indiankanoon.org/ (accessed Oct. 2026).
[10] Supreme Court of India, eCourts Services, “National Judicial Data Grid (NJDG).” [Online]. Available: https://njdg.ecourts.gov.in/ (accessed Oct. 2026).
[11] “26 cases pending in Supreme Court for 30+ years, 558 cases for 20+ years: Centre in Rajya Sabha,” Bar & Bench, 2026. [Online]. Available: https://www.barandbench.com/news/26-cases-pending-in-supreme-court-for-30-years-558-cases-for-20-years-centre-in-rajya-sabha
[12] S. Ramírez, “FastAPI documentation.” [Online]. Available: https://fastapi.tiangolo.com/ (accessed Oct. 2026).
[13] Google, “Gemini API documentation.” [Online]. Available: https://ai.google.dev/ (accessed Oct. 2026).