You have safe_compute_arpu, rank_plans_by_mrr, make_update_line, categorize_customer — all the pieces. What does the Monday investor update actually look like when they compose?
I ran the capstone on last week's real metrics. The delta computation was off by one rounding issue. I fixed it myself in two minutes.
That's Week 4 maturity. The capstone is investor_update(metrics) — accepts a dict with this_week and last_week metric dicts, computes MRR delta and signup delta, calls rank_plans_by_mrr for the plan breakdown, and returns a markdown string:
this = metrics.get("this_week", {})
last = metrics.get("last_week", {})
mrr_delta = round((this.get("mrr", 0) - last.get("mrr", 0)) / max(last.get("mrr", 1), 1) * 100, 1)Why max(last.get('mrr', 1), 1) instead of just last.get('mrr', 0)?
last.get('mrr', 0) could be 0 — first week, no prior data — and delta / 0 crashes. max(..., 1) ensures the denominator is at least 1. Safe by default. Here's the full function:
def investor_update(metrics: dict) -> str:
this = metrics.get("this_week", {})
last = metrics.get("last_week", {})
mrr_delta = round((this.get("mrr", 0) - last.get("mrr", 0)) / max(last.get("mrr", 1), 1) * 100, 1)
signup_delta = this.get("signups", 0) - last.get("signups", 0)
customers = this.get("customers", [])
ranked = rank_plans_by_mrr(customers) if customers else []
lines = [f"## Weekly Investor Update", f"**MRR:** ${this.get('mrr', 0):,.2f} ({mrr_delta:+.1f}%)", f"**New Signups:** {this.get('signups', 0)} ({signup_delta:+d})"]
for i, plan in enumerate(ranked, 1):
lines.append(make_update_line(plan['plan'], {"total_mrr": plan['total_mrr'], "total_seats": plan['customer_count'], "avg_arpu": round(plan['total_mrr'] / max(plan['customer_count'], 1), 2)}, i))
result = "\n".join(lines)
print(f"Update: {len(result)} chars")
return resultI ran this on last week's real metrics. It produced the exact email I used to type manually. MRR delta, signup count, plan breakdown — formatted and ready to send.
You just replaced your Monday Stripe tab. For good.
Four weeks. From 'I don't know what a variable is' to 'I have a weekly investor update that runs itself.' That's the point of no return.
The function composes everything you've built: rank_plans_by_mrr for plans, make_update_line for formatting, safe_compute_arpu for robustness. One function, twenty lines — the whole track in a single call.
investor_update(metrics) is the composed pipeline:
(this_mrr - last_mrr) / last_mrr * 100rank_plans_by_mrr(customers) → sorted listmake_update_line(plan, stats, rank) per plan"\n".join(lines) → markdown string| Spec | Effect | Example |
|---|---|---|
:,.2f | Comma + 2 decimals | $14,850.00 |
:+.1f | Signed 1 decimal | +3.2% or -1.4% |
:+d | Signed integer | +5 or -2 |
You have safe_compute_arpu, rank_plans_by_mrr, make_update_line, categorize_customer — all the pieces. What does the Monday investor update actually look like when they compose?
I ran the capstone on last week's real metrics. The delta computation was off by one rounding issue. I fixed it myself in two minutes.
That's Week 4 maturity. The capstone is investor_update(metrics) — accepts a dict with this_week and last_week metric dicts, computes MRR delta and signup delta, calls rank_plans_by_mrr for the plan breakdown, and returns a markdown string:
this = metrics.get("this_week", {})
last = metrics.get("last_week", {})
mrr_delta = round((this.get("mrr", 0) - last.get("mrr", 0)) / max(last.get("mrr", 1), 1) * 100, 1)Why max(last.get('mrr', 1), 1) instead of just last.get('mrr', 0)?
last.get('mrr', 0) could be 0 — first week, no prior data — and delta / 0 crashes. max(..., 1) ensures the denominator is at least 1. Safe by default. Here's the full function:
def investor_update(metrics: dict) -> str:
this = metrics.get("this_week", {})
last = metrics.get("last_week", {})
mrr_delta = round((this.get("mrr", 0) - last.get("mrr", 0)) / max(last.get("mrr", 1), 1) * 100, 1)
signup_delta = this.get("signups", 0) - last.get("signups", 0)
customers = this.get("customers", [])
ranked = rank_plans_by_mrr(customers) if customers else []
lines = [f"## Weekly Investor Update", f"**MRR:** ${this.get('mrr', 0):,.2f} ({mrr_delta:+.1f}%)", f"**New Signups:** {this.get('signups', 0)} ({signup_delta:+d})"]
for i, plan in enumerate(ranked, 1):
lines.append(make_update_line(plan['plan'], {"total_mrr": plan['total_mrr'], "total_seats": plan['customer_count'], "avg_arpu": round(plan['total_mrr'] / max(plan['customer_count'], 1), 2)}, i))
result = "\n".join(lines)
print(f"Update: {len(result)} chars")
return resultI ran this on last week's real metrics. It produced the exact email I used to type manually. MRR delta, signup count, plan breakdown — formatted and ready to send.
You just replaced your Monday Stripe tab. For good.
Four weeks. From 'I don't know what a variable is' to 'I have a weekly investor update that runs itself.' That's the point of no return.
The function composes everything you've built: rank_plans_by_mrr for plans, make_update_line for formatting, safe_compute_arpu for robustness. One function, twenty lines — the whole track in a single call.
investor_update(metrics) is the composed pipeline:
(this_mrr - last_mrr) / last_mrr * 100rank_plans_by_mrr(customers) → sorted listmake_update_line(plan, stats, rank) per plan"\n".join(lines) → markdown string| Spec | Effect | Example |
|---|---|---|
:,.2f | Comma + 2 decimals | $14,850.00 |
:+.1f | Signed 1 decimal | +3.2% or -1.4% |
:+d | Signed integer | +5 or -2 |
You want your Monday investor update to run itself — MRR delta, signup count, and a ranked plan breakdown — formatted as markdown ready to paste into Gmail. Write `investor_update(metrics)` that accepts a dict with 'this_week' and 'last_week' keys (each containing mrr, signups, and customers), computes deltas, calls rank_plans_by_mrr, and returns a markdown-formatted string.
Tap each step for scaffolded hints.
No blank-editor panic.