Skip to content

Commit

Permalink
CU-862k7qm7k: bug fixes and API improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomolopolis committed Aug 2, 2023
1 parent 283d437 commit f3ad5f1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
2 changes: 2 additions & 0 deletions webapp/api/api/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ def _annotations(self):
_anns.pop('meta_anns')
output = dict()
output['project'] = proj['name']
output['project_id'] = proj['id']
output['document_name'] = doc['name']
output['document_id'] = doc['id']
output.update(_anns)
output.update(meta_anns_dict)
ann_lst.append(output)
Expand Down
17 changes: 5 additions & 12 deletions webapp/frontend/src/components/anns/AnnoResult.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,10 @@ export default {
const matches = [...resTxt.matchAll(regexp)]
let outText = '<span>'
for (let match of matches) {
if (outText === '<span>') {
outText += `${resTxt.slice(0, match.index)}`
} else {
outText += `${resTxt.slice(matches[matches.indexOf(match) - 1].index + srcVal.length, match.index)}`
}
outText += `<span class="${highlightClass}" @click="openAnno">${srcVal}</span>`
if (matches.length === 1 || match === matches[-1]) {
if (match.index === 60) {
// this is the match to use - other matches are spurious, and represent other MedCAT AnnoResults.
outText = `<span>${resTxt.slice(0, match.index)}`
outText += `<span class="${highlightClass}" @click="openAnno">${srcVal}</span>`
outText += `${resTxt.slice(match.index + srcVal.length)}</span>`
}
}
Expand All @@ -56,11 +53,7 @@ export default {
openAnno () {
const routeData = this.$router.resolve(
{
name: 'train-annotations',
params: {
projectId: this.result['project id'],
docId: this.result['document id'],
},
path: `/train-annotations/${this.result['project id']}/${this.result['document id']}`,
query: {
annoStart: this.result['start'],
annoEnd: this.result['end']
Expand Down
5 changes: 3 additions & 2 deletions webapp/frontend/src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ export default new Router({
mode: 'history',
routes: [
{
path: '/train-annotations/:projectId/:docId?',
path: '/train-annotations/:projectId/:docId',
name: 'train-annotations',
component: TrainAnnotations,
props: true
props: true,
query: true
},
{
path: '/metrics/',
Expand Down

0 comments on commit f3ad5f1

Please sign in to comment.