AI Platform for Detecting and Preventing Tax and Customs Evasion in Egypt: Anomaly Detection, NLP Analysis, and Real-Time Alerts.
# AI Platform for Preventing Tax and Customs Evasion
## Overview
This AI platform detects fraudulent activities in tax declarations and customs invoices using machine learning and NLP. Key features:
- **Anomaly Detection**: Identifies unusual patterns in transaction amounts, HS codes, and values (e.g., under-valuation in imports).
- **NLP Analysis**: Extracts entities from invoices (e.g., misclassified goods) using Hugging Face models.
- **Real-Time Alerts**: Flags high-risk cases (e.g., evasion probability >70%) and generates reports.
- **Self-Updating**: Retrains weekly on new data via GitHub Actions.
Built for Egypt's tax/customs authorities, using simulated data from Kaggle (Egyptian VAT datasets) and public APIs. Aligns with digital tax reforms for Vision 2030.
## Features
- Data Loading: Simulated invoices with features like amount, HS code, origin country.
- Detection: Isolation Forest for anomalies + BERT for text classification (fraudulent descriptions).
- Alerts: JSON reports with risk scores and mitigation suggestions.
- Dashboard: Streamlit UI for querying and visualizing flagged cases (run `streamlit run dashboard.py`).
## Installation and Running
1. Clone the repo: `git clone
github.com`
2. Install requirements: `pip install -r requirements.txt`
3. Load data: `python data_loader.py`
4. Train detector: `python evasion_detector.py`
5. Generate alerts: `python alert_generator.py`
6. Run dashboard: `streamlit run dashboard.py`
## Data Sources
- Kaggle Egyptian Tax Dataset: [
kaggle.com].
- HS Code API: UN Comtrade for customs validation.
- Real-Time: Integrate with Egypt Tax Authority APIs (mocked here).
## Technologies
- Python 3.10+
- scikit-learn for anomaly detection.
- Transformers (Hugging Face) for NLP.
- Pandas for data handling.
- Streamlit for UI.
- GitHub Actions for automation.