frabbani commited on
Commit
be0c273
·
1 Parent(s): 0331dac

Fix init_db_hybrid - use existing connection for BP count

Browse files
Files changed (1) hide show
  1. init_db_hybrid.py +2 -4
init_db_hybrid.py CHANGED
@@ -968,15 +968,13 @@ def main():
968
  cursor = conn.execute(f"SELECT COUNT(*) FROM {table} WHERE patient_id = ?", (patient_id,))
969
  counts[table] = cursor.fetchone()[0]
970
 
971
- # Count BP observations for verification
972
- conn_verify = sqlite3.connect("data/patient_data.db")
973
- cursor = conn_verify.execute("""
974
  SELECT code, COUNT(*) FROM observations
975
  WHERE code IN ('8480-6', '8462-4')
976
  GROUP BY code
977
  """)
978
  bp_counts = {row[0]: row[1] for row in cursor.fetchall()}
979
- conn_verify.close()
980
 
981
  conn.close()
982
 
 
968
  cursor = conn.execute(f"SELECT COUNT(*) FROM {table} WHERE patient_id = ?", (patient_id,))
969
  counts[table] = cursor.fetchone()[0]
970
 
971
+ # Count BP observations for verification (use existing connection)
972
+ cursor = conn.execute("""
 
973
  SELECT code, COUNT(*) FROM observations
974
  WHERE code IN ('8480-6', '8462-4')
975
  GROUP BY code
976
  """)
977
  bp_counts = {row[0]: row[1] for row in cursor.fetchall()}
 
978
 
979
  conn.close()
980