Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
quiver-frontend-local
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
subugoe
OCR-D
quiver-frontend-local
Commits
6e17fff2
Commit
6e17fff2
authored
1 year ago
by
Paul Pestov
Browse files
Options
Downloads
Patches
Plain Diff
feat: use runs endpoint for average timeline chart
parent
6b92f0f2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/timeline/MetricAverageChart.vue
+10
-15
10 additions, 15 deletions
src/components/timeline/MetricAverageChart.vue
src/helpers/api.ts
+7
-2
7 additions, 2 deletions
src/helpers/api.ts
with
17 additions
and
17 deletions
src/components/timeline/MetricAverageChart.vue
+
10
−
15
View file @
6e17fff2
...
...
@@ -2,7 +2,7 @@
import
{
onMounted
,
ref
,
watch
}
from
"
vue
"
import
api
from
"
@/helpers/api
"
import
TimelineChart
from
"
@/components/timeline/TimelineChart.vue
"
import
type
{
EvaluationRun
,
TimelineChartDataPoint
,
Workflow
}
from
"
@/types
"
import
type
{
EvaluationResultsDocumentWide
,
EvaluationRun
,
TimelineChartDataPoint
,
Workflow
}
from
"
@/types
"
import
Metrics
from
'
@/helpers/metrics
'
const
props
=
defineProps
<
{
...
...
@@ -13,16 +13,13 @@ const props = defineProps<{
const
data
=
ref
<
TimelineChartDataPoint
[]
>
([])
const
maxY
=
ref
(
2
)
const
workflows
=
ref
<
Workflow
[]
|
null
>
(
null
)
const
runs
=
ref
<
EvaluationRun
[]
[]
>
([])
const
runs
=
ref
<
EvaluationRun
[]
>
([])
onMounted
(
async
()
=>
{
const
{
gtId
,
metric
}
=
props
workflows
.
value
=
await
api
.
getWorkflows
()
for
(
const
workflow
of
workflows
.
value
)
{
const
workflowsRuns
=
await
api
.
getRuns
(
gtId
,
workflow
.
id
)
runs
.
value
.
push
(
workflowsRuns
)
}
runs
.
value
=
await
api
.
getRuns
(
gtId
)
data
.
value
=
getTimelineData
(
runs
.
value
,
metric
)
maxY
.
value
=
getMaxYByMetric
(
metric
)
...
...
@@ -33,18 +30,17 @@ watch(() => props.metric, async (value) => {
maxY
.
value
=
getMaxYByMetric
(
value
)
})
function
getTimelineData
(
runs
:
EvaluationRun
[]
[]
,
metric
:
string
):
TimelineChartDataPoint
[]
{
function
getTimelineData
(
runs
:
EvaluationRun
[],
metric
:
string
):
TimelineChartDataPoint
[]
{
const
datesValues
=
runs
.
reduce
((
acc
,
cur
)
=>
{
cur
.
forEach
(
run
=>
{
const
date
=
new
Date
(
new
Date
(
run
.
metadata
.
timestamp
).
setHours
(
0
,
0
,
0
,
0
)).
toDateString
()
const
value
=
<
number
>
run
.
evaluation_results
.
document_wide
[
metric
]
if
(
!
value
&&
Array
.
isArray
(
value
))
return
acc
const
date
=
new
Date
(
new
Date
(
cur
.
metadata
.
timestamp
).
setHours
(
0
,
0
,
0
,
0
)).
toDateString
()
const
value
=
cur
.
evaluation_results
.
document_wide
[
<
keyof
EvaluationResultsDocumentWide
>
metric
]
if
(
!
value
||
Array
.
isArray
(
value
))
return
acc
if
(
!
acc
[
date
])
acc
[
date
]
=
[
value
]
else
acc
[
date
]
=
[...
acc
[
date
],
value
]
})
return
acc
},
<
{
[
key
:
string
]:
number
[]}
>
{})
return
acc
},
<
{
[
key
:
string
]:
number
[]
}
>
{})
return
Object
.
keys
(
datesValues
)
...
...
@@ -77,5 +73,4 @@ function getMaxYByMetric(metric: string) {
</
template
>
<
style
scoped
lang=
"scss"
>
</
style
>
This diff is collapsed.
Click to expand it.
src/helpers/api.ts
+
7
−
2
View file @
6e17fff2
...
...
@@ -26,8 +26,13 @@ async function getGroundTruth(): Promise<GroundTruth[]> {
return
await
request
(
baseUrl
+
'
/gt
'
)
}
async
function
getRuns
(
gtId
:
string
,
workflowId
:
string
):
Promise
<
EvaluationRun
[]
>
{
return
await
request
(
baseUrl
+
`/runs/
${
gtId
}
/
${
workflowId
}
`
)
async
function
getRuns
(
gtId
?:
string
,
workflowId
?:
string
):
Promise
<
EvaluationRun
[]
>
{
let
path
=
`
${
baseUrl
}
/runs`
if
(
gtId
)
path
+=
`/
${
gtId
}
`
if
(
workflowId
)
path
+=
`/
${
workflowId
}
`
return
await
request
(
path
)
}
async
function
request
(
url
:
string
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment