An AI-powered, production-grade risk intelligence system designed to analyze Aadhaar demographic and enrolment update patterns. By applying behavioral anomaly detection, temporal series forecasting, and spatial density aggregation, the system identifies regions (pincodes) exhibiting anomalies that may require closer administrative scrutiny.
- Interactive Streamlit Dashboard: https://uidai-aadhaar-risk-intelligence-4w38qdtvkssagubcm48fjy.streamlit.app/
- Production API Backend: https://uidai-aadhaar-risk-intelligence-api.onrender.com
- API Swagger Documentation: https://uidai-aadhaar-risk-intelligence-api.onrender.com/docs
The integrity of national identity registry operations is crucial. Due to the high volume of demographic updates (name, date of birth, address) and biometric updates (photo, fingerprints, iris scans), manually identifying irregular update clusters or coordinate shift trends across Indiaβs postal index numbers (pincodes) is infeasible.
This system solves this challenge by implementing an automated unsupervised and temporal machine learning pipeline that processes aggregated update counts to detect irregular activity, identify spatial outliers, track risk evolution, and generate explainable security alertsβwithout storing or exposing individual Aadhaar numbers or PII.
- Privacy-First Design: Operates entirely on aggregated count stats. No individual PII or Aadhaar numbers are collected, stored, or processed.
- Anomalous Pattern Spotting: Combines an unsupervised Isolation Forest (out-of-distribution detection) and a Dense Autoencoder (reconstruction loss mismatch).
- Temporal Forecasting: Uses an LSTM Recurrent Neural Network trained on temporal sequences to predict normal seasonal variations (e.g. school admissions) and separate them from persistent structural anomalies.
- Spatial Neighborhood Analysis: Uses Nearest Neighbors to flag pincodes whose biometric-to-demographic update patterns diverge drastically from neighboring geographic zones.
- Risk Engine Weights Simulator: Includes a dashboard configuration slider allowing admins to fine-tune model fusion weights dynamically.
- Explainable Security Alerts: Translates numerical risk indicators into natural-language reasons for every flagged region.
- Production Decoupling: Decoupled FastAPI backend and Streamlit dashboard ready for cloud autoscaling.
graph TD
A[Demographic Dataset CSVs] -->|Load & Clean| C[DataLoader]
B[Enrolment Dataset CSVs] -->|Load & Clean| C
C -->|Canonicalize States & Align Schema| D[Merged Dataset]
D -->|Feature Extraction| E[FeatureEngineer]
E -->|Scale Features| F[StandardScaler]
F -->|Anomalies fit| G[Isolation Forest]
F -->|Reconstruction fit| H[Dense Autoencoder]
E -->|Temporal Windows| I[LSTM Sequencer]
E -->|Spatial Clustered Ratios| J[Nearest Neighbors]
G -->|Component Scores| K[Risk Fusion Engine]
H -->|Component Scores| K
I -->|Component Scores| K
J -->|Component Scores| K
K -->|Weights Aggregator| L[Final Risk Scores]
L -->|Classify Alerts| M[Actionable Alerts CSV]
L -->|Cache DataFrame| N[FastAPI Backend Server]
N -->|REST Endpoints| O[Streamlit Dashboard Web App]
Detailed technical specifications are available in the docs/ directory:
- Architecture.md β Multi-layered workflow description.
- Dataset.md β Raw CSV schema layouts and canonical cleaning rules.
- Models.md β ML component details and equations.
- API.md β Backend query endpoints reference.
- Deployment.md β Docker & Cloud setups.
The final risk score is computed using a weighted linear combination of the anomaly indicators:
Where default weights are set to:
-
Isolation Forest (
$w_{if}$ = 0.3): Detects global update count spikes. -
Autoencoder (
$w_{ae}$ = 0.3): Captures age-bracket representation skews. -
LSTM Network (
$w_{lstm}$ = 0.2): Flags sustained, cyclical temporal anomalies. -
Spatial Neighborhood (
$w_{spatial}$ = 0.2): Flags pincodes differing from geographical neighbors.
| Risk Level | Range | Meaning & Action |
|---|---|---|
| Normal | Regular lifecycle behavior; normal logs. | |
| Monitor | Elevated activity; requires passive tracking. | |
| High Risk | Structural discrepancy; flagged for audit inspection. | |
| Early Warning | flag = 1 | 7-day risk score trend increases by |
- Programming Language: Python 3.10+
- Deep Learning: TensorFlow (CPU edition)
- Machine Learning: Scikit-Learn
- Web Services API: FastAPI, Uvicorn
- Interactive Dashboard: Streamlit, Plotly, Seaborn, Matplotlib
- CI/CD: GitHub Actions (Automated PyTest & Linting)
- Deployment: Docker, Render (API), Streamlit Community Cloud (Frontend)
UIDAI-PROJECT-main/
βββ .github/
β βββ workflows/
β βββ ci.yml # CI setup (flake8, pytest, coverage)
βββ .streamlit/
β βββ config.toml # Streamlit styling & theme overrides
βββ config/
β βββ config.yaml # Central settings (thresholds, weights)
βββ data/
β βββ raw/ # Anonymized data (kept clean)
β βββ processed/ # Models output (risk scores, summary)
βββ docs/
β βββ screenshots/ # Dashboard screens
β βββ Architecture.md # Flow details
β βββ Dataset.md # Columns & Cleaning rules
β βββ Models.md # Neural network descriptions
β βββ Deployment.md # Production hosting guides
βββ models/ # Trained models (.joblib, .keras)
βββ src/
β βββ config.py # Central config loader
β βββ data/
β β βββ data_loader.py # Loading, deduplication, & canonical cleaning
β βββ features/
β β βββ engineer.py # Feature engineering & sequence prep
β βββ models/
β β βββ train.py # ML models training orchestration
β β βββ predict.py # Inference, trend computing, & alerts
β βββ api/
β β βββ app.py # FastAPI endpoints & bootstrap data
β βββ utils/
β βββ logger.py # Logging setup
βββ app.py # Streamlit dashboard app
βββ run_pipeline.py # CLI runner to trigger ML training/inference
βββ start_services.py # Concurrent server script
βββ tests/ # PyTest test cases
βββ Dockerfile # Containerization script
βββ requirements.txt # Minimal dashboard dependencies
βββ requirements-backend.txt # Full ML pipeline dependencies
python -m venv venv
# On Windows
venv\Scripts\activate
# On Unix/macOS
source venv/bin/activate
# Install dependencies
pip install -r requirements-backend.txtExecute the end-to-end pipeline CLI:
python run_pipeline.py --trainStart the API and Dashboard concurrently:
python start_services.py- FastAPI Endpoints: Open
http://localhost:8081/docsto test endpoints via Swagger. - Interactive Dashboard: Open
http://localhost:8501to view the Streamlit UI.
To verify the entire pipeline, run the test suites:
python -m pytest tests/ --tb=shortThis project is distributed under the terms of the MIT License. Details can be found in the LICENSE file.
Contributions are welcome! Please feel free to open a Pull Request or issue for bugs, documentation improvements, or algorithm optimization proposals.
UIDAI Aadhaar Risk Intelligence System Development Team
- GitHub: @sg721642



