microbiomedata / nmdc-server

Data portal client and server for NMDC.
https://data.microbiomedata.org
Other
9 stars 0 forks source link

Support pathway search with multiple prefixes #1353

Closed naglepuff closed 1 month ago

naglepuff commented 1 month ago

Fix #1342

Changes

This updates the KEGG facet to allow users to search for pathways terms using prefixes other than map. Supported prefixes for pathway searches now include ko, ec, and rn in addition to map.

We store pathway terms in the ko_term_text table in postgres, all with the map prefix. In order to support searching on these terms we do some string substitution so that users can use whichever prefix they'd like.

This affects free-text search for the KEGG facet on the frontend. If a user types in a term that begins with one of the prefixes associated with a pathway search, the associated backend code (crud.py::kegg_text_search) will interpret that as a request to search for pathways, making sure the results keep the the prefix that the user wanted. For example, a user search for ec00010 in the Data Portal will be translated into a search for map00010 in our database, and the results will be translated back to use the ec prefix.

This also affects some KEGG-related functions in encoding.ts. In order to support transforming search terms into proper strings used by the search engine and proper links to external sites, the short and long representations are now functions that adapt to the input.

A similar change has been implemented during search itself, where the check for whether or not a given search term is a pathway has been expanded.

The help text on the KEGG filter flyout has been updated to mention the new supported formats.

Testing

Testing requires working with a database that has the KEGG terms and annotations ingested. I would recommend using the nmdc-server CLI to obtain a backup of the production database. From there, test the KEGG Filter by searching for pathways with various different prefixes. Make sure they return the same results. Additionally, make sure that the free text search results are consistent with the prefix you are using for search, and that the clickable links in the flyout when you have terms selected use the same prefix you searched with.

naglepuff commented 1 month ago

b38715d changes the URL for modules. Previously they were not resolving correctly.