Skip to content

Commit 2df4f85

Browse files
authored
Merge pull request #369 from ImagingDataCommons/idc-test-sp
MVP
2 parents 7c84e0e + 60a2227 commit 2df4f85

File tree

12 files changed

+197
-45
lines changed

12 files changed

+197
-45
lines changed

scripts/database_bootstrap.py

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,22 @@
5858
'year_of_diagnosis': 'year',
5959
'days_to_birth': 'by_negative_3k',
6060
'year_of_initial_pathologic_diagnosis': 'year',
61-
'age_at_diagnosis': None
61+
'age_at_diagnosis': None,
62+
'SUVbw': 'SUVbw',
63+
'Volume': 'Volume',
64+
'Diameter': 'Diameter',
65+
'Surface_area_of_mesh': 'Surface_area_of_mesh',
66+
'Total_Lesion_Glycolysis': 'Total_Lesion_Glycolysis',
67+
'Standardized_Added_Metabolic_Activity': 'Standardized_Added_Metabolic_Activity',
68+
'Percent_Within_First_Quarter_of_Intensity_Range': 'Percent_Within_First_Quarter_of_Intensity_Range',
69+
'Percent_Within_Third_Quarter_of_Intensity_Range': 'Percent_Within_Third_Quarter_of_Intensity_Range',
70+
'Percent_Within_Fourth_Quarter_of_Intensity_Range': 'Percent_Within_Fourth_Quarter_of_Intensity_Range',
71+
'Percent_Within_Second_Quarter_of_Intensity_Range': 'Percent_Within_Second_Quarter_of_Intensity_Range',
72+
'Standardized_Added_Metabolic_Activity_Background': 'Standardized_Added_Metabolic_Activity_Background',
73+
'Glycolysis_Within_First_Quarter_of_Intensity_Range': 'Glycolysis_Within_First_Quarter_of_Intensity_Range',
74+
'Glycolysis_Within_Third_Quarter_of_Intensity_Range': 'Glycolysis_Within_Third_Quarter_of_Intensity_Range',
75+
'Glycolysis_Within_Fourth_Quarter_of_Intensity_Range': 'Glycolysis_Within_Fourth_Quarter_of_Intensity_Range',
76+
'Glycolysis_Within_Second_Quarter_of_Intensity_Range': 'Glycolysis_Within_Second_Quarter_of_Intensity_Range'
6277
}
6378

6479
ranges = {
@@ -69,7 +84,22 @@
6984
'by_500': [{'first': "500", "last": "6000", "gap": "500", "include_lower": False, "unbounded": True,
7085
"include_upper": True, 'type': 'I'}],
7186
'year': [{'first': "1976", "last": "2015", "gap": "5", "include_lower": True, "unbounded": False,
72-
"include_upper": False, 'type': 'I'}]
87+
"include_upper": False, 'type': 'I'}],
88+
'SUVbw': [{'type': 'I', 'include_lower': '1', 'include_upper': '0', 'unbounded': '1', 'first': '3', 'last': '12', 'gap': '1'}],
89+
'Volume': [{'type': 'I', 'include_lower': '1', 'include_upper': '0', 'unbounded': '1', 'first': '10', 'last': '28000', 'gap': '2800'}],
90+
'Diameter': [{'type': 'I', 'include_lower': '1', 'include_upper': '0', 'unbounded': '1', 'first': '6', 'last': '55', 'gap': '6'}],
91+
'Surface_area_of_mesh': [{'type': 'I', 'include_lower': '1', 'include_upper': '0', 'unbounded': '1', 'first': '150', 'last': '4500', 'gap': '435'}],
92+
'Total_Lesion_Glycolysis': [{'type': 'I', 'include_lower': '1', 'include_upper': '0', 'unbounded': '1', 'first': '78', 'last': '698', 'gap': '78'}],
93+
'Standardized_Added_Metabolic_Activity': [{'type': 'I', 'include_lower': '1', 'include_upper': '0', 'unbounded': '1', 'first': '56', 'last': '502', 'gap': '56'}],
94+
'Percent_Within_First_Quarter_of_Intensity_Range': [{'type': 'I', 'include_lower': '1', 'include_upper': '0', 'unbounded': '1', 'first': '10', 'last': '90', 'gap': '10'}],
95+
'Percent_Within_Third_Quarter_of_Intensity_Range': [{'type': 'I', 'include_lower': '1', 'include_upper': '0', 'unbounded': '1', 'first': '10', 'last': '90', 'gap': '10'}],
96+
'Percent_Within_Fourth_Quarter_of_Intensity_Range': [{'type': 'I', 'include_lower': '1', 'include_upper': '0', 'unbounded': '1', 'first': '10', 'last': '90', 'gap': '10'}],
97+
'Percent_Within_Second_Quarter_of_Intensity_Range': [{'type': 'I', 'include_lower': '1', 'include_upper': '0', 'unbounded': '1', 'first': '10', 'last': '90', 'gap': '10'}],
98+
'Standardized_Added_Metabolic_Activity_Background': [{'type': 'F', 'include_lower': '1', 'include_upper': '0', 'unbounded': '1', 'first': '0.5', 'last': '5', 'gap': '0.5'}],
99+
'Glycolysis_Within_First_Quarter_of_Intensity_Range': [{'type': 'I', 'include_lower': '1', 'include_upper': '0', 'unbounded': '1', 'first': '28', 'last': '251', 'gap': '28'}],
100+
'Glycolysis_Within_Third_Quarter_of_Intensity_Range': [{'type': 'I', 'include_lower': '1', 'include_upper': '0', 'unbounded': '1', 'first': '25', 'last': '225', 'gap': '25'}],
101+
'Glycolysis_Within_Fourth_Quarter_of_Intensity_Range': [{'type': 'I', 'include_lower': '1', 'include_upper': '0', 'unbounded': '1', 'first': '19', 'last': '170', 'gap': '19'}],
102+
'Glycolysis_Within_Second_Quarter_of_Intensity_Range': [{'type': 'I', 'include_lower': '1', 'include_upper': '0', 'unbounded': '1', 'first': '25', 'last': '227', 'gap': '25'}]
73103
}
74104

75105
BQ_PROJ_DATASET = 'idc-dev-etl.idc_tcia_views_mvp_wave0'
@@ -576,8 +606,11 @@ def main():
576606

577607
attr = all_attrs[line_split[0]]
578608

579-
if attr['type'] == Attribute.CONTINUOUS_NUMERIC:
580-
attr['range'] = []
609+
if attr['type'] == Attribute.CONTINUOUS_NUMERIC and 'range' not in attr:
610+
if attr['name'] in ranges_needed:
611+
attr['range'] = ranges.get(ranges_needed.get(attr['name'], ''), [])
612+
else:
613+
attr['range'] = []
581614

582615
attr['solr_collex'].append(SOLR_INDEX['dicom_derived'])
583616
attr['bq_tables'].append(BQ_TABLES['quan'])

static/css/style.css

Lines changed: 18 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/css/vendor.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2876,7 +2876,6 @@ fieldset[disabled] a.btn {
28762876
fieldset[disabled] .btn-default.focus,
28772877
fieldset[disabled] .btn-default:active,
28782878
fieldset[disabled] .btn-default.active {
2879-
background-color: transparent;
28802879
border-color: #F7991B; }
28812880
.btn-default .badge {
28822881
color: transparent;

static/js/base.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ define(['jquery', 'utils'], function($, utils) {
207207
}
208208
});
209209

210+
$.getCookie = utils.getCookie;
211+
$.setCookie = utils.setCookie;
212+
$.removeCookie = utils.removeCookie;
213+
210214
return {
211215
blacklist: /<script>|<\/script>|!\[\]|!!\[\]|\[\]\[\".*\"\]|<iframe>|<\/iframe>/ig,
212216
// From http://www.regular-expressions.info/email.html
@@ -217,6 +221,12 @@ define(['jquery', 'utils'], function($, utils) {
217221
setReloadMsg: function(type,text) {
218222
sessionStorage.setItem("reloadMsg",JSON.stringify({type: type, text: text}));
219223
},
224+
setCookie: function(name,val,expires_in,path) {
225+
utils.setCookie(name,val,expires_in,path);
226+
},
227+
removeCookie: function(name, path) {
228+
utils.removeCookie(name, path);
229+
},
220230
blockResubmit: utils.blockResubmit
221231
};
222232
});

static/js/cohorts/cohort-details.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,28 @@ require.config({
3838
require([
3939
'jquery',
4040
'jqueryui',
41+
'base',
4142
'bootstrap',
4243
'assetscore'
4344
,'assetsresponsive',
44-
'base'
45-
], function($, jqueryui, bootstrap) {
45+
], function($, jqueryui, base, bootstrap) {
4646
A11y.Core();
4747

48+
var downloadToken = new Date().getTime();
49+
$('#download-manifest').prop("href", $('#download-manifest').prop("href") + "?downloadToken="+downloadToken);
50+
$('#download-manifest').data('downloadToken',downloadToken);
51+
52+
$('#download-manifest').on('click', function() {
53+
var self=$(this);
54+
55+
self.attr('disabled','disabled');
56+
57+
$('#download-in-progress').modal('show');
58+
59+
base.blockResubmit(function() {
60+
self.removeAttr('disabled');
61+
$('#download-in-progress').modal('hide');
62+
},downloadToken, 'downloadToken');
63+
});
4864

4965
});

static/js/explore.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,41 @@ require([
170170
allowHTML: true,
171171
interactive: true
172172
});
173+
174+
tippy('.tooltip_filter_info',{
175+
content: 'Each chart below reports the number of cases (or patients) for all attributes within a given attribute '+
176+
'category for the cohort constructed by the defined filter. For certain categories (i.e. Modality) some '+
177+
'cases may apply to several attributes within the category. Hence some attributes that seem to be excluded '+
178+
'in the filter definition may have positive case counts.',
179+
theme: 'light',
180+
placement: 'right-end',
181+
arrow: false
182+
});
183+
184+
tippy('.tooltip_chart_info',{
185+
content: 'The panel below reports the number of unique cases (or patients) for each attribute within a cohort '+
186+
'constructed by adding the given attribute (when absent) to the defined filter.',
187+
theme: 'light',
188+
placement: 'right-end',
189+
arrow: false
190+
});
191+
192+
tippy('.checkbox-none',{
193+
content: 'Filtering on the \'None\' attribute is not currently supported within derived data.',
194+
theme: 'light',
195+
placement: 'top-start',
196+
arrow: false
197+
});
198+
199+
tippy.delegate('.studies-table', {
200+
content: function(reference) {
201+
return $(reference).data('study-id');
202+
},
203+
theme: 'dark',
204+
placement: 'right',
205+
arrow: false,
206+
target: '.study-id-col',
207+
maxWidth: 300
208+
});
209+
173210
});

static/js/image_search.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ require(['jquery', 'underscore', 'jquerydt','jqueryui', 'bootstrap','base'],
893893
var studyId = curData.StudyInstanceUID;
894894
var ppStudyId = pretty_print_id(studyId);
895895
var fetchUrl = DICOM_STORE_PATH + studyId;
896-
var hrefTxt = ppStudyId + '</a><span class="tooltiptext_ex">' + studyId + '</span>';
896+
var hrefTxt = ppStudyId + '</a>';
897897
//var hrefTxt = ppStudyId + '<span class="tooltiptext_ex">' + studyId + '</span>';
898898
var pclass = 'project_' + projectId;
899899
var newHtml = '';
@@ -911,7 +911,7 @@ require(['jquery', 'underscore', 'jquerydt','jqueryui', 'bootstrap','base'],
911911
var seriesTxt = ppSeriesId + '<span class="tooltiptext_ex">' + seriesId + '</span>';
912912

913913
newHtml = '<tr id="' + rowId + '" class="' + pclass + ' ' + studyClass + ' text_head">' +
914-
'<td class="col1 tooltip_ex study-id">' + hrefTxt + '</td>' +
914+
'<td class="col1 study-id study-id-col" data-study-id="'+studyId+'">' + hrefTxt + '</td>' +
915915
'<td class="series-number">' + seriesNumber + '</td>' +
916916
'<td class="col1 modality">' + modality + '</td>' +
917917
'<td class="col1 body-part-examined">' + bodyPartExamined + '</td>' +
@@ -938,15 +938,15 @@ require(['jquery', 'underscore', 'jquerydt','jqueryui', 'bootstrap','base'],
938938
newHtml = '<tr id="' + rowId + '" class="' + pclass + ' text_head selected_grey" onclick="(toggleStudy(this,\'' + studyId + '\',\'' + projectId + '\'))">' +
939939
'<td class="col1 project-name">' + projectId + '</td>' +
940940
'<td class="col1 case-id">' + patientId +
941-
'</td><td class="col2 tooltip_ex study-id">' + hrefTxt + '</td>' +
941+
'</td><td class="col2 study-id study-id-col" data-study-id="'+studyId+'">' + hrefTxt + '</td>' +
942942
'<td class="col1 study-description">' + studyDescription + '</td>' +
943943
'<td class="ohif open-viewer"><a href="' + fetchUrl + '" target="_blank"><i class="fa fa-eye"></i></a></td></tr>'
944944

945945
} else {
946946
newHtml = '<tr id="' + rowId + '" class="' + pclass + ' text_head" onclick="(toggleStudy(this,\'' + studyId + '\',\'' + projectId + '\'))">' +
947947
'<td class="col1 project-name">' + projectId + '</td>' +
948948
'<td class="col1 case-id">' + patientId + '</td>' +
949-
'<td class="col2 tooltip_ex study-id">' + hrefTxt + '</td>' +
949+
'<td class="col2 study-id study-id-col" data-study-id="'+studyId+'">' + hrefTxt + '</td>' +
950950
'<td class="col1 study-description">' + studyDescription + '</td>' +
951951
'<td class="ohif open-viewer"><a href="' + fetchUrl + '" target="_blank"><i class="fa fa-eye"></i></a></td></tr>'
952952
}

static/js/utils.js

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
*
3-
* Copyright 2017, Institute for Systems Biology
3+
* Copyright 2020, Institute for Systems Biology
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -47,16 +47,45 @@ define(['jquery'], function($) {
4747
var downloadTimer;
4848
var attempts = 30;
4949

50-
function getCookie(name) {
51-
var parts = document.cookie.split(name + "=");
52-
if (parts.length == 2) {
53-
return parts.pop().split(";").shift();
50+
// Adapted from https://docs.djangoproject.com/en/1.9/ref/csrf/
51+
function _getCookie(name) {
52+
var cookieValue = null;
53+
if (document.cookie && document.cookie != '') {
54+
var cookies = document.cookie.split(';');
55+
for (var i = 0; i < cookies.length; i++) {
56+
var cookie = $.trim(cookies[i]);
57+
// Does this cookie string begin with the name we want?
58+
if (cookie.substring(0, name.length + 1) == (name + '=')) {
59+
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
60+
break;
61+
}
62+
}
5463
}
64+
return cookieValue;
65+
};
66+
67+
function _removeCookie(name, path) {
68+
path = path || "/";
69+
var now = new Date();
70+
var time = now.getTime();
71+
var expireTime = time-(300*1000);
72+
now.setTime(expireTime);
73+
document.cookie=encodeURIComponent(name)+"=; expires="+new Date(0).toUTCString()+"; path="+path+";";
74+
};
75+
76+
function _setCookie(name,val,path,expires_in) {
77+
var now = new Date();
78+
var time = now.getTime();
79+
expires_in = expires_in || (300*1000);
80+
path = path || '/';
81+
var expireTime = time+expires_in;
82+
now.setTime(expireTime);
83+
document.cookie=encodeURIComponent(name)+"="+val+"; expires="+now.toUTCString()+"; path="+path+";";
5584
};
5685

5786
// Set the cookie to expire Forever Ago so it dies immediately
5887
// Optional path parameter for path-specific cookies
59-
function expireCookie(name,path) {
88+
function _expireCookie(name,path) {
6089
path = path || "/";
6190
document.cookie = encodeURIComponent(name) + "=deleted; Path="+path+"; expires=" + new Date(0).toUTCString();
6291
};
@@ -65,7 +94,7 @@ define(['jquery'], function($) {
6594
// Callback can be used on a given page to unblock any DOM-based impediments
6695
function unblockSubmit(callback,cookieName) {
6796
window.clearInterval(downloadTimer);
68-
expireCookie(cookieName);
97+
_expireCookie(cookieName);
6998
attempts = 30;
7099
callback();
71100
};
@@ -106,12 +135,15 @@ define(['jquery'], function($) {
106135
// in its response
107136
blockResubmit: function(callback,downloadToken,expectedCookie) {
108137
downloadTimer = window.setInterval( function() {
109-
var token = getCookie(expectedCookie);
138+
var token = _getCookie(expectedCookie);
110139
if((token == downloadToken) || (attempts == 0)) {
111140
unblockSubmit(callback,expectedCookie);
112141
}
113142
attempts--;
114143
}, 1000 );
115-
}
144+
},
145+
setCookie: _setCookie,
146+
getCookie: _getCookie,
147+
removeCookie: _removeCookie
116148
};
117149
});

templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
</main>
9494

9595
<!-- Warning Modal -->
96-
<div class="modal fade" id="gov_warning" tabindex="-1" role="dialog" aria-labelledby="gov_warning-header" aria-hidden="true">
96+
<div class="modal fade" id="gov_warning" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="gov_warning-header" aria-hidden="true">
9797
<div class="modal-dialog">
9898
<div class="modal-content">
9999
<div class="modal-header">

templates/cohorts/cohort_details.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,19 @@ <h3 class="pull-left" role="heading" aria-level="1">Cohort Name: {{ cohort.name
6363
{% include "idc/explore_data_core.html" %}
6464
{% endwith %}
6565

66+
<!-- Download In Progress Modal -->
67+
<div class="modal fade" id="download-in-progress" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
68+
<div class="modal-dialog">
69+
<div class="modal-content">
70+
<div class="modal-header"></div>
71+
<div class="modal-body">
72+
<p><i class="fa fa-cog fa-spin"></i> Preparing manifest for download...</p>
73+
</div>
74+
<div class="modal-footer"></div>
75+
</div>
76+
</div>
77+
</div>
78+
6679
{% endblock %}
6780

6881
{% block js_file %}

0 commit comments

Comments
 (0)