Append the condensed overall report to output_dir/overall.json. overall.json is a list; each evaluation appends one record, making it easy to compare multiple models side by side.
(report, output_dir)
| 224 | |
| 225 | |
| 226 | def write_overall(report, output_dir): |
| 227 | """Append the condensed overall report to output_dir/overall.json. |
| 228 | |
| 229 | overall.json is a list; each evaluation appends one record, making it easy |
| 230 | to compare multiple models side by side. |
| 231 | """ |
| 232 | overall = build_overall(report) |
| 233 | overall_path = os.path.join(output_dir, "overall.json") |
| 234 | |
| 235 | # Read existing records |
| 236 | existing = [] |
| 237 | if os.path.isfile(overall_path): |
| 238 | try: |
| 239 | with open(overall_path, 'r') as f: |
| 240 | existing = json.load(f) |
| 241 | if not isinstance(existing, list): |
| 242 | existing = [existing] |
| 243 | except (json.JSONDecodeError, Exception): |
| 244 | existing = [] |
| 245 | |
| 246 | existing.append(overall) |
| 247 | |
| 248 | os.makedirs(output_dir, exist_ok=True) |
| 249 | with open(overall_path, 'w') as f: |
| 250 | json.dump(existing, f, indent=2, default=str) |
| 251 | print(f"Overall summary appended to {overall_path}") |
| 252 | |
| 253 | |
| 254 | def print_summary(report): |
no test coverage detected