Parse results.tsv into a pandas DataFrame, also merging any TSV files found in workspace/results/ (written by orchestrate.py). Returns None if no data is found.
(path: str = "results.tsv")
| 64 | |
| 65 | |
| 66 | def load_results(path: str = "results.tsv") -> pd.DataFrame | None: |
| 67 | """ |
| 68 | Parse results.tsv into a pandas DataFrame, also merging any TSV files |
| 69 | found in workspace/results/ (written by orchestrate.py). |
| 70 | Returns None if no data is found. |
| 71 | """ |
| 72 | frames: list[pd.DataFrame] = [] |
| 73 | |
| 74 | # Load the root results.tsv |
| 75 | root_df = _load_single_tsv(path) |
| 76 | if root_df is not None: |
| 77 | frames.append(root_df) |
| 78 | |
| 79 | # Also load all TSV files in workspace/results/ (orchestrate.py output) |
| 80 | if os.path.isdir(WORKSPACE_RESULTS_DIR): |
| 81 | for fname in sorted(os.listdir(WORKSPACE_RESULTS_DIR)): |
| 82 | if fname.endswith(".tsv"): |
| 83 | ws_path = os.path.join(WORKSPACE_RESULTS_DIR, fname) |
| 84 | ws_df = _load_single_tsv(ws_path) |
| 85 | if ws_df is not None: |
| 86 | frames.append(ws_df) |
| 87 | |
| 88 | if not frames: |
| 89 | return None |
| 90 | |
| 91 | df = pd.concat(frames, ignore_index=True) |
| 92 | if len(df) == 0: |
| 93 | return None |
| 94 | |
| 95 | # Validate columns against expected set |
| 96 | missing = [c for c in EXPECTED_COLUMNS if c not in df.columns] |
| 97 | extra = [c for c in df.columns if c not in EXPECTED_COLUMNS] |
| 98 | if missing or extra: |
| 99 | print(f"WARNING: TSV columns do not match expected schema.") |
| 100 | if missing: |
| 101 | print(f" Missing columns: {missing}") |
| 102 | if extra: |
| 103 | print(f" Unexpected columns: {extra}") |
| 104 | |
| 105 | return df |
| 106 | |
| 107 | |
| 108 | def load_baselines() -> dict | None: |
no test coverage detected