-
Notifications
You must be signed in to change notification settings - Fork 1
/
init_db.py
64 lines (60 loc) · 1.91 KB
/
init_db.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import sqlite3
import os
def delete_db():
if os.path.exists('assessment_results.db'):
os.remove('assessment_results.db')
print("Database file deleted.")
else:
print("Database file does not exist.")
# Initialise the Database and table to store the users inputs.
def init_db():
print(sqlite3.version)
conn = sqlite3.connect('assessment_results.db') # This will create the database file
c = conn.cursor()
c.execute('''
CREATE TABLE IF NOT EXISTS results (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id TEXT UNIQUE,
total_score INTEGER,
compliance_percentage REAL,
details TEXT,
consent TEXT,
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
)
''')
c.execute('''
CREATE TABLE IF NOT EXISTS feedback (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id TEXT,
familiarity TEXT,
role TEXT,
experience TEXT,
location TEXT,
use_frequently TEXT,
complexity TEXT,
ease_of_use TEXT,
need_support TEXT,
integration TEXT,
inconsistency TEXT,
learn_quickly TEXT,
cumbersome TEXT,
confidence TEXT,
learning_curve TEXT,
navigation TEXT,
relevance TEXT,
comprehensive TEXT,
useful_recommendations TEXT,
overall_satisfaction TEXT,
recommend TEXT,
best_feature TEXT,
biggest_difficulty TEXT,
missing_feature TEXT,
additional_comments TEXT,
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
)
''')
conn.commit()
conn.close()
if __name__ == '__main__':
init_db()
print("Database and table initialised.")