Update modules/database/discourse_mongo_db.py
Browse files
modules/database/discourse_mongo_db.py
CHANGED
@@ -1,7 +1,12 @@
|
|
1 |
# modules/database/discourse_mongo_db.py
|
2 |
-
|
3 |
import io
|
4 |
import base64
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
from .mongo_db import (
|
7 |
get_collection,
|
@@ -11,14 +16,11 @@ from .mongo_db import (
|
|
11 |
delete_document
|
12 |
)
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
import logging
|
17 |
-
|
18 |
logger = logging.getLogger(__name__)
|
19 |
-
|
20 |
COLLECTION_NAME = 'student_discourse_analysis'
|
21 |
|
|
|
22 |
def store_student_discourse_result(username, text1, text2, analysis_result):
|
23 |
"""
|
24 |
Guarda el resultado del análisis de discurso comparativo en MongoDB.
|
@@ -120,10 +122,6 @@ def get_student_discourse_analysis(username, limit=10):
|
|
120 |
logger.error(f"Error recuperando análisis del discurso: {str(e)}")
|
121 |
return []
|
122 |
#####################################################################################
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
|
128 |
def get_student_discourse_data(username):
|
129 |
"""
|
@@ -149,6 +147,7 @@ def get_student_discourse_data(username):
|
|
149 |
logger.error(f"Error al obtener datos del discurso: {str(e)}")
|
150 |
return {'entries': []}
|
151 |
|
|
|
152 |
def update_student_discourse_analysis(analysis_id, update_data):
|
153 |
"""
|
154 |
Actualiza un análisis del discurso existente.
|
@@ -161,6 +160,7 @@ def update_student_discourse_analysis(analysis_id, update_data):
|
|
161 |
logger.error(f"Error al actualizar análisis del discurso: {str(e)}")
|
162 |
return False
|
163 |
|
|
|
164 |
def delete_student_discourse_analysis(analysis_id):
|
165 |
"""
|
166 |
Elimina un análisis del discurso.
|
|
|
1 |
# modules/database/discourse_mongo_db.py
|
2 |
+
# Importaciones estándar
|
3 |
import io
|
4 |
import base64
|
5 |
+
from datetime import datetime, timezone
|
6 |
+
import logging
|
7 |
+
|
8 |
+
# Importaciones de terceros
|
9 |
+
import matplotlib.pyplot as plt
|
10 |
|
11 |
from .mongo_db import (
|
12 |
get_collection,
|
|
|
16 |
delete_document
|
17 |
)
|
18 |
|
19 |
+
# Configuración del logger
|
|
|
|
|
|
|
20 |
logger = logging.getLogger(__name__)
|
|
|
21 |
COLLECTION_NAME = 'student_discourse_analysis'
|
22 |
|
23 |
+
########################################################################
|
24 |
def store_student_discourse_result(username, text1, text2, analysis_result):
|
25 |
"""
|
26 |
Guarda el resultado del análisis de discurso comparativo en MongoDB.
|
|
|
122 |
logger.error(f"Error recuperando análisis del discurso: {str(e)}")
|
123 |
return []
|
124 |
#####################################################################################
|
|
|
|
|
|
|
|
|
125 |
|
126 |
def get_student_discourse_data(username):
|
127 |
"""
|
|
|
147 |
logger.error(f"Error al obtener datos del discurso: {str(e)}")
|
148 |
return {'entries': []}
|
149 |
|
150 |
+
###########################################################################
|
151 |
def update_student_discourse_analysis(analysis_id, update_data):
|
152 |
"""
|
153 |
Actualiza un análisis del discurso existente.
|
|
|
160 |
logger.error(f"Error al actualizar análisis del discurso: {str(e)}")
|
161 |
return False
|
162 |
|
163 |
+
###########################################################################
|
164 |
def delete_student_discourse_analysis(analysis_id):
|
165 |
"""
|
166 |
Elimina un análisis del discurso.
|