# Domain-Adaptive Arabic NER Strategy Pipeline 🧠⚖️
> **An advanced, AI-powered Named Entity Recognition (NER) architecture specialized for extracting, managing, and annotating Legal and Financial documents in Arabic.**
## 🚀 The Vision
This project is not just a model; it is an **End-to-End Applied AI Architecture**. It bridges the gap between deep machine learning (PyTorch/Transformers) and practical business application (React/Node.js). It allows organizations to automate document processing (OCR & PDF scraping) via Mistral AI and extract highly specialized entities from Arabic text using a custom microservice model.
## ✨ System Architecture Features
### 1. The Core AI Integration (Python Microservice)
- **Lazy Loading Memory Management**: Gracefully handles loading and unloading PyTorch/Transformer Models to avoid CUDA out-of-memory errors on deployment.
- **Mistral Large API Integration**: Uses Mistral for processing raw PDFs, executing OCR on Arabic files, and providing "AI Fix/Reasoning" workflows automatically.
- **Batch Processing API**: Fully optimized routes (`/api/ner/batch`) to handle hundreds of documents concurrently.
### 2. The Secure Gateway / API (Node.js & MongoDB)
- **Role-Based Access Control (RBAC)**: Secure separation between Users, Admins, and Super Admins using strict middleware.
- **Security-First Approach**: Implementation of `helmet.js`, HTTP-Only JWT Cookies, secure Bcrypt hashing, and properly locked CORS restrictions.
- **"Human-in-the-loop" Feedback Engine**: User corrections flow securely from the frontend into a review queue where admins approve them to continuously retrain the AI models safely.
### 3. The Dynamic User Interface (React + Tailwind)
- **Real-time NER Demonstration**: Live text parsing highlighting entities (Persons, Organizations, Legal Actions, Case Numbers) using custom interactive token mappers.
- **Executive Admin Dashboard**: Recharts-powered interactive analytics representing model efficiency, user activit …