Skip to content

Commit 9be804e

Browse files
authored
Merge pull request #1485 from ImagingDataCommons/release-48-sp
Release 48
2 parents f8725b3 + 719564a commit 9be804e

File tree

7 files changed

+70
-40
lines changed

7 files changed

+70
-40
lines changed

etl/etl.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
from idc_collections.models import Program, Collection, Attribute, Attribute_Ranges, \
4444
Attribute_Display_Values, DataSource, DataSourceJoin, DataVersion, DataSetType, \
45-
Attribute_Set_Type, Attribute_Display_Category, ImagingDataCommonsVersion, Attribute_Tooltips
45+
Attribute_Set_Type, Attribute_Display_Category, ImagingDataCommonsVersion, Attribute_Tooltips, Citation
4646
from google_helpers.bigquery.bq_support import BigQuerySupport
4747

4848
from django.contrib.auth.models import User
@@ -319,6 +319,35 @@ def add_source_joins(froms, from_col, tos=None, to_col=None):
319319
DataSourceJoin.objects.bulk_create(src_joins)
320320

321321

322+
def load_citations(filename):
323+
try:
324+
cites_file = open(filename,"r")
325+
current_cites = [x.doi for x in Citation.objects.all()]
326+
new_cites = []
327+
updated_cites = {}
328+
for line in csv_reader(cites_file):
329+
if "doi, citation" in line:
330+
print("[STATUS] Saw header line during citation load - skipping!")
331+
continue
332+
if line[0] in current_cites:
333+
updated_cites[line[0]] = line[1]
334+
else:
335+
new_cites.append(Citation(doi=line[0], cite=line[1]))
336+
if len(new_cites):
337+
Citation.objects.bulk_create(new_cites)
338+
print("[STATUS] The following {} DOI citations were added: {}".format(len(new_cites), " ".join([x.doi for x in new_cites])))
339+
if len(updated_cites):
340+
to_update = Citation.objects.filter(doi__in=updated_cites.keys())
341+
for upd in to_update:
342+
upd.cite = updated_cites[upd.doi]
343+
Citation.objects.bulk_update(to_update, ["cite"])
344+
print("[STATUS] {} DOI citations were updated.".format(len(updated_cites)))
345+
except Exception as e:
346+
ERRORS_SEEN.append("Error seen while loading citations, check the logs!")
347+
logger.error("[ERROR] While trying to load citations: ")
348+
logger.exception(e)
349+
350+
322351
def load_collections(filename, data_version="8.0"):
323352
try:
324353
collection_file = open(filename, "r")
@@ -781,7 +810,8 @@ def parse_args():
781810

782811
parser = ArgumentParser()
783812
parser.add_argument('-j', '--config-file', type=str, default='', help='JSON file of version data to update')
784-
parser.add_argument('-c', '--collex-file', type=str, default='', help='CSV data of collections to update/create')
813+
parser.add_argument('-c', '--collex-file', type=str, default='', help='CSV data of citations to update/create')
814+
parser.add_argument('-i', '--cites-file', type=str, default='', help='CSV data of collections to update/create')
785815
parser.add_argument('-d', '--display-vals', type=str, default='', help='CSV data of display values to add/update')
786816
parser.add_argument('-p', '--programs-file', type=str, default='', help='CSV data of programs to add/update')
787817
parser.add_argument('-a', '--attributes-file', type=str, default='', help='CSV data of attributes to add/update')
@@ -821,6 +851,8 @@ def main():
821851
len(args.programs_file) and load_programs(args.programs_file)
822852
# Add/update collections - any new programs must be added first
823853
len(args.collex_file) and load_collections(args.collex_file)
854+
# Add/update any citations
855+
len(args.cites_file) and load_citations(args.cites_file)
824856
# Add/update display values for attributes
825857
if len(args.display_vals):
826858
dvals = load_display_vals(args.display_vals)

idc/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def landing_page(request):
7676
"Testicles": "Testis",
7777
"Adrenal Glands": "Adrenal Gland",
7878
"Adrenal": "Adrenal Gland",
79-
"Lymph Node": "Lymph Nodes"
79+
"Lymph Node": "Lymph Nodes",
80+
"Bone Marrow": "Blood"
8081
}
8182

8283
skip = [

static/js/filterutils.js

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ define(['jquery', 'base'], function($, base) {
196196
if (sliders.length > 0) {
197197
load_sliders(sliders, false);
198198
}
199-
200199
//mkFiltText();
201200
//return updateFacetsData(true).promise();
202201
return handleFilterSelectionUpdate(null, true, true)
@@ -633,7 +632,6 @@ define(['jquery', 'base'], function($, base) {
633632
}
634633
};
635634

636-
637635
window.resetFilters = function(){
638636
$('input:checkbox').not('.hide-zeros').not('.tbl-sel').prop('checked',false);
639637
$('input:checkbox').not('.hide-zeros').not('.tbl-sel').prop('indeterminate',false);
@@ -664,34 +662,22 @@ define(['jquery', 'base'], function($, base) {
664662
} else {
665663
first_filter_load = false;
666664
}
667-
}
665+
}
668666
}
669667

670668
if (doUpdate){
671669
var mxstudies = 0;
672670
var mxseries = 0;
673-
674671
var projArr=[];
675672
var serverdata = [updateFacetsData(true)];
676673
projArr = Object.keys(window.proj_in_cart);
677-
/*
678-
$('#projects_table').find('tr').each(function(){
679-
if ($(this).hasClass('someInCart')){
680-
var projid = $(this).attr('data-projectid');
681-
projArr.push(projid)
682-
}
683-
684-
});*/
685-
686-
if (projArr.length>0)
687-
{
674+
if (projArr.length>0) {
688675
serverdata.push(getProjectCartStats(projArr));
689676
}
690677

691678
$('.spinner').show();
692679
//$.when.apply(undefined, serverdata).then(function(ret)
693-
promise = Promise.all(serverdata).then(function(ret)
694-
{
680+
promise = Promise.all(serverdata).then(function(ret) {
695681

696682
var collFilt = ret[0][0];
697683
var collectionData = ret[0][1];
@@ -711,22 +697,18 @@ define(['jquery', 'base'], function($, base) {
711697
cartStats={}
712698
}
713699
//var numStudiesRet = totals.StudyInstanceUID;
714-
715-
716-
717700
createPlots('search_orig_set');
718-
createPlots('search_derived_set');
719-
createPlots('tcga_clinical');
701+
createPlots('search_derived_set');
702+
createPlots('tcga_clinical');
720703

721704
if ($('.search-configuration').find('.hide-zeros')[0].checked) {
722-
addSliders('search_orig_set', false, true, '');
723-
addSliders('quantitative', false, true, 'quantitative.');
724-
addSliders('tcga_clinical', false, true, 'tcga_clinical.');
725-
}
705+
addSliders('search_orig_set', false, true, '');
706+
addSliders('quantitative', false, true, 'quantitative.');
707+
addSliders('tcga_clinical', false, true, 'tcga_clinical.');
708+
}
726709

727710
updateTablesAfterFilter(collFilt, collectionData, collectionStats,cartStats);
728711
$('.spinner').hide();
729-
//updateTableCounts(1)
730712
});
731713

732714

static/js/image_search.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ require([
624624
}
625625
}
626626

627-
$(document).ready(function () {
627+
$(document).ready(async function () {
628628

629629
tables.initializeTableCacheData();
630630
tables.initializeTableViewedItemsData();
@@ -694,7 +694,7 @@ require([
694694
window.cartHist.push(cartSel);
695695
window.proj_in_cart = new Object();
696696

697-
filterutils.load_preset_filters();
697+
await filterutils.load_preset_filters();
698698
$('.hide-filter-uri').on('click',function() {
699699
$(this).hide();
700700
$('.get-filter-uri').show();

static/js/sapien.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,17 @@ require([
7373
Chest: 'rgb(0, 233, 255)',
7474
};
7575

76+
// Map the sapiens.js expected location names (typically uses a dash) to the TumorLocation
77+
// value stored in DICOM (freeform text to an extent, not normalized)
78+
//format: { <sapiens.js name>: [<TumorLocation>, ...], ...}
7679
var variantNames = {
7780
'Colorectal': ['Colon','Rectum'],
78-
"Blood": ["Marrow, Blood", "Marrow and Blood", "Blood"],
81+
"Blood": ["Marrow, Blood", "Marrow and Blood", "Blood", "Bone Marrow", "Blood, Bone"],
7982
"Bile-Duct": ["Bile Duct"],
8083
"Adrenal-Gland": ["Adrenal Glands", "Adrenal"],
8184
"Testis": ["Testicles"],
8285
"Head-and-Neck": ["Head", "Head-Neck"],
83-
"Lymph-Nodes": ["Lymph Node", "Lymph Nodes"]
86+
"Lymph-Nodes": ["Lymph Node", "Lymph Nodes"],
8487
};
8588

8689
let data = case_counts.sort(function(a,b){
@@ -119,7 +122,7 @@ require([
119122

120123
root.prepend(rawsvg.buildHumanBody(null,null,' '));
121124

122-
let initChartWidth = 400;
125+
let initChartWidth = 500;
123126
let initChartHeight = 470;
124127
let top = 75;
125128
let labelSize ='12px';
@@ -130,7 +133,7 @@ require([
130133
let fileCountKey = 'fileCount';
131134

132135
const plotHeight = initChartHeight - 30;
133-
const barStartOffset = 130;
136+
const barStartOffset = 200;
134137
const barWidth = initChartWidth - barStartOffset;
135138
const maxCases = Math.max(...data.map(d => d[caseCountKey]));
136139
const halfPixel = 0.5;
@@ -188,7 +191,7 @@ require([
188191
.attr('fill', 'rgb(10, 10, 10)')
189192
.attr('font-size', labelSize)
190193
.style('text-anchor', 'end')
191-
.text(d => d[primarySiteKey])
194+
.text(d => d[primarySiteKey] === "Blood" ? "Blood and Bone Marrow" : d[primarySiteKey])
192195
.on('mouseover', function (d, i) { // needs `this`
193196
const organSelector = toClassName(d[primarySiteKey]);
194197
const organ = document.getElementById(organSelector);

static/js/sapien/raw-svg.js

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/js/tables.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,10 +482,8 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
482482
}
483483
});
484484
return deferred.promise();
485-
486485
}
487486

488-
489487
const caseTableColDefs = function(){
490488
return [
491489
{className: "ckbx studyview","targets": [0]},
@@ -927,6 +925,9 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
927925
}
928926
}, {
929927
"type": "text", "orderable": true, data: 'StudyDate', render: function (data) {
928+
if(data === "" || data === undefined || data === null) {
929+
return "";
930+
}
930931
// fix when StudyData is an array of values
931932
var dt = new Date(Date.parse(data));
932933
var dtStr = (dt.getUTCMonth() + 1).toLocaleString('en-US', {minimumIntegerDigits: 2}) + "-" + dt.getUTCDate().toLocaleString('en-US', {minimumIntegerDigits: 2}) + "-" + dt.getUTCFullYear().toString();

0 commit comments

Comments
 (0)