#!/usr/bin/env python3 """Recomputes every number in "The Early-Entry Reply Protocol" (2026-09 edition) from reply-protocol-2026-09.csv. Standard library only. python3 reply-protocol-2026-09.py [path/to/reply-protocol-2026-09.csv] Engagement rate per stance is pooled: total engagements / total impressions of the replies in that stance (X's definition, applied to the group). Other per-reply figures are plain means. Profile visits are per 1,000 impressions, pooled. """ import csv import statistics import sys STANCES = [ ("topic_extension", "Topic extension"), ("shared_views", "Shared views"), ("different_views", "Different views"), ] def load(path): with open(path, newline="", encoding="utf-8") as f: rows = list(csv.DictReader(f)) for r in rows: for k in ("impressions", "engagements", "likes", "reposts", "bookmarks", "profile_visits"): r[k] = int(r[k]) r["view_rank_percentile"] = int(r["view_rank_percentile"]) if r["view_rank_percentile"] else None return rows def summary(rows): imp = sum(r["impressions"] for r in rows) return { "n": len(rows), "impressions_total": imp, "impressions_mean": imp / len(rows), "engagement_rate": sum(r["engagements"] for r in rows) / imp, "likes_mean": statistics.mean(r["likes"] for r in rows), "bookmarks_total": sum(r["bookmarks"] for r in rows), "bookmarks_mean": statistics.mean(r["bookmarks"] for r in rows), "profile_visits_total": sum(r["profile_visits"] for r in rows), "profile_visits_per_1k": 1000 * sum(r["profile_visits"] for r in rows) / imp, } def main(): path = sys.argv[1] if len(sys.argv) > 1 else "reply-protocol-2026-09.csv" rows = load(path) print(f"Replies: {len(rows)} ({rows[0]['posted_at']} to {rows[-1]['posted_at']})\n") by = {key: summary([r for r in rows if r["stance"] == key]) for key, _ in STANCES} every = summary(rows) print(f"{'Stance':<17}{'n':>3}{'Eng. rate':>11}{'Impr./reply':>13}{'Likes':>8}{'Bookmarks':>11}{'Visits/1k':>11}") for key, label in STANCES: s = by[key] print( f"{label:<17}{s['n']:>3}{s['engagement_rate']:>10.2%}{s['impressions_mean']:>13,.0f}" f"{s['likes_mean']:>8.2f}{s['bookmarks_mean']:>11.2f}{s['profile_visits_per_1k']:>11.2f}" ) s = every print( f"{'All replies':<17}{s['n']:>3}{s['engagement_rate']:>10.2%}{s['impressions_mean']:>13,.0f}" f"{s['likes_mean']:>8.2f}{s['bookmarks_mean']:>11.2f}{s['profile_visits_per_1k']:>11.2f}" ) te, dv = by["topic_extension"], by["different_views"] print(f"\nEngagement-rate gap, topic extension vs different views: {te['engagement_rate'] / dv['engagement_rate']:.1f}x") print(f"Impressions gap, topic extension vs different views: {te['impressions_mean'] / dv['impressions_mean']:.1f}x") print(f"Bookmarks: {te['bookmarks_total']} of {every['bookmarks_total']} went to topic-extension replies") print(f"Impressions: {every['impressions_total']:,}; profile visits: {every['profile_visits_total']}") ranked = [r["view_rank_percentile"] for r in rows if r["view_rank_percentile"] is not None] print(f"\nThread ranking ({len(ranked)} replies with a live parent post):") print(f" mean view-rank percentile: {statistics.mean(ranked):.1f}") print(f" most-viewed reply in its thread: {sum(p == 100 for p in ranked)} ({sum(p == 100 for p in ranked) / len(ranked):.0%})") print(f" above the thread's median reply: {sum(p > 50 for p in ranked)} ({sum(p > 50 for p in ranked) / len(ranked):.0%})") for key, label in STANCES: p = [r["view_rank_percentile"] for r in rows if r["stance"] == key and r["view_rank_percentile"] is not None] print(f" {label}: {statistics.mean(p):.1f} (n={len(p)})") if __name__ == "__main__": main()