Skip to content

Commit 3a62b48

Browse files
authored
Add files via upload
Updated files
1 parent 2dab329 commit 3a62b48

File tree

3 files changed

+1168
-1114
lines changed

3 files changed

+1168
-1114
lines changed

clear_db.py

Lines changed: 64 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,64 @@
1-
import sqlite3
2-
3-
def clear_db():
4-
conn = sqlite3.connect('assessment_results.db')
5-
c = conn.cursor()
6-
7-
# Drop the feedback table if it exists
8-
c.execute('DROP TABLE IF EXISTS feedback')
9-
10-
# Recreate the feedback table with the correct schema
11-
c.execute('''
12-
CREATE TABLE feedback (
13-
id INTEGER PRIMARY KEY AUTOINCREMENT,
14-
user_id TEXT,
15-
familiarity TEXT,
16-
role TEXT,
17-
experience TEXT,
18-
use_frequently TEXT,
19-
complexity TEXT,
20-
ease_of_use TEXT,
21-
need_support TEXT,
22-
integration TEXT,
23-
inconsistency TEXT,
24-
learn_quickly TEXT,
25-
cumbersome TEXT,
26-
confidence TEXT,
27-
learning_curve TEXT,
28-
navigation TEXT,
29-
relevance TEXT,
30-
comprehensive TEXT,
31-
useful_recommendations TEXT,
32-
overall_satisfaction TEXT,
33-
recommend TEXT,
34-
best_feature TEXT,
35-
biggest_difficulty TEXT,
36-
missing_feature TEXT,
37-
additional_comments TEXT,
38-
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
39-
)
40-
''')
41-
42-
# Drop the results table if it exists
43-
c.execute('DROP TABLE IF EXISTS results')
44-
45-
# Recreate the results table with the correct schema
46-
c.execute('''
47-
CREATE TABLE results (
48-
id INTEGER PRIMARY KEY AUTOINCREMENT,
49-
user_id TEXT,
50-
total_score INTEGER,
51-
compliance_percentage REAL,
52-
details TEXT,
53-
consent TEXT,
54-
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
55-
)
56-
''')
57-
58-
conn.commit()
59-
conn.close()
60-
print("Database cleared and tables recreated.")
61-
62-
if __name__ == '__main__':
63-
clear_db()
1+
import sqlite3
2+
3+
def clear_db():
4+
conn = sqlite3.connect('assessment_results.db')
5+
c = conn.cursor()
6+
7+
# Drop the feedback table if it exists
8+
c.execute('DROP TABLE IF EXISTS feedback')
9+
10+
# Recreate the feedback table with the correct schema
11+
c.execute('''
12+
CREATE TABLE IF NOT EXISTS feedback (
13+
id INTEGER PRIMARY KEY AUTOINCREMENT,
14+
user_id TEXT,
15+
familiarity TEXT,
16+
role TEXT,
17+
experience TEXT,
18+
location TEXT,
19+
use_frequently TEXT,
20+
complexity TEXT,
21+
ease_of_use TEXT,
22+
need_support TEXT,
23+
integration TEXT,
24+
inconsistency TEXT,
25+
learn_quickly TEXT,
26+
cumbersome TEXT,
27+
confidence TEXT,
28+
learning_curve TEXT,
29+
navigation TEXT,
30+
relevance TEXT,
31+
comprehensive TEXT,
32+
useful_recommendations TEXT,
33+
overall_satisfaction TEXT,
34+
recommend TEXT,
35+
best_feature TEXT,
36+
biggest_difficulty TEXT,
37+
missing_feature TEXT,
38+
additional_comments TEXT,
39+
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
40+
)
41+
''')
42+
43+
# Drop the results table if it exists
44+
c.execute('DROP TABLE IF EXISTS results')
45+
46+
# Recreate the results table with the correct schema
47+
c.execute('''
48+
CREATE TABLE results (
49+
id INTEGER PRIMARY KEY AUTOINCREMENT,
50+
user_id TEXT,
51+
total_score INTEGER,
52+
compliance_percentage REAL,
53+
details TEXT,
54+
consent TEXT,
55+
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
56+
)
57+
''')
58+
59+
conn.commit()
60+
conn.close()
61+
print("Database cleared and tables recreated.")
62+
63+
if __name__ == '__main__':
64+
clear_db()

init_db.py

Lines changed: 64 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,64 @@
1-
import sqlite3
2-
import os
3-
4-
def delete_db():
5-
if os.path.exists('assessment_results.db'):
6-
os.remove('assessment_results.db')
7-
print("Database file deleted.")
8-
else:
9-
print("Database file does not exist.")
10-
11-
12-
# Initialise the Database and table to store the users inputs.
13-
def init_db():
14-
print(sqlite3.version)
15-
conn = sqlite3.connect('assessment_results.db') # This will create the database file
16-
c = conn.cursor()
17-
c.execute('''
18-
CREATE TABLE IF NOT EXISTS results (
19-
id INTEGER PRIMARY KEY AUTOINCREMENT,
20-
user_id TEXT UNIQUE,
21-
total_score INTEGER,
22-
compliance_percentage REAL,
23-
details TEXT,
24-
consent TEXT,
25-
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
26-
)
27-
''')
28-
c.execute('''
29-
CREATE TABLE IF NOT EXISTS feedback (
30-
id INTEGER PRIMARY KEY AUTOINCREMENT,
31-
user_id TEXT,
32-
familiarity TEXT,
33-
role TEXT,
34-
experience TEXT,
35-
use_frequently TEXT,
36-
complexity TEXT,
37-
ease_of_use TEXT,
38-
need_support TEXT,
39-
integration TEXT,
40-
inconsistency TEXT,
41-
learn_quickly TEXT,
42-
cumbersome TEXT,
43-
confidence TEXT,
44-
learning_curve TEXT,
45-
navigation TEXT,
46-
relevance TEXT,
47-
comprehensive TEXT,
48-
useful_recommendations TEXT,
49-
overall_satisfaction TEXT,
50-
recommend TEXT,
51-
best_feature TEXT,
52-
biggest_difficulty TEXT,
53-
missing_feature TEXT,
54-
additional_comments TEXT,
55-
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
56-
)
57-
''')
58-
conn.commit()
59-
conn.close()
60-
61-
if __name__ == '__main__':
62-
init_db()
63-
print("Database and table initialised.")
1+
import sqlite3
2+
import os
3+
4+
def delete_db():
5+
if os.path.exists('assessment_results.db'):
6+
os.remove('assessment_results.db')
7+
print("Database file deleted.")
8+
else:
9+
print("Database file does not exist.")
10+
11+
12+
# Initialise the Database and table to store the users inputs.
13+
def init_db():
14+
print(sqlite3.version)
15+
conn = sqlite3.connect('assessment_results.db') # This will create the database file
16+
c = conn.cursor()
17+
c.execute('''
18+
CREATE TABLE IF NOT EXISTS results (
19+
id INTEGER PRIMARY KEY AUTOINCREMENT,
20+
user_id TEXT UNIQUE,
21+
total_score INTEGER,
22+
compliance_percentage REAL,
23+
details TEXT,
24+
consent TEXT,
25+
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
26+
)
27+
''')
28+
c.execute('''
29+
CREATE TABLE IF NOT EXISTS feedback (
30+
id INTEGER PRIMARY KEY AUTOINCREMENT,
31+
user_id TEXT,
32+
familiarity TEXT,
33+
role TEXT,
34+
experience TEXT,
35+
location TEXT,
36+
use_frequently TEXT,
37+
complexity TEXT,
38+
ease_of_use TEXT,
39+
need_support TEXT,
40+
integration TEXT,
41+
inconsistency TEXT,
42+
learn_quickly TEXT,
43+
cumbersome TEXT,
44+
confidence TEXT,
45+
learning_curve TEXT,
46+
navigation TEXT,
47+
relevance TEXT,
48+
comprehensive TEXT,
49+
useful_recommendations TEXT,
50+
overall_satisfaction TEXT,
51+
recommend TEXT,
52+
best_feature TEXT,
53+
biggest_difficulty TEXT,
54+
missing_feature TEXT,
55+
additional_comments TEXT,
56+
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
57+
)
58+
''')
59+
conn.commit()
60+
conn.close()
61+
62+
if __name__ == '__main__':
63+
init_db()
64+
print("Database and table initialised.")

0 commit comments

Comments
 (0)