(value: str, field: str, sample_id: str)
| 29 | |
| 30 | |
| 31 | def parse_score(value: str, field: str, sample_id: str) -> float: |
| 32 | text = str(value or "").strip() |
| 33 | if not text: |
| 34 | raise ValueError(f"Missing {field} for sample {sample_id}") |
| 35 | score = float(text) |
| 36 | if score < 1 or score > 5: |
| 37 | raise ValueError(f"{field} for sample {sample_id} must be in [1, 5], got {score}") |
| 38 | return score |
| 39 | |
| 40 | |
| 41 | def index_by_sample(rows: Iterable[Dict[str, str]]) -> Dict[str, Dict[str, str]]: |
no outgoing calls
no test coverage detected