polyguard-openenv / scripts /build_synthetic_patients.py
TheJackBright's picture
Deploy PolyGuard OpenEnv Space
877add7 verified
#!/usr/bin/env python3
"""Generate synthetic patient snapshots."""
from __future__ import annotations
import json
from pathlib import Path
from app.common.enums import Difficulty
from app.simulator.patient_generator import generate_patient_profile
def main() -> None:
root = Path(__file__).resolve().parents[1]
out_dir = root / "data" / "synthetic"
out_dir.mkdir(parents=True, exist_ok=True)
rows = []
for i in range(20):
diff = [Difficulty.EASY, Difficulty.MEDIUM, Difficulty.HARD][i % 3]
rows.append(generate_patient_profile(seed=42 + i, difficulty=diff).model_dump(mode="json"))
(out_dir / "synthetic_patients.json").write_text(json.dumps(rows, ensure_ascii=True, indent=2), encoding="utf-8")
print(f"wrote {len(rows)} patients")
if __name__ == "__main__":
main()