Spaces:
Sleeping
Sleeping
Update modules/database/morphosyntax_iterative_mongo_db.py
Browse files
modules/database/morphosyntax_iterative_mongo_db.py
CHANGED
|
@@ -7,8 +7,8 @@ from .mongo_db import get_collection, insert_document, find_documents, update_do
|
|
| 7 |
logger = logging.getLogger(__name__)
|
| 8 |
|
| 9 |
# Nombres de colecciones manteniendo coherencia
|
| 10 |
-
|
| 11 |
-
|
| 12 |
|
| 13 |
def store_student_morphosyntax_base(username, text, arc_diagrams):
|
| 14 |
"""Almacena el análisis morfosintáctico base"""
|
|
@@ -22,7 +22,7 @@ def store_student_morphosyntax_base(username, text, arc_diagrams):
|
|
| 22 |
'has_iterations': False
|
| 23 |
}
|
| 24 |
|
| 25 |
-
collection = get_collection(
|
| 26 |
result = collection.insert_one(base_document)
|
| 27 |
logger.info(f"Análisis base guardado para {username}")
|
| 28 |
return str(result.inserted_id)
|
|
@@ -44,11 +44,11 @@ def store_student_morphosyntax_iteration(username, base_id, original_text, itera
|
|
| 44 |
'analysis_type': 'morphosyntax_iteration'
|
| 45 |
}
|
| 46 |
|
| 47 |
-
collection = get_collection(
|
| 48 |
result = collection.insert_one(iteration_document)
|
| 49 |
|
| 50 |
# Actualizar documento base
|
| 51 |
-
base_collection = get_collection(
|
| 52 |
base_collection.update_one(
|
| 53 |
{'_id': base_id, 'username': username}, # incluir username en queries
|
| 54 |
{'$set': {'has_iterations': True}}
|
|
|
|
| 7 |
logger = logging.getLogger(__name__)
|
| 8 |
|
| 9 |
# Nombres de colecciones manteniendo coherencia
|
| 10 |
+
BASE_COLLECTION = 'student_morphosyntax_analysis'
|
| 11 |
+
ITERATION_COLLECTION = 'student_morphosyntax_iterations'
|
| 12 |
|
| 13 |
def store_student_morphosyntax_base(username, text, arc_diagrams):
|
| 14 |
"""Almacena el análisis morfosintáctico base"""
|
|
|
|
| 22 |
'has_iterations': False
|
| 23 |
}
|
| 24 |
|
| 25 |
+
collection = get_collection(BASE_COLLECTION)
|
| 26 |
result = collection.insert_one(base_document)
|
| 27 |
logger.info(f"Análisis base guardado para {username}")
|
| 28 |
return str(result.inserted_id)
|
|
|
|
| 44 |
'analysis_type': 'morphosyntax_iteration'
|
| 45 |
}
|
| 46 |
|
| 47 |
+
collection = get_collection(ITERATION_COLLECTION)
|
| 48 |
result = collection.insert_one(iteration_document)
|
| 49 |
|
| 50 |
# Actualizar documento base
|
| 51 |
+
base_collection = get_collection(BASE_COLLECTION)
|
| 52 |
base_collection.update_one(
|
| 53 |
{'_id': base_id, 'username': username}, # incluir username en queries
|
| 54 |
{'$set': {'has_iterations': True}}
|