GraphQL integrate, data correctness
This commit is contained in:
36
check_viewing_data.py
Normal file
36
check_viewing_data.py
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/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()
|
||||
Reference in New Issue
Block a user