From ce0851b2193164f8c473c4515ed19e7bafbf1e5b Mon Sep 17 00:00:00 2001 From: Kevin Schaper Date: Fri, 15 Nov 2024 14:36:56 -0800 Subject: [PATCH] Add faceting/filtering to association endpoints (#786) Updates association endpoints to allow facet field, facet query and (open) filter query params --- backend/src/monarch_py/api/association.py | 6 + backend/src/monarch_py/api/entity.py | 14 ++ backend/src/monarch_py/datamodels/model.py | 114 ++++++++++- backend/src/monarch_py/datamodels/model.yaml | 6 + backend/src/monarch_py/datamodels/solr.py | 3 + .../solr/solr_implementation.py | 19 +- .../implementations/solr/solr_parsers.py | 27 ++- .../implementations/solr/solr_query_utils.py | 19 +- backend/tests/api/__init__.py | 0 backend/tests/api/test_association_router.py | 3 + backend/tests/api/test_entity_router.py | 3 + .../fixtures/association_counts_query.py | 1 + .../fixtures/association_counts_response.py | 3 +- .../fixtures/association_query_direct.py | 1 + .../fixtures/association_query_indirect.py | 1 + .../tests/fixtures/association_response.py | 1 + backend/tests/fixtures/association_table.py | 2 + .../fixtures/association_table_response.py | 1 + backend/tests/fixtures/associations.py | 2 + .../tests/fixtures/associations_compact.py | 2 + backend/tests/fixtures/autocomplete_query.py | 1 + .../tests/fixtures/autocomplete_response.py | 1 + backend/tests/fixtures/histopheno_query.py | 1 + backend/tests/fixtures/histopheno_response.py | 1 + backend/tests/fixtures/mapping_query.py | 1 + backend/tests/fixtures/mapping_response.py | 1 + backend/tests/fixtures/search_query.py | 1 + backend/tests/fixtures/search_response.py | 3 +- frontend/fixtures/association-table.json | 4 +- frontend/fixtures/associations-compact.json | 4 +- frontend/fixtures/associations.json | 4 +- .../phenotype-explorer-multi-compare.json | 179 +++++++++--------- .../fixtures/phenotype-explorer-search.json | 72 +++---- frontend/src/api/model.ts | 12 ++ frontend/src/pages/metadata.json | 49 +++++ 35 files changed, 423 insertions(+), 139 deletions(-) create mode 100644 backend/tests/api/__init__.py create mode 100644 frontend/src/pages/metadata.json diff --git a/backend/src/monarch_py/api/association.py b/backend/src/monarch_py/api/association.py index 992198037..ca203d144 100644 --- a/backend/src/monarch_py/api/association.py +++ b/backend/src/monarch_py/api/association.py @@ -29,6 +29,9 @@ async def _get_associations( object_taxon: Union[List[str], None] = Query(default=None), entity: Union[List[str], None] = Query(default=None), direct: bool = Query(default=False), + facet_fields: List[str] = Query(default_factory=list), + facet_queries: List[str] = Query(default_factory=list), + filter_queries: List[str] = Query(default_factory=list), compact: bool = Query(default=False), pagination: PaginationParams = Depends(), format: OutputFormat = Query( @@ -52,6 +55,9 @@ async def _get_associations( object_namespace=object_namespace, direct=direct, compact=compact, + facet_fields=facet_fields, + facet_queries=facet_queries, + filter_queries=filter_queries, offset=pagination.offset, limit=pagination.limit, ) diff --git a/backend/src/monarch_py/api/entity.py b/backend/src/monarch_py/api/entity.py index fb4002c14..a6d536933 100644 --- a/backend/src/monarch_py/api/entity.py +++ b/backend/src/monarch_py/api/entity.py @@ -86,6 +86,17 @@ def _association_table( title="Only return direct associations", examples=[True, False], ), + facet_fields: List[str] = Query( + default=None, + title="Facet fields to include in the response", + examples=["subject", "subject_taxon", "predicate"], + ), + facet_queries: List[str] = Query( + default=None, title="Facet queries to include in the response", examples=['subject_category:"biolink:Gene"'] + ), + filter_queries: List[str] = Query( + default=None, title="Filter queries to limit the response", examples=['subject_category:"biolink:Gene"'] + ), ) -> Union[AssociationTableResults, str]: """ Retrieves association table data for a given entity and association type @@ -105,6 +116,9 @@ def _association_table( q=query, traverse_orthologs=traverse_orthologs, direct=direct, + facet_fields=facet_fields, + facet_queries=facet_queries, + filter_queries=filter_queries, sort=sort, offset=pagination.offset, limit=pagination.limit, diff --git a/backend/src/monarch_py/datamodels/model.py b/backend/src/monarch_py/datamodels/model.py index b453f149f..91749743a 100644 --- a/backend/src/monarch_py/datamodels/model.py +++ b/backend/src/monarch_py/datamodels/model.py @@ -2205,6 +2205,36 @@ class AssociationResults(Results): } }, ) + facet_fields: Optional[List[FacetField]] = Field( + None, + description="""Collection of facet field responses with the field values and counts""", + json_schema_extra={ + "linkml_meta": { + "alias": "facet_fields", + "domain_of": [ + "AssociationResults", + "CompactAssociationResults", + "AssociationTableResults", + "SearchResults", + ], + } + }, + ) + facet_queries: Optional[List[FacetValue]] = Field( + None, + description="""Collection of facet query responses with the query string values and counts""", + json_schema_extra={ + "linkml_meta": { + "alias": "facet_queries", + "domain_of": [ + "AssociationResults", + "CompactAssociationResults", + "AssociationTableResults", + "SearchResults", + ], + } + }, + ) limit: int = Field( ..., description="""number of items to return in a response""", @@ -2250,6 +2280,36 @@ class CompactAssociationResults(Results): } }, ) + facet_fields: Optional[List[FacetField]] = Field( + None, + description="""Collection of facet field responses with the field values and counts""", + json_schema_extra={ + "linkml_meta": { + "alias": "facet_fields", + "domain_of": [ + "AssociationResults", + "CompactAssociationResults", + "AssociationTableResults", + "SearchResults", + ], + } + }, + ) + facet_queries: Optional[List[FacetValue]] = Field( + None, + description="""Collection of facet query responses with the query string values and counts""", + json_schema_extra={ + "linkml_meta": { + "alias": "facet_queries", + "domain_of": [ + "AssociationResults", + "CompactAssociationResults", + "AssociationTableResults", + "SearchResults", + ], + } + }, + ) limit: int = Field( ..., description="""number of items to return in a response""", @@ -2295,6 +2355,36 @@ class AssociationTableResults(Results): } }, ) + facet_fields: Optional[List[FacetField]] = Field( + None, + description="""Collection of facet field responses with the field values and counts""", + json_schema_extra={ + "linkml_meta": { + "alias": "facet_fields", + "domain_of": [ + "AssociationResults", + "CompactAssociationResults", + "AssociationTableResults", + "SearchResults", + ], + } + }, + ) + facet_queries: Optional[List[FacetValue]] = Field( + None, + description="""Collection of facet query responses with the query string values and counts""", + json_schema_extra={ + "linkml_meta": { + "alias": "facet_queries", + "domain_of": [ + "AssociationResults", + "CompactAssociationResults", + "AssociationTableResults", + "SearchResults", + ], + } + }, + ) limit: int = Field( ..., description="""number of items to return in a response""", @@ -2673,12 +2763,32 @@ class SearchResults(Results): facet_fields: Optional[List[FacetField]] = Field( None, description="""Collection of facet field responses with the field values and counts""", - json_schema_extra={"linkml_meta": {"alias": "facet_fields", "domain_of": ["SearchResults"]}}, + json_schema_extra={ + "linkml_meta": { + "alias": "facet_fields", + "domain_of": [ + "AssociationResults", + "CompactAssociationResults", + "AssociationTableResults", + "SearchResults", + ], + } + }, ) facet_queries: Optional[List[FacetValue]] = Field( None, description="""Collection of facet query responses with the query string values and counts""", - json_schema_extra={"linkml_meta": {"alias": "facet_queries", "domain_of": ["SearchResults"]}}, + json_schema_extra={ + "linkml_meta": { + "alias": "facet_queries", + "domain_of": [ + "AssociationResults", + "CompactAssociationResults", + "AssociationTableResults", + "SearchResults", + ], + } + }, ) limit: int = Field( ..., diff --git a/backend/src/monarch_py/datamodels/model.yaml b/backend/src/monarch_py/datamodels/model.yaml index b31c5ec6e..068bfbdcc 100644 --- a/backend/src/monarch_py/datamodels/model.yaml +++ b/backend/src/monarch_py/datamodels/model.yaml @@ -125,6 +125,8 @@ classes: is_a: Results slots: - items + - facet_fields + - facet_queries slot_usage: items: range: Association @@ -141,6 +143,8 @@ classes: is_a: Results slots: - items + - facet_fields + - facet_queries slot_usage: items: range: CompactAssociation @@ -148,6 +152,8 @@ classes: is_a: Results slots: - items + - facet_fields + - facet_queries slot_usage: items: range: DirectionalAssociation diff --git a/backend/src/monarch_py/datamodels/solr.py b/backend/src/monarch_py/datamodels/solr.py index f9025b4e5..541aaed3d 100644 --- a/backend/src/monarch_py/datamodels/solr.py +++ b/backend/src/monarch_py/datamodels/solr.py @@ -44,6 +44,7 @@ class SolrQuery(BaseModel): facet_fields: Optional[List[str]] = Field(default_factory=list) facet_queries: Optional[List[str]] = Field(default_factory=list) filter_queries: Optional[List[str]] = Field(default_factory=list) + facet_mincount: int = 1 query_fields: Optional[str] = None def_type: str = "edismax" q_op: str = "AND" # See SOLR-8812, need this plus mm=100% to allow boolean operators in queries @@ -85,6 +86,8 @@ def _solrize(self, value): return "facet.query" elif value == "filter_queries": return "fq" + elif value == "facet_mincount": + return "facet.mincount" elif value == "query_fields": return "qf" elif value == "def_type": diff --git a/backend/src/monarch_py/implementations/solr/solr_implementation.py b/backend/src/monarch_py/implementations/solr/solr_implementation.py index 6ca787f3c..a54905a83 100644 --- a/backend/src/monarch_py/implementations/solr/solr_implementation.py +++ b/backend/src/monarch_py/implementations/solr/solr_implementation.py @@ -123,7 +123,7 @@ def get_entity(self, id: str, extra: bool) -> Optional[Union[Node, Entity]]: ).items ] node: Node = Node( - **entity.dict(), + **entity.model_dump(), node_hierarchy=self._get_node_hierarchy(entity), association_counts=self.get_association_counts(id).items, external_links=get_links_for_field(entity.xref) if entity.xref else [], @@ -244,6 +244,9 @@ def get_associations( entity: Optional[List[str]] = None, direct: bool = False, q: Optional[str] = None, + facet_fields: Optional[List[str]] = None, + facet_queries: Optional[List[str]] = None, + filter_queries: Optional[List[str]] = None, compact: bool = False, offset: int = 0, limit: int = 20, @@ -259,6 +262,9 @@ def get_associations( object_closure: Filter to only associations with the specified term ID as an ancestor of the object. Defaults to None entity: Filter to only associations where the specified entities are the subject or the object. Defaults to None. q: Query string to search within matches. Defaults to None. + facet_fields: List of fields to include facet counts for. Defaults to None. + facet_queries: List of queries to include facet counts for. Defaults to None. + filter_queries: List of queries to filter results by. Defaults to None. compact: Return compact results with fewer fields. Defaults to False. offset: Result offset, for pagination. Defaults to 0. limit: Limit results to specified number. Defaults to 20. @@ -283,6 +289,9 @@ def get_associations( object_namespace=[object_namespace] if isinstance(object_namespace, str) else object_namespace, direct=direct, q=q, + facet_fields=facet_fields, + facet_queries=facet_queries, + filter_queries=filter_queries, offset=offset, limit=limit, ) @@ -430,6 +439,7 @@ def get_association_facets( entity: Optional[List[str]] = None, facet_fields: Optional[List[str]] = None, facet_queries: Optional[List[str]] = None, + filter_queries: Optional[List[str]] = None, ) -> SearchResults: solr = SolrService(base_url=self.base_url, core=core.ASSOCIATION) @@ -445,6 +455,7 @@ def get_association_facets( limit=0, facet_fields=facet_fields, facet_queries=facet_queries, + filter_queries=filter_queries, ) query_result = solr.query(query) return SearchResults( @@ -467,6 +478,9 @@ def get_association_table( traverse_orthologs: bool = False, direct: bool = False, q: Optional[str] = None, + facet_fields: Optional[List[str]] = None, + facet_queries: Optional[List[str]] = None, + filter_queries: Optional[List[str]] = None, sort: Optional[List[str]] = None, offset: int = 0, limit: int = 5, @@ -485,6 +499,9 @@ def get_association_table( category=category.value, direct=direct, q=q, + facet_fields=facet_fields, + facet_queries=facet_queries, + filter_queries=filter_queries, sort=sort, offset=offset, limit=limit, diff --git a/backend/src/monarch_py/implementations/solr/solr_parsers.py b/backend/src/monarch_py/implementations/solr/solr_parsers.py index cb18e878e..4753ed821 100644 --- a/backend/src/monarch_py/implementations/solr/solr_parsers.py +++ b/backend/src/monarch_py/implementations/solr/solr_parsers.py @@ -54,7 +54,14 @@ def parse_associations( ) for doc in query_result.response.docs ] - return CompactAssociationResults(items=associations, limit=limit, offset=offset, total=total) + return CompactAssociationResults( + items=associations, + limit=limit, + offset=offset, + total=total, + facet_fields=convert_facet_fields(query_result.facet_counts.facet_fields), + facet_queries=convert_facet_queries(query_result.facet_counts.facet_queries), + ) else: for doc in query_result.response.docs: try: @@ -72,7 +79,14 @@ def parse_associations( get_links_for_field(association.publications) if association.publications else [] ) associations.append(association) - return AssociationResults(items=associations, limit=limit, offset=offset, total=total) + return AssociationResults( + items=associations, + limit=limit, + offset=offset, + total=total, + facet_fields=convert_facet_fields(query_result.facet_counts.facet_fields), + facet_queries=convert_facet_queries(query_result.facet_counts.facet_queries), + ) def parse_association_counts(query_result: SolrQueryResult, entity: str) -> AssociationCountList: @@ -140,7 +154,14 @@ def parse_association_table( except ValidationError: logger.error(f"Validation error for {doc}") raise - results = AssociationTableResults(items=associations, limit=limit, offset=offset, total=total) + results = AssociationTableResults( + items=associations, + limit=limit, + offset=offset, + total=total, + facet_fields=convert_facet_fields(query_result.facet_counts.facet_fields), + facet_queries=convert_facet_queries(query_result.facet_counts.facet_queries), + ) for i in zip(results.items, query_result.response.docs): assert i[0].subject == i[1]["subject"] return results diff --git a/backend/src/monarch_py/implementations/solr/solr_query_utils.py b/backend/src/monarch_py/implementations/solr/solr_query_utils.py index 4eb684eec..bd9e24ec2 100644 --- a/backend/src/monarch_py/implementations/solr/solr_query_utils.py +++ b/backend/src/monarch_py/implementations/solr/solr_query_utils.py @@ -25,6 +25,8 @@ def build_association_query( sort: Optional[List[str]] = None, facet_fields: Optional[List[str]] = None, facet_queries: Optional[List[str]] = None, + filter_queries: Optional[List[str]] = None, + facet_mincount: int = 1, offset: int = 0, limit: int = 20, ) -> SolrQuery: @@ -71,6 +73,9 @@ def build_association_query( query.facet_fields = facet_fields if facet_queries: query.facet_queries = facet_queries + if filter_queries: + query.filter_queries.extend(filter_queries) + query.facet_mincount = facet_mincount return query @@ -79,6 +84,9 @@ def build_association_table_query( category: str, direct: bool = False, q: Optional[str] = None, + facet_fields: List[str] = None, + facet_queries: List[str] = None, + filter_queries: List[str] = None, offset: int = 0, limit: int = 5, sort: List[str] = None, @@ -94,7 +102,16 @@ def build_association_table_query( ] query = build_association_query( - entity=entity, category=[category], q=q, sort=sort, offset=offset, limit=limit, direct=direct + entity=entity, + category=[category], + q=q, + sort=sort, + offset=offset, + limit=limit, + direct=direct, + facet_fields=facet_fields, + facet_queries=facet_queries, + filter_queries=filter_queries, ) return query diff --git a/backend/tests/api/__init__.py b/backend/tests/api/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/backend/tests/api/test_association_router.py b/backend/tests/api/test_association_router.py index fe05430e1..c5c75103e 100644 --- a/backend/tests/api/test_association_router.py +++ b/backend/tests/api/test_association_router.py @@ -41,6 +41,9 @@ def test_associations_params(mock_get_assoc): "object_namespace": ["MONDO", "HP"], "direct": True, "compact": True, + "facet_fields": [], + "facet_queries": [], + "filter_queries": [], "offset": 0, "limit": 20, } diff --git a/backend/tests/api/test_entity_router.py b/backend/tests/api/test_entity_router.py index 0b9cd6b11..9de8217d8 100644 --- a/backend/tests/api/test_entity_router.py +++ b/backend/tests/api/test_entity_router.py @@ -26,6 +26,9 @@ def test_association_table(mock_get_assoc_table): q=None, traverse_orthologs=False, direct=False, + facet_fields=None, + facet_queries=None, + filter_queries=None, sort=None, offset=0, limit=20, diff --git a/backend/tests/fixtures/association_counts_query.py b/backend/tests/fixtures/association_counts_query.py index 3d1a49d2c..848ec8ba0 100644 --- a/backend/tests/fixtures/association_counts_query.py +++ b/backend/tests/fixtures/association_counts_query.py @@ -47,6 +47,7 @@ def association_counts_query(): "filter_queries": [ 'subject:"MONDO:0020121" OR subject_closure:"MONDO:0020121" OR object:"MONDO:0020121" OR object_closure:"MONDO:0020121"' ], + "facet_mincount": 1, "query_fields": None, "def_type": "edismax", "q_op": "AND", diff --git a/backend/tests/fixtures/association_counts_response.py b/backend/tests/fixtures/association_counts_response.py index a506c9e96..b5f25f861 100644 --- a/backend/tests/fixtures/association_counts_response.py +++ b/backend/tests/fixtures/association_counts_response.py @@ -5,7 +5,7 @@ def association_counts_response(): return { "responseHeader": { - "QTime": 0, + "QTime": 1, "params": { "facet.query": [ '(category:"biolink:DiseaseToPhenotypicFeatureAssociation") AND (subject:"MONDO:0020121" OR subject_closure:"MONDO:0020121")', @@ -48,6 +48,7 @@ def association_counts_response(): "start": "0", "q.op": "AND", "fq": 'subject:"MONDO:0020121" OR subject_closure:"MONDO:0020121" OR object:"MONDO:0020121" OR object_closure:"MONDO:0020121"', + "facet.mincount": "1", "rows": "20", "facet": "true", }, diff --git a/backend/tests/fixtures/association_query_direct.py b/backend/tests/fixtures/association_query_direct.py index d02137c71..b8c2c2edc 100644 --- a/backend/tests/fixtures/association_query_direct.py +++ b/backend/tests/fixtures/association_query_direct.py @@ -26,6 +26,7 @@ def association_query_direct(): "object:TEST\\:0000002", 'subject:"TEST:0000005" OR object:"TEST:0000005"', ], + "facet_mincount": 1, "query_fields": "subject subject_label^2 subject_label_t subject_closure subject_closure_label subject_closure_label_t predicate predicate_t object object_label^2 object_label_t object_closure object_closure_label object_closure_label_t publications has_evidence primary_knowledge_source aggregator_knowledge_source provided_by ", "def_type": "edismax", "q_op": "AND", diff --git a/backend/tests/fixtures/association_query_indirect.py b/backend/tests/fixtures/association_query_indirect.py index faaf6ab28..5e8503e9b 100644 --- a/backend/tests/fixtures/association_query_indirect.py +++ b/backend/tests/fixtures/association_query_indirect.py @@ -26,6 +26,7 @@ def association_query_indirect(): 'object:"TEST:0000002" OR object_closure:"TEST:0000002"', 'subject:"TEST:0000005" OR subject_closure:"TEST:0000005" OR object:"TEST:0000005" OR object_closure:"TEST:0000005"', ], + "facet_mincount": 1, "query_fields": "subject subject_label^2 subject_label_t subject_closure subject_closure_label subject_closure_label_t predicate predicate_t object object_label^2 object_label_t object_closure object_closure_label object_closure_label_t publications has_evidence primary_knowledge_source aggregator_knowledge_source provided_by ", "def_type": "edismax", "q_op": "AND", diff --git a/backend/tests/fixtures/association_response.py b/backend/tests/fixtures/association_response.py index af6520502..e7d218f66 100644 --- a/backend/tests/fixtures/association_response.py +++ b/backend/tests/fixtures/association_response.py @@ -14,6 +14,7 @@ def association_response(): "start": "0", "q.op": "AND", "fq": 'subject:"MONDO:0020121" OR subject_closure:"MONDO:0020121" OR object:"MONDO:0020121" OR object_closure:"MONDO:0020121"', + "facet.mincount": "1", "rows": "20", "facet": "true", }, diff --git a/backend/tests/fixtures/association_table.py b/backend/tests/fixtures/association_table.py index ead69f3e4..41124b4e1 100644 --- a/backend/tests/fixtures/association_table.py +++ b/backend/tests/fixtures/association_table.py @@ -1453,4 +1453,6 @@ def association_table(): "direction": "outgoing", }, ], + "facet_fields": [], + "facet_queries": [], } diff --git a/backend/tests/fixtures/association_table_response.py b/backend/tests/fixtures/association_table_response.py index ec3c6100e..5f557de52 100644 --- a/backend/tests/fixtures/association_table_response.py +++ b/backend/tests/fixtures/association_table_response.py @@ -17,6 +17,7 @@ def association_table_response(): "category:biolink\\:DiseaseToPhenotypicFeatureAssociation", 'subject:"MONDO:0020121" OR subject_closure:"MONDO:0020121" OR object:"MONDO:0020121" OR object_closure:"MONDO:0020121"', ], + "facet.mincount": "1", "sort": "frequency_computed_sortable_float desc, evidence_count desc, subject_label asc, predicate asc, object_label asc, primary_knowledge_source asc", "rows": "5", "facet": "true", diff --git a/backend/tests/fixtures/associations.py b/backend/tests/fixtures/associations.py index 07f08b23c..f6c23cc4a 100644 --- a/backend/tests/fixtures/associations.py +++ b/backend/tests/fixtures/associations.py @@ -5800,4 +5800,6 @@ def associations(): "disease_context_qualifier_closure_label": None, }, ], + "facet_fields": [], + "facet_queries": [], } diff --git a/backend/tests/fixtures/associations_compact.py b/backend/tests/fixtures/associations_compact.py index fb8fd4797..85fd5b10c 100644 --- a/backend/tests/fixtures/associations_compact.py +++ b/backend/tests/fixtures/associations_compact.py @@ -189,4 +189,6 @@ def associations_compact(): "negated": False, }, ], + "facet_fields": [], + "facet_queries": [], } diff --git a/backend/tests/fixtures/autocomplete_query.py b/backend/tests/fixtures/autocomplete_query.py index 4e578d7b3..733a5be2c 100644 --- a/backend/tests/fixtures/autocomplete_query.py +++ b/backend/tests/fixtures/autocomplete_query.py @@ -12,6 +12,7 @@ def autocomplete_query(): "facet_fields": [], "facet_queries": [], "filter_queries": [], + "facet_mincount": 1, "query_fields": "id^100 name^10 name_t^5 name_ac symbol^10 symbol_t^5 symbol_ac synonym synonym_t synonym_ac description_t xref", "def_type": "edismax", "q_op": "AND", diff --git a/backend/tests/fixtures/autocomplete_response.py b/backend/tests/fixtures/autocomplete_response.py index 230abed5a..80764896e 100644 --- a/backend/tests/fixtures/autocomplete_response.py +++ b/backend/tests/fixtures/autocomplete_response.py @@ -15,6 +15,7 @@ def autocomplete_response(): "start": "0", "q.op": "AND", "boost": 'product(if(termfreq(category,"biolink:PhenotypicFeature"),1.1,1),if(termfreq(category,"biolink:Disease"),1.3,1),if(and(termfreq(in_taxon,"NCBITaxon:9606"),termfreq(category,"biolink:Gene")),1.1,1),if(termfreq(deprecated,"true"),0.1,1))', + "facet.mincount": "1", "rows": "10", "facet": "true", }, diff --git a/backend/tests/fixtures/histopheno_query.py b/backend/tests/fixtures/histopheno_query.py index c11db3a51..e2d3dfb4c 100644 --- a/backend/tests/fixtures/histopheno_query.py +++ b/backend/tests/fixtures/histopheno_query.py @@ -33,6 +33,7 @@ def histopheno_query(): 'object_closure:"UPHENO:0003013"', ], "filter_queries": ['subject:"MONDO:0020121" OR subject_closure:"MONDO:0020121"'], + "facet_mincount": 1, "query_fields": None, "def_type": "edismax", "q_op": "AND", diff --git a/backend/tests/fixtures/histopheno_response.py b/backend/tests/fixtures/histopheno_response.py index 30a7cbe26..ad6d71b0a 100644 --- a/backend/tests/fixtures/histopheno_response.py +++ b/backend/tests/fixtures/histopheno_response.py @@ -36,6 +36,7 @@ def histopheno_response(): "start": "0", "q.op": "AND", "fq": 'subject:"MONDO:0020121" OR subject_closure:"MONDO:0020121"', + "facet.mincount": "1", "rows": "0", "facet": "true", }, diff --git a/backend/tests/fixtures/mapping_query.py b/backend/tests/fixtures/mapping_query.py index 101a1ad84..b24fa2acc 100644 --- a/backend/tests/fixtures/mapping_query.py +++ b/backend/tests/fixtures/mapping_query.py @@ -12,6 +12,7 @@ def mapping_query(): "facet_fields": [], "facet_queries": [], "filter_queries": ['subject_id:"MONDO\\:0020121" OR object_id:"MONDO\\:0020121"'], + "facet_mincount": 1, "query_fields": None, "def_type": "edismax", "q_op": "AND", diff --git a/backend/tests/fixtures/mapping_response.py b/backend/tests/fixtures/mapping_response.py index 2862d357d..049de649a 100644 --- a/backend/tests/fixtures/mapping_response.py +++ b/backend/tests/fixtures/mapping_response.py @@ -14,6 +14,7 @@ def mapping_response(): "start": "0", "q.op": "AND", "fq": 'subject_id:"MONDO\\:0020121" OR object_id:"MONDO\\:0020121"', + "facet.mincount": "1", "rows": "20", "facet": "true", }, diff --git a/backend/tests/fixtures/search_query.py b/backend/tests/fixtures/search_query.py index 33829b5c5..159fcaf1b 100644 --- a/backend/tests/fixtures/search_query.py +++ b/backend/tests/fixtures/search_query.py @@ -12,6 +12,7 @@ def search_query(): "facet_fields": [], "facet_queries": [], "filter_queries": ["name:*"], + "facet_mincount": 1, "query_fields": "id^100 name^10 name_t^5 name_ac symbol^10 symbol_t^5 symbol_ac synonym synonym_t synonym_ac description_t xref", "def_type": "edismax", "q_op": "AND", diff --git a/backend/tests/fixtures/search_response.py b/backend/tests/fixtures/search_response.py index 285dcfa8f..268660558 100644 --- a/backend/tests/fixtures/search_response.py +++ b/backend/tests/fixtures/search_response.py @@ -5,7 +5,7 @@ def search_response(): return { "responseHeader": { - "QTime": 0, + "QTime": 2, "params": { "mm": "100%", "q": "fanconi", @@ -16,6 +16,7 @@ def search_response(): "q.op": "AND", "boost": 'product(if(termfreq(category,"biolink:PhenotypicFeature"),1.1,1),if(termfreq(category,"biolink:Disease"),1.3,1),if(and(termfreq(in_taxon,"NCBITaxon:9606"),termfreq(category,"biolink:Gene")),1.1,1),if(termfreq(deprecated,"true"),0.1,1))', "fq": "name:*", + "facet.mincount": "1", "rows": "20", "facet": "true", }, diff --git a/frontend/fixtures/association-table.json b/frontend/fixtures/association-table.json index ba0714b2e..8b98cb06e 100644 --- a/frontend/fixtures/association-table.json +++ b/frontend/fixtures/association-table.json @@ -1553,5 +1553,7 @@ "disease_context_qualifier_closure_label": null, "direction": "outgoing" } - ] + ], + "facet_fields": [], + "facet_queries": [] } diff --git a/frontend/fixtures/associations-compact.json b/frontend/fixtures/associations-compact.json index 0ac9b7f0c..8a2ae8264 100644 --- a/frontend/fixtures/associations-compact.json +++ b/frontend/fixtures/associations-compact.json @@ -183,5 +183,7 @@ "object_label": "Lower limb muscle weakness", "negated": false } - ] + ], + "facet_fields": [], + "facet_queries": [] } diff --git a/frontend/fixtures/associations.json b/frontend/fixtures/associations.json index 3caa6d9b0..d9a250137 100644 --- a/frontend/fixtures/associations.json +++ b/frontend/fixtures/associations.json @@ -5954,5 +5954,7 @@ "disease_context_qualifier_closure": null, "disease_context_qualifier_closure_label": null } - ] + ], + "facet_fields": [], + "facet_queries": [] } diff --git a/frontend/fixtures/phenotype-explorer-multi-compare.json b/frontend/fixtures/phenotype-explorer-multi-compare.json index 5b315f4d4..862ecb3ef 100644 --- a/frontend/fixtures/phenotype-explorer-multi-compare.json +++ b/frontend/fixtures/phenotype-explorer-multi-compare.json @@ -22,25 +22,30 @@ "has_phenotype_closure_label": null, "has_phenotype_count": null }, - "score": 8.60883472685004, + "score": 8.608834726850038, "similarity": { "subject_termset": { - "HP:0002020": { - "id": "HP:0002020", - "label": "Gastroesophageal reflux" - }, - "HP:0001533": { "id": "HP:0001533", "label": "Slender build" }, - "HP:0010749": { "id": "HP:0010749", "label": "Blepharochalasis" }, "HP:0004944": { "id": "HP:0004944", "label": "Dilatation of the cerebral artery" }, "HP:0001763": { "id": "HP:0001763", "label": "Pes planus" }, + "HP:0012450": { "id": "HP:0012450", "label": "Chronic constipation" }, "HP:0002616": { "id": "HP:0002616", "label": "Aortic root aneurysm" }, - "HP:0012450": { "id": "HP:0012450", "label": "Chronic constipation" } + "HP:0001533": { "id": "HP:0001533", "label": "Slender build" }, + "HP:0010749": { "id": "HP:0010749", "label": "Blepharochalasis" }, + "HP:0002020": { "id": "HP:0002020", "label": "Gastroesophageal reflux" } }, "object_termset": { - "MP:0001262": { "id": "MP:0001262", "label": "decreased body weight" }, + "MP:0003291": { + "id": "MP:0003291", + "label": "interstinal hyperperistalsis" + }, + "MP:0008489": { + "id": "MP:0008489", + "label": "slow postnatal weight gain" + }, + "MP:0002834": { "id": "MP:0002834", "label": "decreased heart weight" }, "MP:0011960": { "id": "MP:0011960", "label": "abnormal eye anterior chamber depth" @@ -49,30 +54,22 @@ "id": "MP:0011965", "label": "decreased total retina thickness" }, - "MP:0002834": { "id": "MP:0002834", "label": "decreased heart weight" }, - "MP:0008489": { - "id": "MP:0008489", - "label": "slow postnatal weight gain" + "MP:0001262": { "id": "MP:0001262", "label": "decreased body weight" }, + "MP:0011962": { + "id": "MP:0011962", + "label": "increased cornea thickness" }, "MP:0003731": { "id": "MP:0003731", "label": "abnormal retina outer nuclear layer morphology" - }, - "MP:0003291": { - "id": "MP:0003291", - "label": "interstinal hyperperistalsis" - }, - "MP:0011962": { - "id": "MP:0011962", - "label": "increased cornea thickness" } }, "subject_best_matches": { "HP:0001533": { "match_source": "HP:0001533", "match_source_label": "Slender build", - "match_target": "MP:0008489", - "match_target_label": "slow postnatal weight gain", + "match_target": "MP:0001262", + "match_target_label": "decreased body weight", "score": 13.667892510789482, "match_subsumer": null, "match_subsumer_label": null, @@ -80,27 +77,27 @@ "subject_id": "HP:0001533", "subject_label": null, "subject_source": null, - "object_id": "MP:0008489", + "object_id": "MP:0001262", "object_label": null, "object_source": null, - "ancestor_id": "UPHENO:0054299", - "ancestor_label": "decreased multicellular organism mass", + "ancestor_id": "UPHENO:0082794", + "ancestor_label": "Decreased multicellular organism mass", "ancestor_source": null, "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 13.667892510789482, - "jaccard_similarity": 0.38333333333333336, + "jaccard_similarity": 0.40384615384615385, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 2.2889645684900053 + "phenodigm_score": 2.34940967514501 }, "score_metric": "ancestor_information_content" }, "HP:0001763": { "match_source": "HP:0001763", "match_source_label": "Pes planus", - "match_target": "MP:0002834", - "match_target_label": "decreased heart weight", + "match_target": "MP:0011962", + "match_target_label": "increased cornea thickness", "score": 3.066606173373863, "match_subsumer": null, "match_subsumer_label": null, @@ -108,7 +105,7 @@ "subject_id": "HP:0001763", "subject_label": null, "subject_source": null, - "object_id": "MP:0002834", + "object_id": "MP:0011962", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0015280", @@ -117,10 +114,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 3.066606173373863, - "jaccard_similarity": 0.203125, + "jaccard_similarity": 0.16049382716049382, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 0.7892429150563 + "phenodigm_score": 0.7015492578278222 }, "score_metric": "ancestor_information_content" }, @@ -325,8 +322,8 @@ "MP:0003291": { "match_source": "MP:0003291", "match_source_label": "interstinal hyperperistalsis", - "match_target": "HP:0012450", - "match_target_label": "Chronic constipation", + "match_target": "HP:0002020", + "match_target_label": "Gastroesophageal reflux", "score": 9.97713534604573, "match_subsumer": null, "match_subsumer_label": null, @@ -334,7 +331,7 @@ "subject_id": "MP:0003291", "subject_label": null, "subject_source": null, - "object_id": "HP:0012450", + "object_id": "HP:0002020", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0002443", @@ -343,10 +340,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 9.97713534604573, - "jaccard_similarity": 0.4117647058823529, + "jaccard_similarity": 0.3684210526315789, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 2.026877450985369 + "phenodigm_score": 1.9172341292700534 }, "score_metric": "ancestor_information_content" }, @@ -393,8 +390,8 @@ "object_id": "HP:0001533", "object_label": null, "object_source": null, - "ancestor_id": "UPHENO:0054299", - "ancestor_label": "decreased multicellular organism mass", + "ancestor_id": "UPHENO:0082794", + "ancestor_label": "Decreased multicellular organism mass", "ancestor_source": null, "object_information_content": null, "subject_information_content": null, @@ -491,7 +488,7 @@ "score_metric": "ancestor_information_content" } }, - "average_score": 8.60883472685004, + "average_score": 8.608834726850038, "best_score": 13.667892510789482, "metric": "AncestorInformationContent" } @@ -522,38 +519,46 @@ "score": 7.343905449061465, "similarity": { "subject_termset": { - "HP:0002020": { - "id": "HP:0002020", - "label": "Gastroesophageal reflux" - }, - "HP:0010749": { "id": "HP:0010749", "label": "Blepharochalasis" }, "HP:0001533": { "id": "HP:0001533", "label": "Slender build" }, - "HP:0012450": { "id": "HP:0012450", "label": "Chronic constipation" }, "HP:0004944": { "id": "HP:0004944", "label": "Dilatation of the cerebral artery" }, + "HP:0002616": { "id": "HP:0002616", "label": "Aortic root aneurysm" }, + "HP:0002020": { + "id": "HP:0002020", + "label": "Gastroesophageal reflux" + }, "HP:0001763": { "id": "HP:0001763", "label": "Pes planus" }, - "HP:0002616": { "id": "HP:0002616", "label": "Aortic root aneurysm" } + "HP:0010749": { "id": "HP:0010749", "label": "Blepharochalasis" }, + "HP:0012450": { "id": "HP:0012450", "label": "Chronic constipation" } }, "object_termset": { - "MP:0006264": { - "id": "MP:0006264", - "label": "decreased systemic arterial systolic blood pressure" + "MP:0000272": { + "id": "MP:0000272", + "label": "abnormal aorta morphology" + }, + "MP:0004021": { + "id": "MP:0004021", + "label": "abnormal rod electrophysiology" }, "MP:0000230": { "id": "MP:0000230", "label": "abnormal systemic arterial blood pressure" }, - "MP:0004022": { - "id": "MP:0004022", - "label": "abnormal cone electrophysiology" - }, "MP:0002834": { "id": "MP:0002834", "label": "decreased heart weight" }, "MP:0003070": { "id": "MP:0003070", "label": "increased vascular permeability" }, + "MP:0006264": { + "id": "MP:0006264", + "label": "decreased systemic arterial systolic blood pressure" + }, + "MP:0000233": { + "id": "MP:0000233", + "label": "abnormal blood flow velocity" + }, "MP:0003026": { "id": "MP:0003026", "label": "decreased vasoconstriction" @@ -562,17 +567,9 @@ "id": "MP:0009862", "label": "abnormal aorta elastic tissue morphology" }, - "MP:0004021": { - "id": "MP:0004021", - "label": "abnormal rod electrophysiology" - }, - "MP:0000272": { - "id": "MP:0000272", - "label": "abnormal aorta morphology" - }, - "MP:0000233": { - "id": "MP:0000233", - "label": "abnormal blood flow velocity" + "MP:0004022": { + "id": "MP:0004022", + "label": "abnormal cone electrophysiology" } }, "subject_best_matches": { @@ -635,8 +632,8 @@ "HP:0002020": { "match_source": "HP:0002020", "match_source_label": "Gastroesophageal reflux", - "match_target": "MP:0000230", - "match_target_label": "abnormal systemic arterial blood pressure", + "match_target": "MP:0006264", + "match_target_label": "decreased systemic arterial systolic blood pressure", "score": 5.132448071645384, "match_subsumer": null, "match_subsumer_label": null, @@ -644,7 +641,7 @@ "subject_id": "HP:0002020", "subject_label": null, "subject_source": null, - "object_id": "MP:0000230", + "object_id": "MP:0006264", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0002332", @@ -653,10 +650,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 5.132448071645384, - "jaccard_similarity": 0.35294117647058826, + "jaccard_similarity": 0.3333333333333333, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 1.3459020248817237 + "phenodigm_score": 1.3079816603767023 }, "score_metric": "ancestor_information_content" }, @@ -691,8 +688,8 @@ "HP:0004944": { "match_source": "HP:0004944", "match_source_label": "Dilatation of the cerebral artery", - "match_target": "MP:0009862", - "match_target_label": "abnormal aorta elastic tissue morphology", + "match_target": "MP:0000272", + "match_target_label": "abnormal aorta morphology", "score": 9.101342047182207, "match_subsumer": null, "match_subsumer_label": null, @@ -700,7 +697,7 @@ "subject_id": "HP:0004944", "subject_label": null, "subject_source": null, - "object_id": "MP:0009862", + "object_id": "MP:0000272", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0087334", @@ -709,10 +706,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 9.101342047182207, - "jaccard_similarity": 0.25757575757575757, + "jaccard_similarity": 0.2807017543859649, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 1.5311058332979641 + "phenodigm_score": 1.5983624995321914 }, "score_metric": "ancestor_information_content" }, @@ -747,8 +744,8 @@ "HP:0012450": { "match_source": "HP:0012450", "match_source_label": "Chronic constipation", - "match_target": "MP:0004021", - "match_target_label": "abnormal rod electrophysiology", + "match_target": "MP:0003070", + "match_target_label": "increased vascular permeability", "score": 5.132448071645384, "match_subsumer": null, "match_subsumer_label": null, @@ -756,7 +753,7 @@ "subject_id": "HP:0012450", "subject_label": null, "subject_source": null, - "object_id": "MP:0004021", + "object_id": "MP:0003070", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0002332", @@ -765,10 +762,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 5.132448071645384, - "jaccard_similarity": 0.36363636363636365, + "jaccard_similarity": 0.2926829268292683, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 1.3661422888285077 + "phenodigm_score": 1.2256344982940082 }, "score_metric": "ancestor_information_content" } @@ -777,8 +774,8 @@ "MP:0000230": { "match_source": "MP:0000230", "match_source_label": "abnormal systemic arterial blood pressure", - "match_target": "HP:0004944", - "match_target_label": "Dilatation of the cerebral artery", + "match_target": "HP:0002616", + "match_target_label": "Aortic root aneurysm", "score": 7.3467487024345575, "match_subsumer": null, "match_subsumer_label": null, @@ -786,7 +783,7 @@ "subject_id": "MP:0000230", "subject_label": null, "subject_source": null, - "object_id": "HP:0004944", + "object_id": "HP:0002616", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0080362", @@ -795,18 +792,18 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 7.3467487024345575, - "jaccard_similarity": 0.19642857142857142, + "jaccard_similarity": 0.2558139534883721, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 1.2012956972635551 + "phenodigm_score": 1.3709124081630277 }, "score_metric": "ancestor_information_content" }, "MP:0000233": { "match_source": "MP:0000233", "match_source_label": "abnormal blood flow velocity", - "match_target": "HP:0002616", - "match_target_label": "Aortic root aneurysm", + "match_target": "HP:0004944", + "match_target_label": "Dilatation of the cerebral artery", "score": 7.3467487024345575, "match_subsumer": null, "match_subsumer_label": null, @@ -814,7 +811,7 @@ "subject_id": "MP:0000233", "subject_label": null, "subject_source": null, - "object_id": "HP:0002616", + "object_id": "HP:0004944", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0080362", @@ -823,10 +820,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 7.3467487024345575, - "jaccard_similarity": 0.23404255319148937, + "jaccard_similarity": 0.18333333333333332, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 1.311278698055469 + "phenodigm_score": 1.160561902174834 }, "score_metric": "ancestor_information_content" }, diff --git a/frontend/fixtures/phenotype-explorer-search.json b/frontend/fixtures/phenotype-explorer-search.json index de8b0faff..333f09bb9 100644 --- a/frontend/fixtures/phenotype-explorer-search.json +++ b/frontend/fixtures/phenotype-explorer-search.json @@ -100,8 +100,8 @@ } }, "object_termset": { - "HP:0002104": { "id": "HP:0002104", "label": "Apnea" }, - "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" } + "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" }, + "HP:0002104": { "id": "HP:0002104", "label": "Apnea" } }, "subject_best_matches": { "ZP:0018569": { @@ -308,13 +308,13 @@ "score": 7.011754466426716, "similarity": { "subject_termset": { - "ZP:0018568": { - "id": "ZP:0018568", - "label": "primitive hemopoiesis absent, abnormal" - }, "ZP:0018569": { "id": "ZP:0018569", "label": "myeloid cell development absent, abnormal" + }, + "ZP:0018568": { + "id": "ZP:0018568", + "label": "primitive hemopoiesis absent, abnormal" } }, "object_termset": { @@ -411,8 +411,8 @@ "HP:0012378": { "match_source": "HP:0012378", "match_source_label": "Fatigue", - "match_target": "ZP:0018568", - "match_target_label": "primitive hemopoiesis absent, abnormal", + "match_target": "ZP:0018569", + "match_target_label": "myeloid cell development absent, abnormal", "score": 1.6752927740139332, "match_subsumer": null, "match_subsumer_label": null, @@ -420,7 +420,7 @@ "subject_id": "HP:0012378", "subject_label": null, "subject_source": null, - "object_id": "ZP:0018568", + "object_id": "ZP:0018569", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0001005", @@ -552,13 +552,13 @@ "score": 7.011754466426716, "similarity": { "subject_termset": { - "ZP:0018569": { - "id": "ZP:0018569", - "label": "myeloid cell development absent, abnormal" - }, "ZP:0018568": { "id": "ZP:0018568", "label": "primitive hemopoiesis absent, abnormal" + }, + "ZP:0018569": { + "id": "ZP:0018569", + "label": "myeloid cell development absent, abnormal" } }, "object_termset": { @@ -803,13 +803,13 @@ "score": 7.011754466426716, "similarity": { "subject_termset": { - "ZP:0018568": { - "id": "ZP:0018568", - "label": "primitive hemopoiesis absent, abnormal" - }, "ZP:0018569": { "id": "ZP:0018569", "label": "myeloid cell development absent, abnormal" + }, + "ZP:0018568": { + "id": "ZP:0018568", + "label": "primitive hemopoiesis absent, abnormal" } }, "object_termset": { @@ -906,8 +906,8 @@ "HP:0012378": { "match_source": "HP:0012378", "match_source_label": "Fatigue", - "match_target": "ZP:0018569", - "match_target_label": "myeloid cell development absent, abnormal", + "match_target": "ZP:0018568", + "match_target_label": "primitive hemopoiesis absent, abnormal", "score": 1.6752927740139332, "match_subsumer": null, "match_subsumer_label": null, @@ -915,7 +915,7 @@ "subject_id": "HP:0012378", "subject_label": null, "subject_source": null, - "object_id": "ZP:0018569", + "object_id": "ZP:0018568", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0001005", @@ -1054,13 +1054,13 @@ "score": 7.011754466426716, "similarity": { "subject_termset": { - "ZP:0018569": { - "id": "ZP:0018569", - "label": "myeloid cell development absent, abnormal" - }, "ZP:0018568": { "id": "ZP:0018568", "label": "primitive hemopoiesis absent, abnormal" + }, + "ZP:0018569": { + "id": "ZP:0018569", + "label": "myeloid cell development absent, abnormal" } }, "object_termset": { @@ -1157,8 +1157,8 @@ "HP:0012378": { "match_source": "HP:0012378", "match_source_label": "Fatigue", - "match_target": "ZP:0018569", - "match_target_label": "myeloid cell development absent, abnormal", + "match_target": "ZP:0018568", + "match_target_label": "primitive hemopoiesis absent, abnormal", "score": 1.6752927740139332, "match_subsumer": null, "match_subsumer_label": null, @@ -1166,7 +1166,7 @@ "subject_id": "HP:0012378", "subject_label": null, "subject_source": null, - "object_id": "ZP:0018569", + "object_id": "ZP:0018568", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0001005", @@ -1399,8 +1399,8 @@ "HP:0012378": { "match_source": "HP:0012378", "match_source_label": "Fatigue", - "match_target": "ZP:0000945", - "match_target_label": "pigment cell quality, abnormal", + "match_target": "ZP:0100294", + "match_target_label": "visual perception absent, abnormal", "score": 1.6752927740139332, "match_subsumer": null, "match_subsumer_label": null, @@ -1408,7 +1408,7 @@ "subject_id": "HP:0012378", "subject_label": null, "subject_source": null, - "object_id": "ZP:0000945", + "object_id": "ZP:0100294", "object_label": null, "object_source": null, "ancestor_id": "UPHENO:0001005", @@ -1417,10 +1417,10 @@ "object_information_content": null, "subject_information_content": null, "ancestor_information_content": 1.6752927740139332, - "jaccard_similarity": 0.42105263157894735, + "jaccard_similarity": 0.4444444444444444, "cosine_similarity": null, "dice_similarity": null, - "phenodigm_score": 0.8398728660718605 + "phenodigm_score": 0.8628873427211774 }, "score_metric": "ancestor_information_content" } @@ -2013,8 +2013,8 @@ } }, "object_termset": { - "HP:0002104": { "id": "HP:0002104", "label": "Apnea" }, - "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" } + "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" }, + "HP:0002104": { "id": "HP:0002104", "label": "Apnea" } }, "subject_best_matches": { "ZP:0001432": { @@ -2201,8 +2201,8 @@ } }, "object_termset": { - "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" }, - "HP:0002104": { "id": "HP:0002104", "label": "Apnea" } + "HP:0002104": { "id": "HP:0002104", "label": "Apnea" }, + "HP:0012378": { "id": "HP:0012378", "label": "Fatigue" } }, "subject_best_matches": { "ZP:0001432": { diff --git a/frontend/src/api/model.ts b/frontend/src/api/model.ts index 93533c67b..3a635d330 100644 --- a/frontend/src/api/model.ts +++ b/frontend/src/api/model.ts @@ -269,6 +269,10 @@ export interface AssociationCountList { export interface AssociationResults extends Results { /** A collection of items, with the type to be overriden by slot_usage */ items: Association[], + /** Collection of facet field responses with the field values and counts */ + facet_fields?: FacetField[], + /** Collection of facet query responses with the query string values and counts */ + facet_queries?: FacetValue[], } @@ -290,6 +294,10 @@ export interface CompactAssociation { export interface CompactAssociationResults extends Results { /** A collection of items, with the type to be overriden by slot_usage */ items: CompactAssociation[], + /** Collection of facet field responses with the field values and counts */ + facet_fields?: FacetField[], + /** Collection of facet query responses with the query string values and counts */ + facet_queries?: FacetValue[], } @@ -297,6 +305,10 @@ export interface CompactAssociationResults extends Results { export interface AssociationTableResults extends Results { /** A collection of items, with the type to be overriden by slot_usage */ items: DirectionalAssociation[], + /** Collection of facet field responses with the field values and counts */ + facet_fields?: FacetField[], + /** Collection of facet query responses with the query string values and counts */ + facet_queries?: FacetValue[], } diff --git a/frontend/src/pages/metadata.json b/frontend/src/pages/metadata.json new file mode 100644 index 000000000..21a752ddb --- /dev/null +++ b/frontend/src/pages/metadata.json @@ -0,0 +1,49 @@ +{ + "node": [ + { + "label": "Genes", + "icon": "category-gene", + "count": 571144 + }, + { + "label": "Phenotypes", + "icon": "category-phenotypic-quality", + "count": 143946 + }, + { + "label": "Diseases", + "icon": "category-disease", + "count": 29392 + }, + { + "label": "Total Nodes", + "icon": "node", + "count": 1044537 + } + ], + "association": [ + { + "label": "Gene to Disease", + "icon": "category-gene", + "icon2": "category-disease", + "count": 15324 + }, + { + "label": "Gene to Phenotype", + "icon": "category-gene", + "icon2": "category-phenotypic-quality", + "count": 954698 + }, + { + "label": "Disease to Phenotype", + "icon": "category-disease", + "icon2": "category-phenotypic-quality", + "count": 252590 + }, + { + "label": "Total Associations", + "icon": "association", + "count": 11278911 + } + ] +}