petter2025's picture
Create business_logic.py
b0403f2 verified
raw
history blame
9.35 kB
"""
Business Value Demonstration
ROI Calculator, Tier Pricing, Upgrade Paths
"""
from typing import Dict, List
class BusinessValueCalculator:
"""Calculates business value and ROI for ARF tiers"""
def __init__(self):
# Industry benchmarks
self.benchmarks = {
"incident_cost": 100000, # Average incident cost
"incident_reduction": {
"oss": 0.0,
"trial": 0.5,
"starter": 0.7,
"professional": 0.85,
"enterprise": 0.92
},
"time_savings_minutes": 15, # Minutes saved per decision
"decisions_per_day": 20,
"engineer_cost_hourly": 150, # $/hour
"operating_days": 250, # Business days per year
"team_size": {
"oss": 1,
"starter": 5,
"professional": 15,
"enterprise": 50
}
}
# Tier pricing
self.tier_pricing = {
"oss": 0,
"starter": 2000,
"professional": 5000,
"enterprise": 15000
}
# Feature comparison
self.feature_comparison = {
"oss": {
"name": "OSS Edition",
"price": "$0",
"enforcement": "Advisory Only",
"mechanical_gates": "❌ None",
"approval_workflows": "❌ Manual",
"audit_trail": "❌ None",
"support": "Community",
"sla": "None",
"best_for": "Evaluation"
},
"starter": {
"name": "Starter",
"price": "$2,000/mo",
"enforcement": "Mechanical Gates",
"mechanical_gates": "✅ 3 Gates",
"approval_workflows": "✅ Basic",
"audit_trail": "✅ 30 days",
"support": "Business Hours",
"sla": "99.5%",
"best_for": "Small Teams"
},
"professional": {
"name": "Professional",
"price": "$5,000/mo",
"enforcement": "Advanced Gates",
"mechanical_gates": "✅ 5 Gates",
"approval_workflows": "✅ Advanced",
"audit_trail": "✅ 1 year",
"support": "24/7",
"sla": "99.9%",
"best_for": "Growing Companies"
},
"enterprise": {
"name": "Enterprise",
"price": "$15,000/mo",
"enforcement": "Full Mechanical",
"mechanical_gates": "✅ 7 Gates",
"approval_workflows": "✅ Custom",
"audit_trail": "✅ Unlimited",
"support": "Dedicated",
"sla": "99.99%",
"best_for": "Enterprise Scale"
}
}
def calculate_roi(self, current_tier: str, target_tier: str) -> Dict:
"""Calculate ROI for upgrade"""
current_price = self.tier_pricing.get(current_tier, 0)
target_price = self.tier_pricing.get(target_tier, 0)
# Calculate incident cost savings
current_reduction = self.benchmarks["incident_reduction"].get(current_tier, 0)
target_reduction = self.benchmarks["incident_reduction"].get(target_tier, 0)
incident_savings = self.benchmarks["incident_cost"] * (target_reduction - current_reduction) * 12
# Calculate time savings
team_size_current = self.benchmarks["team_size"].get(current_tier, 1)
team_size_target = self.benchmarks["team_size"].get(target_tier, 1)
avg_team_size = (team_size_current + team_size_target) / 2
time_savings = (
self.benchmarks["time_savings_minutes"] / 60 * # Hours per decision
self.benchmarks["decisions_per_day"] * # Decisions per day
self.benchmarks["operating_days"] * # Days per year
self.benchmarks["engineer_cost_hourly"] * # Cost per hour
avg_team_size # Team size
)
# Total annual savings
annual_savings = incident_savings + time_savings
# Calculate ROI
price_difference = target_price - current_price
annual_price_difference = price_difference * 12
if annual_savings > 0:
roi_months = (annual_price_difference / annual_savings) * 12
else:
roi_months = 999
# Payback period
if annual_savings > annual_price_difference:
payback_months = (annual_price_difference / annual_savings) * 12
else:
payback_months = roi_months
return {
"current_tier": current_tier.upper(),
"target_tier": target_tier.upper(),
"annual_savings": f"${annual_savings:,.0f}",
"incident_savings": f"${incident_savings:,.0f}",
"time_savings": f"${time_savings:,.0f}",
"monthly_investment": f"${price_difference:,.0f}",
"roi_months": f"{roi_months:.1f}",
"payback_months": f"{payback_months:.1f}",
"annual_roi": f"{(annual_savings / max(annual_price_difference, 1)) * 100:.0f}%"
}
def get_tier_comparison(self) -> List[Dict]:
"""Get tier comparison matrix"""
return [self.feature_comparison[tier] for tier in ["oss", "starter", "professional", "enterprise"]]
def calculate_enterprise_value(self, company_size: int = 100, incidents_per_year: int = 5) -> Dict:
"""Calculate enterprise-specific value"""
# Incident cost avoidance
incident_avoidance = incidents_per_year * self.benchmarks["incident_cost"] * self.benchmarks["incident_reduction"]["enterprise"]
# Productivity savings
productivity_savings = (
company_size *
self.benchmarks["time_savings_minutes"] / 60 *
self.benchmarks["decisions_per_day"] *
self.benchmarks["operating_days"] *
self.benchmarks["engineer_cost_hourly"]
)
# Compliance value (estimated)
compliance_value = 500000 # Estimated value of compliance automation
total_value = incident_avoidance + productivity_savings + compliance_value
enterprise_cost = self.tier_pricing["enterprise"] * 12
return {
"company_size": company_size,
"incidents_prevented": incidents_per_year * self.benchmarks["incident_reduction"]["enterprise"],
"incident_avoidance": f"${incident_avoidance:,.0f}",
"productivity_savings": f"${productivity_savings:,.0f}",
"compliance_value": f"${compliance_value:,.0f}",
"total_annual_value": f"${total_value:,.0f}",
"enterprise_cost": f"${enterprise_cost:,.0f}",
"value_ratio": f"{total_value / enterprise_cost:.1f}x",
"monthly_roi": f"${(total_value - enterprise_cost) / 12:,.0f}"
}
def generate_upgrade_path(self, current_tier: str) -> List[Dict]:
"""Generate upgrade path from current tier"""
tiers = ["oss", "starter", "professional", "enterprise"]
try:
current_index = tiers.index(current_tier)
except ValueError:
current_index = 0
path = []
for i in range(current_index + 1, len(tiers)):
target_tier = tiers[i]
roi_data = self.calculate_roi(current_tier, target_tier)
path.append({
"from": self.feature_comparison[current_tier]["name"],
"to": self.feature_comparison[target_tier]["name"],
"price_increase": f"${self.tier_pricing[target_tier] - self.tier_pricing[current_tier]:,.0f}/mo",
"annual_savings": roi_data["annual_savings"],
"payback_period": roi_data["payback_months"] + " months",
"key_features": self._get_upgrade_features(current_tier, target_tier)
})
return path
def _get_upgrade_features(self, from_tier: str, to_tier: str) -> List[str]:
"""Get key features gained in upgrade"""
features = {
"oss→starter": [
"Mechanical gates (3 gates)",
"Basic approval workflows",
"30-day audit trail",
"Business hours support"
],
"starter→professional": [
"Advanced gates (5 gates)",
"Custom approval workflows",
"1-year audit trail",
"24/7 support",
"99.9% SLA"
],
"professional→enterprise": [
"Full mechanical gates (7 gates)",
"Custom gate development",
"Unlimited audit trail",
"Dedicated support engineer",
"99.99% SLA",
"On-prem deployment",
"SOC 2 compliance automation"
]
}
key = f"{from_tier}{to_tier}"
return features.get(key, ["Enhanced features and support"])