Files changed (1) hide show
  1. README.md +300 -1
README.md CHANGED
@@ -64,4 +64,303 @@ This code repository is licensed under [the MIT License](https://github.com/deep
64
 
65
  ## 6. Contact
66
 
67
- If you have any questions, please raise an issue or contact us at [service@deepseek.com](mailto:service@deepseek.com).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  ## 6. Contact
66
 
67
+ If you have any questions, please raise an issue or contact us at [service@deepseek.com](mailto:service@deepseek.com).
68
+ # Rebuild the interactive Excel model from scratch, add a BridgeData sheet,
69
+ # and generate a revenue bridge PNG plus a 1-page memo PDF.
70
+
71
+ import os
72
+ import pandas as pd
73
+ from openpyxl import Workbook, load_workbook
74
+ from openpyxl.utils import get_column_letter
75
+ from openpyxl.styles import Alignment, Font, PatternFill, Border, Side, NamedStyle, numbers
76
+ from openpyxl.worksheet.datavalidation import DataValidation
77
+ from openpyxl.chart import BarChart, Reference
78
+ from openpyxl.workbook.defined_name import DefinedName
79
+ import matplotlib.pyplot as plt
80
+ from matplotlib.backends.backend_pdf import PdfPages
81
+
82
+ base_path = "/mnt/data"
83
+ xlsx_path = os.path.join(base_path, "D4W_MAUI_Aylo_Model_Sept_21_2025.xlsx")
84
+
85
+ # ---------- Build workbook ----------
86
+ wb = Workbook()
87
+
88
+ # Styles
89
+ header_fill = PatternFill("solid", fgColor="1F4E78")
90
+ subheader_fill = PatternFill("solid", fgColor="D9E1F2")
91
+ white = PatternFill("solid", fgColor="FFFFFF")
92
+ thin = Side(style="thin", color="DDDDDD")
93
+ border_all = Border(top=thin, left=thin, right=thin, bottom=thin)
94
+ title_font = Font(bold=True, color="FFFFFF")
95
+ bold_font = Font(bold=True)
96
+
97
+ # Sheet: Inputs
98
+ ws = wb.active
99
+ ws.title = "Inputs"
100
+ inputs = [
101
+ ["Label", "Name", "Value", "Min", "Max", "Notes"],
102
+ ["GMV per unit ($)", "GMV", 100, 100, 100, "Per-$100 analysis anchor"],
103
+ ["Current Payment Fee (as % of GMV)", "Pay_Current", 0.032, 0, 0.1, "Blended incl. chargebacks"],
104
+ ["Target Payment Fee (best-case)", "Pay_Target", 0.016, 0, 0.1, "Mixed rails auth ↑ fraud ↓"],
105
+ ["Payment Mix Shift Achieved (0–1)", "Pay_Shift", 0.50, 0, 1, "0=no change; 1=target reached"],
106
+ ["Current Infra COGS (store/CDN/compute/ID/mod)", "Infra_Current", 0.10, 0, 0.5, "Blended infra cost"],
107
+ ["Target Infra COGS (best-case)", "Infra_Target", 0.075, 0, 0.5, "Decentralized + automation"],
108
+ ["Infra Savings Achieved (0–1)", "Infra_Shift", 0.75, 0, 1, "0=no change; 1=target reached"],
109
+ ["Current Compliance & Legal", "Comp_Current", 0.03, 0, 0.2, "Age/consent, takedowns, counsel"],
110
+ ["Target Compliance & Legal", "Comp_Target", 0.015, 0, 0.2, "Policy-as-code + evidence"],
111
+ ["Compliance Automation Achieved (0–1)", "Comp_Shift", 0.75, 0, 1, "0=no change; 1=target reached"],
112
+ ["Platform Rake (Current)", "Plat_Current", 0.15, 0, 0.5, "Ops, S&M, G&A capture"],
113
+ ["Platform Rake (New, baseline)", "Plat_New", 0.12, 0, 0.5, "Adjust to hold net"],
114
+ ["D4W Program Rake (2–7%)", "D4W_Rake", 0.04, 0.02, 0.07, "Funds infra, governance"],
115
+ ]
116
+
117
+ for r, row in enumerate(inputs, start=1):
118
+ for c, val in enumerate(row, start=1):
119
+ ws.cell(row=r, column=c, value=val)
120
+ ws.cell(row=r, column=c).border = border_all
121
+ if r==1:
122
+ ws.cell(row=r, column=c).fill = header_fill
123
+ ws.cell(row=r, column=c).font = title_font
124
+ ws.cell(row=r, column=c).alignment = Alignment(horizontal="center")
125
+ elif c==1:
126
+ ws.cell(row=r, column=c).fill = subheader_fill
127
+ ws.cell(row=r, column=c).font = bold_font
128
+
129
+ # Validation
130
+ for r in range(3, len(inputs)+1):
131
+ dv = DataValidation(type="decimal", operator="between",
132
+ formula1=str(ws.cell(row=r, column=4).value),
133
+ formula2=str(ws.cell(row=r, column=5).value),
134
+ allow_blank=False)
135
+ ws.add_data_validation(dv)
136
+ dv.add(ws.cell(row=r, column=3))
137
+
138
+ # Named ranges
139
+ for r in range(2, len(inputs)+1):
140
+ name = ws.cell(row=r, column=2).value
141
+ ref = f"'{ws.title}'!$C${r}"
142
+ dn = DefinedName(name=name, attr_text=ref)
143
+ wb.defined_names.append(dn)
144
+
145
+ ws.column_dimensions["A"].width = 42
146
+ ws.column_dimensions["B"].width = 24
147
+ ws.column_dimensions["C"].width = 18
148
+ ws.column_dimensions["F"].width = 50
149
+ ws["F2"] = "Tip: Developer → Insert → Scroll Bar. Link to the input cells in column C."
150
+
151
+ # Sheet: Model
152
+ ws2 = wb.create_sheet("Model")
153
+ model_rows = [
154
+ ("GMV", "=GMV"),
155
+ ("Payment Fee – Current", "=Pay_Current"),
156
+ ("Payment Fee – New", "=Pay_Current - (Pay_Current - Pay_Target)*Pay_Shift"),
157
+ ("Infra COGS – Current", "=Infra_Current"),
158
+ ("Infra COGS – New", "=Infra_Current - (Infra_Current - Infra_Target)*Infra_Shift"),
159
+ ("Compliance – Current", "=Comp_Current"),
160
+ ("Compliance – New", "=Comp_Current - (Comp_Current - Comp_Target)*Comp_Shift"),
161
+ ("Platform Rake – Current", "=Plat_Current"),
162
+ ("Platform Rake – New", "=Plat_New"),
163
+ ("D4W Rake – New", "=D4W_Rake"),
164
+ ("Net After Fees – Current", "=1 - (Pay_Current + Infra_Current + Comp_Current)"),
165
+ ("Net After Fees – New", "=1 - ((Pay_Current - (Pay_Current - Pay_Target)*Pay_Shift) + (Infra_Current - (Infra_Current - Infra_Target)*Infra_Shift) + (Comp_Current - (Comp_Current - Comp_Target)*Comp_Shift))"),
166
+ ("Creator Payout – Current (as % GMV)", "=(1 - (Pay_Current + Infra_Current + Comp_Current)) - Plat_Current"),
167
+ ("Creator Payout – New (as % GMV)", "=(1 - ((Pay_Current - (Pay_Current - Pay_Target)*Pay_Shift) + (Infra_Current - (Infra_Current - Infra_Target)*Infra_Shift) + (Comp_Current - (Comp_Current - Comp_Target)*Comp_Shift))) - Plat_New - D4W_Rake"),
168
+ ]
169
+ ws2.append(["Metric", "Value (as % of GMV)"])
170
+ ws2["A1"].font = title_font; ws2["A1"].fill = header_fill; ws2["A1"].alignment = Alignment(horizontal="center")
171
+ ws2["B1"].font = title_font; ws2["B1"].fill = header_fill; ws2["B1"].alignment = Alignment(horizontal="center")
172
+ for i, (label, formula) in enumerate(model_rows, start=2):
173
+ ws2.cell(row=i, column=1, value=label)
174
+ ws2.cell(row=i, column=2, value=formula)
175
+ ws2.cell(row=i, column=1).border = border_all
176
+ ws2.cell(row=i, column=2).border = border_all
177
+ ws2.cell(row=i, column=2).number_format = "0.00%"
178
+ ws2.column_dimensions["A"].width = 42
179
+ ws2.column_dimensions["B"].width = 24
180
+
181
+ # Sheet: Per_100
182
+ ws3 = wb.create_sheet("Per_100")
183
+ ws3.append(["Line item", "% of GMV", "$ per 100 (Current)", "$ per 100 (New)"])
184
+ for c in range(1,5):
185
+ ws3.cell(row=1, column=c).fill = header_fill
186
+ ws3.cell(row=1, column=c).font = title_font
187
+ ws3.cell(row=1, column=c).alignment = Alignment(horizontal="center")
188
+ ws3.cell(row=1, column=c).border = border_all
189
+
190
+ per_rows = [
191
+ ("GMV", "1", "=GMV", "=GMV"),
192
+ ("Payment fees", "=Pay_Current", "=GMV*Pay_Current", "=GMV*(Pay_Current - (Pay_Current - Pay_Target)*Pay_Shift)"),
193
+ ("Infra COGS", "=Infra_Current", "=GMV*Infra_Current", "=GMV*(Infra_Current - (Infra_Current - Infra_Target)*Infra_Shift)"),
194
+ ("Compliance & legal", "=Comp_Current", "=GMV*Comp_Current", "=GMV*(Comp_Current - (Comp_Current - Comp_Target)*Comp_Shift)"),
195
+ ("Net after fees/COGS", "=1 - (Pay_Current + Infra_Current + Comp_Current)", "=GMV*(1 - (Pay_Current + Infra_Current + Comp_Current))", "=GMV*(1 - ((Pay_Current - (Pay_Current - Pay_Target)*Pay_Shift) + (Infra_Current - (Infra_Current - Infra_Target)*Infra_Shift) + (Comp_Current - (Comp_Current - Comp_Target)*Comp_Shift)))"),
196
+ ("Platform rake", "=Plat_Current", "=GMV*Plat_Current", "=GMV*Plat_New"),
197
+ ("D4W rake", "0", "0", "=GMV*D4W_Rake"),
198
+ ("Creator payout", "=(1 - (Pay_Current + Infra_Current + Comp_Current)) - Plat_Current", "=GMV*((1 - (Pay_Current + Infra_Current + Comp_Current)) - Plat_Current)", "=GMV*(((1 - ((Pay_Current - (Pay_Current - Pay_Target)*Pay_Shift) + (Infra_Current - (Infra_Current - Infra_Target)*Infra_Shift) + (Comp_Current - (Comp_Current - Comp_Target)*Comp_Shift))) - Plat_New - D4W_Rake))"),
199
+ ]
200
+ for i, (label, pct, cur, new) in enumerate(per_rows, start=2):
201
+ ws3.cell(row=i, column=1, value=label)
202
+ ws3.cell(row=i, column=2, value=pct)
203
+ ws3.cell(row=i, column=3, value=cur)
204
+ ws3.cell(row=i, column=4, value=new)
205
+ for c in range(1,5):
206
+ ws3.cell(row=i, column=c).border = border_all
207
+ ws3.cell(row=i, column=2).number_format = "0.00%"
208
+ for c in [3,4]:
209
+ ws3.cell(row=i, column=c).number_format = numbers.FORMAT_CURRENCY_USD_SIMPLE
210
+ ws3.column_dimensions["A"].width = 30
211
+ ws3.column_dimensions["B"].width = 16
212
+ ws3.column_dimensions["C"].width = 20
213
+ ws3.column_dimensions["D"].width = 20
214
+
215
+ # quick bar chart for creator payout
216
+ chart = BarChart()
217
+ chart.title = "Creator Payout ($ per 100) — Current vs New"
218
+ chart.y_axis.title = "USD"
219
+ chart.x_axis.title = "Scenario"
220
+ data = Reference(ws3, min_col=3, min_row=8, max_col=4, max_row=8)
221
+ cats = Reference(ws3, min_col=3, min_row=1, max_col=4, max_row=1)
222
+ chart.add_data(data, titles_from_data=False)
223
+ chart.set_categories(cats)
224
+ ws3.add_chart(chart, "F3")
225
+
226
+ # Sheet: Sensitivity
227
+ ws4 = wb.create_sheet("Sensitivity")
228
+ ws4["A1"] = "Creator payout ($/100) vs D4W rake and Savings Achieved (applies equally to Pay/Infra/Comp)"
229
+ ws4["A1"].font = bold_font
230
+ d4w_values = [0.02, 0.04, 0.07]
231
+ save_values = [0.50, 0.75, 1.00]
232
+ ws4.append(["Savings → / D4W ↓"] + d4w_values)
233
+ thin = Side(style="thin", color="DDDDDD")
234
+ border_all = Border(top=thin, left=thin, right=thin, bottom=thin)
235
+ for r, s in enumerate(save_values, start=3):
236
+ ws4.cell(row=r, column=1, value=s)
237
+ for c, d in enumerate(d4w_values, start=2):
238
+ pay_new = f"(Pay_Current - (Pay_Current - Pay_Target)*{s})"
239
+ infra_new = f"(Infra_Current - (Infra_Current - Infra_Target)*{s})"
240
+ comp_new = f"(Comp_Current - (Comp_Current - Comp_Target)*{s})"
241
+ formula = f"=GMV*(1 - ({pay_new} + {infra_new} + {comp_new})) - GMV*Plat_New - GMV*{d}"
242
+ ws4.cell(row=r, column=c, value=formula)
243
+ ws4.cell(row=r, column=c).number_format = numbers.FORMAT_CURRENCY_USD_SIMPLE
244
+ ws4.cell(row=r, column=c).border = border_all
245
+ for col in range(1, 1+len(d4w_values)+1):
246
+ ws4.column_dimensions[get_column_letter(col)].width = 20
247
+
248
+ # Sheet: Memo
249
+ ws5 = wb.create_sheet("Memo (1-pager)")
250
+ memo_lines = [
251
+ "Investment Committee Cover Memo – Maui/D4W x Aylo (Sept 21, 2025)",
252
+ "Recommendation: Approve pilot with KPI-gated creator uplift; preserve Aylo net margin; D4W rake 2–7% funded from savings.",
253
+ "Why Now: Regulatory enforcement + payment brand risk → compliance rail becomes market rail.",
254
+ "Economics (per $100 GMV): Current creator $68.8 → New $73.4; D4W $4.0; Aylo net held via OPEX reduction.",
255
+ "Guardrails: KPI gates; throttle D4W rake within 2–7%; platform rake new baseline at 12% (adjustable).",
256
+ "Gaps: Confirm revenue mix, PSP auth/chargeback rates, infra COGS, moderation unit cost, legal run-rate.",
257
+ "Next Steps: 12-week MVP (age+consent DID), pilot scope sign-off, weekly KPI dashboard, vendor RFP.",
258
+ "",
259
+ "Instructions: Use the 'Inputs' sheet to adjust assumptions. To add sliders: Developer » Insert » Scroll Bar; link to input cells."
260
+ ]
261
+ for i, line in enumerate(memo_lines, start=1):
262
+ ws5.cell(row=i, column=1, value=line)
263
+
264
+ # Add BridgeData
265
+ ws6 = wb.create_sheet("BridgeData")
266
+ data_rows = [
267
+ ["Item", "Value ($ per 100)", "Type"],
268
+ ["Savings (Payments+Infra+Compliance)", 5.60, "increase"],
269
+ ["Creator Uplift", -4.60, "decrease"],
270
+ ["D4W Program Rake", -4.00, "decrease"],
271
+ ["Platform Rake Reduction", 3.00, "increase"],
272
+ ["Net Balance", 0.00, "total"]
273
+ ]
274
+ for r, row in enumerate(data_rows, start=1):
275
+ for c, val in enumerate(row, start=1):
276
+ ws6.cell(row=r, column=c, value=val)
277
+ ws6.cell(row=r, column=c).border = border_all
278
+ if r == 1:
279
+ ws6.cell(row=r, column=c).fill = header_fill
280
+ ws6.cell(row=r, column=c).font = title_font
281
+ ws6.cell(row=r, column=c).alignment = Alignment(horizontal="center")
282
+ elif c == 1:
283
+ ws6.cell(row=r, column=c).font = bold_font
284
+ ws6.column_dimensions["A"].width = 38
285
+ ws6.column_dimensions["B"].width = 22
286
+ ws6.column_dimensions["C"].width = 16
287
+
288
+ wb.save(xlsx_path)
289
+
290
+ # ---------- Create revenue bridge PNG ----------
291
+ labels = [r[0] for r in data_rows[1:-1]]
292
+ values = [r[1] for r in data_rows[1:-1]]
293
+
294
+ fig, ax = plt.subplots(figsize=(8, 4))
295
+ colors = ["#2ECC40" if v > 0 else "#FF4136" for v in values]
296
+ cum = 0
297
+ x, y, bottoms = [], [], []
298
+ for i, v in enumerate(values):
299
+ x.append(i)
300
+ if v > 0:
301
+ bottoms.append(cum)
302
+ y.append(v)
303
+ cum += v
304
+ else:
305
+ bottoms.append(cum + v)
306
+ y.append(-v)
307
+ cum += v
308
+
309
+ for i in range(len(values)):
310
+ ax.bar(x[i], y[i], bottom=bottoms[i], color=colors[i], edgecolor="black")
311
+
312
+ ax.axhline(0, color="black", linewidth=0.8)
313
+ ax.set_xticks(range(len(labels)))
314
+ ax.set_xticklabels(labels, rotation=20, ha="right")
315
+ ax.set_ylabel("USD per $100 GMV")
316
+ ax.set_title("Savings Allocation Bridge (Mid-case)")
317
+ plt.tight_layout()
318
+
319
+ bridge_png = os.path.join(base_path, "Revenue_Bridge.png")
320
+ plt.savefig(bridge_png, dpi=200)
321
+ plt.close(fig)
322
+
323
+ # ---------- Create 1-page PDF memo ----------
324
+ pdf_path = os.path.join(base_path, "IC_Memo_OnePager.pdf")
325
+ lines = [
326
+ "Investment Committee Cover Memo – Maui/D4W x Aylo (Sept 21, 2025)",
327
+ "",
328
+ "Recommendation: Approve KPI-gated pilot; preserve Aylo net; fund D4W rake (2–7%) from savings.",
329
+ "Why Now: Enforcement/brand-risk turns compliance into the market rail; Big Tech avoids the vertical.",
330
+ "",
331
+ "Economics (per $100 GMV, mid-case):",
332
+ "• Current: Creator $68.80, Platform rake $15.00, Payments $3.20, Infra $10.00, Compliance $3.00.",
333
+ "• With D4W: Creator $73.40 (+$4.60), D4W $4.00, Platform rake $12.00, Payments $1.60, Infra $7.50, Compliance $1.50.",
334
+ "• Savings (+$5.60) = Creator uplift (+$4.60) + D4W (+$4.00) – Platform rake reduction (−$3.00).",
335
+ "",
336
+ "Guardrails & KPIs:",
337
+ "• +150–300 bps auth, −20–40% chargeback bps, −30–50% moderation unit-cost, T+1 payouts, zero incidents with full evidence.",
338
+ "• Creator uplift released in bands; D4W rake throttled 2–7% to hold platform net.",
339
+ "",
340
+ "Sensitivities:",
341
+ "• If savings land at 50% and D4W ≥5% while creator uplift >+6 pts, platform net may compress — pause uplift or reduce D4W rake until KPIs hit.",
342
+ "",
343
+ "Implementation & Budget:",
344
+ "• MVP (12 weeks): DID+ZK age/consent rail, automated evidence, royalty engine — ~$430k.",
345
+ "• Pilot: 1–2 Aylo properties; payment savings within 4–8 weeks; infra/compliance savings follow.",
346
+ "",
347
+ "Data Gaps (pre-term sheet): revenue mix by brand; PSP auth & chargeback rates; infra COGS; moderation unit cost/volumes; legal run-rate.",
348
+ ]
349
+
350
+ with PdfPages(pdf_path) as pdf:
351
+ fig, ax = plt.subplots(figsize=(8.27, 11.69)) # A4 portrait
352
+ ax.axis("off")
353
+ y = 0.97
354
+ for ln in lines:
355
+ ax.text(0.05, y, ln, fontsize=10, va="top")
356
+ y -= 0.035 if ln else 0.02
357
+ # Insert bridge image
358
+ import matplotlib.image as mpimg
359
+ if os.path.exists(bridge_png):
360
+ img = mpimg.imread(bridge_png)
361
+ ax.imshow(img, extent=(0.05, 0.95, 0.09, 0.35), aspect="auto")
362
+ pdf.savefig(fig, bbox_inches="tight")
363
+ plt.close(fig)
364
+
365
+ xlsx_path, bridge_png, pdf_path
366
+