Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CU-862k7qm7k: bug fixes and API improvements. #143

Merged
merged 2 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion webapp/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ django-polymorphic~=3.0
djangorestframework~=3.10
django-background-tasks~=1.2
openpyxl~=3.0
medcat~=1.6
medcat~=1.9