Files
hiffi-artist-intelligence/main.py
T

96 lines
3.0 KiB
Python

"""
main.py
HIFFI Artist Intelligence Pipeline CLI Orchestrator.
Supports unified commands: run, audit, test, report, all.
"""
import argparse
import subprocess
import sys
from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parent
if str(PROJECT_ROOT) not in sys.path:
sys.path.insert(0, str(PROJECT_ROOT))
from core.health_detector import PipelineHealthDetector
from pipeline.batch_500_runner import main as run_batch_pipeline
def run_pipeline():
print("\n[HIFFI CLI] Executing Batch Multi-Platform Signal Ingestion & Scoring...")
run_batch_pipeline()
def run_audit():
print("\n[HIFFI CLI] Executing Automated Pipeline Health & Anomaly Detector...")
detector = PipelineHealthDetector()
anomalies_df, summary = detector.run_health_audit()
print("=" * 85)
print("HIFFI PIPELINE AUTOMATED HEALTH & ANOMALY DETECTOR")
print("=" * 85)
print(f"Total Cohort Rows Evaluated: {summary['total_rows']}")
print(f"Total Anomalies Flagged: {summary['total_anomalies']}")
print(f"Actionable Unresolved (P0/P1): {summary['actionable_p0_p1']}")
print(f"Data Governance Breaches: {summary['governance_breaches']}")
print("-" * 85)
if not anomalies_df.empty:
print(anomalies_df.to_string(index=False))
else:
print("No anomalous signals detected across active cohort.")
print("=" * 85)
def run_tests():
print("\n[HIFFI CLI] Running QA Governance Test Suite via Pytest...")
test_file = PROJECT_ROOT / "test_multiplatform_ranking.py"
cmd = [sys.executable, "-m", "pytest", str(test_file), "-v"]
result = subprocess.run(cmd)
if result.returncode != 0:
print("\n[HIFFI CLI] QA Governance Test Suite FAILED.")
sys.exit(result.returncode)
def run_report():
print("\n[HIFFI CLI] Generating Executive Provenance Report...")
report_script = PROJECT_ROOT / "pipeline" / "generate_report.py"
if report_script.exists():
subprocess.run([sys.executable, str(report_script)])
else:
print(f"[HIFFI CLI] Report script not found at {report_script}")
def run_all():
print("=" * 80)
print("HIFFI PIPELINE: EXECUTING FULL END-TO-END VALIDATION & REPORTING")
print("=" * 80)
run_audit()
run_tests()
run_report()
def main():
parser = argparse.ArgumentParser(description="HIFFI Artist Intelligence Multi-Platform Pipeline CLI")
parser.add_argument(
"action",
choices=["run", "audit", "test", "report", "all"],
help="Pipeline command to execute: 'run' (ingest & score), 'audit' (health checks), 'test' (pytest suite), 'report' (executive movers), or 'all' (audit + test + report)."
)
args = parser.parse_args()
if args.action == "run":
run_pipeline()
elif args.action == "audit":
run_audit()
elif args.action == "test":
run_tests()
elif args.action == "report":
run_report()
elif args.action == "all":
run_all()
if __name__ == "__main__":
main()