import subprocess
import os

# Run the chart generator
print("Generating chart...")
result1 = subprocess.run(['python', 'artifacts/generate_chart.py'], capture_output=True, text=True, cwd='.')
print(result1.stdout)
if result1.stderr:
    print("Chart errors:", result1.stderr)

# Run the summary generator
print("\nGenerating summary PDF...")
result2 = subprocess.run(['python', 'artifacts/generate_summary.py'], capture_output=True, text=True, cwd='.')
print(result2.stdout)
if result2.stderr:
    print("Summary errors:", result2.stderr)

# Check files exist
for f in ['artifacts/spain_property_prices_chart.png', 'artifacts/spain_property_prices_chart.svg', 'artifacts/spain_property_prices_summary.pdf']:
    if os.path.exists(f):
        size = os.path.getsize(f)
        print(f"✓ {f} ({size:,} bytes)")
    else:
        print(f"✗ {f} NOT FOUND")
