@konfuzio/document-validation-ui 0.1.5-styles-refactor → 0.1.6-multi-ann-set
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/app.css +1 -1
- package/dist/index.html +1 -1
- package/dist/js/app.js +1 -1
- package/dist/js/app.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/images/DraggableIcon.vue +14 -0
- package/src/assets/images/GridIcon.vue +16 -0
- package/src/assets/images/MagicWandIcon.vue +16 -0
- package/src/assets/images/NotFoundIcon.vue +16 -0
- package/src/assets/images/SettingsIcon.vue +14 -0
- package/src/assets/images/SplitZigZag.vue +47 -14
- package/src/assets/images/StarIcon.vue +16 -0
- package/src/assets/scss/ann_set_table_options.scss +26 -0
- package/src/assets/scss/annotation_details.scss +85 -73
- package/src/assets/scss/document_annotations.scss +54 -57
- package/src/assets/scss/document_category.scss +0 -1
- package/src/assets/scss/document_dashboard.scss +7 -2
- package/src/assets/scss/document_edit.scss +90 -46
- package/src/assets/scss/main.scss +108 -49
- package/src/assets/scss/multi_ann_table_overlay.scss +44 -0
- package/src/assets/scss/splitting_confirmation_modal.scss +41 -0
- package/src/assets/scss/variables.scss +2 -0
- package/src/components/DocumentAnnotations/AnnotationActionButtons.vue +153 -0
- package/src/components/DocumentAnnotations/AnnotationDetails.vue +28 -7
- package/src/components/DocumentAnnotations/AnnotationRow.vue +131 -40
- package/src/components/DocumentAnnotations/AnnotationSetActionButtons.vue +86 -0
- package/src/components/DocumentAnnotations/CategorizeModal.vue +24 -2
- package/src/components/DocumentAnnotations/DocumentAnnotations.vue +114 -82
- package/src/components/DocumentAnnotations/EmptyAnnotation.vue +16 -3
- package/src/components/DocumentAnnotations/ExtractingData.vue +3 -3
- package/src/components/DocumentAnnotations/index.js +0 -1
- package/src/components/DocumentCategory.vue +13 -5
- package/src/components/DocumentDashboard.vue +17 -6
- package/src/components/DocumentEdit/DocumentEdit.vue +208 -68
- package/src/components/DocumentEdit/EditConfirmationModal.vue +54 -0
- package/src/components/DocumentEdit/EditPages.vue +29 -18
- package/src/components/DocumentEdit/EditSidebar.vue +92 -45
- package/src/components/DocumentEdit/SidebarButtons.vue +53 -0
- package/src/components/DocumentEdit/SplitInfoBar.vue +19 -0
- package/src/components/DocumentEdit/SplitOverview.vue +4 -5
- package/src/components/{DocumentError.vue → DocumentModals/DocumentErrorModal.vue} +3 -4
- package/src/components/{NotOptimizedViewportModal.vue → DocumentModals/NotOptimizedViewportModal.vue} +2 -2
- package/src/components/DocumentModals/SplittingSuggestionsModal.vue +120 -0
- package/src/components/DocumentPage/ActionBar.vue +3 -3
- package/src/components/DocumentPage/AnnSetTableOptions.vue +107 -0
- package/src/components/DocumentPage/DocumentPage.vue +12 -2
- package/src/components/DocumentPage/MultiAnnSelection.vue +89 -1
- package/src/components/DocumentPage/MultiAnnotationTableOverlay.vue +274 -0
- package/src/components/DocumentPage/MultiAnnotationTablePopup.vue +19 -46
- package/src/components/DocumentPage/ScrollingDocument.vue +11 -2
- package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +35 -30
- package/src/components/DocumentTopBar/KeyboardActionsDescription.vue +3 -1
- package/src/locales/de.json +23 -6
- package/src/locales/en.json +24 -6
- package/src/locales/es.json +23 -6
- package/src/store/display.js +44 -0
- package/src/store/document.js +171 -23
- package/src/store/edit.js +67 -48
- package/src/store/project.js +14 -14
- package/src/components/DocumentAnnotations/ActionButtons.vue +0 -257
- package/src/components/DocumentAnnotations/RejectedLabels.vue +0 -96
package/src/locales/de.json
CHANGED
|
@@ -49,8 +49,7 @@
|
|
|
49
49
|
"data_being_extracted": "Neue Daten werden extrahiert",
|
|
50
50
|
"analysing_document": "Wir analysieren Ihr Dokument.",
|
|
51
51
|
"few_minutes": "Dies könnte ein paar Minuten dauern.",
|
|
52
|
-
"
|
|
53
|
-
"rejected": "Abgelehnt",
|
|
52
|
+
"missing_annotation": "Als fehlend markieren",
|
|
54
53
|
"ann_exists": "Eine Annotation für dieses Label und Label-Set existiert bereits.",
|
|
55
54
|
"lite_mode": "Schreibgeschützt",
|
|
56
55
|
"limited_functionalities": "Sie verwenden die schreibgeschützte Version mit begrenzten Funktionalitäten.",
|
|
@@ -88,14 +87,13 @@
|
|
|
88
87
|
"categorize_document_no_category_description": "Bitten Sie den Projektmanager, eine Beschreibung dieser Kategorie hinzuzufügen, um mehr über diese Kategorie zu erfahren.",
|
|
89
88
|
"annotations_pending": "Ausstehende Annotationen",
|
|
90
89
|
"annotations_accepted": "Akzeptierte Annotationen",
|
|
91
|
-
"
|
|
90
|
+
"mark_all_missing": "Alle leeren als fehlend markieren",
|
|
92
91
|
"no_labels_to_choose": "Keine Labels",
|
|
93
92
|
"accept_group": "Alle akzeptieren",
|
|
94
93
|
"use_your_keyboard": "Benutze deine Tastatur",
|
|
95
94
|
"arrow_keys": "Navigieren",
|
|
96
95
|
"esc_key": "Exit",
|
|
97
96
|
"enter_key": "Akzeptieren oder Speichern",
|
|
98
|
-
"delete_key": "Ablehnen",
|
|
99
97
|
"decline": "Decline",
|
|
100
98
|
"server_error": "Wir haben derzeit ein Serverproblem. Bitte versuchen Sie es später noch einmal oder",
|
|
101
99
|
"get_support": "Hole dir Unterstützung",
|
|
@@ -110,8 +108,27 @@
|
|
|
110
108
|
"new_multi_ann_description": "Wählen Sie ein Datenmodell aus den vorhandenen aus und deaktivieren Sie dann die Labels, die in diesem Dokument nicht vorhanden sind.",
|
|
111
109
|
"drag_drop_columns_multi_ann": "Drag and Drop, um die Reihenfolge der Labels zu ändern",
|
|
112
110
|
"error_creating_multi_ann": "Nicht alle Annotationen wurden erfolgreich erstellt.",
|
|
113
|
-
"disabled_finish_review": "Der Abschluss der Dokumentenprüfung ist erst möglich, nachdem alle Annotationen überarbeitet wurden, unabhängig davon, ob sie akzeptiert oder abgelehnt wurden.",
|
|
114
111
|
"no_multi_ann_labelset_model": "Es gibt keine verfügbaren Label Sets, die mehrfach in diesem Dokument zu finden sind. Weitere Informationen finden Sie unter <a href='https://help.konfuzio.com/tutorials/advanced-document-extraction/index.html#multiple-annotation-sets' target='_blank'>diesem Link</a>.",
|
|
115
112
|
"single_category_in_project": "Das aktuelle Projekt hat nur eine Kategorie. Um sie ändern zu können, sollte die neue zuerst dem Projekt hinzugefügt werden. Einzelheiten dazu finden Sie unter <a href='https://help.konfuzio.com/modules/categories/index.html#add-a-category' target='_blank'>diesem Link</a>.",
|
|
116
|
-
"approved_annotations": "Die Kategorie kann nicht geändert werden, da bereits akzeptierte Annotationen oder manuell erstellte Annotationen zu diesem Dokument vorhanden sind."
|
|
113
|
+
"approved_annotations": "Die Kategorie kann nicht geändert werden, da bereits akzeptierte Annotationen oder manuell erstellte Annotationen zu diesem Dokument vorhanden sind.",
|
|
114
|
+
"restore": "Restore",
|
|
115
|
+
"disabled_finish_review": "Das Beenden der Dokumentenprüfung ist erst möglich, nachdem alle Annotationen überarbeitet wurden, unabhängig davon, ob sie akzeptiert oder als fehlend markiert wurden.",
|
|
116
|
+
"split_modal_title": "Dokument aufteilen",
|
|
117
|
+
"split_modal_body": "Wir haben Ihre Datei gescannt und <strong>{number_of_split_documents}</strong> verschiedene Dokumente gefunde. <strong>Wir empfehlen dringend,</strong> sie zu diesem Zeitpunkt aufzuteilen, da sonst alle Fortschritte, die Sie gemacht haben, aufgrund der erneuten Extraktion der Dokumentdaten verloren gehen.",
|
|
118
|
+
"do_it_later": "Ich werde es später machen",
|
|
119
|
+
"review_now": "Jetzt reviewen",
|
|
120
|
+
"recommended": "Empfohlen",
|
|
121
|
+
"smart_split": "Smart Split",
|
|
122
|
+
"smart_split_suggestions": "Unsere Smart Split-Vorschläge sind grün hervorgehoben",
|
|
123
|
+
"no_splitting_suggestions": "Dieses Dokument enthält keine Split-Vorschläge",
|
|
124
|
+
"confirm_splitting": "Sind Sie sicher, dass Sie die Änderungen bestätigen möchten?",
|
|
125
|
+
"splitting_warning": "Beachten Sie bitte, dass alle Annotationen, die Sie in diesem Dokument gemacht haben, nicht gespeichert werden, wenn Sie fortfahren.",
|
|
126
|
+
"no": "Nein",
|
|
127
|
+
"yes": "Ja",
|
|
128
|
+
"split_modal_no_suggestions": "Do you need to split the document? <strong>We strongly recommend</strong> splitting it at this stage, otherwise all the progress you’ve made will be lost in the future.",
|
|
129
|
+
"missing_from_document": "Fehlt im Dokument",
|
|
130
|
+
"edit_label": "Edit label",
|
|
131
|
+
"delete_label": "Delete label",
|
|
132
|
+
"table": "Table",
|
|
133
|
+
"delete_table": "Delete table"
|
|
117
134
|
}
|
package/src/locales/en.json
CHANGED
|
@@ -51,8 +51,7 @@
|
|
|
51
51
|
"data_being_extracted": "New data is being extracted",
|
|
52
52
|
"analysing_document": "We are analysing your document.",
|
|
53
53
|
"few_minutes": "This might take a few minutes.",
|
|
54
|
-
"
|
|
55
|
-
"rejected": "Rejected",
|
|
54
|
+
"missing_annotation": "Mark as Missing",
|
|
56
55
|
"ann_exists": "An annotation for this label and label set already exists.",
|
|
57
56
|
"lite_mode": "Read Only",
|
|
58
57
|
"limited_functionalities": "You are using the Read Only version with limited functionalities.",
|
|
@@ -89,7 +88,7 @@
|
|
|
89
88
|
"categorize_document_no_category_description": "Ask the Project Manager to add a description of this Category to know more about this category.",
|
|
90
89
|
"annotations_pending": "pending",
|
|
91
90
|
"annotations_accepted": "accepted",
|
|
92
|
-
"
|
|
91
|
+
"mark_all_missing": "Mark all empty as Missing",
|
|
93
92
|
"no_labels_to_choose": "No Labels",
|
|
94
93
|
"accept_group": "Accept all",
|
|
95
94
|
"new_ann_set_title": "New annotation set",
|
|
@@ -102,7 +101,6 @@
|
|
|
102
101
|
"arrow_keys": "to Navigate",
|
|
103
102
|
"esc_key": "Exit",
|
|
104
103
|
"enter_key": "Accept or Save",
|
|
105
|
-
"delete_key": "Reject",
|
|
106
104
|
"decline": "Decline",
|
|
107
105
|
"server_error": "We are currently experiencing a server issue. Please try again later or",
|
|
108
106
|
"get_support": "Get Support",
|
|
@@ -111,8 +109,28 @@
|
|
|
111
109
|
"new_multi_ann_description": "Select a data model from the existing ones, then deselect the labels that don't exist in this document.",
|
|
112
110
|
"drag_drop_columns_multi_ann": "Drag and drop to change the order of the labels",
|
|
113
111
|
"error_creating_multi_ann": "Not all annotation sets were created successfully.",
|
|
114
|
-
"disabled_finish_review": "Finishing the document review is only possible after all annotations have been revised, whether they are accepted or
|
|
112
|
+
"disabled_finish_review": "Finishing the document review is only possible after all annotations have been revised, whether they are accepted or marked as missing.",
|
|
115
113
|
"no_multi_ann_labelset_model": "There are no available label sets that can be found multiple times in this document. For more details, you can visit <a href='https://help.konfuzio.com/tutorials/advanced-document-extraction/index.html#multiple-annotation-sets' target='_blank'>this link</a>.",
|
|
116
114
|
"single_category_in_project": "The current project has only one category. To be able to change it, the new one should be first added to the project. For details on how to do this, visit <a href='https://help.konfuzio.com/modules/categories/index.html#add-a-category' target='_blank'>this link</a>.",
|
|
117
|
-
"approved_annotations": "It is not possible to change the current category since the document has approved or manually created annotations."
|
|
115
|
+
"approved_annotations": "It is not possible to change the current category since the document has approved or manually created annotations.",
|
|
116
|
+
"restore": "Restore",
|
|
117
|
+
"split_modal_title": "Split the document",
|
|
118
|
+
"split_modal_body": "We've scanned your file and found <strong>{number_of_split_documents}</strong> different documents. <strong>We strongly recommend</strong> splitting it at this stage, otherwise all the progress you’ve made will be lost due to document data re-extraction.",
|
|
119
|
+
"do_it_later": "I'll do it later",
|
|
120
|
+
"review_now": "Review now",
|
|
121
|
+
"recommended": "Recommended",
|
|
122
|
+
"smart_split": "Smart Split",
|
|
123
|
+
"smart_split_suggestions": "Our Smart Split suggestions are highlighted in green",
|
|
124
|
+
"no_splitting_suggestions": "This document does not have splitting suggestions",
|
|
125
|
+
"confirm_splitting": "Are you sure you want to confirm the changes?",
|
|
126
|
+
"splitting_warning": "Be aware that any annotations you have made in this document will not be saved if you proceed.",
|
|
127
|
+
"no": "No",
|
|
128
|
+
"yes": "Yes",
|
|
129
|
+
"prepare_document": "Prepare the document",
|
|
130
|
+
"split_modal_no_suggestions": "Do you need to split the document? <strong>We strongly recommend</strong> splitting it at this stage, otherwise all the progress you’ve made will be lost in the future.",
|
|
131
|
+
"missing_from_document": "Missing from the document",
|
|
132
|
+
"edit_label": "Edit label",
|
|
133
|
+
"delete_label": "Delete label",
|
|
134
|
+
"table": "Table",
|
|
135
|
+
"delete_table": "Delete table"
|
|
118
136
|
}
|
package/src/locales/es.json
CHANGED
|
@@ -51,8 +51,7 @@
|
|
|
51
51
|
"data_being_extracted": "Se están extrayendo nuevos datos",
|
|
52
52
|
"analysing_document": "Estamos analizando el documento.",
|
|
53
53
|
"few_minutes": "Esto puede tardar unos minutos.",
|
|
54
|
-
"
|
|
55
|
-
"rejected": "Rechazadas",
|
|
54
|
+
"missing_annotation": "Marcar como Faltante",
|
|
56
55
|
"ann_exists": "Ya existe una anotación para esta etiqueta y grupo de etiquetas.",
|
|
57
56
|
"lite_mode": "Sólo lectura",
|
|
58
57
|
"limited_functionalities": "Está utilizando la versión de sólo lectura con funcionalidad limitada.",
|
|
@@ -89,14 +88,13 @@
|
|
|
89
88
|
"categorize_document_no_category_description": "Solicite a su Gestor de Proyecto que agregue una descripción a esta Categoría para saber más sobre ella.",
|
|
90
89
|
"annotations_pending": "pendientes",
|
|
91
90
|
"annotations_accepted": "aceptadas",
|
|
92
|
-
"
|
|
91
|
+
"mark_all_missing": "Marcas todas las anotaciones vacías como Faltantes",
|
|
93
92
|
"no_labels_to_choose": "Sin etiquetas",
|
|
94
93
|
"accept_group": "Aceptar todas",
|
|
95
94
|
"use_your_keyboard": "Use su teclado",
|
|
96
95
|
"arrow_keys": "para Navegar",
|
|
97
96
|
"esc_key": "Salir del modo de edición",
|
|
98
97
|
"enter_key": "Aceptar o Guardar",
|
|
99
|
-
"delete_key": "Rechazar",
|
|
100
98
|
"decline": "Declinar",
|
|
101
99
|
"server_error": "Estamos experimentando problemas con el servidor. Por favor, repita la operación o ",
|
|
102
100
|
"get_support": "Contacte al Soporte",
|
|
@@ -109,8 +107,27 @@
|
|
|
109
107
|
"continue": "Continuar",
|
|
110
108
|
"drag_drop_columns_multi_ann": "Arrastre y suelte las columnas para ordenar las etiquetas",
|
|
111
109
|
"error_creating_multi_ann": "No todos los grupos de anotaciones fueron creados de manera exitosa.",
|
|
112
|
-
"disabled_finish_review": "Solo es posible finalizar la revisión del documento si todas las anotaciones han sido revisadas, ya sea aceptadas o
|
|
110
|
+
"disabled_finish_review": "Solo es posible finalizar la revisión del documento si todas las anotaciones han sido revisadas, ya sea aceptadas o marcadas como faltantes.",
|
|
113
111
|
"no_multi_ann_labelset_model": "En este documento no hay grupos de etiquetas múltiples disponibles. Para más información, haz clic en <a href='https://help.konfuzio.com/tutorials/advanced-document-extraction/index.html#multiple-annotation-sets' target='_blank'>este enlace</a>.",
|
|
114
112
|
"single_category_in_project": "Este proyecto solo tiene una categoría. Para poder modificarla, es necesario agregar esta nueva categoría al proyecto. Para más información, visita <a href='https://help.konfuzio.com/modules/categories/index.html#add-a-category' target='_blank'>este enlace</a>.",
|
|
115
|
-
"approved_annotations": "No es posible cambiar la categoría, ya que existen anotaciones aceptadas o creadas manualmente en este documento."
|
|
113
|
+
"approved_annotations": "No es posible cambiar la categoría, ya que existen anotaciones aceptadas o creadas manualmente en este documento.",
|
|
114
|
+
"restore": "Restore",
|
|
115
|
+
"split_modal_title": "Dividir el documento",
|
|
116
|
+
"split_modal_body": "Hemos escaneado tu documento y hemos encontrado <strong>{number_of_split_documents}</strong> documentos diferentes. <strong>Te recomendamos</strong> dividir el documento en esta etapa, ya que de lo contrario se perderá el progreso logrado debido a una nueva extracción de los datos del documento.",
|
|
117
|
+
"do_it_later": "Lo haré luego",
|
|
118
|
+
"review_now": "Revisar ahora",
|
|
119
|
+
"recommended": "Recomendado",
|
|
120
|
+
"smart_split": "División Inteligente",
|
|
121
|
+
"smart_split_suggestions": "Nuestras sugerencias de División Inteligente están marcadas en color verde",
|
|
122
|
+
"no_splitting_suggestions": "Este documento no tiene sugerencias de división",
|
|
123
|
+
"confirm_splitting": "¿Seguro que quieres confirmar los cambios?",
|
|
124
|
+
"splitting_warning": "Ten en cuenta que se perderán las anotaciones que hayas confirmado en el documento.",
|
|
125
|
+
"no": "No",
|
|
126
|
+
"yes": "Sí",
|
|
127
|
+
"split_modal_no_suggestions": "Do you need to split the document? <strong>We strongly recommend</strong> splitting it at this stage, otherwise all the progress you’ve made will be lost in the future.",
|
|
128
|
+
"missing_from_document": "Falta en el documento",
|
|
129
|
+
"edit_label": "Edit label",
|
|
130
|
+
"delete_label": "Delete label",
|
|
131
|
+
"table": "Table",
|
|
132
|
+
"delete_table": "Delete table"
|
|
116
133
|
}
|
package/src/store/display.js
CHANGED
|
@@ -30,6 +30,7 @@ const state = {
|
|
|
30
30
|
documentActionBar: null, // document action bar properties
|
|
31
31
|
categorizeModalIsActive: false,
|
|
32
32
|
pageChangedFromThumbnail: false,
|
|
33
|
+
showAnnSetTable: null,
|
|
33
34
|
};
|
|
34
35
|
|
|
35
36
|
const getters = {
|
|
@@ -60,6 +61,31 @@ const getters = {
|
|
|
60
61
|
imageScale: (state) => (page) => {
|
|
61
62
|
return new BigNumber(page.size[0]).div(page.original_size[0]).toNumber();
|
|
62
63
|
},
|
|
64
|
+
bboxToPoint:
|
|
65
|
+
(state, getters) =>
|
|
66
|
+
(page, point, hasOffset = false) => {
|
|
67
|
+
const imageScale = getters.imageScale(page);
|
|
68
|
+
const { x, y } = point;
|
|
69
|
+
const pageHeight = new BigNumber(page.original_size[1]);
|
|
70
|
+
const newPoint = {
|
|
71
|
+
// left
|
|
72
|
+
x: new BigNumber(x)
|
|
73
|
+
.minus(hasOffset ? 1 : 0)
|
|
74
|
+
.times(state.scale)
|
|
75
|
+
.times(imageScale)
|
|
76
|
+
.div(PIXEL_RATIO)
|
|
77
|
+
.toNumber(),
|
|
78
|
+
// top
|
|
79
|
+
y: pageHeight
|
|
80
|
+
.minus(new BigNumber(y))
|
|
81
|
+
.minus(hasOffset ? 17.1 : 0)
|
|
82
|
+
.times(state.scale)
|
|
83
|
+
.times(imageScale)
|
|
84
|
+
.div(PIXEL_RATIO)
|
|
85
|
+
.toNumber(),
|
|
86
|
+
};
|
|
87
|
+
return newPoint;
|
|
88
|
+
},
|
|
63
89
|
bboxToRect:
|
|
64
90
|
(state, getters) =>
|
|
65
91
|
(page, bbox, hasOffset = false) => {
|
|
@@ -207,6 +233,12 @@ const actions = {
|
|
|
207
233
|
show ? { icon, text, action, loading } : null
|
|
208
234
|
);
|
|
209
235
|
},
|
|
236
|
+
showAnnSetTable({ commit }, tableSet) {
|
|
237
|
+
commit("SET_ANN_SET_TABLE", tableSet);
|
|
238
|
+
},
|
|
239
|
+
toggleAnnSetTable({ commit }, tableSet) {
|
|
240
|
+
commit("TOGGLE_ANN_SET_TABLE", tableSet);
|
|
241
|
+
},
|
|
210
242
|
setCategorizeModalIsActive: ({ commit }, value) => {
|
|
211
243
|
commit("SET_CATEGORIZE_MODAL_IS_ACTIVE", value);
|
|
212
244
|
},
|
|
@@ -236,6 +268,18 @@ const mutations = {
|
|
|
236
268
|
state.documentActionBar = actionBar;
|
|
237
269
|
},
|
|
238
270
|
|
|
271
|
+
SET_ANN_SET_TABLE: (state, tableSet) => {
|
|
272
|
+
state.showAnnSetTable = tableSet;
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
TOGGLE_ANN_SET_TABLE: (state, tableSet) => {
|
|
276
|
+
if (state.showAnnSetTable) {
|
|
277
|
+
state.showAnnSetTable = null;
|
|
278
|
+
} else {
|
|
279
|
+
state.showAnnSetTable = tableSet;
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
|
|
239
283
|
SET_CATEGORIZE_MODAL_IS_ACTIVE: (state, value) => {
|
|
240
284
|
state.categorizeModalIsActive = value;
|
|
241
285
|
},
|
package/src/store/document.js
CHANGED
|
@@ -3,6 +3,7 @@ import { sleep } from "../utils/utils";
|
|
|
3
3
|
|
|
4
4
|
const HTTP = myImports.HTTP;
|
|
5
5
|
const documentPollDuration = 1000;
|
|
6
|
+
export const table_reference_api = "api.v3.dvui.table";
|
|
6
7
|
|
|
7
8
|
const state = {
|
|
8
9
|
loading: true,
|
|
@@ -21,13 +22,14 @@ const state = {
|
|
|
21
22
|
showActionError: false,
|
|
22
23
|
errorMessage: null,
|
|
23
24
|
showDocumentError: false,
|
|
24
|
-
|
|
25
|
+
annotationsMarkedAsMissing: null,
|
|
25
26
|
errorMessageWidth: null,
|
|
26
27
|
hoveredAnnotationSet: null,
|
|
27
28
|
finishedReview: false,
|
|
28
29
|
newAcceptedAnnotations: null,
|
|
29
30
|
selectedEntities: null,
|
|
30
31
|
serverError: false,
|
|
32
|
+
splittingSuggestions: null,
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
const getters = {
|
|
@@ -157,6 +159,78 @@ const getters = {
|
|
|
157
159
|
return state.annotationSets.find((annSet) => annSet.id === annotationSetId);
|
|
158
160
|
},
|
|
159
161
|
|
|
162
|
+
/* Get annotation sets created in table */
|
|
163
|
+
annotationSetsInTable: (state) => () => {
|
|
164
|
+
const annotationSetsList = {};
|
|
165
|
+
state.annotationSets.forEach((annotationSet) => {
|
|
166
|
+
let addAnnotationSet = false;
|
|
167
|
+
if (annotationSet.labels) {
|
|
168
|
+
annotationSet.labels.forEach((label) => {
|
|
169
|
+
if (
|
|
170
|
+
label.annotations &&
|
|
171
|
+
label.annotations.find(
|
|
172
|
+
(annotation) =>
|
|
173
|
+
annotation.origin && annotation.origin === table_reference_api
|
|
174
|
+
)
|
|
175
|
+
) {
|
|
176
|
+
addAnnotationSet = true;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
if (addAnnotationSet) {
|
|
182
|
+
// group by label set
|
|
183
|
+
if (annotationSetsList[`${annotationSet.label_set.id}`]) {
|
|
184
|
+
annotationSetsList[`${annotationSet.label_set.id}`].push(
|
|
185
|
+
annotationSet
|
|
186
|
+
);
|
|
187
|
+
} else {
|
|
188
|
+
annotationSetsList[`${annotationSet.label_set.id}`] = [annotationSet];
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
return annotationSetsList;
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
/* Get annotation sets without tables */
|
|
196
|
+
annotationSetsToShowInList: (state) => () => {
|
|
197
|
+
const annotationSetsList = [];
|
|
198
|
+
state.annotationSets.forEach((annotationSet) => {
|
|
199
|
+
let addAnnotationSet = true;
|
|
200
|
+
if (annotationSet.labels) {
|
|
201
|
+
annotationSet.labels.forEach((label) => {
|
|
202
|
+
if (
|
|
203
|
+
label.annotations &&
|
|
204
|
+
label.annotations.find(
|
|
205
|
+
(annotation) =>
|
|
206
|
+
annotation.origin && annotation.origin === table_reference_api
|
|
207
|
+
)
|
|
208
|
+
) {
|
|
209
|
+
addAnnotationSet = false;
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
if (addAnnotationSet) {
|
|
215
|
+
annotationSetsList.push(annotationSet);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
return annotationSetsList;
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
/* Get annotations inside a list of annotation sets */
|
|
222
|
+
annotationsInAnnotationsSets: (state) => (annotationsSets) => {
|
|
223
|
+
const annotations = [];
|
|
224
|
+
annotationsSets.forEach((annotationSet) => {
|
|
225
|
+
annotationSet.labels.forEach((label) => {
|
|
226
|
+
label.annotations.forEach((annotation) => {
|
|
227
|
+
annotations.push(annotation);
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
return annotations;
|
|
232
|
+
},
|
|
233
|
+
|
|
160
234
|
/* Process annotations and extract labels and sets */
|
|
161
235
|
processAnnotationSets: (state, getters) => (annotationSets) => {
|
|
162
236
|
// group annotations for sidebar
|
|
@@ -228,6 +302,7 @@ const getters = {
|
|
|
228
302
|
});
|
|
229
303
|
return found ? `${value + 1}` : "";
|
|
230
304
|
}
|
|
305
|
+
return "";
|
|
231
306
|
},
|
|
232
307
|
|
|
233
308
|
/**
|
|
@@ -308,6 +383,27 @@ const getters = {
|
|
|
308
383
|
return pendingEmpty.length;
|
|
309
384
|
},
|
|
310
385
|
|
|
386
|
+
annotationIsNotFound: (state) => (annotationSet, label) => {
|
|
387
|
+
// Check if the combined label and label set have been marked as missing
|
|
388
|
+
// or if the document is in public mode
|
|
389
|
+
if (state.missingAnnotations.length === 0) {
|
|
390
|
+
return false;
|
|
391
|
+
} else {
|
|
392
|
+
const found = state.missingAnnotations.filter(
|
|
393
|
+
(el) =>
|
|
394
|
+
el.label === label.id &&
|
|
395
|
+
el.annotation_set === annotationSet.id &&
|
|
396
|
+
el.label_set === annotationSet.label_set.id
|
|
397
|
+
);
|
|
398
|
+
|
|
399
|
+
if (found.length !== 0) {
|
|
400
|
+
return true;
|
|
401
|
+
} else {
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
|
|
311
407
|
// Check if document is ready to be finished
|
|
312
408
|
isDocumentReviewFinished: (state) => () => {
|
|
313
409
|
// check if all annotations have been revised
|
|
@@ -335,7 +431,7 @@ const getters = {
|
|
|
335
431
|
|
|
336
432
|
// if all annotations have been revised
|
|
337
433
|
// and if there are no empty annotations or
|
|
338
|
-
// all empty annotations were
|
|
434
|
+
// all empty annotations were marked as missing,
|
|
339
435
|
// we can finish the review
|
|
340
436
|
if (
|
|
341
437
|
!emptyAnnotations ||
|
|
@@ -419,6 +515,20 @@ const getters = {
|
|
|
419
515
|
}
|
|
420
516
|
},
|
|
421
517
|
|
|
518
|
+
/**
|
|
519
|
+
* If automatic splitting is enabled for the project
|
|
520
|
+
*/
|
|
521
|
+
waitingForSplittingConfirmation: () => (document) => {
|
|
522
|
+
return document && document.status_data === 41;
|
|
523
|
+
},
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Show the Smart Split switch or not
|
|
527
|
+
*/
|
|
528
|
+
documentHasProposedSplit: () => (document) => {
|
|
529
|
+
return document.proposed_split && document.proposed_split.length > 0;
|
|
530
|
+
},
|
|
531
|
+
|
|
422
532
|
/**
|
|
423
533
|
* Joins all strings in a multi-entity Annotation array
|
|
424
534
|
* to look like a single string
|
|
@@ -445,7 +555,7 @@ const getters = {
|
|
|
445
555
|
/**
|
|
446
556
|
* Check status of annotation
|
|
447
557
|
*/
|
|
448
|
-
|
|
558
|
+
notExtracted: () => (annotation) => {
|
|
449
559
|
if (annotation) {
|
|
450
560
|
return !annotation.span;
|
|
451
561
|
} else {
|
|
@@ -574,8 +684,8 @@ const actions = {
|
|
|
574
684
|
setDocumentError: ({ commit }, value) => {
|
|
575
685
|
commit("SET_DOCUMENT_ERROR", value);
|
|
576
686
|
},
|
|
577
|
-
|
|
578
|
-
commit("
|
|
687
|
+
setAnnotationsMarkedAsMissing: ({ commit }, annotations) => {
|
|
688
|
+
commit("SET_ANNOTATIONS_MARKED_AS_MISSING", annotations);
|
|
579
689
|
},
|
|
580
690
|
setErrorMessageWidth: ({ commit }, width) => {
|
|
581
691
|
commit("SET_ERROR_MESSAGE_WIDTH", width);
|
|
@@ -589,6 +699,9 @@ const actions = {
|
|
|
589
699
|
setSelectedEntities: ({ commit }, entities) => {
|
|
590
700
|
commit("SET_SELECTED_ENTITIES", entities);
|
|
591
701
|
},
|
|
702
|
+
setSplittingSuggestions: ({ commit }, value) => {
|
|
703
|
+
commit("SET_SPLITTING_SUGGESTIONS", value);
|
|
704
|
+
},
|
|
592
705
|
|
|
593
706
|
/**
|
|
594
707
|
* Actions that use HTTP requests always return the axios promise,
|
|
@@ -635,6 +748,10 @@ const actions = {
|
|
|
635
748
|
});
|
|
636
749
|
}
|
|
637
750
|
|
|
751
|
+
if (getters.documentHasProposedSplit(response.data)) {
|
|
752
|
+
commit("SET_SPLITTING_SUGGESTIONS", response.data.proposed_split);
|
|
753
|
+
}
|
|
754
|
+
|
|
638
755
|
categoryId = response.data.category;
|
|
639
756
|
// TODO: add this validation to a method
|
|
640
757
|
isRecalculatingAnnotations = response.data.labeling_available !== 1;
|
|
@@ -698,7 +815,7 @@ const actions = {
|
|
|
698
815
|
id: annotation.id,
|
|
699
816
|
span,
|
|
700
817
|
page: span.page_index + 1,
|
|
701
|
-
labelName: label.name,
|
|
818
|
+
labelName: label ? label.name : "",
|
|
702
819
|
};
|
|
703
820
|
commit("SET_DOCUMENT_ANNOTATION_SELECTED", value);
|
|
704
821
|
},
|
|
@@ -716,7 +833,7 @@ const actions = {
|
|
|
716
833
|
HTTP.post(`/annotations/`, annotation)
|
|
717
834
|
.then(async (response) => {
|
|
718
835
|
if (response.status === 201) {
|
|
719
|
-
dispatch("fetchMissingAnnotations");
|
|
836
|
+
await dispatch("fetchMissingAnnotations");
|
|
720
837
|
commit("SET_FINISHED_REVIEW", getters.isDocumentReviewFinished());
|
|
721
838
|
|
|
722
839
|
if (!getters.annotationSetExists(response.data.annotation_set)) {
|
|
@@ -827,13 +944,14 @@ const actions = {
|
|
|
827
944
|
});
|
|
828
945
|
},
|
|
829
946
|
|
|
830
|
-
addMissingAnnotations: ({ commit,
|
|
947
|
+
addMissingAnnotations: ({ commit, getters }, missingAnnotations) => {
|
|
831
948
|
return new Promise((resolve, reject) => {
|
|
832
|
-
|
|
833
|
-
.then((response) => {
|
|
949
|
+
HTTP.post(`/missing-annotations/`, missingAnnotations)
|
|
950
|
+
.then(async (response) => {
|
|
834
951
|
if (response.status === 201) {
|
|
835
|
-
commit("
|
|
836
|
-
|
|
952
|
+
commit("SET_ANNOTATIONS_MARKED_AS_MISSING", null);
|
|
953
|
+
commit("ADD_MISSING_ANNOTATIONS", response.data);
|
|
954
|
+
commit("SET_FINISHED_REVIEW", getters.isDocumentReviewFinished());
|
|
837
955
|
}
|
|
838
956
|
|
|
839
957
|
resolve(response);
|
|
@@ -845,12 +963,13 @@ const actions = {
|
|
|
845
963
|
});
|
|
846
964
|
},
|
|
847
965
|
|
|
848
|
-
deleteMissingAnnotation: ({ commit, getters
|
|
966
|
+
deleteMissingAnnotation: ({ commit, getters }, id) => {
|
|
849
967
|
return new Promise((resolve, reject) => {
|
|
850
968
|
return HTTP.delete(`/missing-annotations/${id}/`)
|
|
851
969
|
.then((response) => {
|
|
852
970
|
if (response.status === 204) {
|
|
853
|
-
|
|
971
|
+
commit("DELETE_MISSING_ANNOTATION", id);
|
|
972
|
+
commit("SET_FINISHED_REVIEW", getters.isDocumentReviewFinished());
|
|
854
973
|
resolve(true);
|
|
855
974
|
}
|
|
856
975
|
})
|
|
@@ -891,8 +1010,11 @@ const actions = {
|
|
|
891
1010
|
`documents/${state.documentId}/?fields=status_data,labeling_available`
|
|
892
1011
|
)
|
|
893
1012
|
.then((response) => {
|
|
894
|
-
if (
|
|
895
|
-
|
|
1013
|
+
if (
|
|
1014
|
+
getters.isDocumentReadyToBeReviewed(response.data) ||
|
|
1015
|
+
getters.waitingForSplittingConfirmation(response.data)
|
|
1016
|
+
) {
|
|
1017
|
+
// ready or has splitting suggestions
|
|
896
1018
|
return resolve(true);
|
|
897
1019
|
} else if (getters.documentHadErrorDuringExtraction(response.data)) {
|
|
898
1020
|
// error
|
|
@@ -1029,11 +1151,21 @@ const mutations = {
|
|
|
1029
1151
|
(existingAnnotation) => existingAnnotation.id === annotation.id
|
|
1030
1152
|
);
|
|
1031
1153
|
if (indexOfAnnotationAnnotationSets > -1) {
|
|
1032
|
-
label
|
|
1033
|
-
|
|
1034
|
-
1
|
|
1035
|
-
|
|
1036
|
-
|
|
1154
|
+
// checks if an annotation label was changed and add it to the new label
|
|
1155
|
+
if (annotation.label && annotation.label.id !== label.id) {
|
|
1156
|
+
label.annotations.splice(indexOfAnnotationAnnotationSets, 1);
|
|
1157
|
+
|
|
1158
|
+
const labelToAdd = annotationSet.labels.find(
|
|
1159
|
+
(labelToAdd) => labelToAdd.id === annotation.label.id
|
|
1160
|
+
);
|
|
1161
|
+
labelToAdd.annotations.push(annotation);
|
|
1162
|
+
} else {
|
|
1163
|
+
label.annotations.splice(
|
|
1164
|
+
indexOfAnnotationAnnotationSets,
|
|
1165
|
+
1,
|
|
1166
|
+
annotation
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1037
1169
|
updatedAnnotation = true;
|
|
1038
1170
|
return;
|
|
1039
1171
|
}
|
|
@@ -1123,7 +1255,20 @@ const mutations = {
|
|
|
1123
1255
|
SET_MISSING_ANNOTATIONS: (state, missingAnnotations) => {
|
|
1124
1256
|
state.missingAnnotations = missingAnnotations;
|
|
1125
1257
|
},
|
|
1258
|
+
ADD_MISSING_ANNOTATIONS: (state, missingAnnotations) => {
|
|
1259
|
+
missingAnnotations.map((annotation) => {
|
|
1260
|
+
state.missingAnnotations.push(annotation);
|
|
1261
|
+
});
|
|
1262
|
+
},
|
|
1263
|
+
DELETE_MISSING_ANNOTATION: (state, id) => {
|
|
1264
|
+
const indexOfAnnotationToDelete = state.missingAnnotations.findIndex(
|
|
1265
|
+
(annotation) => annotation.id === id
|
|
1266
|
+
);
|
|
1126
1267
|
|
|
1268
|
+
if (indexOfAnnotationToDelete > -1) {
|
|
1269
|
+
state.missingAnnotations.splice(indexOfAnnotationToDelete, 1);
|
|
1270
|
+
}
|
|
1271
|
+
},
|
|
1127
1272
|
SET_SHOW_ACTION_ERROR: (state, value) => {
|
|
1128
1273
|
state.showActionError = value;
|
|
1129
1274
|
},
|
|
@@ -1133,8 +1278,8 @@ const mutations = {
|
|
|
1133
1278
|
SET_DOCUMENT_ERROR: (state, value) => {
|
|
1134
1279
|
state.showDocumentError = value;
|
|
1135
1280
|
},
|
|
1136
|
-
|
|
1137
|
-
state.
|
|
1281
|
+
SET_ANNOTATIONS_MARKED_AS_MISSING: (state, annotations) => {
|
|
1282
|
+
state.annotationsMarkedAsMissing = annotations;
|
|
1138
1283
|
},
|
|
1139
1284
|
SET_ERROR_MESSAGE_WIDTH: (state, width) => {
|
|
1140
1285
|
state.errorMessageWidth = width;
|
|
@@ -1164,6 +1309,9 @@ const mutations = {
|
|
|
1164
1309
|
UPDATE_FILE_NAME: (state, value) => {
|
|
1165
1310
|
state.selectedDocument.data_file_name = value;
|
|
1166
1311
|
},
|
|
1312
|
+
SET_SPLITTING_SUGGESTIONS: (state, array) => {
|
|
1313
|
+
state.splittingSuggestions = array;
|
|
1314
|
+
},
|
|
1167
1315
|
};
|
|
1168
1316
|
|
|
1169
1317
|
export default {
|