Refactor economics to expense-record ledger with correct Bubble cost
Replace pre-aggregated costs.json with expense_records.json (48 line-item records) and payment_records.json. All monthly and cumulative totals are computed deterministically in observatory/ledger.py. Correct Bubble.io to $32/mo (since Feb 2025) — infrastructure €69.44/mo not €72.20.
This commit is contained in:
parent
ea2c2c6403
commit
31db9f8f31
12 changed files with 843 additions and 299 deletions
|
|
@ -4,7 +4,7 @@ from dataclasses import dataclass
|
|||
from decimal import Decimal
|
||||
from typing import Literal
|
||||
|
||||
CostCategory = Literal["fixed", "variable"]
|
||||
ExpenseClass = Literal["infrastructure", "payment_processing"]
|
||||
MemberStatus = Literal["active", "churned", "paused"]
|
||||
PricingModelStatus = Literal["active", "candidate", "retired"]
|
||||
LiquidityStatus = Literal["burning", "neutral", "generating"]
|
||||
|
|
@ -33,14 +33,28 @@ class PricingModel:
|
|||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class CostEntry:
|
||||
class ExpenseRecord:
|
||||
id: str
|
||||
name: str
|
||||
category: CostCategory
|
||||
period: str
|
||||
vendor: str
|
||||
description: str
|
||||
cost_class: ExpenseClass
|
||||
amount: Decimal
|
||||
currency: str
|
||||
cadence: str
|
||||
allocation: str
|
||||
source: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PaymentRecord:
|
||||
id: str
|
||||
period: str
|
||||
gross_amount: Decimal
|
||||
fees_amount: Decimal
|
||||
refunds_amount: Decimal
|
||||
net_amount: Decimal
|
||||
currency: str
|
||||
source: str
|
||||
member_count: int = 0
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
|
@ -63,18 +77,6 @@ class Budget:
|
|||
started: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RevenueEntry:
|
||||
id: str
|
||||
period: str
|
||||
gross_amount: Decimal
|
||||
fees_amount: Decimal
|
||||
refunds_amount: Decimal
|
||||
net_amount: Decimal
|
||||
currency: str
|
||||
source: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MembershipRecord:
|
||||
id: str
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue