Files
scaev/check_viewing_data.py
2025-12-07 00:36:57 +01:00

37 lines
1011 B
Python

#!/usr/bin/env python3
"""Check viewing time data"""
import sqlite3
conn = sqlite3.connect('/mnt/okcomputer/output/cache.db')
# Check if viewing_time has data
cursor = conn.execute("""
SELECT viewing_time, pickup_date
FROM lots
WHERE viewing_time IS NOT NULL AND viewing_time != ''
LIMIT 5
""")
rows = cursor.fetchall()
print("Existing viewing_time data:")
for r in rows:
print(f" Viewing: {r[0]}")
print(f" Pickup: {r[1]}")
print()
# Check overall completeness
cursor = conn.execute("""
SELECT
COUNT(*) as total,
SUM(CASE WHEN viewing_time IS NOT NULL AND viewing_time != '' THEN 1 ELSE 0 END) as has_viewing,
SUM(CASE WHEN pickup_date IS NOT NULL AND pickup_date != '' THEN 1 ELSE 0 END) as has_pickup
FROM lots
""")
row = cursor.fetchone()
print(f"Completeness:")
print(f" Total lots: {row[0]}")
print(f" Has viewing_time: {row[1]} ({100*row[1]/row[0]:.1f}%)")
print(f" Has pickup_date: {row[2]} ({100*row[2]/row[0]:.1f}%)")
conn.close()