#!/usr/bin/env python3 """Reproduce the headline calculations from the published CSV ledger.""" from pathlib import Path import csv csv_path = Path(__file__).resolve().parents[1] / "data" / "testosterone-long-duration-rct-ledger-2026.csv" with csv_path.open(newline="", encoding="utf-8") as f: rows = list(csv.DictReader(f)) n = {row["trial"]: int(row["randomized_n"]) for row in rows} total = sum(n.values()) traverse = n["TRAVERSE"] other = total - traverse top_three = sum(sorted(n.values(), reverse=True)[:3]) assert len(rows) == 11 assert total == 9249 assert traverse == 5246 assert other == 4003 assert traverse - other == 1243 assert top_three == 7043 assert round(traverse / total * 100, 1) == 56.7 assert round(top_three / total * 100, 1) == 76.1 print(f"Trials: {len(rows)}") print(f"Randomized men: {total:,}") print(f"TRAVERSE: {traverse:,} ({traverse / total * 100:.1f}%)") print(f"Other 10 trials: {other:,}") print(f"TRAVERSE minus other 10: {traverse - other:,}") print(f"Three largest trials: {top_three:,} ({top_three / total * 100:.1f}%)")