diff --git a/webapp/api/api/views.py b/webapp/api/api/views.py index de484afa..c35afa42 100644 --- a/webapp/api/api/views.py +++ b/webapp/api/api/views.py @@ -636,7 +636,7 @@ def serialize_task(task, state): return { 'report_id': task.id, 'report_name_generated': task.verbose_name, - 'projects': task.verbose_name.split('-')[1].split(','), + 'projects': task.verbose_name.split('-')[1].split('_'), 'created_user': task.creator.username, 'create_time': task.run_at.strftime(dt_fmt), 'status': state @@ -698,7 +698,7 @@ def remove_metrics_job(request, report_id: int): pass task.delete() logger.info('Completed metrics job deleted - report ID: %s', report_id) - return Response(200, 'task / report deleted') + return Response('task / report deleted', 200) @api_view(http_method_names=['GET', 'PUT']) diff --git a/webapp/frontend/src/router.js b/webapp/frontend/src/router.js index 4a1c54f0..ce18996b 100644 --- a/webapp/frontend/src/router.js +++ b/webapp/frontend/src/router.js @@ -14,7 +14,7 @@ export default new Router({ mode: 'history', routes: [ { - path: '/train-annotations/:projectId/:docId', + path: '/train-annotations/:projectId/:docId?', name: 'train-annotations', component: TrainAnnotations, props: true, diff --git a/webapp/frontend/src/styles/_common.scss b/webapp/frontend/src/styles/_common.scss index bbc20924..46463bb8 100644 --- a/webapp/frontend/src/styles/_common.scss +++ b/webapp/frontend/src/styles/_common.scss @@ -25,6 +25,12 @@ $blur-radius: 10px; +@each $i, $col in $task-colors { + .task-color-text-#{$i} { + color: $col; + } +} + @each $i, $col in $task-colors { .task-btn-#{$i} { border-color: $col; diff --git a/webapp/frontend/src/views/Metrics.vue b/webapp/frontend/src/views/Metrics.vue index c6d5fd8d..3cd32f83 100644 --- a/webapp/frontend/src/views/Metrics.vue +++ b/webapp/frontend/src/views/Metrics.vue @@ -22,7 +22,15 @@ - + + + + {{data.item.status}} + + + + + @@ -203,7 +211,23 @@ export default { this.reportName = resp.data.results.report_name || resp.data.results.report_name_generated this.$set(this.userStats, 'items', resp.data.results.user_stats) this.$set(this.conceptSummary, 'items', resp.data.results.concept_summary) - this.$set(this.annoSummary, 'items', resp.data.results.annotation_summary) + let anno_summary = resp.data.results.annotation_summary.map(s => { + if (s.correct) { + s.status = 'Correct' + } else if (s.deleted) { + s.status = 'Incorrect' + } else if (s.alternative) { + s.status = 'Alternative' + } else if (s.manually_created) { + s.status = 'Manually Added' + } else if (s.killed) { + s.status = 'Terminated' + } else if (s.irrelevant) { + s.status = 'Irrelevant' + } + return s + }) + this.$set(this.annoSummary, 'items', anno_summary) this.$set(this.metaAnnsSummary, 'items', resp.data.results.meta_anno_summary) }) } @@ -226,10 +250,10 @@ export default { { key: 'document_name', label: 'Doc. Name', sortable: true }, { key: 'id', label: 'Annotation Id', sortable: true }, { key: 'user', label: 'User', sortable: true }, - { key: 'cui', label: 'CUI' }, + { key: 'cui', label: 'CUI', sortable: true }, { key: 'concept_name', label: 'Concept', sortable: true }, - { key: 'value', label: 'text' } - // more fields for the validated, killed, correct, incorrect etc. + { key: 'value', label: 'text', sortable: true }, + { key: 'status', label: 'Status', sortable: true } ] }, conceptSummary: { @@ -259,6 +283,15 @@ export default { } }, methods: { + textColorClass (status) { + return { + 'task-color-text-0': status === 'Correct' || status === 'Manually Added', + 'task-color-text-1': status === 'Incorrect', + 'task-color-text-2': status === 'Terminated', + 'task-color-text-3': status === 'Alternative', + 'task-color-text-4': status === 'Irrelevant' + } + }, clearModalData () { this.modalData = { results: null, diff --git a/webapp/frontend/src/views/MetricsHome.vue b/webapp/frontend/src/views/MetricsHome.vue index fa9905e4..56f670a8 100644 --- a/webapp/frontend/src/views/MetricsHome.vue +++ b/webapp/frontend/src/views/MetricsHome.vue @@ -8,6 +8,10 @@ :fields="reports.fields" :select-mode="'single'" @row-selected="loadMetrics"> + + + + Pending @@ -20,7 +24,8 @@ - + @@ -44,18 +49,20 @@