Skip to content

Commit

Permalink
fix: case overview diseases terms input missing omim (#1759) (#1785)
Browse files Browse the repository at this point in the history
  • Loading branch information
stolpeo authored Jul 9, 2024
1 parent 3c325fe commit 9f55cd5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
8 changes: 4 additions & 4 deletions frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ lint:

.PHONY: test
test:
npm run -- test:unit --run
NODE_OPTIONS=${NODE_OPTIONS} npm run -- test:unit --run

# Tests in the CI are forced into a single thread as the worker only has
# two cores only and some tests run into timeouts otherwise.
Expand All @@ -63,15 +63,15 @@ ci: \

.PHONY: build
build:
MODE=development npm run build
NODE_OPTIONS=${NODE_OPTIONS} MODE=development npm run build

.PHONY: serve
serve:
MODE=development npm run serve
NODE_OPTIONS=${NODE_OPTIONS} MODE=development npm run serve

.PHONY: serve-public
serve-public:
MODE=development npm run serve-public
NODE_OPTIONS=${NODE_OPTIONS} MODE=development npm run serve-public

.PHONY: openapi-ts
openapi-ts:
Expand Down
11 changes: 5 additions & 6 deletions frontend/src/cases/components/CaseDetail/CardTerms.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,13 @@ const fetchTermLabels = async (terms) => {
for (const term of terms || allTerms.value) {
if (!termLabels[term]) {
let results
if (query.startsWith('HP:')) {
if (term.startsWith('HP:')) {
results = await vigunoClient.resolveHpoTermById(term)
} else if (query.startsWith('OMIM:')) {
results = await vigunoClient.resolveOmimTermById(term)
} else {
results = await vigunoClient.queryHpoTermsByName(term)
} else if (term.startsWith('OMIM:')) {
const term2 = term.replace('OMIM:', '')
results = await vigunoClient.resolveOmimTermById(term2)
}
if (results.length) {
if (results.result.length) {
termLabels[term] = results[0].label
}
}
Expand Down
26 changes: 21 additions & 5 deletions frontend/src/variants/components/HpoTermInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,32 @@ const fetchHpoTerm = async (query) => {
let results
if (query.startsWith('HP:')) {
results = await vigunoClient.resolveHpoTermById(queryArg)
results = results.result
} else if (query.startsWith('OMIM:')) {
results = await vigunoClient.resolveOmimTermById(queryArg)
const queryArg2 = encodeURIComponent(query.replace('OMIM:', ''))
results = await vigunoClient.resolveOmimTermById(queryArg2)
results = results.result
} else {
results = await vigunoClient.queryHpoTermsByName(queryArg)
let results1 = await vigunoClient.queryHpoTermsByName(queryArg)
results1 = results1.result
let results2 = await vigunoClient.queryOmimTermsByName(queryArg)
results2 = results2.result
if (results1.length < 2 && results2.length > 2) {
results2 = results2.slice(0, 2 + results1.length)
} else if (results2.length < 2 && results1.length > 2) {
results1 = results1.slice(0, 2 + results2.length)
} else {
results1 = results1.slice(0, 2)
results2 = results2.slice(0, 2)
}
results = results1.concat(results2)
}
const data = results.result.map(({ termId, name }) => {
const data = results.map(({ termId, omimId, name }) => {
const id = termId || omimId
return {
label: `${termId} - ${name}`,
label: `${id} - ${name}`,
value: {
term_id: termId,
term_id: id,
name,
},
}
Expand Down

0 comments on commit 9f55cd5

Please sign in to comment.