#!/usr/bin/env python3 """Render concise Markdown tables after verifying all released artifacts.""" from __future__ import annotations from verify_results import verify_all def main() -> int: report = verify_all() challenge = report["challenge"] external = report["external"] robustness = report["robustness"] post = report["postprocessing"] intervals = report["interval_consistency"]["digitized_vs_native_auto"] print("## Verified primary and external results\n") print("| Result | Value |") print("|---|---:|") print(f"| Official private challenge | {challenge['score_db']:.3f} dB; rank {challenge['rank']}/{challenge['teams']} |") print(f"| LUDB coverage | {external['successes']}/{external['records']} |") print(f"| LUDB mean record SNR | {external['mean_snr_db']:.3f} dB |") print(f"| LUDB pooled SNR | {external['pooled_snr_db']:.3f} dB |") print("\n## Paired robustness\n") print("| Profile | Mean SNR (dB) | Change vs clean (dB) |") print("|---|---:|---:|") for profile in ("clean", "mild", "moderate", "severe"): print(f"| {profile} | {robustness['mean_snr_db'][profile]:.2f} | {robustness['paired_delta_db'][profile]:+.2f} |") print("\n## Post-processing ablation\n") print("| Mode | Mean SNR (dB) | Change vs none (dB) |") print("|---|---:|---:|") for mode in ("none", "smooth", "partial", "project", "blend", "smooth+project+blend"): print(f"| {mode} | {post['mean_snr_db'][mode]:.3f} | {post['paired_delta_db'][mode]:+.3f} |") print("\n## Digitized-vs-native automated interval consistency\n") print("| Quantity | n | MAE |") print("|---|---:|---:|") for metric in ("HR", "RR", "QRS", "PR", "QT", "QTc"): unit = "bpm" if metric == "HR" else "ms" item = intervals[metric] print(f"| {metric} | {item['n']} | {item['mae']:.3f} {unit} |") return 0 if __name__ == "__main__": raise SystemExit(main())