Skip to content

Commit

Permalink
CU-862hxw03e: Fix broken demo page.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomolopolis committed Aug 3, 2023
1 parent fa078a2 commit a7aeb25
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 30 deletions.
18 changes: 14 additions & 4 deletions webapp/frontend/src/components/common/ClinicalText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,18 @@ export default {
ents: Array,
loading: String,
currentEnt: Object,
currentRelStartEnt: Object,
currentRelEndEnt: Object,
currentRelStartEnt: {
default () {
return {}
},
type: Object,
},
currentRelEndEnt: {
default () {
return {}
},
type: Object,
},
addAnnos: Boolean
},
data () {
Expand Down Expand Up @@ -73,9 +83,9 @@ export default {
styleClass = `highlight-task-${btnIndex}`
}
if ((this.ents[i] === this.currentRelStartEnt) || (this.ents[i].id === (this.currentRelStartEnt || {}).id)) {
if (this.ents[i] === this.currentRelStartEnt) {
styleClass += ' current-rel-start'
} else if ((this.ents[i] === this.currentRelEndEnt) || (this.ents[i].id === (this.currentRelEndEnt || {}).id)) {
} else if (this.ents[i] === this.currentRelEndEnt) {
styleClass += ' current-rel-end'
}
Expand Down
16 changes: 0 additions & 16 deletions webapp/frontend/src/components/common/ConceptSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,22 +200,6 @@ export default {
})
},
deep: true
},
'project': {
handler () {
let that = this
if (this.project.cdb_search_filter.length > 0) {
this.$http.get(`/api/concept-dbs/${this.project.cdb_search_filter[0]}/`).then(resp => {
if (resp.data) {
// this is a bit hacky - backend should just return the correct CDB search filter
that.$set(that, 'searchFilterDBIndex', `${resp.data.name}_id_${that.project.cdb_search_filter}`)
this.fetchDetail(this.selectedEnt, this.searchFilterDBIndex, () => {
that.cleanProps()
})
}
})
}
}
}
}
}
Expand Down
31 changes: 21 additions & 10 deletions webapp/frontend/src/views/Demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,17 @@
<textarea v-model="cuiFilters" class="form-control" name="cui"
rows="3" placeholder="Comma separated list: S-91175000, S-84757009"></textarea>
</div>
<div class="form-group">
<label>Type IDs Filter</label>
<textarea v-model="typeIDsFilters" class="form-control" name="type_ids"
rows="3" placeholder="Comma separated list: T-00010, T00020"></textarea>
</div>
<button @click="annotate()" class="btn btn-primary">Annotate</button>
</form>
</div>
<div class="view-port">
<div class="clinical-text">
<clinical-text :loading="loadingDoc" :text="annotatedText" :ents="ents"
<clinical-text :loading="loadingMsg" :text="annotatedText" :ents="ents"
:taskName="task" :taskValues="taskValues" @select:concept="selectEntity"></clinical-text>
</div>
<div class="sidebar">
<concept-summary :selectedEnt="currentEnt" :project="selectedProject"></concept-summary>
<concept-summary :selectedEnt="currentEnt" :project="selectedProject"
:searchFilterDBIndex="searchFilterDBIndex"></concept-summary>
</div>
</div>
</div>
Expand All @@ -57,13 +53,13 @@ export default {
projects: [],
selectedProject: {},
cuiFilters: '',
typeIDsFilters: '',
ents: [],
currentEnt: {},
annotatedText: '',
loadingMsg: null,
task: TASK_NAME,
taskValues: VALUES
taskValues: VALUES,
searchFilterDBIndex: null
}
},
created () {
Expand All @@ -89,7 +85,6 @@ export default {
project_id: this.selectedProject.id,
message: this.exampleText,
cuis: this.cuiFilters,
tuis: this.tuiFilters
}
this.loadingMsg = 'Annotating Text...'
this.$http.post('/api/annotate-text/', payload).then(resp => {
Expand All @@ -105,6 +100,22 @@ export default {
},
selectEntity (entIndex) {
this.currentEnt = this.ents[entIndex]
},
fetchCDBSearchIndex () {
if (this.selectedProject.cdb_search_filter.length > 0) {
this.$http.get(`/api/concept-dbs/${this.selectedProject.cdb_search_filter[0]}/`).then(resp => {
if (resp.data) {
this.searchFilterDBIndex = `${resp.data.name}_id_${this.selectedProject.cdb_search_filter}`
}
})
}
}
},
watch: {
'selectedProject': {
handler () {
this.fetchCDBSearchIndex()
}
}
}
}
Expand Down

0 comments on commit a7aeb25

Please sign in to comment.