From 084933b7a37ad15cf694ae5ac979711a77c5af66 Mon Sep 17 00:00:00 2001 From: jfrer <76432831+jfrer@users.noreply.github.com> Date: Tue, 25 Jun 2024 10:55:51 +0200 Subject: [PATCH 1/2] feat: add filtering by workflow, processor and date range to timeline view (#85) * feat: filter by workflow and processor * feat: filter by date range * feat: implement multi-selectable workflow steps filtering * fix: make only related workflows visible while filtering by processors * fix: set all checkboxes of processor filter to selected on page load * ref: highlight selected processors * fix: refactor to own component and prepare visual filtering * fix: show filter also when no data is selected * fix: workflow filter label * feat: hide workflow when neither workflow or processor in workflow are selected * refactor: remove unused imports/vars, style * fix: remove search from workflow filter * feat: change date range dropdown to multiselect * refactor: change order * feat: add i18n translations * fix: adjust filter position for smaller screens * fix: changed faulty imported that failed build * fix: workflow filter not working --------- Co-authored-by: amtul.noor Co-authored-by: noornoorie Co-authored-by: jfrer --- .../workflows/WorkflowsTimeline.vue | 34 ++-- src/components/workflows/filters/Filters.vue | 3 +- .../workflows/timeline/TimelineFilters.vue | 156 ++++++++++++++++++ .../workflows/timeline/TimelineItem.vue | 9 +- src/helpers/utils.ts | 14 +- src/locales/de.json | 8 +- src/locales/en.json | 9 +- src/store/filters-store.ts | 8 +- src/types/index.d.ts | 76 ++++++--- 9 files changed, 261 insertions(+), 56 deletions(-) create mode 100644 src/components/workflows/timeline/TimelineFilters.vue diff --git a/src/components/workflows/WorkflowsTimeline.vue b/src/components/workflows/WorkflowsTimeline.vue index b594de5..c3c4d63 100644 --- a/src/components/workflows/WorkflowsTimeline.vue +++ b/src/components/workflows/WorkflowsTimeline.vue @@ -1,8 +1,8 @@ + + \ No newline at end of file diff --git a/src/components/workflows/timeline/TimelineItem.vue b/src/components/workflows/timeline/TimelineItem.vue index cbf2e4c..f7cb57e 100644 --- a/src/components/workflows/timeline/TimelineItem.vue +++ b/src/components/workflows/timeline/TimelineItem.vue @@ -6,10 +6,11 @@ import MetricChart from "@/components/workflows/timeline/MetricChart.vue" import type { EvaluationResultsDocumentWide, GroundTruth, Workflow, WorkflowStep } from "@/types" import MetricAverageChart from "@/components/workflows/timeline/MetricAverageChart.vue" import { Icon } from '@iconify/vue' -import { onMounted, nextTick, ref } from "vue" +import { computed, nextTick, ref } from "vue" import { OverlayPanelDropdownStyles } from "@/helpers/pt" import workflowsStore from "@/store/workflows-store" import TimelineItemMetadata from "@/components/workflows/timeline/TimelineItemMetadata.vue" +import filtersStore from "@/store/filters-store" const props = defineProps<{ @@ -22,12 +23,8 @@ const isOpVisible = ref(false) const selectedStep = ref(null) const startDate = ref(new Date('2023-10-01')) const endDate = ref(new Date()) -const workflows = ref([]) - -onMounted(() => { - workflows.value = workflowsStore.workflows -}) +const workflows = computed(() => workflowsStore.workflows.filter(({ id }) => filtersStore.workflow.findIndex(({ value }) => value === id ) > - 1)) function getStepAcronym(stepId) { return StepsAcronyms[stepId] diff --git a/src/helpers/utils.ts b/src/helpers/utils.ts index 70dc749..0bc3f08 100644 --- a/src/helpers/utils.ts +++ b/src/helpers/utils.ts @@ -1,5 +1,5 @@ import { ref } from 'vue' -import type { EvaluationResultsDocumentWide, EvaluationRun } from "@/types" +import type { EvaluationResultsDocumentWide, EvaluationRun, Workflow, WorkflowStep } from "@/types" const utils = ref({}) @@ -72,9 +72,19 @@ const mapGtId = (id: string) => { return arr[arr.length - 1].split('.')[0] } +const deduplicateStepIds = (workflows: Workflow[]) => { + return Array.from(workflows.reduce((acc, cur) => { + cur.steps.forEach(({ id }) => { + acc.add(id) + }) + return acc + }, new Set())) +} + export { getEvalColor, setEvalColors, createReadableMetricValue, - mapGtId + mapGtId, + deduplicateStepIds, } diff --git a/src/locales/de.json b/src/locales/de.json index d367ca3..db55ba1 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -80,5 +80,11 @@ "volume": "Umfang", "labelling": "Kennzeichnung", "no_labels_for_this_entry": "Keine Kennzeichnung für diesen Eintrag.", - "average_timeline": "Chronik (Durchschnitt)" + "average_timeline": "Chronik (Durchschnitt)", + "filter_by_date_range": "Nach Zeitspanne filtern", + "filter_by_workflow": "Nach Workflow filtern", + "filter_by_processor": "Nach Prozessor filtern", + "select_a_date_range": "Zeitraum auswählen", + "select_a_workflow": "Workflow auswählen", + "select_a_processor": "Prozessor auswählen" } diff --git a/src/locales/en.json b/src/locales/en.json index 1ab9d4c..2fc3f36 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -74,6 +74,11 @@ "volume": "Volume", "labelling": "Labelling", "no_labels_for_this_entry": "No labels for this entry.", - "average_timeline": "Average Timeline" - + "average_timeline": "Average Timeline", + "filter_by_date_range": "Filter by date range", + "filter_by_workflow": "Filter by workflow", + "filter_by_processor": "Filter by processor", + "select_a_date_range": "Select a date range", + "select_a_workflow": "Select a workflow", + "select_a_processor": "Select a processor" } diff --git a/src/store/filters-store.ts b/src/store/filters-store.ts index e1d92f1..1dfec73 100644 --- a/src/store/filters-store.ts +++ b/src/store/filters-store.ts @@ -3,8 +3,12 @@ import type { FilterOption } from "@/types" export default reactive<{ gt: FilterOption[], - metric: FilterOption[] + gtTimeline: FilterOption[], + metric: FilterOption[], + workflow: FilterOption[], }>({ gt: [], - metric: [] + gtTimeline: [], + metric: [], + workflow: [] }) diff --git a/src/types/index.d.ts b/src/types/index.d.ts index 270a5ac..2776794 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -1,31 +1,57 @@ export interface GroundTruth { id: string, label: string, - metadata: { - title: string, - url: string, - language: string[], - script: string[], - 'script-type': string, - license: { - name: string, - url: string, - }[], - volume: { - TxtRegion?: string, - GraphRegion?: string, - SepRegion?: string, - MusicRegion?: string, - NoiseRegion?: string, - TextLine?: string, - Page?: string, - } | - { - metric: string, - count: number, - }[] - labelling: string[], - } + metadata: GroundTruthMetadata +} + +export interface GroundTruthMetadata { + authors: { + name: string, + surname: string, + roles: string[] + }[], + description: string, + format: string, + gtTyp: string, + hands: { + count: string, + level: string + }, + labelling: string[], + language: string[], + license: { + name: string, + url: string + }[], + 'project-name': string, + 'project-website': string, + schema: string, + script: string[], + 'script-type': string, + sources: { + reference: string, + link: string + }[], + time: { + notBefore: string, + notAfter: string + }, + title: string, + 'transcription-guidelines': string, + url: string, + volume: { + TxtRegion?: string, + GraphRegion?: string, + SepRegion?: string, + MusicRegion?: string, + NoiseRegion?: string, + TextLine?: string, + Page?: string, + } | + { + metric: string, + count: number, + }[], } export interface Workflow { From 1fbbbac5f2f591f75396488122172b962b536832 Mon Sep 17 00:00:00 2001 From: jfrer <76432831+jfrer@users.noreply.github.com> Date: Fri, 28 Jun 2024 11:35:38 +0200 Subject: [PATCH 2/2] fix: document filter is now reactive again (#87) --- src/components/workflows/timeline/TimelineFilters.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/workflows/timeline/TimelineFilters.vue b/src/components/workflows/timeline/TimelineFilters.vue index ca40b64..de050d3 100644 --- a/src/components/workflows/timeline/TimelineFilters.vue +++ b/src/components/workflows/timeline/TimelineFilters.vue @@ -1,7 +1,7 @@