Skip to content

Commit

Permalink
Add mondo ID to disease detail pages
Browse files Browse the repository at this point in the history
  • Loading branch information
susannasiebert committed May 9, 2024
1 parent 58708da commit 5a7cec2
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,18 @@
<ng-container *ngSwitchCase="1">
<div class="tab-padding">
<nz-row [nzGutter]="8">
<nz-col [nzSpan]="12">
<nz-descriptions nzSize="small" [nzBordered]="true" [nzColumn]="2">
<nz-col [nzSpan]="24">
<nz-descriptions nzSize="small" [nzBordered]="true" [nzColumn]="1">
<nz-descriptions-item nzTitle="Definition">
<ng-container *ngIf="diseaseInfo.mondoDef; else noValue">
{{diseaseInfo.mondoDef}}
</ng-container>
</nz-descriptions-item>
<nz-descriptions-item nzTitle="ID">
<ng-container *ngIf="diseaseInfo.mondoId; else noValue">
{{diseaseInfo.mondoId}}
</ng-container>
</nz-descriptions-item>
</nz-descriptions>
</nz-col>
</nz-row>
Expand Down
3 changes: 2 additions & 1 deletion client/src/app/generated/civic.apollo-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ export type MyChemInfoFieldPolicy = {
pubchemCid?: FieldPolicy<any> | FieldReadFunction<any>,
rxnorm?: FieldPolicy<any> | FieldReadFunction<any>
};
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<any> | FieldReadFunction<any>,
diseaseOntologyRelatedSynonyms?: FieldPolicy<any> | FieldReadFunction<any>,
Expand All @@ -1427,6 +1427,7 @@ export type MyDiseaseInfoFieldPolicy = {
icdo?: FieldPolicy<any> | FieldReadFunction<any>,
mesh?: FieldPolicy<any> | FieldReadFunction<any>,
mondoDef?: FieldPolicy<any> | FieldReadFunction<any>,
mondoId?: FieldPolicy<any> | FieldReadFunction<any>,
ncit?: FieldPolicy<any> | FieldReadFunction<any>,
omim?: FieldPolicy<any> | FieldReadFunction<any>
};
Expand Down
8 changes: 5 additions & 3 deletions client/src/app/generated/civic.apollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3702,6 +3702,7 @@ export type MyDiseaseInfo = {
icdo?: Maybe<Scalars['String']>;
mesh?: Maybe<Scalars['String']>;
mondoDef?: Maybe<Scalars['String']>;
mondoId?: Maybe<Scalars['String']>;
ncit: Array<Scalars['String']>;
omim?: Maybe<Scalars['String']>;
};
Expand Down Expand Up @@ -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<string>, link: string, deprecated: boolean, myDiseaseInfo?: { __typename: 'MyDiseaseInfo', diseaseOntologyExactSynonyms: Array<string>, diseaseOntologyRelatedSynonyms: Array<string>, mesh?: string | undefined, icdo?: string | undefined, icd10?: string | undefined, ncit: Array<string>, omim?: string | undefined, doDef?: string | undefined, doDefCitations: Array<string>, 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<string>, link: string, deprecated: boolean, myDiseaseInfo?: { __typename: 'MyDiseaseInfo', diseaseOntologyExactSynonyms: Array<string>, diseaseOntologyRelatedSynonyms: Array<string>, mesh?: string | undefined, icdo?: string | undefined, icd10?: string | undefined, ncit: Array<string>, omim?: string | undefined, doDef?: string | undefined, doDefCitations: Array<string>, mondoDef?: string | undefined, mondoId?: string | undefined } | undefined } | undefined };

export type MyDiseaseInfoFieldsFragment = { __typename: 'MyDiseaseInfo', diseaseOntologyExactSynonyms: Array<string>, diseaseOntologyRelatedSynonyms: Array<string>, mesh?: string | undefined, icdo?: string | undefined, icd10?: string | undefined, ncit: Array<string>, omim?: string | undefined, doDef?: string | undefined, doDefCitations: Array<string>, mondoDef?: string | undefined };
export type MyDiseaseInfoFieldsFragment = { __typename: 'MyDiseaseInfo', diseaseOntologyExactSynonyms: Array<string>, diseaseOntologyRelatedSynonyms: Array<string>, mesh?: string | undefined, icdo?: string | undefined, icd10?: string | undefined, ncit: Array<string>, omim?: string | undefined, doDef?: string | undefined, doDefCitations: Array<string>, 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<string>, link: string, deprecated: boolean, myDiseaseInfo?: { __typename: 'MyDiseaseInfo', diseaseOntologyExactSynonyms: Array<string>, diseaseOntologyRelatedSynonyms: Array<string>, mesh?: string | undefined, icdo?: string | undefined, icd10?: string | undefined, ncit: Array<string>, omim?: string | undefined, doDef?: string | undefined, doDefCitations: Array<string>, mondoDef?: string | undefined } | undefined };
export type DiseasesSummaryFieldsFragment = { __typename: 'Disease', id: number, name: string, doid?: string | undefined, diseaseUrl?: string | undefined, displayName: string, diseaseAliases: Array<string>, link: string, deprecated: boolean, myDiseaseInfo?: { __typename: 'MyDiseaseInfo', diseaseOntologyExactSynonyms: Array<string>, diseaseOntologyRelatedSynonyms: Array<string>, mesh?: string | undefined, icdo?: string | undefined, icd10?: string | undefined, ncit: Array<string>, omim?: string | undefined, doDef?: string | undefined, doDefCitations: Array<string>, mondoDef?: string | undefined, mondoId?: string | undefined } | undefined };

export type EvidenceDetailQueryVariables = Exact<{
evidenceId: Scalars['Int'];
Expand Down Expand Up @@ -10920,6 +10921,7 @@ export const MyDiseaseInfoFieldsFragmentDoc = gql`
doDef
doDefCitations
mondoDef
mondoId
}
`;
export const DiseasesSummaryFieldsFragmentDoc = gql`
Expand Down
1 change: 1 addition & 0 deletions client/src/app/generated/server.model.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6262,6 +6262,7 @@ type MyDiseaseInfo {
icdo: String
mesh: String
mondoDef: String
mondoId: String
ncit: [String!]!
omim: String
}
Expand Down
12 changes: 12 additions & 0 deletions client/src/app/generated/server.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ fragment MyDiseaseInfoFields on MyDiseaseInfo {
doDef
doDefCitations
mondoDef
mondoId
}

fragment DiseasesSummaryFields on Disease {
Expand Down
1 change: 1 addition & 0 deletions server/app/graphql/types/entities/my_disease_info_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 8 additions & 5 deletions server/app/models/my_disease_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 5a7cec2

Please sign in to comment.