AI Drift Detection & Anomaly Monitoring Engine
Algorzen Research Division Β© 2025 β Author Rishi Singh
Project Drop 002
Algorzen Vigil is an enterprise-grade AI-powered drift detection and anomaly monitoring system designed for time-series KPI analysis. Built with executive business insights in mind, Vigil combines advanced statistical methods with optional GPT-4 integration to deliver actionable intelligence through professional PDF reports.
-
π― Multi-Method Anomaly Detection
- Z-score outlier detection (configurable Ο threshold)
- Rolling median deviation analysis (>25% default)
- Seasonal trend decomposition
-
π€ AI-Powered Narrative Engine
- GPT-4 integration for executive summaries
- Intelligent root cause analysis
- Actionable recommendations
- Fallback heuristic explanations
-
π Professional PDF Reports
- Algorzen Research Division branding
- Time-series visualizations with anomaly highlights
- Executive narrative sections
- KPI statistics tables
- Metadata JSON export
-
π Interactive Web Interface
- Streamlit-powered UI
- File upload and analysis
- Real-time visualization
- One-click PDF generation
algorzen-vigil/
βββ main.py # CLI entry point
βββ drift_detector.py # Anomaly detection algorithms
βββ anomaly_explainer.py # AI narrative generation
βββ report_generator.py # PDF report builder
βββ app/
β βββ streamlit_app.py # Web interface
βββ data/
β βββ sample_kpi_data.csv # Sample dataset
βββ reports/ # Generated reports
β βββ Vigil_Report_*.pdf
β βββ report_metadata.json
βββ requirements.txt # Python dependencies
βββ README.md
- Python 3.10 or higher
- pip package manager
-
Clone the repository
git clone https://github.com/algorzen/vigil.git cd vigil -
Create a virtual environment (recommended)
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Configure OpenAI API (optional)
cp .env.example .env # Edit .env and add your OPENAI_API_KEY
Basic usage:
python main.py --input data/sample_kpi_data.csvWith OpenAI GPT-4:
python main.py --input data/sample_kpi_data.csv --use-openaiCustom parameters:
python main.py \
--input data/sample_kpi_data.csv \
--zscore-threshold 2.5 \
--rolling-window 14 \
--deviation-threshold 0.30 \
--output-dir custom_reports \
--use-openaiCLI Options:
--input, -i: Path to input CSV file (required)--output-dir, -o: Output directory for reports (default:reports)--use-openai: Enable GPT-4 explanations--zscore-threshold: Z-score threshold (default: 3.0)--rolling-window: Rolling window size in days (default: 7)--deviation-threshold: Deviation threshold percentage (default: 0.25)--date-column: Name of date column (default:date)--report-id: Custom report identifier
Launch Streamlit app:
streamlit run app/streamlit_app.pyThen navigate to http://localhost:8501 in your browser.
Web features:
- Upload CSV files
- Configure detection parameters
- Interactive visualizations
- Real-time analysis
- Download PDF reports
Your CSV file should contain:
- A date/timestamp column (configurable name)
- One or more numeric KPI columns
Example:
date,revenue,customer_acquisition,churn_rate,server_uptime,api_latency
2024-01-01,125000,450,2.1,99.95,120
2024-01-02,128000,465,2.0,99.97,115
2024-01-03,130000,472,1.9,99.96,118==============================================================================
π§ Algorzen Vigil - AI Drift Detection Engine
Algorzen Research Division Β© 2025 β Author Rishi Singh
Project Drop 002 β Anomaly Monitoring & Analytics
==============================================================================
π Loading KPI data from: data/sample_kpi_data.csv
β
Loaded 90 records with 6 columns
π Initializing drift detection system...
β
Monitoring 5 KPIs: revenue, customer_acquisition, churn_rate, server_uptime, api_latency
π― Running Z-score outlier detection (threshold: 3.0Ο)...
β
Found 3 Z-score outliers
π Total Anomalies: 8
β οΈ Severity Level: Medium
π KPIs Analyzed: 5
π Report Location: reports/Vigil_Report_2025-11-10.pdf
- Executive Summary: AI-generated business insights
- Anomaly Overview: Total count, severity, affected KPIs
- Key Findings: Detailed analysis of detected anomalies
- Recommendations: Actionable next steps
- KPI Statistics: Mean, std dev, min, max for each metric
- Visualizations: Time-series charts with anomaly highlights
{
"project": "Algorzen Vigil",
"report_id": "VIGIL-2025-Q4-001",
"generated_by": "Rishi Singh",
"created_at": "2025-11-10T14:30:00",
"tone": "Executive Business",
"openai_used": true,
"anomaly_summary": {
"total_anomalies": 8,
"severity": "Medium",
"affected_kpis": ["revenue", "churn_rate", "server_uptime"]
}
}Core anomaly detection algorithms:
- Z-score Analysis: Identifies extreme outliers beyond configurable standard deviations
- Rolling Deviation: Detects rapid changes from recent trends
- Seasonal Decomposition: Separates trend, seasonal, and residual components
- Statistical Summaries: Comprehensive KPI statistics
AI-powered narrative generation:
- GPT-4 Integration: Intelligent analysis using OpenAI API
- Fallback Engine: Heuristic-based explanations when API unavailable
- Executive Tone: Business-focused, concise, actionable insights
- Multi-Section Output: Summary, findings, recommendations
Professional PDF creation:
- Algorzen Branding: Custom headers, footers, styling
- Chart Generation: Matplotlib/Seaborn visualizations
- Table Formatting: ReportLab tables for statistics
- Metadata Export: JSON file with report metadata
Command-line orchestration:
- Argument Parsing: Flexible CLI configuration
- Pipeline Execution: Coordinated analysis workflow
- Progress Feedback: Real-time status updates
- Error Handling: Graceful failure recovery
Interactive web interface:
- File Upload: CSV drag-and-drop
- Parameter Controls: Sliders and inputs
- Live Visualization: Interactive charts
- Report Download: One-click PDF generation
Create a .env file in the project root:
# OpenAI API Configuration (optional)
OPENAI_API_KEY=sk-your-api-key-hereAll detection thresholds are configurable:
-
Z-Score Threshold: 1.0 - 5.0 (default: 3.0)
- Lower = more sensitive, more anomalies
- Higher = less sensitive, fewer anomalies
-
Rolling Window: 3 - 30 days (default: 7)
- Smaller = detects short-term changes
- Larger = detects long-term trends
-
Deviation Threshold: 10% - 50% (default: 25%)
- Lower = more sensitive to deviations
- Higher = only major deviations flagged
- Executive Summaries: AI-generated insights in business language
- Risk Assessment: Severity-based anomaly classification
- Actionable Recommendations: Clear next steps for intervention
- Multi-Method Detection: Comprehensive anomaly coverage
- Configurable Thresholds: Tune sensitivity to your needs
- Automated Reporting: Consistent, reproducible analysis
- Early Warning System: Detect issues before they escalate
- Root Cause Analysis: AI-powered explanations
- Audit Trail: Metadata tracking for compliance
Test with the included sample data:
python main.py --input data/sample_kpi_data.csvExpected output:
- Console log showing analysis progress
- PDF report in
reports/directory - Metadata JSON file
- Multiple visualization PNG files
pip install -r requirements.txt- Verify
OPENAI_API_KEYin.env - Use
--use-openaiflag only if API key is set - Fallback mode works without API key
- Ensure CSV has a date column
- Specify column name with
--date-column - Date format: YYYY-MM-DD recommended
- Process data in chunks
- Reduce rolling window size
- Limit visualizations to top KPIs
- pandas (β₯2.0.0): Data manipulation
- numpy (β₯1.24.0): Numerical computing
- scipy (β₯1.10.0): Statistical functions
- statsmodels (β₯0.14.0): Time-series analysis
- matplotlib (β₯3.7.0): Visualization
- seaborn (β₯0.12.0): Statistical plotting
- reportlab (β₯4.0.0): PDF generation
- openai (β₯1.0.0): GPT-4 integration
- streamlit (β₯1.28.0): Web interface
- python-dotenv (β₯1.0.0): Environment management
Copyright Β© 2025 Algorzen Research Division
This project is proprietary software developed by Rishi Singh for Algorzen Research Division.
Algorzen Research Division develops cutting-edge AI and data intelligence solutions for enterprise analytics. We combine academic rigor with business pragmatism to deliver actionable insights at scale.
Project Drops:
- Drop 001: [Classified]
- Drop 002: Vigil (AI Drift Detection Engine) β You are here
- Drop 003: [Coming Soon]
Rishi Singh
Lead Researcher, Algorzen Research Division
For questions, collaborations, or enterprise licensing:
- GitHub: [Your GitHub Profile]
- Email: [Your Email]
- Website: [Algorzen Website]
Built with:
- Python ecosystem (NumPy, Pandas, SciPy)
- OpenAI GPT-4 API
- ReportLab PDF Library
- Streamlit Framework
Below are placeholders for screenshots that illustrate the working Vigil app. Add your exported PNGs to docs/assets/ with the filenames shown below and they will render here.
Caption: Landing / dashboard view showing high-level summary.
Caption: CSV upload and parameter controls.
Caption: Detected anomalies, KPIs, and metrics table.
Caption: Correlation heatmap, seasonal decomposition, distribution analysis.
Caption: Example of the PDF report generated by the project.
Caption: Reserved slot β upgrade to access premium dashboards and extended analytics. This image is a placeholder that can contain a Paywall CTA, screenshot of premium charts, or a lock overlay indicating gated features.
Notes on images:
- Recommended format: PNG
- Suggested sizes: 1000β1400px width for landscape images
- If screenshots are not present, GitHub will show broken image icons; keep
docs/assets/README.mdfor guidance.
- v1.0.0 (2025-11-10): Initial release
- Multi-method anomaly detection
- GPT-4 integration with fallback
- PDF report generation
- Streamlit web interface
- Complete documentation
Algorzen Research Division Β© 2025 β Author Rishi Singh
Powering Data Intelligence