Files
2026-09-06 10:18:26 -07:00

24 lines
1.3 KiB
Python

import sqlite3, json, sys
db = "out/cli_direct.db"
conn = sqlite3.connect(db)
cur = conn.cursor()
cur.execute("SELECT count(*) FROM daily_file_records")
print("sqlite rows:", cur.fetchone()[0])
cur.execute("SELECT count(DISTINCT record_type), group_concat(record_type) FROM (SELECT DISTINCT record_type FROM daily_file_records)")
print("record types:", cur.fetchone())
cur.execute("SELECT count(*) FROM daily_file_records WHERE committee IS NOT NULL AND committee != ''")
print("with committee ref:", cur.fetchone()[0])
cur.execute("SELECT count(*) FROM daily_file_records WHERE record_type='hearing'")
print("hearings:", cur.fetchone()[0])
cur.execute("SELECT count(*) FROM daily_file_records WHERE description IS NOT NULL AND description != ''")
print("non-empty descriptions:", cur.fetchone()[0])
conn.close()
# Show one hearing record and one committee-bill from the jsonl
with open("out/cli_direct.jsonl") as fh:
hearing = next((json.loads(l) for l in fh if json.loads(l).get("record_type")=="hearing"), None)
with open("out/cli_direct.jsonl") as fh:
cbill = next((json.loads(l) for l in fh if json.loads(l).get("committee") and json.loads(l).get("record_type")=="bill"), None)
print("sample hearing record:", json.dumps(hearing, sort_keys=True) if hearing else "NONE")
print("sample committee bill record:", json.dumps(cbill, sort_keys=True) if cbill else "NONE")