Download src/reference_db/review/decisions.py from offCanada/reference-db-system: direct link, hf CLI and curl.
- Browser
- Download file 661 Bytes
-
https://huggingface.co/offCanada/reference-db-system/resolve/main/src/reference_db/review/decisions.py
- Command line
-
hf download hf://offCanada/reference-db-system/src/reference_db/review/decisions.py
-
curl -L -o decisions.py https://huggingface.co/offCanada/reference-db-system/resolve/main/src/reference_db/review/decisions.py
661 Bytes
| import json | |
| from dataclasses import dataclass | |
| from pathlib import Path | |
| class ReviewDecision: | |
| record_id: str | |
| retailer: str | |
| phase: str | |
| decision: str | |
| resume_from: str | |
| reviewer: str | |
| def save_decision( | |
| decision: ReviewDecision, | |
| output_dir: str = "data/review", | |
| ) -> Path: | |
| """ | |
| Save a review decision. | |
| """ | |
| phase_dir = Path(output_dir) / decision.retailer / decision.phase | |
| phase_dir.mkdir(parents=True, exist_ok=True) | |
| output_file = phase_dir / "decisions.jsonl" | |
| with output_file.open("a", encoding="utf-8") as f: | |
| f.write(json.dumps(decision.__dict__) + "\n") | |
| return output_file | |