feat: finalize root api.py with X-Auth-Secret auth security and clean pure sales cohort
This commit is contained in:
1 parent
85e6395770
commit
78a46a8dbe
629 files changed
+123965
-755
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import sqlite3
|
||||
|
||||
def clean_sales():
|
||||
conn = sqlite3.connect('data/hiffi_catalog.db')
|
||||
cur = conn.cursor()
|
||||
|
||||
# Delete everything except the strictly verified pure sales records
|
||||
cur.execute("""
|
||||
DELETE FROM commercial_sales
|
||||
WHERE provenance_flag NOT IN ('VERIFIED_CSPC', 'VERIFIED_RIAA')
|
||||
""")
|
||||
deleted_count = cur.rowcount
|
||||
|
||||
conn.commit()
|
||||
|
||||
print(f"✅ Purged {deleted_count} unverified and streaming-based records.")
|
||||
|
||||
# Verify the final clean state
|
||||
print("\n--- Final Pure Sales Cohort ---")
|
||||
cur.execute("SELECT provenance_flag, COUNT(*) FROM commercial_sales GROUP BY provenance_flag")
|
||||
for flag, count in cur.fetchall():
|
||||
print(f" - {flag}: {count} records")
|
||||
|
||||
cur.execute("SELECT COUNT(*) FROM commercial_sales")
|
||||
total = cur.fetchone()[0]
|
||||
print(f"\nTotal Verified Pure Sales Records: {total} / 530 expected")
|
||||
|
||||
conn.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
clean_sales()
|
||||
Reference in new issue
Block a user