import json, sqlite3, os MASTER_V2_PATH = '/workspace/ecommerce_research_sources/benchmark_master_v2.json' TIMELINE_DATA_PATH = '/workspace/ecommerce_research_sources/timeline_deep_dataset.json' DB_PATH = '/workspace/ecommerce_research_sources/ecommerce_brands_research.db' OUTPUT_INDEX = '/workspace/ecommerce_research_sources/index.html' with open(MASTER_V2_PATH, 'r', encoding='utf-8') as f: master = json.load(f) with open(TIMELINE_DATA_PATH, 'r', encoding='utf-8') as f: timeline = json.load(f) conn = sqlite3.connect(DB_PATH) c = conn.cursor() c.execute(''' SELECT id, title, url, source_type, platform, publication_year, category, summary, entities_mentioned, http_status FROM sources ORDER BY id ASC ''') sources_rows = c.fetchall() sources_cols = [desc[0] for desc in c.description] sources_list = [dict(zip(sources_cols, r)) for r in sources_rows] conn.close() # Prepare datasets commissions = master.get('commissions_data', []) growth_levers = master.get('growth_levers_data', []) revenue_models = master.get('revenue_models_data', []) ecosystem_pillars = master.get('brand_ecosystem_pillars', []) executives = master.get('executives_directory', []) war_report = master.get('war_report_1404', {}) seller_intel = master.get('seller_intelligence_mordad_1405', {}) consulting_fw = master.get('consulting_framework', {}) failures_pivots = master.get('failures_and_pivots_dossier', []) playbook = master.get('playbook_dossier', {}) category_matrix = master.get('category_brand_deep_matrix', []) market_channels = master.get('market_channel_breakdown', []) yearly_metrics = timeline.get('yearly_metrics', []) print(f"Loaded: {len(commissions)} commissions, {len(growth_levers)} levers, {len(revenue_models)} revenue models, {len(executives)} executives, {len(failures_pivots)} failures, {len(category_matrix)} categories, {len(market_channels)} market rows, {len(yearly_metrics)} years, {len(sources_list)} sources.")