Skip to content

Commit d718dd9

Browse files
committed
Added std dev entities evaluation
1 parent 4ebc303 commit d718dd9

29 files changed

Lines changed: 309 additions & 191 deletions

File tree

client/.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"type": "chrome",
99
"request": "launch",
1010
"name": "Launch Chrome against localhost",
11-
"url": "http://localhost:8080",
11+
"url": "http://localhost:5173",
1212
"webRoot": "${workspaceFolder}"
1313
}
1414
]
15-
}
15+
}

client/src/api/evaluation.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@ import type {
1111
Metrics,
1212
TermComparison,
1313
} from "@/types/evaluation"
14-
import type { DocumentEntities, JobEntities } from "@/types/evaluation/entities"
14+
import type {
15+
DocumentEntities,
16+
JobEntities,
17+
JobsEntities,
18+
} from "@/types/evaluation/entities"
1519

1620
type ConfusionResponse = AxiosResponse<ConfusionWrapper>
1721
type DistributionResponse = AxiosResponse<DistributionWrapper>
1822
type MetricsResponse = AxiosResponse<Metrics>
1923
type DocumentEntitiesResponse = AxiosResponse<DocumentEntities>
2024
type JobEntitiesResponse = AxiosResponse<JobEntities>
25+
type JobsEntitiesResponse = AxiosResponse<JobsEntities>
2126

2227
const evaluationPath = (corpus: UUID, hypothesis: string): string =>
2328
`/corpora/${corpus}/jobs/${hypothesis}/evaluation`
@@ -38,10 +43,15 @@ const documentLayerComparisonPath = (
3843
job: string,
3944
document: string,
4045
): string => `/corpora/${corpus}/jobs/${job}/documents/${document}/evaluation`
41-
const documentEntitiesPath = (corpus: UUID, job: string, document: string): string =>
42-
`/corpora/${corpus}/jobs/${job}/documents/${document}/entities`
46+
const documentEntitiesPath = (
47+
corpus: UUID,
48+
job: string,
49+
document: string,
50+
): string => `/corpora/${corpus}/jobs/${job}/documents/${document}/entities`
4351
const jobEntitiesPath = (corpus: UUID, job: string): string =>
4452
`${evaluationPath(corpus, job)}/entities`
53+
const jobsEntitiesPath = (corpus: UUID): string =>
54+
`/corpora/${corpus}/evaluation/entities`
4555
/**
4656
* Fetch term frequency distribution.
4757
* @param corpus UUID of the corpus.
@@ -182,3 +192,7 @@ export function getJobEntities(
182192
): Promise<JobEntitiesResponse> {
183193
return axios.get(jobEntitiesPath(corpus, job))
184194
}
195+
196+
export function getJobsEntities(corpus: UUID): Promise<JobsEntitiesResponse> {
197+
return axios.get(jobsEntitiesPath(corpus))
198+
}

client/src/components/GCard.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ flex: 1;
8888
gap: 1rem;
8989
max-width: 100%;
9090
overflow-x: auto;
91-
overflow-y: clip;
9291
9392
&.article {
9493
max-width: 800px;

client/src/components/input/GButton.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ button {
4242
word-break: keep-all;
4343
white-space: nowrap;
4444
width: max-content;
45-
margin: 0px 2px;
4645
cursor: pointer;
4746
line-height: 1.2rem;
4847
gap: 5px;

client/src/components/input/JobSelect.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
2-
<label for="job-select">{{ label }}</label>
2+
<label>{{ label }}</label>
33
<GSpinner v-if="jobsStore.loading" />
4-
<GSelect v-else id="job-select" title="Select an annotation layer" :options="jobSelectionStore.selectableJobs"
4+
<GSelect v-else title="Select an annotation layer" :options="jobSelectionStore.selectableJobs"
55
v-model="selectedJob" />
66
<GInfo v-if="untaggedDocsExist">
77
<p>

client/src/components/modals/GModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</template>
1212
<slot></slot>
1313
</GCard>
14-
<form @submit.prevent class="buttons">
14+
<form class="buttons" @submit.prevent>
1515
<GButton red @click="$emit('hide')">Close</GButton>
1616
<slot name="buttons"></slot>
1717
</form>

client/src/components/modals/jobs/JobModal.vue

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<!-- Show load icon while posting an action-->
4444
<GSpinner />
4545
</div>
46-
<div class="buttons" v-else-if="taggerIsAvailable">
46+
<form v-else-if="taggerIsAvailable" @submit.prevent class="buttons">
4747
<GButton green :disabled="job.progress.pending === 0 || job.progress.busy" @click="
4848
() => {
4949
jobsStore.tag(job.tagger.id)
@@ -64,13 +64,13 @@
6464
@click="deleteJobId = job.tagger.id">
6565
Delete
6666
</GButton>
67-
</div>
67+
</form>
6868

6969
<!-- progress -->
7070
<JobProgress :job />
7171

7272
<!-- Layer preview -->
73-
<LayerViewer :layer="job.preview" />
73+
<LayerViewer v-if="job.resultSummary.tokens > 0" :job />
7474

7575
<!-- errors -->
7676
<GInfo v-if="job.progress.failed > 0" error>
@@ -189,30 +189,8 @@ function firstFive(obj: Record<string, unknown>) {
189189
</script>
190190

191191
<style scoped lang="scss">
192-
.error {
193-
width: fit-content;
194-
margin: auto;
195-
}
196-
197192
.buttons {
198-
height: 100%;
199193
display: flex;
200-
justify-content: center;
201-
align-items: center;
202-
margin-top: 10px;
203-
}
204-
205-
.centerText {
206-
text-align: center;
207-
}
208-
209-
.healthy {
210-
background-color: var(--gold);
211-
color: black;
212-
}
213-
214-
.unhealthy {
215-
background-color: var(--int-red);
216-
color: white;
194+
gap: 0.25rem;
217195
}
218196
</style>

client/src/components/tables/CorpusTable.vue

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,22 @@
1010
</template>
1111

1212
<template #table-empty-instruction>
13-
<slot name="tableEmpty"> First, create a new corpus. </slot>
13+
<slot name="tableEmpty">First, create a new corpus.</slot>
1414
</template>
1515

1616
<template #prepend>
17-
<form v-if="type != TableCorporaType.Dataset" @submit.prevent>
18-
<GButton green @click="$emit('create')" v-if="type == TableCorporaType.User"> New </GButton>
19-
<GButton orange :disabled="!activeCorpusInTable" @click="$emit('update', selectedCorpus)">Edit
17+
<form v-if="type != TableCorporaType.Dataset" class="buttons" @submit.prevent>
18+
<GButton green @click="$emit('create')" v-if="type == TableCorporaType.User">
19+
New
20+
</GButton>
21+
<GButton orange :disabled="!activeCorpusInTable" @click="$emit('update', selectedCorpus)">
22+
Edit
2023
</GButton>
2124
<GButton v-if="type == TableCorporaType.User"
2225
:disabled="!userStore.canDelete(selectedCorpus) || !activeCorpusInTable" red
23-
@click="$emit('delete', selectedCorpus)">Delete</GButton>
26+
@click="$emit('delete', selectedCorpus)">
27+
Delete
28+
</GButton>
2429
</form>
2530
</template>
2631

@@ -161,3 +166,10 @@ function customSharedSort(i: CorpusMetadata) {
161166
return i.collaborators.length + i.viewers.length
162167
}
163168
</script>
169+
170+
<style scoped lang="scss">
171+
.buttons {
172+
display: flex;
173+
gap: 0.25rem;
174+
}
175+
</style>

client/src/components/tables/DocumentEntitiesTable.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ const {
1616
filter,
1717
} = defineProps<{
1818
entities: Entity[]
19-
filter: string
19+
filter?: string
2020
}>()
2121
22-
const items = computed(() => entities.filter((i) => i.label === filter || filter === "total"))
22+
const items = computed(() => entities.filter((i) => i.label === filter || filter === undefined))
2323
const columns = ref<Field[]>([
2424
{ key: "label", sortOn: (i) => i.label },
2525
{ key: "form", sortOn: (i) => i.form },

client/src/components/tables/DocumentsTable.vue

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,7 @@
3636
{{ data.value.tokens }}
3737
</template>
3838
<template #right>
39-
<InspectButton v-if="data.value.tokens > 0" @click="
40-
() => {
41-
preview = data.value.layerPreview
42-
previewDocument = data.item
43-
}
44-
" />
39+
<InspectButton v-if="data.value.tokens > 0" @click="previewDocument = data.item" />
4540
</template>
4641
</RightFloatCell>
4742
</template>
@@ -76,11 +71,10 @@
7671
</GTable>
7772

7873
<!-- preview modal -->
79-
<GModal :show="previewDocument != null" @hide="previewDocument = null"
80-
:title="`Preview of document ${previewDocument?.name}`">
81-
<template #title>Source layer preview of document {{ previewDocument?.name }}</template>
74+
<GModal :show="previewDocument !== undefined" @hide="previewDocument = undefined">
75+
<template #title>Annotations of {{ previewDocument?.name }}</template>
8276
<template #help> Here you can inspect a small part of the source layer of the document. </template>
83-
<LayerViewer :layer="previewDocument?.layerPreview" />
77+
<LayerViewer :document="previewDocument" />
8478
</GModal>
8579

8680
<!-- delete modal -->
@@ -96,7 +90,6 @@ import stores from "@/stores"
9690
import { formatDate } from "@/ts/utils"
9791
import type { CorpusMetadata } from "@/types/corpora"
9892
import type { DocumentMetadata } from "@/types/documents"
99-
import type { LayerPreview } from "@/types/jobs"
10093
// API & types
10194
import { type Field, TableDocumentsType } from "@/types/ui/table"
10295
@@ -113,8 +106,7 @@ const props = defineProps({
113106
114107
// Fields
115108
const deleteDocumentData = ref(null as null | DocumentMetadata)
116-
const previewDocument = ref(null as null | DocumentMetadata)
117-
const preview = ref(null as null | LayerPreview)
109+
const previewDocument = ref<DocumentMetadata>()
118110
const showDeleteModal = ref(false)
119111
120112
const columns = computed<Field[]>(() => {

0 commit comments

Comments
 (0)