Skip to content

Commit 395a7f3

Browse files
authored
Merge pull request #405 from ImagingDataCommons/idc-prod-sp
Hotfixes for slowdowns
2 parents e1ffdcd + 42aa9f6 commit 395a7f3

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

cohorts/views/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ def cohort_detail(request, cohort_id):
266266
messages.error(request, 'You do not have permission to view that cohort.')
267267
return redirect('cohort_list')
268268

269+
print("Cohort detail call, counts only is: {}".format(counts_only))
269270
shared_with_ids = Cohort_Perms.objects.filter(cohort=cohort, perm=Cohort_Perms.READER).values_list('user', flat=True)
270271
shared_with_users = User.objects.filter(id__in=shared_with_ids)
271272

idc_collections/collex_metadata_utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ def build_explorer_context(is_dicofdic, source, versions, filters, fields, order
282282
for source in sources:
283283
is_origin = DataSetType.IMAGE_DATA in source_data_types[source.id]
284284
# If a field list wasn't provided, work from a default set
285-
if is_origin and not len(fields):
286-
fields = source.get_attr(for_faceting=False).filter(default_ui_display=True).values_list('name',
287-
flat=True)
285+
if is_origin and not counts_only and not len(fields):
286+
fields = ["SeriesInstanceUID", "StudyInstanceUID", "collection_id", "PatientID", "program_name"]
287+
logger.info("[STATUS] No field list provided, using default field list of: {}".format(fields))
288288
for dataset in data_sets:
289289
if dataset.data_type in source_data_types[source.id]:
290290
set_type = dataset.get_set_name()
@@ -2381,6 +2381,10 @@ def get_metadata_solr(filters, fields, sources, counts_only, collapse_on, record
23812381

23822382
if DataSetType.IMAGE_DATA in source_data_types[source.id] and not counts_only:
23832383
# Get the records
2384+
if not len(fields):
2385+
logger.warning("[WARNING] Requesting records without a field lists results in all fields being returned, which we almost never want!")
2386+
logger.warning("[WARNING] Always give a precise list of fields!")
2387+
fields = ["collection_id", "SeriesInstanceUID", "StudyInstanceUID", "PatientID", "program_name"]
23842388
solr_result = query_solr_and_format_result({
23852389
'collection': source.name if not record_source else record_source.name,
23862390
'fields': list(fields),

0 commit comments

Comments
 (0)