forked from BimberLab/DiscvrLabKeyModules
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmanageStudy.html
More file actions
90 lines (80 loc) · 4.29 KB
/
manageStudy.html
File metadata and controls
90 lines (80 loc) · 4.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<script type="text/javascript" nonce="<%=scriptNonce%>">
(function($, LABKEY) {
$(function(){
$( document ).ready(function() {
const studyId = LABKEY.ActionURL.getParameter('studyId')
if (!studyId) {
alert('Must supply a study ID!')
return
}
const webpart = <%=webpartContext%>;
const parentDiv = $('#' + webpart.wrapperDivId)
parentDiv.append('<div id="' + webpart.wrapperDivId + '-studyCohorts"></div>')
parentDiv.append('<div id="' + webpart.wrapperDivId + '-demographics"></div>')
parentDiv.append('<div id="' + webpart.wrapperDivId + '-anchorEvents"></div>')
parentDiv.append('<div id="' + webpart.wrapperDivId + '-expectedTimepoints"></div>')
LDK.Utils.getBasicQWP({
frame: 'portal',
title: 'Cohorts',
name: 'query-studies',
schemaName: 'studies',
queryName: 'studyCohorts',
filterArray: [LABKEY.Filter.create('studyId',studyId, LABKEY.Filter.Types.EQUAL)],
maxRows: 20,
renderTo: webpart.wrapperDivId + '-studyCohorts'
}).render();
if (LABKEY.getModuleContext('study')?.subject) {
const hasAssignmentDataset = !!LABKEY.getModuleContext('studies')?.hasAssignmentDataset
if (hasAssignmentDataset) {
LABKEY.Query.selectRows({
schemaName: 'studies',
queryName: 'studies',
columns: 'rowId,studyName',
filterArray: [LABKEY.Filter.create('rowId', studyId)],
failure: LDK.Utils.getErrorCallback(),
success: function(results) {
const studyName = results.rows?.[0].studyName;
LDK.Assert.assertNotEmpty('StudyName was empty in manageStudy.view', studyName);
const projectFieldName = 'allProjectsPivot/' + studyName + '::lastStartDate';
const demographicsDefaultView = LABKEY.getModuleProperty('studies', 'demographicsDefaultView')
LDK.Utils.getBasicQWP({
frame: 'portal',
title: LABKEY.moduleContext.study?.subject.nounPlural,
name: 'query-demographics',
schemaName: 'study',
queryName: 'demographics',
viewName: demographicsDefaultView,
filterArray: [LABKEY.Filter.create(projectFieldName, null, LABKEY.Filter.Types.NONBLANK)],
maxRows: 20,
renderTo: webpart.wrapperDivId + '-demographics'
}).render();
},
scope: this
});
}
}
LDK.Utils.getBasicQWP({
frame: 'portal',
title: 'Anchor Events',
name: 'query-anchorEvents',
schemaName: 'studies',
queryName: 'anchorEvents',
filterArray: [LABKEY.Filter.create('studyId',studyId, LABKEY.Filter.Types.EQUAL)],
maxRows: 20,
renderTo: webpart.wrapperDivId + '-anchorEvents'
}).render();
LDK.Utils.getBasicQWP({
frame: 'portal',
title: 'Expected Timepoints',
name: 'query-expectedTimepoints',
schemaName: 'studies',
queryName: 'expectedTimepoints',
filterArray: [LABKEY.Filter.create('studyId',studyId, LABKEY.Filter.Types.EQUAL)],
maxRows: 20,
renderTo: webpart.wrapperDivId + '-expectedTimepoints'
}).render();
})
});
}(jQuery, LABKEY));
</script>
<br><br>