DataGuard is an end-to-end data quality monitoring framework that automatically detects, measures, and alerts on data quality issues. It combines statistical checks, ML-based anomaly detection, time-series drift monitoring, interactive dashboards, and CI/CD gate support β all in a single, extensible Python package.
| Feature | Description |
|---|---|
| π§ͺ 6 Quality Dimensions | Completeness, Uniqueness, Validity, Consistency, Timeliness, Accuracy |
| π 4 Anomaly Detection Methods | IQR, Z-score, Modified Z-score (MAD), Isolation Forest |
| π Drift Detection | Rolling-window trend analysis across 30-day time series |
| π₯οΈ Interactive Dashboard | 6-page Streamlit dashboard with drill-downs, live charts, and catalog |
| π Data Catalog | Auto-generated schema documentation with per-column profiles & quality flags |
| π Multi-Channel Alerting | Slack webhook + SMTP email + console with configurable thresholds |
| β° Scheduled Runs | Continuous loop mode, cron-style, or CI/CD gate (--gate) |
| ποΈ DB Connectors | PostgreSQL, Snowflake, SQLite, CSV β bring your own data |
| π Quality History | SQLite-backed tracking of quality scores over time with trend summaries |
| π³ Docker Support | Containerized deployment with docker-compose |
| β 72+ Unit Tests | Comprehensive coverage across all modules |
| Overview | Data Quality |
|---|---|
![]() |
![]() |
| Anomaly Detection | Drift Analysis |
|---|---|
![]() |
![]() |
| Data Explorer | Data Catalog |
|---|---|
![]() |
![]() |
# Clone
git clone https://github.com/Yash-Patil-1/dataguard.git
cd dataguard
# Install
pip install -r requirements.txt
# Generate sample data with intentionally injected quality issues
python src/data_generator.py
# Run quality checks
python src/validators.py
# Run anomaly detection
python src/detectors.py
# Launch the dashboard
streamlit run dashboard.pyOr use the all-in-one runner:
python run_pipeline.py # Full pipeline
python run_pipeline.py --alert # With Slack/Email alerts
python run_pipeline.py --schedule # Every hour
python run_pipeline.py --stages validate,detect # Specific stages only
python run_pipeline.py --csv ./my_data.csv # Run on your own CSV
python run_pipeline.py --gate --gate-threshold 0.7 # CI/CD gate modeDataGuard/
βββ src/
β βββ config.py # Configuration & data quality issue definitions
β βββ data_generator.py # Synthetic data generator with quality issues
β βββ validators.py # 6 modular quality checkers + pipeline
β βββ detectors.py # 4 anomaly/drift detection methods + pipeline
β βββ data_catalog.py # Auto-column profiling & data catalog
β βββ alerts.py # Slack/Email/Console alert dispatcher
β βββ connectors.py # PostgreSQL / Snowflake / SQLite / CSV connectors
β βββ history.py # Quality score tracking in SQLite
β βββ utils.py # QualityReport, scoring, reporting utilities
βββ tests/
β βββ test_validators.py
β βββ test_detectors.py
β βββ test_connectors.py
β βββ test_data_catalog.py
β βββ test_data_generator.py
β βββ test_history.py
β βββ test_profiler.py
β βββ test_utils.py
β βββ test_pipeline.py
βββ config/
β βββ thresholds.yaml # Configurable pass/fail thresholds
β βββ alerts.yaml # Alert channel configuration
βββ data/ # Generated datasets (auto-created)
βββ reports/ # Quality reports (auto-created)
βββ docs/ # Usage, architecture, development guides
βββ dashboard.py # Streamlit interactive dashboard
βββ run_pipeline.py # CLI pipeline orchestrator
βββ Dockerfile # Container build
βββ docker-compose.yml # Multi-service orchestration
βββ pyproject.toml # Package metadata & dependencies
Data Generation βββΊ Quality Checks βββΊ Anomaly Detection βββΊ Alerts
β β β β
βΌ βΌ βΌ βΌ
CSV Files QualityReport Anomaly Scores Slack/Email
(30 days) (JSON + TXT) (per method) + Console
β β β
βΌ βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Streamlit Dashboard (6 pages) β
β Overview β Data Quality β Anomalies β Drift β β
β Data Explorer β Data Catalog β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Each dimension is implemented as a modular checker class in src/validators.py:
| Dimension | Checker | What It Detects |
|---|---|---|
| Completeness | CompletenessChecker |
Null rates per column, empty strings |
| Uniqueness | UniquenessChecker |
Exact row duplicates, key column duplicates |
| Validity | ValidityChecker |
Email format (regex), future dates, numeric range violations |
| Consistency | ConsistencyChecker |
Referential integrity (orphan IDs), amount calculation accuracy, city-state mapping |
| Timeliness | TimelinessChecker |
Data freshness (hours since last update), recent data ratio |
| Accuracy | AccuracyChecker |
Distribution shift vs ground truth (mean/std comparison) |
Scoring: Each check produces a 0.0β1.0 score. Dimension scores are weighted and aggregated into an Overall Quality Score with PASS (β₯75%), WARNING (50β75%), or CRITICAL (<50%) status.
Four detection methods in src/detectors.py:
| Method | Type | Best For |
|---|---|---|
| IQR | Statistical | Univariate outliers, simple threshold-based detection |
| Z-score | Statistical | Normally distributed data, standard deviation-based |
| Modified Z-score | Robust | Data with outliers already present (MAD-based) |
| Isolation Forest | ML-based | Multivariate anomalies β unusual combinations of values |
| Drift Detection | Time-series | Distribution shifts over time (rolling window) |
The Streamlit dashboard has 6 interactive pages:
| Page | Features |
|---|---|
| π Overview | KPI cards, quality dimension bar chart, missing value pie chart |
| π§ͺ Data Quality | Full checks table, pass/fail breakdown, failures by dimension |
| π Anomaly Detection | Method comparison, top IForest anomalies, outlier counts by column |
| π Drift Analysis | Multi-metric quality trends over 30 days, category drift, alert detail tabs |
| π Data Explorer | Null-highlighted preview, dirty vs clean comparison, per-column profiles |
| π Data Catalog | Schema overview, column stats & distributions, cross-table comparison |
streamlit run dashboard.pyConfigure alerts in config/alerts.yaml or via environment variables:
# Slack
export DATAGUARD_SLACK_WEBHOOK="https://hooks.slack.com/services/..."
# Email
export DATAGUARD_SMTP_HOST="smtp.gmail.com"
export DATAGUARD_SMTP_USER="your@gmail.com"
export DATAGUARD_SMTP_PASS="app-password"
export DATAGUARD_ALERT_EMAILS="team@company.com"
# Run with alerts
python run_pipeline.py --alertAlert triggers: critical score drop, any check failures, drift events, daily summary.
# Continuous loop (every hour)
python run_pipeline.py --schedule --interval 3600
# Daily runs (via cron)
0 0 * * * cd /path/to/dataguard && python run_pipeline.py --alert
# CI/CD gate β exits 0 on pass, 1 on fail
python run_pipeline.py --gate --gate-threshold 0.70
# Bring your own CSV or database
python run_pipeline.py --csv ./my_data.csv
python run_pipeline.py --db postgresql://user:pass@host/db --table ordersdocker compose up -d
# Services: pipeline, dashboard (port 8501), schedulerpytest tests/ -v
# 72+ tests β all modules, including connectors, data catalog & history| File | Description |
|---|---|
customers.csv |
8,000 clean customer records |
all_orders_combined.csv |
~50,000 dirty orders with injected issues |
ground_truth_orders.csv |
~50,000 clean orders (no issues) for comparison |
daily_orders_01β30.csv |
30 daily snapshots with escalating quality issue rates |
quality_issues_log.json |
Audit trail of all injected quality issues |
Quality issues escalate over the 30-day period: null rates increase from 3β12% to 6β24%, duplicate rates from 3% to 9%, email invalidity from 5% to 11%, and category distributions drift.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing) - Run tests (
pytest tests/ -v) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing) - Open a Pull Request
Yash Patil
- π§ yashpatil7714@gmail.com
- π LinkedIn
- π GitHub





