updated to use new data classes and bugfixes
This commit is contained in:
+18
-13
@@ -13,15 +13,14 @@ from dash_auth import BasicAuth
|
||||
from pydantic import ValidationError
|
||||
|
||||
from .layout import app_layout
|
||||
from src.database import connect
|
||||
from src.database import get_visual_communication
|
||||
from src.database import ModelOutputs
|
||||
from src.database import NoDocumentFoundException
|
||||
from src.database import total_annotated
|
||||
from src.database import total_documents
|
||||
from src.database import upsert_annotations
|
||||
from src.database import upsert_visual_communication
|
||||
from src.database import VisualCommunication
|
||||
from core.database import connect
|
||||
from core.database import count_documents
|
||||
from core.database import get_visual_communication
|
||||
from core.database import NoDocumentFoundException
|
||||
from core.database import upsert_annotation
|
||||
from core.database import upsert_visual_communication
|
||||
from core.database import VisualCommunication
|
||||
from core.dto import ModelData
|
||||
|
||||
# setup app
|
||||
app = Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
|
||||
@@ -82,8 +81,14 @@ def update_progress_bar(
|
||||
logging.info('began updating progress bar')
|
||||
global collection
|
||||
# get values from database
|
||||
num_total = total_documents(collection=collection)
|
||||
num_handled = total_annotated(collection=collection)
|
||||
num_total = count_documents(
|
||||
collection=collection,
|
||||
only_with_annotation=False,
|
||||
)
|
||||
num_handled = count_documents(
|
||||
collection=collection,
|
||||
only_with_annotation=True,
|
||||
)
|
||||
limit = int(num_total/20)
|
||||
label_str = f"{num_handled}/{num_total}" if num_handled >= limit else ''
|
||||
return num_handled, num_total, label_str
|
||||
@@ -200,9 +205,9 @@ def cycle_visual_communication_data(
|
||||
in zip(annotation_keys, annotation_values)
|
||||
}
|
||||
# instantiate ModelOutputs object
|
||||
annotations = ModelOutputs.from_annotations(**annotation_map)
|
||||
annotations = ModelData.from_annotations(**annotation_map)
|
||||
# save data to database
|
||||
upsert_annotations(
|
||||
upsert_annotation(
|
||||
collection=collection,
|
||||
vis_com_name=vis_com_name,
|
||||
annotations=annotations,
|
||||
|
||||
Reference in New Issue
Block a user