-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__main__.py
More file actions
42 lines (32 loc) · 1.23 KB
/
Copy path__main__.py
File metadata and controls
42 lines (32 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""Command-line entry point for the data-quality workflow."""
from __future__ import annotations
import argparse
from pathlib import Path
from data_quality.workflow import DataQualityError, run_workflow
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
description="Validate, clean, aggregate and export a small assessment-result CSV."
)
parser.add_argument("--input", type=Path, required=True, help="Path to the raw CSV input.")
parser.add_argument(
"--output",
type=Path,
required=True,
help="Directory for cleaned data, rejected rows, KPIs and the quality report.",
)
return parser
def main() -> int:
args = build_parser().parse_args()
try:
result = run_workflow(args.input, args.output)
except DataQualityError as exc:
print(f"Data-quality workflow failed: {exc}")
return 1
print("Data-quality workflow completed.")
print(f"Input rows: {result.report['input_rows']}")
print(f"Accepted rows: {result.report['accepted_rows']}")
print(f"Rejected rows: {result.report['rejected_rows']}")
print(f"Output directory: {args.output}")
return 0
if __name__ == "__main__":
raise SystemExit(main())