diff --git a/frontend/src/api/viguno.ts b/frontend/src/api/viguno.ts index b23c1b82..7a57a97d 100644 --- a/frontend/src/api/viguno.ts +++ b/frontend/src/api/viguno.ts @@ -69,8 +69,8 @@ export class VigunoClient { return await response.json() } - async queryHpoTermsByName(query: string, matchType: string = 'contains'): Promise { - const url = `${this.apiBaseUrl}hpo/terms?name=${query}&match=${matchType}` + async queryHpoTermsByName(query: string): Promise { + const url = `${this.apiBaseUrl}hpo/terms?name=${query}` const response = await fetch(url, { method: 'GET' }) diff --git a/frontend/src/components/CaseInformationCard.vue b/frontend/src/components/CaseInformationCard.vue index 4b37e026..e63a7858 100644 --- a/frontend/src/components/CaseInformationCard.vue +++ b/frontend/src/components/CaseInformationCard.vue @@ -168,7 +168,7 @@ watch( :items="termsStore.omimTerms" :loading="omimIsLoading" label="Disease" - item-title="name" + :item-title="(item) => item.name" :item-value="(item) => item" multiple chips @@ -187,8 +187,14 @@ watch( :items="termsStore.hpoTerms" :loading="hpoIsLoading" label="HPO Terms" - item-title="name" + :item-title="(item) => `${item.name} (${item.term_id})`" :item-value="(item) => item" + :item-props=" + (item) => ({ + subtitle: item.definition + }) + " + :no-filter="true" multiple chips closable-chips diff --git a/frontend/src/stores/case.ts b/frontend/src/stores/case.ts index 87905940..0f80085d 100644 --- a/frontend/src/stores/case.ts +++ b/frontend/src/stores/case.ts @@ -105,6 +105,7 @@ export const ZygosityLabels = new Map([ export interface HpoTerm { term_id: string name: string + definition?: string } /** Interface for storing one OMIM term, for storage and API. */ diff --git a/frontend/src/stores/terms.ts b/frontend/src/stores/terms.ts index eaf6d40e..74111e05 100644 --- a/frontend/src/stores/terms.ts +++ b/frontend/src/stores/terms.ts @@ -33,10 +33,8 @@ export const useTermsStore = defineStore('terms', () => { try { // Check if query matches the pattern for HPO ID if (hpoIdPattern.test(query)) { - // Extract only the digits part if "HPO:" is present - const hpoId = query.replace(/^HP:/, '') - const response = await vigunoClient.resolveHpoTermById(hpoId) - hpoTerms.value = [response.result as HpoTerm] + const response = await vigunoClient.resolveHpoTermById(query) + hpoTerms.value = response.result as HpoTerm[] } else { const response = await vigunoClient.queryHpoTermsByName(query) hpoTerms.value = response.result.map((item: any) => item as HpoTerm)