auto-data-analyst / verify_pipeline.py
salihfurkaan's picture
demo files
bb9980b
import pandas as pd
import sys
import os
# Add the project root to sys.path
sys.path.append(os.getcwd())
from app import analyze_dataset, load_example
class MockFile:
def __init__(self, path):
self.name = path
print("Generating example dataset...")
example_path = load_example()
print(f"Example dataset created at: {example_path}")
print("Running pipeline...")
mock_file = MockFile(example_path)
try:
results = analyze_dataset(mock_file)
# Unpack results to verify types
overview_md, overview_df, insights, chart, anomalies_md, anomalies_df, questions = results
print("Pipeline finished successfully.")
print(f"Overview MD Length: {len(overview_md)}")
print(f"Overview DF Shape: {overview_df.shape if hasattr(overview_df, 'shape') else 'None'}")
print(f"Insights: {insights[:50]}...")
print(f"Chart Object: {type(chart)}")
print(f"Anomalies MD Length: {len(anomalies_md)}")
print(f"Anomalies DF Shape: {anomalies_df.shape if hasattr(anomalies_df, 'shape') else 'None'}")
print(f"Questions: {questions[:50]}...")
except Exception as e:
print(f"Pipeline Failed: {e}")
import traceback
traceback.print_exc()
# Cleanup
if os.path.exists(example_path):
os.remove(example_path)