From 5a7cec2c4241af375527367b492f4eb4003f0bd3 Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Thu, 9 May 2024 15:28:56 -0500 Subject: [PATCH] Add mondo ID to disease detail pages --- .../my-disease-info/my-disease-info.component.html | 9 +++++++-- client/src/app/generated/civic.apollo-helpers.ts | 3 ++- client/src/app/generated/civic.apollo.ts | 8 +++++--- client/src/app/generated/server.model.graphql | 1 + client/src/app/generated/server.schema.json | 12 ++++++++++++ .../diseases-summary/diseases-summary.query.gql | 1 + .../graphql/types/entities/my_disease_info_type.rb | 1 + server/app/models/my_disease_info.rb | 13 ++++++++----- 8 files changed, 37 insertions(+), 11 deletions(-) diff --git a/client/src/app/components/diseases/my-disease-info/my-disease-info.component.html b/client/src/app/components/diseases/my-disease-info/my-disease-info.component.html index 7b3ce832d..55c776941 100644 --- a/client/src/app/components/diseases/my-disease-info/my-disease-info.component.html +++ b/client/src/app/components/diseases/my-disease-info/my-disease-info.component.html @@ -76,13 +76,18 @@
- - + + {{diseaseInfo.mondoDef}} + + + {{diseaseInfo.mondoId}} + + diff --git a/client/src/app/generated/civic.apollo-helpers.ts b/client/src/app/generated/civic.apollo-helpers.ts index bc6aada76..833feb46c 100644 --- a/client/src/app/generated/civic.apollo-helpers.ts +++ b/client/src/app/generated/civic.apollo-helpers.ts @@ -1417,7 +1417,7 @@ export type MyChemInfoFieldPolicy = { pubchemCid?: FieldPolicy | FieldReadFunction, rxnorm?: FieldPolicy | FieldReadFunction }; -export type MyDiseaseInfoKeySpecifier = ('diseaseOntologyExactSynonyms' | 'diseaseOntologyRelatedSynonyms' | 'doDef' | 'doDefCitations' | 'icd10' | 'icdo' | 'mesh' | 'mondoDef' | 'ncit' | 'omim' | MyDiseaseInfoKeySpecifier)[]; +export type MyDiseaseInfoKeySpecifier = ('diseaseOntologyExactSynonyms' | 'diseaseOntologyRelatedSynonyms' | 'doDef' | 'doDefCitations' | 'icd10' | 'icdo' | 'mesh' | 'mondoDef' | 'mondoId' | 'ncit' | 'omim' | MyDiseaseInfoKeySpecifier)[]; export type MyDiseaseInfoFieldPolicy = { diseaseOntologyExactSynonyms?: FieldPolicy | FieldReadFunction, diseaseOntologyRelatedSynonyms?: FieldPolicy | FieldReadFunction, @@ -1427,6 +1427,7 @@ export type MyDiseaseInfoFieldPolicy = { icdo?: FieldPolicy | FieldReadFunction, mesh?: FieldPolicy | FieldReadFunction, mondoDef?: FieldPolicy | FieldReadFunction, + mondoId?: FieldPolicy | FieldReadFunction, ncit?: FieldPolicy | FieldReadFunction, omim?: FieldPolicy | FieldReadFunction }; diff --git a/client/src/app/generated/civic.apollo.ts b/client/src/app/generated/civic.apollo.ts index ae7ab95a0..296b30c35 100644 --- a/client/src/app/generated/civic.apollo.ts +++ b/client/src/app/generated/civic.apollo.ts @@ -3702,6 +3702,7 @@ export type MyDiseaseInfo = { icdo?: Maybe; mesh?: Maybe; mondoDef?: Maybe; + mondoId?: Maybe; ncit: Array; omim?: Maybe; }; @@ -8450,11 +8451,11 @@ export type DiseasesSummaryQueryVariables = Exact<{ }>; -export type DiseasesSummaryQuery = { __typename: 'Query', disease?: { __typename: 'Disease', id: number, name: string, doid?: string | undefined, diseaseUrl?: string | undefined, displayName: string, diseaseAliases: Array, link: string, deprecated: boolean, myDiseaseInfo?: { __typename: 'MyDiseaseInfo', diseaseOntologyExactSynonyms: Array, diseaseOntologyRelatedSynonyms: Array, mesh?: string | undefined, icdo?: string | undefined, icd10?: string | undefined, ncit: Array, omim?: string | undefined, doDef?: string | undefined, doDefCitations: Array, mondoDef?: string | undefined } | undefined } | undefined }; +export type DiseasesSummaryQuery = { __typename: 'Query', disease?: { __typename: 'Disease', id: number, name: string, doid?: string | undefined, diseaseUrl?: string | undefined, displayName: string, diseaseAliases: Array, link: string, deprecated: boolean, myDiseaseInfo?: { __typename: 'MyDiseaseInfo', diseaseOntologyExactSynonyms: Array, diseaseOntologyRelatedSynonyms: Array, mesh?: string | undefined, icdo?: string | undefined, icd10?: string | undefined, ncit: Array, omim?: string | undefined, doDef?: string | undefined, doDefCitations: Array, mondoDef?: string | undefined, mondoId?: string | undefined } | undefined } | undefined }; -export type MyDiseaseInfoFieldsFragment = { __typename: 'MyDiseaseInfo', diseaseOntologyExactSynonyms: Array, diseaseOntologyRelatedSynonyms: Array, mesh?: string | undefined, icdo?: string | undefined, icd10?: string | undefined, ncit: Array, omim?: string | undefined, doDef?: string | undefined, doDefCitations: Array, mondoDef?: string | undefined }; +export type MyDiseaseInfoFieldsFragment = { __typename: 'MyDiseaseInfo', diseaseOntologyExactSynonyms: Array, diseaseOntologyRelatedSynonyms: Array, mesh?: string | undefined, icdo?: string | undefined, icd10?: string | undefined, ncit: Array, omim?: string | undefined, doDef?: string | undefined, doDefCitations: Array, mondoDef?: string | undefined, mondoId?: string | undefined }; -export type DiseasesSummaryFieldsFragment = { __typename: 'Disease', id: number, name: string, doid?: string | undefined, diseaseUrl?: string | undefined, displayName: string, diseaseAliases: Array, link: string, deprecated: boolean, myDiseaseInfo?: { __typename: 'MyDiseaseInfo', diseaseOntologyExactSynonyms: Array, diseaseOntologyRelatedSynonyms: Array, mesh?: string | undefined, icdo?: string | undefined, icd10?: string | undefined, ncit: Array, omim?: string | undefined, doDef?: string | undefined, doDefCitations: Array, mondoDef?: string | undefined } | undefined }; +export type DiseasesSummaryFieldsFragment = { __typename: 'Disease', id: number, name: string, doid?: string | undefined, diseaseUrl?: string | undefined, displayName: string, diseaseAliases: Array, link: string, deprecated: boolean, myDiseaseInfo?: { __typename: 'MyDiseaseInfo', diseaseOntologyExactSynonyms: Array, diseaseOntologyRelatedSynonyms: Array, mesh?: string | undefined, icdo?: string | undefined, icd10?: string | undefined, ncit: Array, omim?: string | undefined, doDef?: string | undefined, doDefCitations: Array, mondoDef?: string | undefined, mondoId?: string | undefined } | undefined }; export type EvidenceDetailQueryVariables = Exact<{ evidenceId: Scalars['Int']; @@ -10920,6 +10921,7 @@ export const MyDiseaseInfoFieldsFragmentDoc = gql` doDef doDefCitations mondoDef + mondoId } `; export const DiseasesSummaryFieldsFragmentDoc = gql` diff --git a/client/src/app/generated/server.model.graphql b/client/src/app/generated/server.model.graphql index 0af2f9715..3d10fc435 100644 --- a/client/src/app/generated/server.model.graphql +++ b/client/src/app/generated/server.model.graphql @@ -6262,6 +6262,7 @@ type MyDiseaseInfo { icdo: String mesh: String mondoDef: String + mondoId: String ncit: [String!]! omim: String } diff --git a/client/src/app/generated/server.schema.json b/client/src/app/generated/server.schema.json index 8af88eae3..67fa31f12 100644 --- a/client/src/app/generated/server.schema.json +++ b/client/src/app/generated/server.schema.json @@ -29036,6 +29036,18 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "mondoId", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "ncit", "description": null, diff --git a/client/src/app/views/diseases/diseases-detail/diseases-summary/diseases-summary.query.gql b/client/src/app/views/diseases/diseases-detail/diseases-summary/diseases-summary.query.gql index b37857176..c0b85d8ea 100644 --- a/client/src/app/views/diseases/diseases-detail/diseases-summary/diseases-summary.query.gql +++ b/client/src/app/views/diseases/diseases-detail/diseases-summary/diseases-summary.query.gql @@ -15,6 +15,7 @@ fragment MyDiseaseInfoFields on MyDiseaseInfo { doDef doDefCitations mondoDef + mondoId } fragment DiseasesSummaryFields on Disease { diff --git a/server/app/graphql/types/entities/my_disease_info_type.rb b/server/app/graphql/types/entities/my_disease_info_type.rb index 36a280ffd..56ea81743 100644 --- a/server/app/graphql/types/entities/my_disease_info_type.rb +++ b/server/app/graphql/types/entities/my_disease_info_type.rb @@ -10,5 +10,6 @@ class MyDiseaseInfoType < Types::BaseObject field :do_def, String, null: true field :do_def_citations, [String], null: false field :mondo_def, String, null: true + field :mondo_id, String, null: true end end diff --git a/server/app/models/my_disease_info.rb b/server/app/models/my_disease_info.rb index 7cf5c196f..18ea795cc 100644 --- a/server/app/models/my_disease_info.rb +++ b/server/app/models/my_disease_info.rb @@ -30,7 +30,8 @@ def parse_response(resp) do_def, do_def_citations = process_do_def(data.dig('def')) - mondo_def = process_mondo_def(p) + mondo_data = p['hits'][0].dig('mondo') + mondo_def = process_mondo_def(mondo_data) return { 'disease_ontology_exact_synonyms': Array(data.dig('synonyms', 'exact')), @@ -42,7 +43,8 @@ def parse_response(resp) 'omim': data.dig('xrefs', 'omim'), 'do_def': do_def, 'do_def_citations': do_def_citations, - 'mondo_def': mondo_def + 'mondo_def': mondo_def, + 'mondo_id': mondo_data.dig('mondo') } end @@ -60,7 +62,8 @@ def fields 'disease_ontology.xrefs.omim', 'disease_ontology.xrefs.icd10', 'disease_ontology.xrefs.icdo', - 'mondo.definition' + 'mondo.definition', + 'mondo.mondo', ] end @@ -74,8 +77,8 @@ def cache_key(disease) "my_disease_info_#{disease.id}_#{disease.updated_at}" end - def process_mondo_def(p) - if md = p['hits'][0].dig('mondo', 'definition') + def process_mondo_def(mondo_data) + if md = mondo_data.dig('definition') md.gsub(/\[(.+)\]/, '').strip else nil