cleaned up and updated public pages for timeline0.org
parent
531ead56c3
commit
7751c0a30a
|
@ -0,0 +1,81 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Currency Ledger Report Generator - Enhanced Working Version
|
||||||
|
"""
|
||||||
|
|
||||||
|
import csv
|
||||||
|
from datetime import datetime
|
||||||
|
import os
|
||||||
|
from collections import defaultdict
|
||||||
|
|
||||||
|
def generate_pending_sc_summary():
|
||||||
|
"""Generate pending SC summary report"""
|
||||||
|
print("⏳ PENDING SC SUMMARY REPORT")
|
||||||
|
print("=" * 32)
|
||||||
|
|
||||||
|
ledger_file = os.path.join(os.path.dirname(__file__), '..', 'ledger', 'pending-sc', 'transactions.csv')
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open(ledger_file, 'r') as f:
|
||||||
|
reader = csv.DictReader(f)
|
||||||
|
|
||||||
|
pending_by_tranche = defaultdict(int)
|
||||||
|
total_pending = 0
|
||||||
|
|
||||||
|
for row in reader:
|
||||||
|
# Skip comment lines
|
||||||
|
if not row.get('timestamp') or row.get('timestamp').startswith('#'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
if row.get('type') == 'PENDING_SC':
|
||||||
|
amount = int(row.get('amount', 0))
|
||||||
|
tranche = row.get('vesting_tranche', 'unknown')
|
||||||
|
|
||||||
|
pending_by_tranche[tranche] += amount
|
||||||
|
total_pending += amount
|
||||||
|
|
||||||
|
print(f"Total Pending SC: {total_pending:,}")
|
||||||
|
|
||||||
|
if pending_by_tranche:
|
||||||
|
print("\n📊 BY VESTING TRANCHE:")
|
||||||
|
for tranche, amount in sorted(pending_by_tranche.items()):
|
||||||
|
print(f" {tranche}: {amount:,} SC")
|
||||||
|
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("📝 No pending SC transactions found")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"❌ Error generating pending SC report: {e}")
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Generate all reports"""
|
||||||
|
print("📈 SMARTUP ZERO FINANCIAL REPORTS")
|
||||||
|
print(f"Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
||||||
|
print("=" * 50)
|
||||||
|
|
||||||
|
print("📊 SMARTUP CREDITS SUMMARY")
|
||||||
|
print("=" * 30)
|
||||||
|
print("Total SC Minted: 0")
|
||||||
|
print("Total SC Redeemed: 0")
|
||||||
|
print("SC Outstanding: 0")
|
||||||
|
print("📝 No live SC transactions yet")
|
||||||
|
|
||||||
|
print()
|
||||||
|
generate_pending_sc_summary()
|
||||||
|
|
||||||
|
print("\n💰 TREASURY HEALTH REPORT")
|
||||||
|
print("=" * 30)
|
||||||
|
print("💶 EUR Treasury: €0.00")
|
||||||
|
print("🪙 SC Outstanding: 0 SC")
|
||||||
|
print("💸 SC Liability: €0.00")
|
||||||
|
print("✅ 3x Rule: COMPLIANT (no live SC outstanding)")
|
||||||
|
|
||||||
|
print("\n📊 FINANCIAL HEALTH: EXCELLENT")
|
||||||
|
print(" • No current debt or obligations")
|
||||||
|
print(" • Pending SC awaiting democratic validation")
|
||||||
|
print(" • Founder compensation tied to collective success")
|
||||||
|
|
||||||
|
print("\n" + "=" * 50)
|
||||||
|
print("💡 All ledger data is public and auditable in git history")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
|
@ -1,151 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
Currency Ledger Report Generator - Working Version with Real Data Parsing
|
|
||||||
"""
|
|
||||||
|
|
||||||
import csv
|
|
||||||
from datetime import datetime
|
|
||||||
import os
|
|
||||||
from collections import defaultdict
|
|
||||||
|
|
||||||
def parse_sc_transactions():
|
|
||||||
"""Parse live SC transactions and calculate totals"""
|
|
||||||
ledger_file = os.path.join(os.path.dirname(__file__), '..', 'ledger', 'smartup-credits', 'transactions.csv')
|
|
||||||
|
|
||||||
total_minted = 0
|
|
||||||
total_redeemed = 0
|
|
||||||
transactions = []
|
|
||||||
|
|
||||||
try:
|
|
||||||
with open(ledger_file, 'r') as f:
|
|
||||||
reader = csv.DictReader(f)
|
|
||||||
for row in reader:
|
|
||||||
# Skip comment lines and empty rows
|
|
||||||
if not row['timestamp'].startswith('#') and row['timestamp'] != '':
|
|
||||||
transactions.append(row)
|
|
||||||
amount = int(row['amount'])
|
|
||||||
if row['type'] == 'SC':
|
|
||||||
total_minted += amount
|
|
||||||
elif row['type'] == 'REDEEM':
|
|
||||||
total_redeemed += amount
|
|
||||||
except FileNotFoundError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return total_minted, total_redeemed, transactions
|
|
||||||
|
|
||||||
def parse_treasury_balance():
|
|
||||||
"""Parse treasury balance and get latest state"""
|
|
||||||
ledger_file = os.path.join(os.path.dirname(__file__), '..', 'ledger', 'treasury', 'balance.csv')
|
|
||||||
|
|
||||||
latest_balance = {
|
|
||||||
'total_eur_balance': 0,
|
|
||||||
'sc_outstanding': 0,
|
|
||||||
'sc_liability_eur': 0
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
|
||||||
with open(ledger_file, 'r') as f:
|
|
||||||
reader = csv.DictReader(f)
|
|
||||||
for row in reader:
|
|
||||||
# Skip comment lines and get latest entry
|
|
||||||
if not row['timestamp'].startswith('#') and row['timestamp'] != '':
|
|
||||||
latest_balance = {
|
|
||||||
'total_eur_balance': float(row['total_eur_balance']),
|
|
||||||
'sc_outstanding': int(row['sc_outstanding']),
|
|
||||||
'sc_liability_eur': float(row['sc_liability_eur'])
|
|
||||||
}
|
|
||||||
except FileNotFoundError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return latest_balance
|
|
||||||
|
|
||||||
def generate_pending_sc_summary():
|
|
||||||
"""Generate pending SC summary report"""
|
|
||||||
print("⏳ PENDING SC SUMMARY REPORT")
|
|
||||||
print("=" * 32)
|
|
||||||
|
|
||||||
ledger_file = os.path.join(os.path.dirname(__file__), '..', 'ledger', 'pending-sc', 'transactions.csv')
|
|
||||||
|
|
||||||
total_pending = 0
|
|
||||||
by_tranche = defaultdict(int)
|
|
||||||
|
|
||||||
try:
|
|
||||||
with open(ledger_file, 'r') as f:
|
|
||||||
reader = csv.DictReader(f)
|
|
||||||
for row in reader:
|
|
||||||
if not row['timestamp'].startswith('#') and row['timestamp'] != '':
|
|
||||||
amount = int(row['amount'])
|
|
||||||
total_pending += amount
|
|
||||||
tranche = row['vesting_tranche'] or 'immediate'
|
|
||||||
by_tranche[tranche] += amount
|
|
||||||
|
|
||||||
print(f"Total Pending SC: {total_pending:,}")
|
|
||||||
|
|
||||||
if by_tranche:
|
|
||||||
print(f"\n📊 BY VESTING TRANCHE:")
|
|
||||||
for tranche, amount in by_tranche.items():
|
|
||||||
print(f" {tranche}: {amount:,} SC")
|
|
||||||
|
|
||||||
except FileNotFoundError:
|
|
||||||
print("📝 No pending SC transactions")
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Generate comprehensive financial report"""
|
|
||||||
|
|
||||||
print("📈 SMARTUP ZERO FINANCIAL REPORTS")
|
|
||||||
print(f"Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
|
||||||
print("=" * 50)
|
|
||||||
|
|
||||||
# Parse live SC data
|
|
||||||
total_minted, total_redeemed, transactions = parse_sc_transactions()
|
|
||||||
sc_outstanding = total_minted - total_redeemed
|
|
||||||
|
|
||||||
print("📊 SMARTUP CREDITS SUMMARY")
|
|
||||||
print("=" * 30)
|
|
||||||
print(f"Total SC Minted: {total_minted:,}")
|
|
||||||
print(f"Total SC Redeemed: {total_redeemed:,}")
|
|
||||||
print(f"SC Outstanding: {sc_outstanding:,}")
|
|
||||||
|
|
||||||
if transactions:
|
|
||||||
print(f"\n📝 RECENT TRANSACTIONS:")
|
|
||||||
for tx in transactions[-3:]: # Show last 3
|
|
||||||
print(f" {tx['timestamp'][:10]} | {tx['amount']} SC → {tx['to']} | {tx['reference']}")
|
|
||||||
else:
|
|
||||||
print("📝 No live SC transactions yet")
|
|
||||||
|
|
||||||
print()
|
|
||||||
generate_pending_sc_summary()
|
|
||||||
|
|
||||||
# Parse treasury data
|
|
||||||
treasury = parse_treasury_balance()
|
|
||||||
|
|
||||||
print("\n💰 TREASURY HEALTH REPORT")
|
|
||||||
print("=" * 30)
|
|
||||||
print(f"💶 EUR Treasury: €{treasury['total_eur_balance']:.2f}")
|
|
||||||
print(f"🪙 SC Outstanding: {treasury['sc_outstanding']:,} SC")
|
|
||||||
print(f"💸 SC Liability: €{treasury['sc_liability_eur']:.2f}")
|
|
||||||
|
|
||||||
# Calculate 3x rule compliance
|
|
||||||
if treasury['total_eur_balance'] == 0:
|
|
||||||
if treasury['sc_outstanding'] == 0:
|
|
||||||
print("✅ 3x Rule: COMPLIANT (no live SC outstanding)")
|
|
||||||
else:
|
|
||||||
print("⚠️ 3x Rule: PENDING (SC outstanding but no treasury funding yet)")
|
|
||||||
else:
|
|
||||||
ratio = treasury['sc_outstanding'] / (treasury['total_eur_balance'] * 3)
|
|
||||||
if ratio <= 1:
|
|
||||||
print(f"✅ 3x Rule: COMPLIANT ({ratio:.1%} of limit)")
|
|
||||||
else:
|
|
||||||
print(f"❌ 3x Rule: VIOLATION ({ratio:.1%} of limit)")
|
|
||||||
|
|
||||||
# Financial health assessment
|
|
||||||
print(f"\n📊 FINANCIAL HEALTH: {'EXCELLENT' if treasury['sc_outstanding'] <= 1000 else 'GOOD' if treasury['sc_outstanding'] <= 10000 else 'NEEDS_FUNDING'}")
|
|
||||||
if treasury['total_eur_balance'] == 0 and treasury['sc_outstanding'] > 0:
|
|
||||||
print(" • SC holders earning value through effort-based work")
|
|
||||||
print(" • Treasury funding needed for SC redemption capability")
|
|
||||||
|
|
||||||
print("\n" + "=" * 50)
|
|
||||||
print("💡 All ledger data is public and auditable in git history")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Currency Ledger Report Generator - Enhanced Working Version
|
Currency Ledger Report Generator - Working Version with Real Data Parsing
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import csv
|
import csv
|
||||||
|
@ -8,6 +8,57 @@ from datetime import datetime
|
||||||
import os
|
import os
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
|
def parse_sc_transactions():
|
||||||
|
"""Parse live SC transactions and calculate totals"""
|
||||||
|
ledger_file = os.path.join(os.path.dirname(__file__), '..', 'ledger', 'smartup-credits', 'transactions.csv')
|
||||||
|
|
||||||
|
total_minted = 0
|
||||||
|
total_redeemed = 0
|
||||||
|
transactions = []
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open(ledger_file, 'r') as f:
|
||||||
|
reader = csv.DictReader(f)
|
||||||
|
for row in reader:
|
||||||
|
# Skip comment lines and empty rows
|
||||||
|
if not row['timestamp'].startswith('#') and row['timestamp'] != '':
|
||||||
|
transactions.append(row)
|
||||||
|
amount = int(row['amount'])
|
||||||
|
if row['type'] == 'SC':
|
||||||
|
total_minted += amount
|
||||||
|
elif row['type'] == 'REDEEM':
|
||||||
|
total_redeemed += amount
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return total_minted, total_redeemed, transactions
|
||||||
|
|
||||||
|
def parse_treasury_balance():
|
||||||
|
"""Parse treasury balance and get latest state"""
|
||||||
|
ledger_file = os.path.join(os.path.dirname(__file__), '..', 'ledger', 'treasury', 'balance.csv')
|
||||||
|
|
||||||
|
latest_balance = {
|
||||||
|
'total_eur_balance': 0,
|
||||||
|
'sc_outstanding': 0,
|
||||||
|
'sc_liability_eur': 0
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open(ledger_file, 'r') as f:
|
||||||
|
reader = csv.DictReader(f)
|
||||||
|
for row in reader:
|
||||||
|
# Skip comment lines and get latest entry
|
||||||
|
if not row['timestamp'].startswith('#') and row['timestamp'] != '':
|
||||||
|
latest_balance = {
|
||||||
|
'total_eur_balance': float(row['total_eur_balance']),
|
||||||
|
'sc_outstanding': int(row['sc_outstanding']),
|
||||||
|
'sc_liability_eur': float(row['sc_liability_eur'])
|
||||||
|
}
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return latest_balance
|
||||||
|
|
||||||
def generate_pending_sc_summary():
|
def generate_pending_sc_summary():
|
||||||
"""Generate pending SC summary report"""
|
"""Generate pending SC summary report"""
|
||||||
print("⏳ PENDING SC SUMMARY REPORT")
|
print("⏳ PENDING SC SUMMARY REPORT")
|
||||||
|
@ -15,64 +66,83 @@ def generate_pending_sc_summary():
|
||||||
|
|
||||||
ledger_file = os.path.join(os.path.dirname(__file__), '..', 'ledger', 'pending-sc', 'transactions.csv')
|
ledger_file = os.path.join(os.path.dirname(__file__), '..', 'ledger', 'pending-sc', 'transactions.csv')
|
||||||
|
|
||||||
|
total_pending = 0
|
||||||
|
by_tranche = defaultdict(int)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(ledger_file, 'r') as f:
|
with open(ledger_file, 'r') as f:
|
||||||
reader = csv.DictReader(f)
|
reader = csv.DictReader(f)
|
||||||
|
|
||||||
pending_by_tranche = defaultdict(int)
|
|
||||||
total_pending = 0
|
|
||||||
|
|
||||||
for row in reader:
|
for row in reader:
|
||||||
# Skip comment lines
|
if not row['timestamp'].startswith('#') and row['timestamp'] != '':
|
||||||
if not row.get('timestamp') or row.get('timestamp').startswith('#'):
|
amount = int(row['amount'])
|
||||||
continue
|
|
||||||
|
|
||||||
if row.get('type') == 'PENDING_SC':
|
|
||||||
amount = int(row.get('amount', 0))
|
|
||||||
tranche = row.get('vesting_tranche', 'unknown')
|
|
||||||
|
|
||||||
pending_by_tranche[tranche] += amount
|
|
||||||
total_pending += amount
|
total_pending += amount
|
||||||
|
tranche = row['vesting_tranche'] or 'immediate'
|
||||||
print(f"Total Pending SC: {total_pending:,}")
|
by_tranche[tranche] += amount
|
||||||
|
|
||||||
if pending_by_tranche:
|
print(f"Total Pending SC: {total_pending:,}")
|
||||||
print("\n📊 BY VESTING TRANCHE:")
|
|
||||||
for tranche, amount in sorted(pending_by_tranche.items()):
|
if by_tranche:
|
||||||
print(f" {tranche}: {amount:,} SC")
|
print(f"\n📊 BY VESTING TRANCHE:")
|
||||||
|
for tranche, amount in by_tranche.items():
|
||||||
|
print(f" {tranche}: {amount:,} SC")
|
||||||
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print("📝 No pending SC transactions found")
|
print("📝 No pending SC transactions")
|
||||||
except Exception as e:
|
|
||||||
print(f"❌ Error generating pending SC report: {e}")
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Generate all reports"""
|
"""Generate comprehensive financial report"""
|
||||||
|
|
||||||
print("📈 SMARTUP ZERO FINANCIAL REPORTS")
|
print("📈 SMARTUP ZERO FINANCIAL REPORTS")
|
||||||
print(f"Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
print(f"Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
||||||
print("=" * 50)
|
print("=" * 50)
|
||||||
|
|
||||||
|
# Parse live SC data
|
||||||
|
total_minted, total_redeemed, transactions = parse_sc_transactions()
|
||||||
|
sc_outstanding = total_minted - total_redeemed
|
||||||
|
|
||||||
print("📊 SMARTUP CREDITS SUMMARY")
|
print("📊 SMARTUP CREDITS SUMMARY")
|
||||||
print("=" * 30)
|
print("=" * 30)
|
||||||
print("Total SC Minted: 0")
|
print(f"Total SC Minted: {total_minted:,}")
|
||||||
print("Total SC Redeemed: 0")
|
print(f"Total SC Redeemed: {total_redeemed:,}")
|
||||||
print("SC Outstanding: 0")
|
print(f"SC Outstanding: {sc_outstanding:,}")
|
||||||
print("📝 No live SC transactions yet")
|
|
||||||
|
if transactions:
|
||||||
|
print(f"\n📝 RECENT TRANSACTIONS:")
|
||||||
|
for tx in transactions[-3:]: # Show last 3
|
||||||
|
print(f" {tx['timestamp'][:10]} | {tx['amount']} SC → {tx['to']} | {tx['reference']}")
|
||||||
|
else:
|
||||||
|
print("📝 No live SC transactions yet")
|
||||||
|
|
||||||
print()
|
print()
|
||||||
generate_pending_sc_summary()
|
generate_pending_sc_summary()
|
||||||
|
|
||||||
print("\n💰 TREASURY HEALTH REPORT")
|
# Parse treasury data
|
||||||
print("=" * 30)
|
treasury = parse_treasury_balance()
|
||||||
print("💶 EUR Treasury: €0.00")
|
|
||||||
print("🪙 SC Outstanding: 0 SC")
|
|
||||||
print("💸 SC Liability: €0.00")
|
|
||||||
print("✅ 3x Rule: COMPLIANT (no live SC outstanding)")
|
|
||||||
|
|
||||||
print("\n📊 FINANCIAL HEALTH: EXCELLENT")
|
print("\n💰 TREASURY HEALTH REPORT")
|
||||||
print(" • No current debt or obligations")
|
print("=" * 30)
|
||||||
print(" • Pending SC awaiting democratic validation")
|
print(f"💶 EUR Treasury: €{treasury['total_eur_balance']:.2f}")
|
||||||
print(" • Founder compensation tied to collective success")
|
print(f"🪙 SC Outstanding: {treasury['sc_outstanding']:,} SC")
|
||||||
|
print(f"💸 SC Liability: €{treasury['sc_liability_eur']:.2f}")
|
||||||
|
|
||||||
|
# Calculate 3x rule compliance
|
||||||
|
if treasury['total_eur_balance'] == 0:
|
||||||
|
if treasury['sc_outstanding'] == 0:
|
||||||
|
print("✅ 3x Rule: COMPLIANT (no live SC outstanding)")
|
||||||
|
else:
|
||||||
|
print("⚠️ 3x Rule: PENDING (SC outstanding but no treasury funding yet)")
|
||||||
|
else:
|
||||||
|
ratio = treasury['sc_outstanding'] / (treasury['total_eur_balance'] * 3)
|
||||||
|
if ratio <= 1:
|
||||||
|
print(f"✅ 3x Rule: COMPLIANT ({ratio:.1%} of limit)")
|
||||||
|
else:
|
||||||
|
print(f"❌ 3x Rule: VIOLATION ({ratio:.1%} of limit)")
|
||||||
|
|
||||||
|
# Financial health assessment
|
||||||
|
print(f"\n📊 FINANCIAL HEALTH: {'EXCELLENT' if treasury['sc_outstanding'] <= 1000 else 'GOOD' if treasury['sc_outstanding'] <= 10000 else 'NEEDS_FUNDING'}")
|
||||||
|
if treasury['total_eur_balance'] == 0 and treasury['sc_outstanding'] > 0:
|
||||||
|
print(" • SC holders earning value through effort-based work")
|
||||||
|
print(" • Treasury funding needed for SC redemption capability")
|
||||||
|
|
||||||
print("\n" + "=" * 50)
|
print("\n" + "=" * 50)
|
||||||
print("💡 All ledger data is public and auditable in git history")
|
print("💡 All ledger data is public and auditable in git history")
|
||||||
|
|
|
@ -1,54 +1,221 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Comprehensive System Check - Working Version
|
Comprehensive Smartup Zero System Health Check
|
||||||
|
Validates complete currency ledger and task management system
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import csv
|
import csv
|
||||||
import yaml
|
import yaml
|
||||||
from datetime import datetime
|
from pathlib import Path
|
||||||
|
|
||||||
def check_file_structure():
|
class SystemChecker:
|
||||||
"""Check all required files exist"""
|
def __init__(self):
|
||||||
print("📁 CHECKING FILE STRUCTURE")
|
self.base_path = Path(__file__).parent.parent
|
||||||
print("=" * 30)
|
self.errors = []
|
||||||
|
self.warnings = []
|
||||||
|
|
||||||
|
def check_file_structure(self):
|
||||||
|
"""Validate complete file structure exists"""
|
||||||
|
print("📁 CHECKING FILE STRUCTURE")
|
||||||
|
print("=" * 30)
|
||||||
|
|
||||||
|
required_files = [
|
||||||
|
"ledger/smartup-credits/transactions.csv",
|
||||||
|
"ledger/social-karma/transactions.csv",
|
||||||
|
"ledger/pending-sc/transactions.csv",
|
||||||
|
"ledger/treasury/balance.csv",
|
||||||
|
"ledger/task-management/task-budgets.csv",
|
||||||
|
"ledger/task-management/session-logs.csv",
|
||||||
|
"ownership/book-of-owners.csv",
|
||||||
|
"policies/credit-rates.yml",
|
||||||
|
"policies/validation-rules.yml",
|
||||||
|
"policies/task-management/effort-assessment-template.yml",
|
||||||
|
"policies/task-management/mission-leader-rules.yml"
|
||||||
|
]
|
||||||
|
|
||||||
|
for file_path in required_files:
|
||||||
|
full_path = self.base_path / file_path
|
||||||
|
if full_path.exists():
|
||||||
|
print(f"✅ {file_path}")
|
||||||
|
else:
|
||||||
|
print(f"❌ {file_path}")
|
||||||
|
self.errors.append(f"Missing required file: {file_path}")
|
||||||
|
|
||||||
base_path = os.path.join(os.path.dirname(__file__), '..')
|
def validate_csv_integrity(self):
|
||||||
required_files = [
|
"""Check CSV files can be parsed and have proper headers"""
|
||||||
'ledger/smartup-credits/transactions.csv',
|
print(f"\n📊 VALIDATING CSV INTEGRITY")
|
||||||
'ledger/social-karma/transactions.csv',
|
print("=" * 30)
|
||||||
'ledger/treasury/balance.csv',
|
|
||||||
'ownership/book-of-owners.csv',
|
csv_files = {
|
||||||
'policies/credit-rates.yml',
|
"ledger/smartup-credits/transactions.csv": ["timestamp", "type", "amount", "from", "to", "reference"],
|
||||||
'scripts/manage-organization.py'
|
"ledger/treasury/balance.csv": ["timestamp", "event_type", "total_eur_balance", "sc_outstanding"],
|
||||||
]
|
"ledger/task-management/task-budgets.csv": ["task_id", "total_sc_budget", "attacker_alias", "defender_alias"],
|
||||||
|
"ownership/book-of-owners.csv": ["owner_id", "display_name", "license_type"]
|
||||||
|
}
|
||||||
|
|
||||||
|
for file_path, required_headers in csv_files.items():
|
||||||
|
full_path = self.base_path / file_path
|
||||||
|
if full_path.exists():
|
||||||
|
try:
|
||||||
|
with open(full_path, 'r') as f:
|
||||||
|
reader = csv.DictReader(f)
|
||||||
|
headers = reader.fieldnames
|
||||||
|
|
||||||
|
missing_headers = [h for h in required_headers if h not in headers]
|
||||||
|
if missing_headers:
|
||||||
|
print(f"⚠️ {file_path} - Missing headers: {missing_headers}")
|
||||||
|
self.warnings.append(f"{file_path} missing headers: {missing_headers}")
|
||||||
|
else:
|
||||||
|
print(f"✅ {file_path}")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"❌ {file_path} - Parse error: {e}")
|
||||||
|
self.errors.append(f"CSV parse error in {file_path}: {e}")
|
||||||
|
|
||||||
all_exist = True
|
def validate_treasury_balance(self):
|
||||||
for file_path in required_files:
|
"""Check 3x rule compliance and balance integrity"""
|
||||||
full_path = os.path.join(base_path, file_path)
|
print(f"\n💰 VALIDATING TREASURY BALANCE")
|
||||||
if os.path.exists(full_path):
|
print("=" * 30)
|
||||||
print(f"✅ {file_path}")
|
|
||||||
|
try:
|
||||||
|
# Get latest treasury state
|
||||||
|
treasury_file = self.base_path / "ledger/treasury/balance.csv"
|
||||||
|
latest_balance = {"sc_outstanding": 0, "total_eur_balance": 0}
|
||||||
|
|
||||||
|
with open(treasury_file, 'r') as f:
|
||||||
|
reader = csv.DictReader(f)
|
||||||
|
for row in reader:
|
||||||
|
if not row['timestamp'].startswith('#') and row['timestamp']:
|
||||||
|
latest_balance = {
|
||||||
|
"sc_outstanding": int(row['sc_outstanding']),
|
||||||
|
"total_eur_balance": float(row['total_eur_balance'])
|
||||||
|
}
|
||||||
|
|
||||||
|
# Calculate SC outstanding from transactions
|
||||||
|
sc_file = self.base_path / "ledger/smartup-credits/transactions.csv"
|
||||||
|
calculated_outstanding = 0
|
||||||
|
|
||||||
|
with open(sc_file, 'r') as f:
|
||||||
|
reader = csv.DictReader(f)
|
||||||
|
for row in reader:
|
||||||
|
if not row['timestamp'].startswith('#') and row['timestamp']:
|
||||||
|
if row['type'] == 'SC':
|
||||||
|
calculated_outstanding += int(row['amount'])
|
||||||
|
elif row['type'] in ['REDEEM', 'DESTROY']:
|
||||||
|
calculated_outstanding -= int(row['amount'])
|
||||||
|
|
||||||
|
print(f"Treasury SC Outstanding: {latest_balance['sc_outstanding']}")
|
||||||
|
print(f"Calculated SC Outstanding: {calculated_outstanding}")
|
||||||
|
print(f"EUR Treasury Balance: €{latest_balance['total_eur_balance']}")
|
||||||
|
|
||||||
|
if latest_balance['sc_outstanding'] != calculated_outstanding:
|
||||||
|
self.errors.append(f"Treasury/SC mismatch: {latest_balance['sc_outstanding']} vs {calculated_outstanding}")
|
||||||
|
print(f"❌ Treasury balance mismatch!")
|
||||||
|
else:
|
||||||
|
print(f"✅ Treasury balance consistent")
|
||||||
|
|
||||||
|
# Check 3x rule
|
||||||
|
if latest_balance['total_eur_balance'] > 0:
|
||||||
|
ratio = latest_balance['sc_outstanding'] / (latest_balance['total_eur_balance'] * 3)
|
||||||
|
if ratio <= 1:
|
||||||
|
print(f"✅ 3x Rule compliant ({ratio:.1%})")
|
||||||
|
else:
|
||||||
|
print(f"❌ 3x Rule violation ({ratio:.1%})")
|
||||||
|
self.errors.append(f"3x rule violation: {ratio:.1%}")
|
||||||
|
else:
|
||||||
|
if latest_balance['sc_outstanding'] > 0:
|
||||||
|
print(f"⚠️ 3x Rule: SC outstanding but no treasury funding")
|
||||||
|
self.warnings.append("SC outstanding without treasury funding")
|
||||||
|
else:
|
||||||
|
print(f"✅ 3x Rule: No SC outstanding, no treasury needed")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"❌ Treasury validation failed: {e}")
|
||||||
|
self.errors.append(f"Treasury validation error: {e}")
|
||||||
|
|
||||||
|
def validate_task_system(self):
|
||||||
|
"""Check task-management system integrity"""
|
||||||
|
print(f"\n🎯 VALIDATING TASK SYSTEM")
|
||||||
|
print("=" * 30)
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Check if task budgets match session logs
|
||||||
|
budget_file = self.base_path / "ledger/task-management/task-budgets.csv"
|
||||||
|
session_file = self.base_path / "ledger/task-management/session-logs.csv"
|
||||||
|
|
||||||
|
task_budgets = {}
|
||||||
|
if budget_file.exists():
|
||||||
|
with open(budget_file, 'r') as f:
|
||||||
|
reader = csv.DictReader(f)
|
||||||
|
for row in reader:
|
||||||
|
task_budgets[row['task_id']] = row
|
||||||
|
|
||||||
|
print(f"✅ {len(task_budgets)} tasks in budget system")
|
||||||
|
|
||||||
|
session_logs = {}
|
||||||
|
if session_file.exists():
|
||||||
|
with open(session_file, 'r') as f:
|
||||||
|
reader = csv.DictReader(f)
|
||||||
|
for row in reader:
|
||||||
|
session_logs[row['task_id']] = row
|
||||||
|
|
||||||
|
print(f"✅ {len(session_logs)} completed sessions logged")
|
||||||
|
|
||||||
|
# Verify ADM split calculations
|
||||||
|
for task_id, budget in task_budgets.items():
|
||||||
|
total_budget = int(budget['total_sc_budget'])
|
||||||
|
attacker_sc = int(budget['attacker_sc'])
|
||||||
|
defender_sc = int(budget['defender_sc'])
|
||||||
|
|
||||||
|
expected_attacker = int(total_budget * 0.9)
|
||||||
|
expected_defender = int(total_budget * 0.1)
|
||||||
|
|
||||||
|
if attacker_sc != expected_attacker or defender_sc != expected_defender:
|
||||||
|
print(f"⚠️ {task_id}: ADM split incorrect")
|
||||||
|
self.warnings.append(f"{task_id} has incorrect ADM split")
|
||||||
|
else:
|
||||||
|
print(f"✅ {task_id}: ADM split correct")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"❌ Task system validation failed: {e}")
|
||||||
|
self.errors.append(f"Task system validation error: {e}")
|
||||||
|
|
||||||
|
def run_complete_check(self):
|
||||||
|
"""Run all system checks"""
|
||||||
|
print("🚀 SMARTUP ZERO COMPREHENSIVE SYSTEM CHECK")
|
||||||
|
print("=" * 50)
|
||||||
|
|
||||||
|
self.check_file_structure()
|
||||||
|
self.validate_csv_integrity()
|
||||||
|
self.validate_treasury_balance()
|
||||||
|
self.validate_task_system()
|
||||||
|
|
||||||
|
print(f"\n📊 SYSTEM CHECK RESULTS")
|
||||||
|
print("=" * 30)
|
||||||
|
|
||||||
|
if self.errors:
|
||||||
|
print(f"❌ {len(self.errors)} ERRORS FOUND:")
|
||||||
|
for error in self.errors:
|
||||||
|
print(f" • {error}")
|
||||||
|
|
||||||
|
if self.warnings:
|
||||||
|
print(f"⚠️ {len(self.warnings)} WARNINGS:")
|
||||||
|
for warning in self.warnings:
|
||||||
|
print(f" • {warning}")
|
||||||
|
|
||||||
|
if not self.errors and not self.warnings:
|
||||||
|
print("🎉 SYSTEM CHECK PASSED!")
|
||||||
|
print("✅ All components operational")
|
||||||
|
print("✅ Data integrity verified")
|
||||||
|
print("✅ Ready for production use")
|
||||||
|
elif not self.errors:
|
||||||
|
print("✅ SYSTEM OPERATIONAL (with warnings)")
|
||||||
|
print("💡 Address warnings for optimal performance")
|
||||||
else:
|
else:
|
||||||
print(f"❌ {file_path} - MISSING")
|
print("❌ SYSTEM CHECK FAILED")
|
||||||
all_exist = False
|
print("🔧 Fix errors before production deployment")
|
||||||
|
|
||||||
return all_exist
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Run system check"""
|
|
||||||
print("🚀 SMARTUP ZERO SYSTEM CHECK")
|
|
||||||
print("=" * 50)
|
|
||||||
|
|
||||||
files_ok = check_file_structure()
|
|
||||||
|
|
||||||
print("\n" + "=" * 50)
|
|
||||||
if files_ok:
|
|
||||||
print("🎉 SYSTEM CHECK PASSED!")
|
|
||||||
print("✅ All individual script tests working")
|
|
||||||
print("✅ Book of Owners shows robbert_founder properly configured")
|
|
||||||
print("✅ Ready for founding work audit!")
|
|
||||||
else:
|
|
||||||
print("🚨 System check failed")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
checker = SystemChecker()
|
||||||
|
checker.run_complete_check()
|
||||||
|
|
Loading…
Reference in New Issue