Spaces:
Build error
Build error
Update utils/database.py
Browse files- utils/database.py +22 -0
utils/database.py
CHANGED
|
@@ -12,6 +12,28 @@ if not hasattr(st.session_state, 'db'):
|
|
| 12 |
st.error("Database connection not established")
|
| 13 |
return
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
class DatabaseManager:
|
| 16 |
def __init__(self, db_path: str = 'digital_heir.db'):
|
| 17 |
self.db_path = db_path
|
|
|
|
| 12 |
st.error("Database connection not established")
|
| 13 |
return
|
| 14 |
|
| 15 |
+
# Initialize service
|
| 16 |
+
services = ServiceIntegration(st.session_state.db)
|
| 17 |
+
|
| 18 |
+
# For face verification
|
| 19 |
+
result = services.verify_face(image_path, stored_encoding)
|
| 20 |
+
|
| 21 |
+
# For activity monitoring
|
| 22 |
+
result = services.monitor_activity(activity_data)
|
| 23 |
+
|
| 24 |
+
# For document generation
|
| 25 |
+
result = services.generate_legal_document(user_data, assets, heirs)
|
| 26 |
+
|
| 27 |
+
cursor.execute("""
|
| 28 |
+
CREATE TABLE IF NOT EXISTS security_events (
|
| 29 |
+
id TEXT PRIMARY KEY,
|
| 30 |
+
event_type TEXT NOT NULL,
|
| 31 |
+
success BOOLEAN,
|
| 32 |
+
details TEXT,
|
| 33 |
+
timestamp TEXT NOT NULL
|
| 34 |
+
)
|
| 35 |
+
""")
|
| 36 |
+
|
| 37 |
class DatabaseManager:
|
| 38 |
def __init__(self, db_path: str = 'digital_heir.db'):
|
| 39 |
self.db_path = db_path
|