Metadata-Version: 2.4
Name: csvguard
Version: 0.1.0
Summary: The Fast, Terminal-First Data Quality & Cleaning CLI
Home-page: https://github.com/your-username/csvguard
Author: Sumit
Author-email: Sumit <sumit.developer@example.com>
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Environment :: Console
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: pandas>=1.3.0
Requires-Dist: numpy>=1.20.0
Requires-Dist: rich>=12.0.0
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# 🛡️ csvguard

> **The Fast, Terminal-First Data Quality Profiler & Cleaning CLI for Python.**

[![PyPI Version](https://img.shields.io/badge/pypi-v0.1.0-blue.svg)](https://pypi.org/)
[![Python](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://www.python.org/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Stop writing 40 lines of boilerplate Pandas code just to inspect missing values, bad headers, duplicate rows, and statistical outliers in messy CSV files. 

`csvguard` gives you a **CIBIL-style Data Health Score (0-100)**, an interactive terminal dashboard, and one-command automated data cleaning.

---

## ✨ Features

- 🩺 **Instant Health Score (0-100):** Comprehensive weighted evaluation of missing data ratios, duplicate rows, IQR outliers, and header hygiene.
- 🎨 **Rich Terminal Dashboard:** Color-coded tables, status indicators, and progress spinners directly inside your shell.
- 🧹 **Automated Autonomous Cleaning:** Drop duplicates, sanitize column headers to `snake_case`, and impute missing numerical/categorical values with a single command.
- 📈 **Statistical Outlier Detection:** Identifies extreme values using Tukey's Interquartile Range (IQR) fences.
- 📄 **Markdown & CI/CD Export:** Generate markdown audit reports suitable for GitHub PRs and automated data validation pipelines.
- ⚡ **Dual Interface:** Use as a standalone Command-Line Tool (`csvguard`) or as a Python library (`import csvguard`).

---

## 🚀 Installation

### Via PyPI (Recommended):
```bash
pip install csvguard
```

### From Source (Local Development):
```bash
git clone https://github.com/your-username/csvguard.git
cd csvguard
pip install -e .
```

---

## 💻 CLI Usage

### 1. Audit a CSV File (Health Checkup):
```bash
csvguard audit data.csv
```

### 2. Auto-Clean and Sanitize Data:
```bash
csvguard clean messy.csv --auto -o cleaned.csv
```
This automatically:
- Sanitizes headers (`  Annual Income  ` ➔ `annual_income`)
- Removes exact duplicate records
- Imputes missing numerical values with column medians
- Fills missing text fields with `'Unknown'`

### 3. Generate a Markdown Documentation Report:
```bash
csvguard report data.csv -o DATA_QUALITY_REPORT.md
```

---

## 🐍 Python Library Usage

You can also import `csvguard` directly in your machine learning scripts or Jupyter Notebooks:

```python
import csvguard as cg

# 1. Audit dataset
profile = cg.audit("samples/messy_sample.csv")
print(f"Health Score: {profile['health_score']}/100 ({profile['grade']})")
print(f"Duplicates: {profile['duplicates']}")

# 2. Clean dataset programmatically
res = cg.clean("samples/messy_sample.csv", output_path="clean.csv", impute_numeric="median")
print(f"Cleaned dataset saved to: {res['output_path']}")
```

---

## 📦 How to Publish to PyPI (For Maintainers)

1. Build the distribution package:
```bash
python -m pip install --upgrade build twine
python -m build
```

2. Upload to PyPI:
```bash
python -m twine upload dist/*
```

---

## 📄 License
Distributed under the [MIT License](LICENSE).
