GraphQL integrate, data correctness

This commit is contained in:
Tour
2025-12-07 00:25:25 +01:00
parent 8c5f6016ec
commit 71567fd965
17 changed files with 1037 additions and 13 deletions

54
check_data.py Normal file
View File

@@ -0,0 +1,54 @@
#!/usr/bin/env python3
"""Check current data quality in cache.db"""
import sqlite3
conn = sqlite3.connect('/mnt/okcomputer/output/cache.db')
print("=" * 60)
print("CURRENT DATA QUALITY CHECK")
print("=" * 60)
# Check lots table
print("\n[*] Sample Lot Data:")
cursor = conn.execute("""
SELECT lot_id, current_bid, bid_count, closing_time
FROM lots
LIMIT 10
""")
for row in cursor:
print(f" Lot: {row[0]}")
print(f" Current Bid: {row[1]}")
print(f" Bid Count: {row[2]}")
print(f" Closing Time: {row[3]}")
# Check auctions table
print("\n[*] Sample Auction Data:")
cursor = conn.execute("""
SELECT auction_id, title, closing_time, first_lot_closing_time
FROM auctions
LIMIT 5
""")
for row in cursor:
print(f" Auction: {row[0]}")
print(f" Title: {row[1][:50]}...")
print(f" Closing Time: {row[2] if len(row) > 2 else 'N/A'}")
print(f" First Lot Closing: {row[3]}")
# Data completeness stats
print("\n[*] Data Completeness:")
cursor = conn.execute("""
SELECT
COUNT(*) as total,
SUM(CASE WHEN current_bid IS NULL OR current_bid = '' THEN 1 ELSE 0 END) as missing_current_bid,
SUM(CASE WHEN closing_time IS NULL OR closing_time = '' THEN 1 ELSE 0 END) as missing_closing_time,
SUM(CASE WHEN bid_count IS NULL OR bid_count = 0 THEN 1 ELSE 0 END) as zero_bid_count
FROM lots
""")
row = cursor.fetchone()
print(f" Total lots: {row[0]:,}")
print(f" Missing current_bid: {row[1]:,} ({100*row[1]/row[0]:.1f}%)")
print(f" Missing closing_time: {row[2]:,} ({100*row[2]/row[0]:.1f}%)")
print(f" Zero bid_count: {row[3]:,} ({100*row[3]/row[0]:.1f}%)")
conn.close()
print("\n" + "=" * 60)