Update modules/database/discourse_mongo_db.py
Browse files
modules/database/discourse_mongo_db.py
CHANGED
@@ -8,7 +8,7 @@ import logging
|
|
8 |
logger = logging.getLogger(__name__)
|
9 |
COLLECTION_NAME = 'student_discourse_analysis'
|
10 |
|
11 |
-
def
|
12 |
"""
|
13 |
Guarda el resultado del análisis de discurso en MongoDB.
|
14 |
Args:
|
@@ -43,7 +43,7 @@ def store_student_semantic_result(username, text, analysis_result):
|
|
43 |
logger.error(f"Error al guardar el análisis semántico: {str(e)}")
|
44 |
return False
|
45 |
|
46 |
-
def
|
47 |
"""
|
48 |
Recupera los análisis semánticos de un estudiante.
|
49 |
Args:
|
@@ -55,7 +55,7 @@ def get_student_semantic_analysis(username, limit=10):
|
|
55 |
query = {"username": username, "analysis_type": "semantic"}
|
56 |
return find_documents(COLLECTION_NAME, query, sort=[("timestamp", -1)], limit=limit)
|
57 |
|
58 |
-
def
|
59 |
"""
|
60 |
Actualiza un análisis semántico existente.
|
61 |
Args:
|
@@ -66,7 +66,7 @@ def update_student_semantic_analysis(analysis_id, update_data):
|
|
66 |
update = {"$set": update_data}
|
67 |
return update_document(COLLECTION_NAME, query, update)
|
68 |
|
69 |
-
def
|
70 |
"""
|
71 |
Elimina un análisis semántico.
|
72 |
Args:
|
@@ -75,7 +75,7 @@ def delete_student_semantic_analysis(analysis_id):
|
|
75 |
query = {"_id": analysis_id}
|
76 |
return delete_document(COLLECTION_NAME, query)
|
77 |
|
78 |
-
def
|
79 |
"""
|
80 |
Obtiene todos los análisis semánticos de un estudiante.
|
81 |
Args:
|
@@ -102,9 +102,9 @@ def get_student_semantic_data(username):
|
|
102 |
|
103 |
# Exportar las funciones necesarias
|
104 |
__all__ = [
|
105 |
-
'
|
106 |
-
'
|
107 |
-
'
|
108 |
-
'
|
109 |
-
'
|
110 |
]
|
|
|
8 |
logger = logging.getLogger(__name__)
|
9 |
COLLECTION_NAME = 'student_discourse_analysis'
|
10 |
|
11 |
+
def store_student_discourse_result(username, text, analysis_result):
|
12 |
"""
|
13 |
Guarda el resultado del análisis de discurso en MongoDB.
|
14 |
Args:
|
|
|
43 |
logger.error(f"Error al guardar el análisis semántico: {str(e)}")
|
44 |
return False
|
45 |
|
46 |
+
def get_student_discourse_analysis(username, limit=10):
|
47 |
"""
|
48 |
Recupera los análisis semánticos de un estudiante.
|
49 |
Args:
|
|
|
55 |
query = {"username": username, "analysis_type": "semantic"}
|
56 |
return find_documents(COLLECTION_NAME, query, sort=[("timestamp", -1)], limit=limit)
|
57 |
|
58 |
+
def update_student_discourse_analysis(analysis_id, update_data):
|
59 |
"""
|
60 |
Actualiza un análisis semántico existente.
|
61 |
Args:
|
|
|
66 |
update = {"$set": update_data}
|
67 |
return update_document(COLLECTION_NAME, query, update)
|
68 |
|
69 |
+
def delete_student_discourse_analysis(analysis_id):
|
70 |
"""
|
71 |
Elimina un análisis semántico.
|
72 |
Args:
|
|
|
75 |
query = {"_id": analysis_id}
|
76 |
return delete_document(COLLECTION_NAME, query)
|
77 |
|
78 |
+
def get_student_discourse_data(username):
|
79 |
"""
|
80 |
Obtiene todos los análisis semánticos de un estudiante.
|
81 |
Args:
|
|
|
102 |
|
103 |
# Exportar las funciones necesarias
|
104 |
__all__ = [
|
105 |
+
'store_student_discourse_result',
|
106 |
+
'get_student_discourse_analysis',
|
107 |
+
'update_student_discourse_analysis',
|
108 |
+
'delete_student_discourse_analysis',
|
109 |
+
'get_student_discourse_data'
|
110 |
]
|