Skip to content

Commit

Permalink
Typehead diseases when query contains source substring (#4592)
Browse files Browse the repository at this point in the history
* Typehead deiseases when query contains source string

* Better changelog

* Use constant instead of repeated string

* Simplify

---------

Co-authored-by: Chiara Rasi <rasi.chiara@gmacil.com>
  • Loading branch information
northwestwitch and Chiara Rasi committed Apr 25, 2024
1 parent 9de367c commit 51ee90f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ About changelog [here](https://keepachangelog.com/en/1.0.0/)
- Option to filter variants by excluding genes listed in selected gene panels, files or provided as list
- STR variant information card with database links, replacing empty frequency panel
- Display paging and number of HPO terms available in the database on Phenotypes page
- On case page, typeahead hints when searching for a disease using substrings containing source ("OMIM:", "ORPHA:")
### Changed
- In the case_report #panel-tables has a fixed width
- Updated IGV.js to 2.15.11
Expand Down
7 changes: 5 additions & 2 deletions scout/adapter/mongo/disease_terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
LOG = logging.getLogger(__name__)

DISEASE_FILTER_PROJECT = {"hpo_terms": 0, "genes": 0}
REGEX = "$regex"
REGEX_OPTIONS = "$options"
REGEX_IGNORECASE = "i"


class DiagnosisHandler(object):
Expand All @@ -32,8 +35,8 @@ def query_disease(
if query:
query_dict = {
"$or": [
{"disease_nr": {"$regex": query, "$options": "i"}},
{"description": {"$regex": query, "$options": "i"}},
{"disease_id": {REGEX: query, REGEX_OPTIONS: REGEX_IGNORECASE}},
{"description": {REGEX: query, REGEX_OPTIONS: REGEX_IGNORECASE}},
]
}
# If source is specified, add this restriction to the query
Expand Down

0 comments on commit 51ee90f

Please sign in to comment.