File size: 728 Bytes
931223d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

# Script to verify patients in DB

import sqlite3
import os

DB_NAME = "elephmind.db"
if os.path.exists('/data/elephmind.db'):
    DB_NAME = '/data/elephmind.db'

def list_patients():
    if not os.path.exists(DB_NAME):
        print(f"Database {DB_NAME} not found.")
        return

    conn = sqlite3.connect(DB_NAME)
    conn.row_factory = sqlite3.Row
    c = conn.cursor()
    try:
        c.execute("SELECT * FROM patients")
        rows = c.fetchall()
        print(f"Found {len(rows)} patients.")
        for row in rows:
            print(dict(row))
    except Exception as e:
        print(f"Error: {e}")
    finally:
        conn.close()

if __name__ == "__main__":
    list_patients()