File size: 900 Bytes
eb41309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/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)