scout-browser 4.90__py3-none-any.whl → 4.91__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. scout/__version__.py +1 -1
  2. scout/adapter/mongo/case.py +27 -38
  3. scout/commands/export/variant.py +14 -4
  4. scout/commands/load/panel.py +2 -1
  5. scout/commands/update/panelapp.py +11 -3
  6. scout/commands/view/case.py +2 -2
  7. scout/constants/__init__.py +1 -2
  8. scout/constants/acmg.py +15 -15
  9. scout/constants/case_tags.py +0 -46
  10. scout/constants/clnsig.py +2 -1
  11. scout/constants/gene_tags.py +0 -6
  12. scout/constants/panels.py +16 -0
  13. scout/constants/variants_export.py +2 -0
  14. scout/demo/__init__.py +4 -1
  15. scout/demo/panelapp_panel.json +463 -0
  16. scout/demo/panelapp_panels_reduced.json +37 -0
  17. scout/load/panel.py +3 -142
  18. scout/load/panelapp.py +138 -0
  19. scout/models/case/case_loading_models.py +5 -4
  20. scout/parse/matchmaker.py +18 -6
  21. scout/parse/panel.py +3 -117
  22. scout/parse/panelapp.py +112 -0
  23. scout/parse/variant/clnsig.py +26 -21
  24. scout/parse/variant/genotype.py +6 -5
  25. scout/server/blueprints/alignviewers/controllers.py +7 -5
  26. scout/server/blueprints/alignviewers/templates/alignviewers/utils.html +1 -1
  27. scout/server/blueprints/cases/templates/cases/case_sma.html +49 -42
  28. scout/server/blueprints/cases/templates/cases/collapsible_actionbar.html +27 -12
  29. scout/server/blueprints/cases/views.py +18 -7
  30. scout/server/blueprints/clinvar/templates/clinvar/clinvar_submissions.html +7 -7
  31. scout/server/blueprints/clinvar/templates/clinvar/multistep_add_variant.html +2 -2
  32. scout/server/blueprints/dashboard/controllers.py +128 -165
  33. scout/server/blueprints/dashboard/forms.py +3 -13
  34. scout/server/blueprints/dashboard/templates/dashboard/dashboard_general.html +17 -22
  35. scout/server/blueprints/institutes/forms.py +1 -2
  36. scout/server/blueprints/institutes/templates/overview/cases.html +2 -133
  37. scout/server/blueprints/institutes/templates/overview/utils.html +135 -0
  38. scout/server/blueprints/omics_variants/templates/omics_variants/outliers.html +5 -0
  39. scout/server/blueprints/panels/templates/panels/panel.html +5 -1
  40. scout/server/blueprints/panels/templates/panels/panel_pdf_simple.html +5 -1
  41. scout/server/blueprints/variant/controllers.py +6 -1
  42. scout/server/blueprints/variant/templates/variant/buttons.html +11 -10
  43. scout/server/blueprints/variant/templates/variant/components.html +63 -44
  44. scout/server/blueprints/variant/templates/variant/str-variant-reviewer.html +1 -1
  45. scout/server/blueprints/variant/templates/variant/utils.html +38 -10
  46. scout/server/blueprints/variant/templates/variant/variant.html +1 -1
  47. scout/server/blueprints/variants/controllers.py +9 -4
  48. scout/server/blueprints/variants/templates/variants/cancer-sv-variants.html +9 -5
  49. scout/server/blueprints/variants/templates/variants/cancer-variants.html +6 -17
  50. scout/server/blueprints/variants/templates/variants/str-variants.html +2 -2
  51. scout/server/blueprints/variants/templates/variants/sv-variants.html +8 -1
  52. scout/server/blueprints/variants/templates/variants/utils.html +14 -0
  53. scout/server/extensions/__init__.py +2 -0
  54. scout/server/extensions/panelapp_extension.py +75 -0
  55. scout/server/links.py +19 -1
  56. scout/server/utils.py +25 -33
  57. {scout_browser-4.90.dist-info → scout_browser-4.91.dist-info}/METADATA +1 -1
  58. {scout_browser-4.90.dist-info → scout_browser-4.91.dist-info}/RECORD +62 -58
  59. {scout_browser-4.90.dist-info → scout_browser-4.91.dist-info}/WHEEL +1 -1
  60. scout/demo/panelapp_test_panel.json +0 -79
  61. {scout_browser-4.90.dist-info → scout_browser-4.91.dist-info}/LICENSE +0 -0
  62. {scout_browser-4.90.dist-info → scout_browser-4.91.dist-info}/entry_points.txt +0 -0
  63. {scout_browser-4.90.dist-info → scout_browser-4.91.dist-info}/top_level.txt +0 -0
@@ -1,9 +1,13 @@
1
1
  import logging
2
+ from typing import Dict, List, Set
2
3
 
3
4
  from flask import flash, redirect, request, url_for
4
5
  from flask_login import current_user
6
+ from werkzeug.datastructures.structures import ImmutableMultiDict
7
+ from werkzeug.local import LocalProxy
5
8
 
6
- from scout.constants import CASE_SEARCH_TERMS, CASE_TAGS
9
+ from scout.adapter import MongoAdapter
10
+ from scout.constants import CASE_TAGS
7
11
  from scout.server.extensions import store
8
12
  from scout.server.utils import user_institutes
9
13
 
@@ -22,7 +26,7 @@ def institute_select_choices():
22
26
  # Collect only institutes available to the user
23
27
  institute_objs = user_institutes(store, current_user)
24
28
  for inst in institute_objs:
25
- institute_choices.append((inst["_id"], inst["display_name"]))
29
+ institute_choices.append((inst["_id"], f'{inst["display_name"]} ({inst["_id"]})'))
26
30
  return institute_choices
27
31
 
28
32
 
@@ -33,116 +37,90 @@ def dashboard_form(request_form=None):
33
37
  return form
34
38
 
35
39
 
36
- def compose_slice_query(search_type, search_term):
37
- """Extract a filter query given a form search term and search type
40
+ def populate_dashboard_data(request: LocalProxy) -> dict:
41
+ """Collect data to display on the dashboard page"""
38
42
 
39
- Args:
40
- search_type(str): example -> "case:"
41
- search_term(str): example -> "17867"
42
-
43
- Returns:
44
- slice_query(str): example case:17867
45
- """
46
- slice_query = None
47
- if search_term and search_type:
48
- slice_query = "".join([search_type, search_term])
49
-
50
- return slice_query
51
-
52
-
53
- def populate_dashboard_data(request):
54
- """Prepate data display object to be returned to the view
55
-
56
- Args:
57
- request(flask.rquest): request received by the view
58
-
59
- Returns:
60
- data(dict): data to be diplayed in the template
61
- """
62
- data = {"dashboard_form": dashboard_form(request.form), "search_terms": CASE_SEARCH_TERMS}
43
+ data = {"dashboard_form": dashboard_form(request.form)}
63
44
  if request.method == "GET":
64
45
  return data
65
46
 
66
- allowed_insititutes = [inst[0] for inst in institute_select_choices()]
47
+ allowed_institutes = [inst[0] for inst in institute_select_choices()]
67
48
 
68
49
  institute_id = request.form.get(
69
- "search_institute", allowed_insititutes[0]
50
+ "search_institute", allowed_institutes[0]
70
51
  ) # GET request has no institute, select the first option of the select
71
52
 
72
- if institute_id and institute_id not in allowed_insititutes:
53
+ if institute_id and institute_id not in allowed_institutes:
73
54
  flash("Your user is not allowed to visualize this data", "warning")
74
55
  redirect(url_for("dashboard.index"))
75
56
 
76
57
  if institute_id == "All":
77
58
  institute_id = None
78
59
 
79
- search_term = request.form["search_term"].strip() if request.form.get("search_term") else ""
80
- slice_query = compose_slice_query(request.form.get("search_type"), search_term)
81
- get_dashboard_info(store, data, institute_id, slice_query)
60
+ get_dashboard_info(adapter=store, data=data, institute_id=institute_id, cases_form=request.form)
82
61
  return data
83
62
 
84
63
 
85
- def get_dashboard_info(adapter, data={}, institute_id=None, slice_query=None):
86
- """Append case data stats to data display object
87
- Args:
88
- adapter(adapter.MongoAdapter)
89
- data(dict): data dictionary to be passed to template
90
- institute_id(str): institute id
91
- slice_query(str): example case:55888
64
+ def get_dashboard_info(
65
+ adapter: MongoAdapter, data: dict = None, institute_id: str = None, cases_form=None
66
+ ) -> dict:
67
+ """Append case data stats to data display object"""
92
68
 
93
- Returns:
94
- data(dict): data to be diplayed in the template
95
- """
96
- # If a slice_query is present then numbers in "General statistics" and "Case statistics" will
97
- # reflect the data available for the query
98
- general_sliced_info = get_general_case_info(
99
- adapter, institute_id=institute_id, slice_query=slice_query
69
+ if not data:
70
+ data = {}
71
+
72
+ # Filter data using eventual filter provided in cases filters form
73
+ filtered_cases_info = get_general_case_info(
74
+ adapter=adapter, institute_id=institute_id, cases_form=cases_form
100
75
  )
101
76
 
102
- total_sliced_cases = general_sliced_info["total_cases"]
103
- data["total_cases"] = total_sliced_cases
77
+ total_filtered_cases = filtered_cases_info["total_cases"]
78
+ data["total_cases"] = total_filtered_cases
104
79
 
105
- if total_sliced_cases == 0:
80
+ if total_filtered_cases == 0:
106
81
  return data
107
82
 
108
83
  data["pedigree"] = []
109
- for ped_info in general_sliced_info["pedigree"].values():
110
- ped_info["percent"] = ped_info["count"] / total_sliced_cases
84
+ for ped_info in filtered_cases_info["pedigree"].values():
85
+ ped_info["percent"] = ped_info["count"] / total_filtered_cases
111
86
  data["pedigree"].append(ped_info)
112
87
 
113
88
  data["cases"] = get_case_groups(
114
- adapter, total_sliced_cases, institute_id=institute_id, slice_query=slice_query
89
+ adapter=adapter,
90
+ total_cases=total_filtered_cases,
91
+ institute_id=institute_id,
92
+ name_query=cases_form,
115
93
  )
116
94
 
117
95
  data["analysis_types"] = get_analysis_types(
118
- adapter, total_sliced_cases, institute_id=institute_id, slice_query=slice_query
96
+ adapter=adapter, institute_id=institute_id, name_query=cases_form
119
97
  )
120
98
 
121
99
  overview = [
122
100
  {
123
101
  "title": "Phenotype terms",
124
- "count": general_sliced_info["phenotype_cases"],
125
- "percent": general_sliced_info["phenotype_cases"] / total_sliced_cases,
102
+ "count": filtered_cases_info["phenotype_cases"],
103
+ "percent": filtered_cases_info["phenotype_cases"] / total_filtered_cases,
126
104
  },
127
105
  {
128
106
  "title": "Causative variants",
129
- "count": general_sliced_info["causative_cases"],
130
- "percent": general_sliced_info["causative_cases"] / total_sliced_cases,
107
+ "count": filtered_cases_info["causative_cases"],
108
+ "percent": filtered_cases_info["causative_cases"] / total_filtered_cases,
131
109
  },
132
110
  {
133
111
  "title": "Pinned variants",
134
- "count": general_sliced_info["pinned_cases"],
135
- "percent": general_sliced_info["pinned_cases"] / total_sliced_cases,
112
+ "count": filtered_cases_info["pinned_cases"],
113
+ "percent": filtered_cases_info["pinned_cases"] / total_filtered_cases,
136
114
  },
137
115
  {
138
116
  "title": "Cohort tag",
139
- "count": general_sliced_info["cohort_cases"],
140
- "percent": general_sliced_info["cohort_cases"] / total_sliced_cases,
117
+ "count": filtered_cases_info["cohort_cases"],
118
+ "percent": filtered_cases_info["cohort_cases"] / total_filtered_cases,
141
119
  },
142
120
  {
143
121
  "title": "Case status tag",
144
- "count": general_sliced_info["tagged_cases"],
145
- "percent": general_sliced_info["tagged_cases"] / total_sliced_cases,
122
+ "count": filtered_cases_info["tagged_cases"],
123
+ "percent": filtered_cases_info["tagged_cases"] / total_filtered_cases,
146
124
  },
147
125
  ]
148
126
 
@@ -150,8 +128,8 @@ def get_dashboard_info(adapter, data={}, institute_id=None, slice_query=None):
150
128
  overview.append(
151
129
  {
152
130
  "title": CASE_TAGS[stats_tag]["label"] + " status tag",
153
- "count": general_sliced_info[stats_tag + "_cases"],
154
- "percent": general_sliced_info[stats_tag + "_cases"] / total_sliced_cases,
131
+ "count": filtered_cases_info[stats_tag + "_cases"],
132
+ "percent": filtered_cases_info[stats_tag + "_cases"] / total_filtered_cases,
155
133
  }
156
134
  )
157
135
 
@@ -160,26 +138,10 @@ def get_dashboard_info(adapter, data={}, institute_id=None, slice_query=None):
160
138
  return data
161
139
 
162
140
 
163
- def get_general_case_info(adapter, institute_id=None, slice_query=None):
164
- """Return general information about cases
165
-
166
- Count e.g. cases with each kind of case tag, as well as cases that have phenotype, causatives or pinned variants
167
- marked or are part of cohorts.
168
-
169
- Gather pedigree information - single, duo, trio or many individuals in case.
170
-
171
- Args:
172
- adapter(adapter.MongoAdapter)
173
- institute_id(str)
174
- slice_query(str): Query to filter cases to obtain statistics for.
175
-
176
- Returns:
177
- general(dict)
178
- """
179
- general = {}
180
-
181
- # Potentially sensitive slice queries are assumed allowed if we have got this far
182
- name_query = slice_query
141
+ def get_general_case_info(
142
+ adapter, institute_id: str = None, cases_form: ImmutableMultiDict = None
143
+ ) -> dict:
144
+ """Return general information about cases."""
183
145
 
184
146
  CASE_GENERAL_INFO_PROJECTION = {
185
147
  "phenotype_terms": 1,
@@ -189,77 +151,88 @@ def get_general_case_info(adapter, institute_id=None, slice_query=None):
189
151
  "individuals": 1,
190
152
  "tags": 1,
191
153
  }
154
+
192
155
  cases = adapter.cases(
193
- owner=institute_id, name_query=name_query, projection=CASE_GENERAL_INFO_PROJECTION
156
+ owner=institute_id, name_query=cases_form, projection=CASE_GENERAL_INFO_PROJECTION
194
157
  )
195
158
 
196
- case_counter_keys = [
197
- "phenotype",
198
- "causative",
199
- "pinned",
200
- "cohort",
201
- "tagged",
202
- ]
203
- case_counter_keys.extend(CASE_TAGS.keys())
159
+ # Initialize counters and structures
160
+ case_counter_keys = ["phenotype", "causative", "pinned", "cohort", "tagged"] + list(
161
+ CASE_TAGS.keys()
162
+ )
163
+ case_counter = initialize_case_counter(case_counter_keys)
164
+ pedigree = initialize_pedigree()
204
165
 
205
- case_counter = {}
206
- for counter in case_counter_keys:
207
- case_counter[counter] = 0
166
+ case_ids: Set[str] = set()
167
+ total_cases = 0
208
168
 
209
- pedigree = {
210
- 1: {"title": "Single", "count": 0},
211
- 2: {"title": "Duo", "count": 0},
212
- 3: {"title": "Trio", "count": 0},
213
- "many": {"title": "Many", "count": 0},
169
+ # Process each case
170
+ for total_cases, case in enumerate(cases, 1):
171
+ case_ids.add(case["_id"])
172
+ update_case_counters(case, case_counter, case_counter_keys)
173
+ update_pedigree(case, pedigree)
174
+
175
+ # Prepare general info dictionary
176
+ general = {
177
+ "total_cases": total_cases,
178
+ "pedigree": pedigree,
179
+ "case_ids": case_ids,
180
+ **{f"{key}_cases": count for key, count in case_counter.items()},
214
181
  }
215
182
 
216
- case_ids = set()
183
+ return general
217
184
 
218
- total_cases = 0
219
- for total_cases, case in enumerate(cases, 1):
220
- case_ids.add(case["_id"])
221
- if case.get("phenotype_terms"):
222
- case_counter["phenotype"] += 1
223
- if case.get("causatives"):
224
- case_counter["causative"] += 1
225
- if case.get("suspects"):
226
- case_counter["pinned"] += 1
227
- if case.get("cohorts"):
228
- case_counter["cohort"] += 1
229
- if case.get("tags"):
230
- case_counter["tagged"] += 1
231
- case_tags = case.get("tags")
232
- for tag in case_tags:
233
- case_counter[tag] += 1
234
185
 
235
- nr_individuals = len(case.get("individuals", []))
236
- if nr_individuals == 0:
237
- continue
238
- if nr_individuals > 3:
239
- pedigree["many"]["count"] += 1
240
- else:
241
- pedigree[nr_individuals]["count"] += 1
186
+ def initialize_case_counter(case_counter_keys) -> Dict[str, int]:
187
+ """Initialize the case counter dictionary with the given keys set to zero."""
188
+ return {key: 0 for key in case_counter_keys}
242
189
 
243
- general["total_cases"] = total_cases
244
- general["pedigree"] = pedigree
245
- general["case_ids"] = case_ids
246
- for counter in case_counter_keys:
247
- general[counter + "_cases"] = case_counter[counter]
248
190
 
249
- return general
191
+ def initialize_pedigree() -> Dict:
192
+ """Initialize the pedigree structure with counts set to zero."""
193
+ return {
194
+ 1: {"title": "Single", "count": 0},
195
+ 2: {"title": "Duo", "count": 0},
196
+ 3: {"title": "Trio", "count": 0},
197
+ "many": {"title": "Many", "count": 0},
198
+ }
250
199
 
251
200
 
252
- def get_case_groups(adapter, total_cases, institute_id=None, slice_query=None):
253
- """Return the information about case groups
201
+ def update_case_counters(case: dict, case_counter: Dict[str, int], case_counter_keys):
202
+ """Update case counter based on the case's attributes."""
203
+ if case.get("phenotype_terms"):
204
+ case_counter["phenotype"] += 1
205
+ if case.get("causatives"):
206
+ case_counter["causative"] += 1
207
+ if case.get("suspects"):
208
+ case_counter["pinned"] += 1
209
+ if case.get("cohorts"):
210
+ case_counter["cohort"] += 1
211
+ if case.get("tags"):
212
+ case_counter["tagged"] += 1
213
+ for tag in case.get("tags", []):
214
+ if tag in case_counter_keys: # Ensure tag is in the predefined keys
215
+ case_counter[tag] += 1
254
216
 
255
- Args:
256
- store(adapter.MongoAdapter)
257
- total_cases(int): Total number of cases
258
- slice_query(str): Query to filter cases to obtain statistics for.
259
217
 
260
- Returns:
261
- cases(dict):
262
- """
218
+ def update_pedigree(case: dict, pedigree: Dict):
219
+ """Update pedigree information based on the number of individuals in the case."""
220
+ nr_individuals = len(case.get("individuals", []))
221
+ if nr_individuals == 0:
222
+ return
223
+ if nr_individuals > 3:
224
+ pedigree["many"]["count"] += 1
225
+ else:
226
+ pedigree[nr_individuals]["count"] += 1
227
+
228
+
229
+ def get_case_groups(
230
+ adapter: MongoAdapter,
231
+ total_cases: int,
232
+ institute_id: str = None,
233
+ name_query: ImmutableMultiDict = None,
234
+ ) -> List[dict]:
235
+ """Return the information about case groups"""
263
236
  # Create a group with all cases in the database
264
237
  cases = [{"status": "all", "count": total_cases, "percent": 1}]
265
238
  # Group the cases based on their status
@@ -267,12 +240,12 @@ def get_case_groups(adapter, total_cases, institute_id=None, slice_query=None):
267
240
  group = {"$group": {"_id": "$status", "count": {"$sum": 1}}}
268
241
 
269
242
  subquery = {}
270
- if institute_id and slice_query:
271
- subquery = adapter.cases(owner=institute_id, name_query=slice_query, yield_query=True)
243
+ if institute_id and name_query:
244
+ subquery = adapter.cases(owner=institute_id, name_query=name_query, yield_query=True)
272
245
  elif institute_id:
273
246
  subquery = adapter.cases(owner=institute_id, yield_query=True)
274
- elif slice_query:
275
- subquery = adapter.cases(name_query=slice_query, yield_query=True)
247
+ elif name_query:
248
+ subquery = adapter.cases(name_query=name_query, yield_query=True)
276
249
 
277
250
  query = {"$match": subquery} if subquery else {}
278
251
 
@@ -294,28 +267,18 @@ def get_case_groups(adapter, total_cases, institute_id=None, slice_query=None):
294
267
  return cases
295
268
 
296
269
 
297
- def get_analysis_types(adapter, total_cases, institute_id=None, slice_query=None):
298
- """Return information about analysis types.
299
- Group cases based on analysis type for the individuals.
300
- Args:
301
- adapter(adapter.MongoAdapter)
302
- total_cases(int): Total number of cases
303
- institute_id(str)
304
- slice_query(str): Query to filter cases to obtain statistics for.
305
- Returns:
306
- analysis_types array of hashes with name: analysis_type(str), count: count(int)
307
-
308
- """
309
- # Group cases based on analysis type of the individuals
310
- query = {}
270
+ def get_analysis_types(
271
+ adapter: MongoAdapter, institute_id: str = None, name_query: ImmutableMultiDict = None
272
+ ) -> List[dict]:
273
+ """Group cases based on analysis type of the individuals."""
311
274
 
312
275
  subquery = {}
313
- if institute_id and slice_query:
314
- subquery = adapter.cases(owner=institute_id, name_query=slice_query, yield_query=True)
276
+ if institute_id and name_query:
277
+ subquery = adapter.cases(owner=institute_id, name_query=name_query, yield_query=True)
315
278
  elif institute_id:
316
279
  subquery = adapter.cases(owner=institute_id, yield_query=True)
317
- elif slice_query:
318
- subquery = adapter.cases(name_query=slice_query, yield_query=True)
280
+ elif name_query:
281
+ subquery = adapter.cases(name_query=name_query, yield_query=True)
319
282
 
320
283
  query = {"$match": subquery}
321
284
 
@@ -1,12 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
- from flask_wtf import FlaskForm
3
2
  from wtforms import SelectField, StringField, SubmitField, validators
4
3
 
5
- from scout.constants import CASE_SEARCH_TERMS
6
-
7
- CASE_SEARCH_KEY = [("", "")] + [
8
- (value["prefix"], value["label"]) for key, value in CASE_SEARCH_TERMS.items()
9
- ]
4
+ from scout.server.blueprints.institutes.forms import CaseFilterForm
10
5
 
11
6
 
12
7
  class NonValidatingSelectField(SelectField):
@@ -16,12 +11,7 @@ class NonValidatingSelectField(SelectField):
16
11
  pass
17
12
 
18
13
 
19
- class DashboardFilterForm(FlaskForm):
20
- """Takes care of cases filtering in cases page"""
14
+ class DashboardFilterForm(CaseFilterForm):
15
+ """Takes care of cases filtering on dashboard page"""
21
16
 
22
- search_type = NonValidatingSelectField(
23
- "Search by", [validators.Optional()], choices=CASE_SEARCH_KEY
24
- )
25
17
  search_institute = NonValidatingSelectField("Institute", choices=[])
26
- search_term = StringField("Search term")
27
- search = SubmitField(label="Search")
@@ -1,4 +1,5 @@
1
1
  {% extends "layout.html" %}
2
+ {% from "overview/utils.html" import cases_search_form %}
2
3
 
3
4
  {% block top_nav %}
4
5
  {{ super() }}
@@ -14,7 +15,7 @@
14
15
  <div class="container-float mt-3">
15
16
  <!--filter panel -->
16
17
  <div>
17
- {{ dashboard_search_form() }}
18
+ {{ cases_search_form(dashboard_form, url_for('dashboard.index'), url_for('dashboard.index'), urlnone) }}
18
19
  {% if total_cases == 0 %}
19
20
  <div class="alert alert-danger mt-3">Your search didn't return any results!</div>
20
21
  {% elif not total_cases %}
@@ -133,29 +134,23 @@
133
134
  <script src="{{ url_for('dashboard.static', filename='charts.js') }}"></script>
134
135
  <script type="text/javascript">
135
136
 
136
- // Code taking care of case filtering
137
- var caseSearchTerms = {{ search_terms|safe }};
138
- var searchTerm = document.getElementById('search_term'); // Case search term label
139
- var sel = document.getElementById('search_type'); // Case search term select
140
- document.getElementById("search_type").onchange = function() {
141
- // Change case search term placeholder
142
- selectedKey = sel.options[sel.selectedIndex].value.slice(0, -1);
143
- if(selectedKey){
144
- searchTerm.placeholder=caseSearchTerms[selectedKey]["placeholder"];
145
- searchTerm.disabled = false;
146
- }
147
- else{
148
- searchTerm.disabled = (sel.value == "");
149
- searchTerm.placeholder="Search term";
150
- }
151
- // Reset search
152
- searchTerm.value="";
153
- };
137
+ // Show/hide advanced search options
138
+ let advSearchBlock = $('#advancesSearchOptions');
154
139
 
155
- $(document).ready(function(){
156
- searchTerm.disabled = (sel.value == "");
157
- });
140
+ let advBlockCheckbox = $('#advanced_search');
158
141
 
142
+ window.onload = function(){
143
+ if(!advBlockCheckbox.is(':checked'))
144
+ advSearchBlock.hide();
145
+ }
146
+
147
+ advBlockCheckbox.on('click', function() {
148
+ if($(this).is(':checked')) {
149
+ advSearchBlock.show();
150
+ } else {
151
+ advSearchBlock.hide();
152
+ }
153
+ })
159
154
 
160
155
  {% if cases %}
161
156
  //create analysis type chart ===> general stats
@@ -13,10 +13,9 @@ from wtforms import (
13
13
  )
14
14
  from wtforms.widgets import PasswordInput, TextInput
15
15
 
16
- from scout.constants import CASE_SEARCH_TERMS, PHENOTYPE_GROUPS
16
+ from scout.constants import PHENOTYPE_GROUPS
17
17
  from scout.models.case import STATUS
18
18
 
19
- CASE_SEARCH_KEY = [(value["prefix"], value["label"]) for key, value in CASE_SEARCH_TERMS.items()]
20
19
  CATEGORY_CHOICES = [("snv", "SNV"), ("sv", "SV")]
21
20
 
22
21