datadoc-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- datadoc_cli-0.1.0/.github/workflows/ci.yml +52 -0
- datadoc_cli-0.1.0/.gitignore +33 -0
- datadoc_cli-0.1.0/CONTRIBUTING.md +98 -0
- datadoc_cli-0.1.0/LICENSE +21 -0
- datadoc_cli-0.1.0/PKG-INFO +254 -0
- datadoc_cli-0.1.0/README.md +223 -0
- datadoc_cli-0.1.0/datadoc/__init__.py +0 -0
- datadoc_cli-0.1.0/datadoc/cli/__init__.py +0 -0
- datadoc_cli-0.1.0/datadoc/cli/app.py +539 -0
- datadoc_cli-0.1.0/datadoc/core/__init__.py +0 -0
- datadoc_cli-0.1.0/datadoc/core/engine.py +142 -0
- datadoc_cli-0.1.0/datadoc/plugins/__init__.py +0 -0
- datadoc_cli-0.1.0/datadoc/plugins/base.py +70 -0
- datadoc_cli-0.1.0/datadoc/plugins/datetime_feat.py +102 -0
- datadoc_cli-0.1.0/datadoc/plugins/encoders.py +73 -0
- datadoc_cli-0.1.0/datadoc/plugins/missing_values.py +74 -0
- datadoc_cli-0.1.0/datadoc/plugins/outliers.py +93 -0
- datadoc_cli-0.1.0/datadoc/plugins/scaling.py +103 -0
- datadoc_cli-0.1.0/pyproject.toml +58 -0
- datadoc_cli-0.1.0/test.csv +6 -0
- datadoc_cli-0.1.0/tests/__init__.py +1 -0
- datadoc_cli-0.1.0/tests/test_core.py +335 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ${{ matrix.os }}
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
15
|
+
python-version: ["3.9", "3.10", "3.11", "3.12"]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install -e ".[dev]"
|
|
29
|
+
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: pytest tests/ -v --tb=short
|
|
32
|
+
|
|
33
|
+
lint:
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v4
|
|
37
|
+
|
|
38
|
+
- name: Set up Python
|
|
39
|
+
uses: actions/setup-python@v5
|
|
40
|
+
with:
|
|
41
|
+
python-version: "3.12"
|
|
42
|
+
|
|
43
|
+
- name: Install dependencies
|
|
44
|
+
run: |
|
|
45
|
+
python -m pip install --upgrade pip
|
|
46
|
+
pip install ruff
|
|
47
|
+
|
|
48
|
+
- name: Run Ruff linter
|
|
49
|
+
run: ruff check datadoc/
|
|
50
|
+
|
|
51
|
+
- name: Run Ruff formatter check
|
|
52
|
+
run: ruff format --check datadoc/
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
*.egg
|
|
9
|
+
|
|
10
|
+
# Virtual environments
|
|
11
|
+
.venv/
|
|
12
|
+
venv/
|
|
13
|
+
env/
|
|
14
|
+
|
|
15
|
+
# IDE
|
|
16
|
+
.vscode/
|
|
17
|
+
.idea/
|
|
18
|
+
*.swp
|
|
19
|
+
*.swo
|
|
20
|
+
|
|
21
|
+
# OS
|
|
22
|
+
.DS_Store
|
|
23
|
+
Thumbs.db
|
|
24
|
+
|
|
25
|
+
# DATADOC generated outputs
|
|
26
|
+
clean_*.csv
|
|
27
|
+
pipeline_*.py
|
|
28
|
+
report_*.md
|
|
29
|
+
|
|
30
|
+
# Testing
|
|
31
|
+
.pytest_cache/
|
|
32
|
+
htmlcov/
|
|
33
|
+
.coverage
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Contributing to DATADOC
|
|
2
|
+
|
|
3
|
+
Thank you for considering contributing to DATADOC! This guide will help you get started.
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Clone the repository
|
|
9
|
+
git clone https://github.com/narain-karti/DATADOC.git
|
|
10
|
+
cd DATADOC
|
|
11
|
+
|
|
12
|
+
# Install in development mode with dev dependencies
|
|
13
|
+
pip install -e ".[dev]"
|
|
14
|
+
|
|
15
|
+
# Run the test suite
|
|
16
|
+
pytest tests/ -v
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## How to Build a Plugin
|
|
20
|
+
|
|
21
|
+
DATADOC's entire architecture is built around plugins. Every feature engineering operation is an isolated plugin that inherits from `BasePlugin`.
|
|
22
|
+
|
|
23
|
+
### Step 1: Create a new file
|
|
24
|
+
|
|
25
|
+
Create `datadoc/plugins/your_plugin.py`:
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import pandas as pd
|
|
29
|
+
from datadoc.plugins.base import BasePlugin
|
|
30
|
+
|
|
31
|
+
class YourPlugin(BasePlugin):
|
|
32
|
+
@property
|
|
33
|
+
def name(self) -> str:
|
|
34
|
+
return "YourPlugin"
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def version(self) -> str:
|
|
38
|
+
return "0.1.0"
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def description(self) -> str:
|
|
42
|
+
return "What your plugin does in one sentence."
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def priority(self) -> int:
|
|
46
|
+
return 50 # Lower = runs first
|
|
47
|
+
|
|
48
|
+
def analyze(self, df: pd.DataFrame) -> dict:
|
|
49
|
+
# Detect if this plugin should run
|
|
50
|
+
return {"has_issue": True}
|
|
51
|
+
|
|
52
|
+
def recommend(self, analysis_result: dict) -> list[str]:
|
|
53
|
+
if analysis_result.get("has_issue"):
|
|
54
|
+
return ["Description of what should be done."]
|
|
55
|
+
return []
|
|
56
|
+
|
|
57
|
+
def generate_code(self, analysis_result: dict) -> str:
|
|
58
|
+
if not analysis_result.get("has_issue"):
|
|
59
|
+
return ""
|
|
60
|
+
return "# Your pandas code here\ndf['new_col'] = df['old_col'] * 2"
|
|
61
|
+
|
|
62
|
+
def apply(self, df: pd.DataFrame) -> pd.DataFrame:
|
|
63
|
+
df_clean = df.copy()
|
|
64
|
+
# Your transformation logic
|
|
65
|
+
return df_clean
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Step 2: Register the plugin
|
|
69
|
+
|
|
70
|
+
Add your plugin to `datadoc/core/engine.py` in the `self.plugins` list inside `__init__`.
|
|
71
|
+
|
|
72
|
+
### Step 3: Update the CLI
|
|
73
|
+
|
|
74
|
+
Add handling for your plugin's analysis output in the `analyze` command in `datadoc/cli/app.py`.
|
|
75
|
+
|
|
76
|
+
### Step 4: Write tests
|
|
77
|
+
|
|
78
|
+
Add tests in `tests/test_core.py` to verify your plugin's `analyze()`, `apply()`, and `recommend()` methods.
|
|
79
|
+
|
|
80
|
+
## Code Style
|
|
81
|
+
|
|
82
|
+
- We use [Ruff](https://docs.astral.sh/ruff/) for linting and formatting.
|
|
83
|
+
- Run `ruff check datadoc/` before submitting.
|
|
84
|
+
- Target Python 3.9+.
|
|
85
|
+
|
|
86
|
+
## Submitting Changes
|
|
87
|
+
|
|
88
|
+
1. Fork the repository.
|
|
89
|
+
2. Create a feature branch: `git checkout -b feature/your-plugin`
|
|
90
|
+
3. Make your changes and add tests.
|
|
91
|
+
4. Run the full test suite: `pytest tests/ -v`
|
|
92
|
+
5. Submit a pull request.
|
|
93
|
+
|
|
94
|
+
## Labels
|
|
95
|
+
|
|
96
|
+
- `good first issue` - Great for newcomers
|
|
97
|
+
- `plugin-idea` - Propose a new plugin
|
|
98
|
+
- `core-engine` - Changes to the core orchestrator
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 narain-karti
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: datadoc-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The Open Source Operating System for Dataset Engineering.
|
|
5
|
+
Project-URL: Homepage, https://github.com/narain-karti/DATADOC
|
|
6
|
+
Project-URL: Repository, https://github.com/narain-karti/DATADOC
|
|
7
|
+
Project-URL: Issues, https://github.com/narain-karti/DATADOC/issues
|
|
8
|
+
Author: narain-karti
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Requires-Dist: numpy>=1.24.0
|
|
23
|
+
Requires-Dist: plotext>=5.2.8
|
|
24
|
+
Requires-Dist: polars>=0.20.0
|
|
25
|
+
Requires-Dist: rich>=13.7.0
|
|
26
|
+
Requires-Dist: typer>=0.12.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: ruff>=0.4.0; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<pre>
|
|
34
|
+
____ _ _____ _ ____ ___ ____
|
|
35
|
+
| _ \ / \|_ _|/ \ | _ \ / _ \ / ___|
|
|
36
|
+
| | | |/ _ \ | | / _ \ | | | | | | | |
|
|
37
|
+
| |_| / ___ \| |/ ___ \| |_| | |_| | |___
|
|
38
|
+
|____/_/ \_\_/_/ \_\____/ \___/ \____|
|
|
39
|
+
</pre>
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
<h3 align="center">The Open Source Operating System for Dataset Engineering.</h3>
|
|
43
|
+
|
|
44
|
+
<p align="center">
|
|
45
|
+
<a href="#installation">Install</a> |
|
|
46
|
+
<a href="#quick-start">Quick Start</a> |
|
|
47
|
+
<a href="#cli-commands">CLI Commands</a> |
|
|
48
|
+
<a href="#plugins">Plugins</a> |
|
|
49
|
+
<a href="#contributing">Contributing</a>
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## What is DATADOC?
|
|
55
|
+
|
|
56
|
+
DATADOC is an intelligent, modular **Dataset Engineering Framework** that orchestrates existing powerful libraries (Pandas, NumPy, Scikit-learn) into a standardized, reusable workflow.
|
|
57
|
+
|
|
58
|
+
**DATADOC is NOT another EDA tool.** It doesn't just show you charts. It **diagnoses**, **recommends**, and **automatically engineers** your dataset -- then hands you a portable Python script to replicate it anywhere.
|
|
59
|
+
|
|
60
|
+
### Core Philosophy
|
|
61
|
+
|
|
62
|
+
- **Orchestrate, don't replace** -- DATADOC wraps Pandas, NumPy, and Sklearn. It doesn't reinvent them.
|
|
63
|
+
- **Modular Plugin Architecture** -- Every transformation is an isolated, testable plugin.
|
|
64
|
+
- **Explainable by Default** -- Every action can be explained, rolled back, and exported as code.
|
|
65
|
+
- **Deterministic First** -- v1.0 uses a rule-based engine. No black-box AI decisions.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Installation
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Clone and install
|
|
73
|
+
git clone https://github.com/narain-karti/DATADOC.git
|
|
74
|
+
cd DATADOC
|
|
75
|
+
pip install -e .
|
|
76
|
+
|
|
77
|
+
# Or install with dev dependencies
|
|
78
|
+
pip install -e ".[dev]"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Quick Start
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Analyze your dataset's health
|
|
87
|
+
datadoc analyze your_data.csv
|
|
88
|
+
|
|
89
|
+
# Get recommendations without changing anything
|
|
90
|
+
datadoc recommend your_data.csv
|
|
91
|
+
|
|
92
|
+
# Automatically engineer your dataset
|
|
93
|
+
datadoc engineer your_data.csv
|
|
94
|
+
|
|
95
|
+
# Compare before vs after
|
|
96
|
+
datadoc compare your_data.csv
|
|
97
|
+
|
|
98
|
+
# Export a standalone Python pipeline
|
|
99
|
+
datadoc pipeline your_data.csv
|
|
100
|
+
|
|
101
|
+
# Generate a Markdown report
|
|
102
|
+
datadoc report your_data.csv
|
|
103
|
+
|
|
104
|
+
# List all available plugins
|
|
105
|
+
datadoc plugin
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Python SDK
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
from datadoc.core.engine import DATADOC
|
|
112
|
+
|
|
113
|
+
doc = DATADOC("your_data.csv")
|
|
114
|
+
|
|
115
|
+
# Analyze
|
|
116
|
+
report = doc.analyze()
|
|
117
|
+
print(report)
|
|
118
|
+
|
|
119
|
+
# Get recommendations
|
|
120
|
+
for rec in doc.recommend():
|
|
121
|
+
print(rec)
|
|
122
|
+
|
|
123
|
+
# Auto-engineer
|
|
124
|
+
clean_df = doc.engineer()
|
|
125
|
+
clean_df.to_csv("clean_data.csv", index=False)
|
|
126
|
+
|
|
127
|
+
# Export pipeline
|
|
128
|
+
with open("pipeline.py", "w") as f:
|
|
129
|
+
f.write(doc.pipeline())
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## CLI Commands
|
|
135
|
+
|
|
136
|
+
| Command | Description |
|
|
137
|
+
|---------|-------------|
|
|
138
|
+
| `datadoc analyze <file>` | Scans dataset and shows a health report with status indicators |
|
|
139
|
+
| `datadoc recommend <file>` | Lists suggested engineering steps without modifying data |
|
|
140
|
+
| `datadoc engineer <file>` | Automatically applies all recommended transformations |
|
|
141
|
+
| `datadoc compare <file>` | Shows a before/after diff of the raw vs engineered dataset |
|
|
142
|
+
| `datadoc pipeline <file>` | Exports a standalone `.py` script with the exact Pandas code |
|
|
143
|
+
| `datadoc report <file>` | Generates a full Markdown report |
|
|
144
|
+
| `datadoc plugin` | Lists all registered plugins with priority and descriptions |
|
|
145
|
+
| `datadoc version` | Displays the DATADOC version |
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Plugins
|
|
150
|
+
|
|
151
|
+
DATADOC ships with 5 built-in plugins, executed in priority order:
|
|
152
|
+
|
|
153
|
+
| Priority | Plugin | What it Does |
|
|
154
|
+
|----------|--------|-------------|
|
|
155
|
+
| 10 | **MissingValuePlugin** | Imputes missing numeric values with median, categorical with mode |
|
|
156
|
+
| 20 | **OutlierPlugin** | Detects outliers via IQR and clips at 5th/95th percentiles |
|
|
157
|
+
| 30 | **DatetimePlugin** | Detects date columns and extracts year, month, day, day_of_week |
|
|
158
|
+
| 40 | **CategoricalEncoderPlugin** | One-Hot Encodes categorical columns (< 10 unique values) |
|
|
159
|
+
| 45 | **ScalingPlugin** | Standard scales numeric columns when scale ratio exceeds 10x |
|
|
160
|
+
|
|
161
|
+
### Plugin Interface
|
|
162
|
+
|
|
163
|
+
Every plugin implements the full `BasePlugin` interface:
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
class BasePlugin(ABC):
|
|
167
|
+
name: str # Plugin identifier
|
|
168
|
+
version: str # Semantic version
|
|
169
|
+
description: str # One-line description
|
|
170
|
+
priority: int # Execution order (lower = first)
|
|
171
|
+
supported_datatypes # Which dtypes this plugin handles
|
|
172
|
+
dependencies # Plugins that must run before this one
|
|
173
|
+
|
|
174
|
+
analyze(df) -> dict # Detect issues
|
|
175
|
+
recommend(analysis) -> list # Suggest fixes
|
|
176
|
+
generate_code(analysis) -> str # Export as Python code
|
|
177
|
+
apply(df) -> DataFrame # Apply transformation
|
|
178
|
+
validate(df) -> bool # Verify result
|
|
179
|
+
rollback(original) -> DataFrame # Undo transformation
|
|
180
|
+
explain() -> str # Human-readable explanation
|
|
181
|
+
estimate_runtime(df) -> float # Performance estimate
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Building Your Own Plugin
|
|
185
|
+
|
|
186
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for a step-by-step guide on building and registering custom plugins.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Architecture
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
datadoc/
|
|
194
|
+
core/
|
|
195
|
+
engine.py # DATADOC orchestrator class
|
|
196
|
+
cli/
|
|
197
|
+
app.py # Typer CLI with Rich terminal UI
|
|
198
|
+
plugins/
|
|
199
|
+
base.py # Abstract BasePlugin interface
|
|
200
|
+
missing_values.py # MissingValuePlugin
|
|
201
|
+
outliers.py # OutlierPlugin
|
|
202
|
+
datetime_feat.py # DatetimePlugin
|
|
203
|
+
encoders.py # CategoricalEncoderPlugin
|
|
204
|
+
scaling.py # ScalingPlugin
|
|
205
|
+
tests/
|
|
206
|
+
test_core.py # Comprehensive test suite
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The CLI talks to the Core Engine, which orchestrates Plugins sorted by priority. Each plugin independently analyzes, recommends, and applies transformations.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Development
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Install dev dependencies
|
|
217
|
+
pip install -e ".[dev]"
|
|
218
|
+
|
|
219
|
+
# Run tests
|
|
220
|
+
pytest tests/ -v
|
|
221
|
+
|
|
222
|
+
# Lint
|
|
223
|
+
ruff check datadoc/
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Roadmap
|
|
229
|
+
|
|
230
|
+
- [x] Core Engine with plugin orchestration
|
|
231
|
+
- [x] 5 built-in plugins (Missing Values, Outliers, Datetime, Encoding, Scaling)
|
|
232
|
+
- [x] 7 CLI commands with Rich terminal UI
|
|
233
|
+
- [x] Pipeline export (standalone `.py` scripts)
|
|
234
|
+
- [x] Markdown report generation
|
|
235
|
+
- [x] Full plugin interface (validate, rollback, explain, estimate_runtime)
|
|
236
|
+
- [x] CI/CD with GitHub Actions
|
|
237
|
+
- [ ] PyPI release (`pip install datadoc`)
|
|
238
|
+
- [ ] Polars backend support
|
|
239
|
+
- [ ] REST API (FastAPI)
|
|
240
|
+
- [ ] Web Dashboard
|
|
241
|
+
- [ ] AI Planner (LLM replaces Rule Engine)
|
|
242
|
+
- [ ] Plugin Marketplace
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## License
|
|
247
|
+
|
|
248
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Contributing
|
|
253
|
+
|
|
254
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<pre>
|
|
3
|
+
____ _ _____ _ ____ ___ ____
|
|
4
|
+
| _ \ / \|_ _|/ \ | _ \ / _ \ / ___|
|
|
5
|
+
| | | |/ _ \ | | / _ \ | | | | | | | |
|
|
6
|
+
| |_| / ___ \| |/ ___ \| |_| | |_| | |___
|
|
7
|
+
|____/_/ \_\_/_/ \_\____/ \___/ \____|
|
|
8
|
+
</pre>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<h3 align="center">The Open Source Operating System for Dataset Engineering.</h3>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="#installation">Install</a> |
|
|
15
|
+
<a href="#quick-start">Quick Start</a> |
|
|
16
|
+
<a href="#cli-commands">CLI Commands</a> |
|
|
17
|
+
<a href="#plugins">Plugins</a> |
|
|
18
|
+
<a href="#contributing">Contributing</a>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## What is DATADOC?
|
|
24
|
+
|
|
25
|
+
DATADOC is an intelligent, modular **Dataset Engineering Framework** that orchestrates existing powerful libraries (Pandas, NumPy, Scikit-learn) into a standardized, reusable workflow.
|
|
26
|
+
|
|
27
|
+
**DATADOC is NOT another EDA tool.** It doesn't just show you charts. It **diagnoses**, **recommends**, and **automatically engineers** your dataset -- then hands you a portable Python script to replicate it anywhere.
|
|
28
|
+
|
|
29
|
+
### Core Philosophy
|
|
30
|
+
|
|
31
|
+
- **Orchestrate, don't replace** -- DATADOC wraps Pandas, NumPy, and Sklearn. It doesn't reinvent them.
|
|
32
|
+
- **Modular Plugin Architecture** -- Every transformation is an isolated, testable plugin.
|
|
33
|
+
- **Explainable by Default** -- Every action can be explained, rolled back, and exported as code.
|
|
34
|
+
- **Deterministic First** -- v1.0 uses a rule-based engine. No black-box AI decisions.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Clone and install
|
|
42
|
+
git clone https://github.com/narain-karti/DATADOC.git
|
|
43
|
+
cd DATADOC
|
|
44
|
+
pip install -e .
|
|
45
|
+
|
|
46
|
+
# Or install with dev dependencies
|
|
47
|
+
pip install -e ".[dev]"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Quick Start
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Analyze your dataset's health
|
|
56
|
+
datadoc analyze your_data.csv
|
|
57
|
+
|
|
58
|
+
# Get recommendations without changing anything
|
|
59
|
+
datadoc recommend your_data.csv
|
|
60
|
+
|
|
61
|
+
# Automatically engineer your dataset
|
|
62
|
+
datadoc engineer your_data.csv
|
|
63
|
+
|
|
64
|
+
# Compare before vs after
|
|
65
|
+
datadoc compare your_data.csv
|
|
66
|
+
|
|
67
|
+
# Export a standalone Python pipeline
|
|
68
|
+
datadoc pipeline your_data.csv
|
|
69
|
+
|
|
70
|
+
# Generate a Markdown report
|
|
71
|
+
datadoc report your_data.csv
|
|
72
|
+
|
|
73
|
+
# List all available plugins
|
|
74
|
+
datadoc plugin
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Python SDK
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from datadoc.core.engine import DATADOC
|
|
81
|
+
|
|
82
|
+
doc = DATADOC("your_data.csv")
|
|
83
|
+
|
|
84
|
+
# Analyze
|
|
85
|
+
report = doc.analyze()
|
|
86
|
+
print(report)
|
|
87
|
+
|
|
88
|
+
# Get recommendations
|
|
89
|
+
for rec in doc.recommend():
|
|
90
|
+
print(rec)
|
|
91
|
+
|
|
92
|
+
# Auto-engineer
|
|
93
|
+
clean_df = doc.engineer()
|
|
94
|
+
clean_df.to_csv("clean_data.csv", index=False)
|
|
95
|
+
|
|
96
|
+
# Export pipeline
|
|
97
|
+
with open("pipeline.py", "w") as f:
|
|
98
|
+
f.write(doc.pipeline())
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## CLI Commands
|
|
104
|
+
|
|
105
|
+
| Command | Description |
|
|
106
|
+
|---------|-------------|
|
|
107
|
+
| `datadoc analyze <file>` | Scans dataset and shows a health report with status indicators |
|
|
108
|
+
| `datadoc recommend <file>` | Lists suggested engineering steps without modifying data |
|
|
109
|
+
| `datadoc engineer <file>` | Automatically applies all recommended transformations |
|
|
110
|
+
| `datadoc compare <file>` | Shows a before/after diff of the raw vs engineered dataset |
|
|
111
|
+
| `datadoc pipeline <file>` | Exports a standalone `.py` script with the exact Pandas code |
|
|
112
|
+
| `datadoc report <file>` | Generates a full Markdown report |
|
|
113
|
+
| `datadoc plugin` | Lists all registered plugins with priority and descriptions |
|
|
114
|
+
| `datadoc version` | Displays the DATADOC version |
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Plugins
|
|
119
|
+
|
|
120
|
+
DATADOC ships with 5 built-in plugins, executed in priority order:
|
|
121
|
+
|
|
122
|
+
| Priority | Plugin | What it Does |
|
|
123
|
+
|----------|--------|-------------|
|
|
124
|
+
| 10 | **MissingValuePlugin** | Imputes missing numeric values with median, categorical with mode |
|
|
125
|
+
| 20 | **OutlierPlugin** | Detects outliers via IQR and clips at 5th/95th percentiles |
|
|
126
|
+
| 30 | **DatetimePlugin** | Detects date columns and extracts year, month, day, day_of_week |
|
|
127
|
+
| 40 | **CategoricalEncoderPlugin** | One-Hot Encodes categorical columns (< 10 unique values) |
|
|
128
|
+
| 45 | **ScalingPlugin** | Standard scales numeric columns when scale ratio exceeds 10x |
|
|
129
|
+
|
|
130
|
+
### Plugin Interface
|
|
131
|
+
|
|
132
|
+
Every plugin implements the full `BasePlugin` interface:
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
class BasePlugin(ABC):
|
|
136
|
+
name: str # Plugin identifier
|
|
137
|
+
version: str # Semantic version
|
|
138
|
+
description: str # One-line description
|
|
139
|
+
priority: int # Execution order (lower = first)
|
|
140
|
+
supported_datatypes # Which dtypes this plugin handles
|
|
141
|
+
dependencies # Plugins that must run before this one
|
|
142
|
+
|
|
143
|
+
analyze(df) -> dict # Detect issues
|
|
144
|
+
recommend(analysis) -> list # Suggest fixes
|
|
145
|
+
generate_code(analysis) -> str # Export as Python code
|
|
146
|
+
apply(df) -> DataFrame # Apply transformation
|
|
147
|
+
validate(df) -> bool # Verify result
|
|
148
|
+
rollback(original) -> DataFrame # Undo transformation
|
|
149
|
+
explain() -> str # Human-readable explanation
|
|
150
|
+
estimate_runtime(df) -> float # Performance estimate
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Building Your Own Plugin
|
|
154
|
+
|
|
155
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for a step-by-step guide on building and registering custom plugins.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Architecture
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
datadoc/
|
|
163
|
+
core/
|
|
164
|
+
engine.py # DATADOC orchestrator class
|
|
165
|
+
cli/
|
|
166
|
+
app.py # Typer CLI with Rich terminal UI
|
|
167
|
+
plugins/
|
|
168
|
+
base.py # Abstract BasePlugin interface
|
|
169
|
+
missing_values.py # MissingValuePlugin
|
|
170
|
+
outliers.py # OutlierPlugin
|
|
171
|
+
datetime_feat.py # DatetimePlugin
|
|
172
|
+
encoders.py # CategoricalEncoderPlugin
|
|
173
|
+
scaling.py # ScalingPlugin
|
|
174
|
+
tests/
|
|
175
|
+
test_core.py # Comprehensive test suite
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
The CLI talks to the Core Engine, which orchestrates Plugins sorted by priority. Each plugin independently analyzes, recommends, and applies transformations.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Development
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Install dev dependencies
|
|
186
|
+
pip install -e ".[dev]"
|
|
187
|
+
|
|
188
|
+
# Run tests
|
|
189
|
+
pytest tests/ -v
|
|
190
|
+
|
|
191
|
+
# Lint
|
|
192
|
+
ruff check datadoc/
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Roadmap
|
|
198
|
+
|
|
199
|
+
- [x] Core Engine with plugin orchestration
|
|
200
|
+
- [x] 5 built-in plugins (Missing Values, Outliers, Datetime, Encoding, Scaling)
|
|
201
|
+
- [x] 7 CLI commands with Rich terminal UI
|
|
202
|
+
- [x] Pipeline export (standalone `.py` scripts)
|
|
203
|
+
- [x] Markdown report generation
|
|
204
|
+
- [x] Full plugin interface (validate, rollback, explain, estimate_runtime)
|
|
205
|
+
- [x] CI/CD with GitHub Actions
|
|
206
|
+
- [ ] PyPI release (`pip install datadoc`)
|
|
207
|
+
- [ ] Polars backend support
|
|
208
|
+
- [ ] REST API (FastAPI)
|
|
209
|
+
- [ ] Web Dashboard
|
|
210
|
+
- [ ] AI Planner (LLM replaces Rule Engine)
|
|
211
|
+
- [ ] Plugin Marketplace
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## License
|
|
216
|
+
|
|
217
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Contributing
|
|
222
|
+
|
|
223
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
File without changes
|
|
File without changes
|