|
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