""" pipeline/generate_report.py Generates executive audit summaries and identifies movers between the verified Production YouTube rank and the Experimental HIFFI-XP model. """ import sys from pathlib import Path PROJECT_ROOT = Path(__file__).resolve().parent.parent if str(PROJECT_ROOT) not in sys.path: sys.path.insert(0, str(PROJECT_ROOT)) import pandas as pd CSV_PATH = PROJECT_ROOT / "data" / "hiffi_multiplatform_500.csv" df = pd.read_csv(CSV_PATH) # Compute Rank Delta: Positive = climbed in XP rank; Negative = dropped df["rank_delta"] = df["production_hiffi_rank"] - df["hiffi_xp_rank"] print("=" * 90) print("SUPERLABS HIFFI: 500-ARTIST AUDITED MULTI-PLATFORM SUMMARY") print("=" * 90) print(f"Total Cohort Processed: {len(df)}") print(f"Resolved Spotify Candidate URIs: {(df['spotify_id'] != 'N/A').sum()} (100.0%)") print(f"Spotify Ingestion Telemetry: 0 / {len(df)} (BLOCKED_HTTP_403_PREMIUM_REQUIRED)") print(f"Instagram Live Follower Signals: {df['instagram_followers'].notna().sum()} ({(df['instagram_followers'].notna().mean()):.1%})") print(f"Complete Cross-Platform Signals: {df['has_complete_multiplatform_signals'].sum()} (Awaiting Spotify Credential)") print("-" * 90) print("\nTOP 10 GAINERS (Lifted by Validated Social Audience Footprint):") gainers = df[df["production_hiffi_rank"].notna()].sort_values("rank_delta", ascending=False).head(10) display_cols = ["name", "production_hiffi_rank", "hiffi_xp_rank", "rank_delta", "instagram_followers", "hiffi_xp_score"] print(gainers[display_cols].to_string(index=False)) print("\nTOP 10 FALLERS (Strong YouTube Velocity, but Awaiting/Lacking Social Reach):") fallers = df[df["production_hiffi_rank"].notna()].sort_values("rank_delta", ascending=True).head(10) print(fallers[display_cols].to_string(index=False)) print("=" * 90)