File size: 648 Bytes
21c7db9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python3
"""Mock EHR preprocessing."""

from __future__ import annotations

import json
from pathlib import Path


def main() -> None:
    root = Path(__file__).resolve().parents[1]
    raw = root / "data" / "raw" / "mock_ehr"
    out = root / "data" / "processed"
    out.mkdir(parents=True, exist_ok=True)
    records = []
    for path in raw.glob("*.json"):
        records.append(json.loads(path.read_text(encoding="utf-8")))
    (out / "mock_ehr_processed.json").write_text(json.dumps(records, ensure_ascii=True, indent=2), encoding="utf-8")
    print(f"processed_records={len(records)}")


if __name__ == "__main__":
    main()