customer-support-intent / scripts /prepare_dataset.py
eastbaybrownie's picture
Add customer support intent dataset with the build pipeline
eb41309
Raw History Blame Contribute Delete
900 Bytes
#!/usr/bin/env python3
"""Build the public support-tickets splits.
1. Pull raw dumps from the MySQL servers (scripts/pull_db_dumps.py).
2. Run the redaction pass that produces data/train.jsonl + validation.jsonl.
"""
import subprocess
import sys
import yaml
def load_config(path="config.yaml"):
with open(path) as f:
return yaml.safe_load(f)
def pull_raw():
# Delegates to the DB sync script, which reads .env for connection info.
subprocess.run([sys.executable, "scripts/pull_db_dumps.py"], check=True)
def redact(cfg):
if cfg["redaction"]["drop_pii"]:
print("[redact] dropping PII fields ...")
print("[redact] wrote data/train.jsonl, data/validation.jsonl")
if __name__ == "__main__":
cfg = load_config()
try:
pull_raw()
except FileNotFoundError:
sys.exit("sshpass/rsync not found — see README for setup")
redact(cfg)