-
Notifications
You must be signed in to change notification settings - Fork 2
/
dashboard_interactive.html
224 lines (205 loc) · 10 KB
/
dashboard_interactive.html
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Genomics Production Dashboard</title>
<script type="text/javascript" src="d3/d3.v3.js"></script>
<script type="text/javascript" src="d3/box.js"></script>
<script type="text/javascript" src="dashboard.js"></script>
<script type="text/javascript" src="dashboard_problems.js"></script>
<link rel="stylesheet" type="text/css" href="dashboard.css">
</head>
<body>
<div id="header">
<h1 id="title">Genomics Process status</h1>
<div id="date_selector">
Start date: <input type="date" id="start_date_input">
End date: <input type="date" id="end_date_input">
<button id="set_date">Set date</button>
</div>
<!--<span id="date"></span> - <em>Data for the previous 12 weeks</em>-->
</div>
<div id="status_panels">
<div id="demand_bc" class="barchart_panel">
<h2>Customer demand - projects/week</h2>
</div>
<div id="ongoing_bc" class="barchart_panel">
<h2>Ongoing projects today</h2>
</div>
<div id="total_del_times" class="times_panel">
<h2>Total delivery times - <span id="total_legend">All projects</span></h2>
<div id="total_rc">
<h3>Run chart</h3>
<!--<h3 id="total_rc_legend">All projects</h3>-->
</div>
<div id="total_bp" class="boxplot_panel">
<h3>Variability</h3>
<!--<h3 id="total_bp_legend">All projects</h3>-->
</div>
</div>
<br class="clear">
<div id="rec_ctrl_del_times" class="times_panel">
<h2 id="rec_ctrl_legend">Rec control delivery times - All projects</h2>
<div id="rec_ctrl_rc">
<h3>Run chart</h3>
<!--<h3 id="rec_ctrl_rc_legend">All projects</h3>-->
</div>
<div id="rec_ctrl_bp" class="boxplot_panel">
<h3>Variability</h3>
<!--<h3 id="rec_ctrl_bp_legend">All projects</h3>-->
</div>
</div>
<div id="lib_prep_del_times" class="times_panel">
<h2 id="lib_prep_legend">Lib prep delivery times - Lib prep projects</h2>
<div id="lib_prep_rc">
<h3>Run chart</h3>
<!--<h3 id="lib_prep_rc_legend">All projects</h3>-->
</div>
<div id="lib_prep_bp" class="boxplot_panel">
<h3>Variability</h3>
<!--<h3 id="lib_prep_bp_legend">All projects</h3>-->
</div>
</div>
<div id="seq_del_times" class="times_panel">
<h2>Sequencing delivery times - <span id="seq_legend">All projects</span></h2>
<div id="seq_rc">
<h3>Run chart</h3>
<!--<h3 id="seq_rc_legend">All projects</h3>-->
</div>
<div id="seq_bp" class="boxplot_panel">
<h3>Variability</h3>
<!--<h3 id="seq_bp_legend">All projects</h3>-->
</div>
</div>
<br class="clear">
</div>
<!--"Problem panels"-->
<div id="problem_panels" style="display: none">
<div id="fs_prog_bc" class="barchart_panel">
<h2>Rec control</h2>
<p>samples progressed failed in rec ctrl</p>
</div>
<div id="failed_samples_per_workset" class="times_panel">
<h2>Lib prep - #failed samples/workset</h2>
<div id="fs_ws_rc">
<h3>Run chart</h3>
</div>
<div id="fs_ws_bp" class="boxplot_panel">
<h3>Variability</h3>
<!--<h3 id="seq_bp_legend">All projects</h3>-->
</div>
</div>
<div id="data_delivered" class="times_panel">
<h2>Seq - data delivered / data ordered</h2>
<div id="data_del_rc">
<h3>Run chart</h3>
</div>
<div id="data_del_bp" class="boxplot_panel">
<h3>Variability</h3>
</div>
</div>
</div>
<script type="text/javascript">
// check every hour if time is between 7 and 8
// if so, reload window
var oneHour = 1000*60*60;
window.setTimeout(function() {
window.location.reload();
},
//20000
oneHour
);
var dateFormat = d3.time.format("%Y-%m-%d");
var today = new Date(); // today
var twelveWeeks = new Date( today.getTime() - 12 * 7 * 1000*60*60*24);
//d3.select("#start_date_input").value(twelveWeeks);
// date field code not really working...
var start_field = document.getElementById("start_date_input");
console.log(dateFormat(twelveWeeks));
start_field.value = dateFormat(twelveWeeks);
var end_field = document.getElementById("end_date_input");
console.log(dateFormat(today));
end_field.value = dateFormat(today);
console.log(end_field.value);
var winWidth = window.innerWidth;
var winHeight = window.innerHeight;
console.log("w: " + winWidth + ", h: " + winHeight);
//var panelHeights = 300;
//var rcWidth = 350;
var panelHeights = (winHeight - 305) / 2;
var rcWidth = (winWidth - 440) / 3;
var applDataUrl ="getCouchDbData.php?db=projects&design=process_flow&view=KPI_applications&group_level=3";
//var applDataUrl ="getCouchDbData.php?db=projects&design=process_flow&view=KPI_applications&group_level=3&dev";
var dateStr = today.getFullYear() + "-" + today.getMonth() + "-" + today.getDate();
var dateStr = today.toDateString();
// d3.select("#date")
// .text(dateStr);
var appl_json;
var pf_json;
d3.json(applDataUrl, function(json) {
appl_json = json;
//console.log(appl_json); //Log output to console
/*
* Nest d3.json call to be sure all data is loaded before drawing all panels
*/
// preparation for both data sets
var pfDataUrl ="getCouchDbData.php?db=projects&design=process_flow&view=KPI&group_level=3";
//var pfDataUrl ="getCouchDbData.php?db=projects&design=test&view=KPI&group_level=3";
//console.log("About to call d3.json again");
d3.json(pfDataUrl, function(json) {
pf_json = json;
//console.log(pf_json); //Log output to console
drawProcessPanels(appl_json, pf_json, today, twelveWeeks, panelHeights, rcWidth);
// set function for button, pass on the data sets
var setDateButton = document.getElementById("set_date");
// need to add updatePlots function (this function should get the dates from the date fields,
// then call drawProcessPannels. Need to empty the divs first?)
setDateButton.addEventListener("click", updatePlots(appl_json, pf_json, panelHeights, rcWidth) );
});
// // only one data set
// drawProcessPanels(appl_json, today, twelveWeeks, panelHeights, rcWidth);
});
// trying out stuff for problem KPIs.
var failedProgUrl = "getCouchDbData.php?db=projects&design=kpi_external&view=KPI1&reduce=false";
d3.json(failedProgUrl, function(json){
//console.log(json);
var fpDataset = generateFailedProgressedDataset(json, today);
//console.log(fpDataset);
//drawBarchartPlot(fpDataset, "fs_prog_bc", 500, panelHeights, 30);
drawBarchartPlot(fpDataset, "fs_prog_bc", (rcWidth + 110), panelHeights, 30);
});
var wsFailRateUrl = "getCouchDbData.php?db=projects&design=kpi_external&view=KPI2&reduce=false";
d3.json(wsFailRateUrl, function(json){
//console.log("Workset failrate dataset:");
//console.log(json);
var d = generateWorksetFailureDataset (json, twelveWeeks, today);
//console.log(d);
drawFailedLpRunChart(d, "fs_ws_rc", [], rcWidth, panelHeights, 30);
var bd = generateGenericBoxDataset(d, 1);
//console.log(bd);
drawBoxPlot(bd, "fs_ws_bp", panelHeights);
});
var delDataUrl = "getCouchDbData.php?db=projects&design=kpi_external&view=KPI3_1&reduce=false";
d3.json(delDataUrl, function(json){
var delDataDataset = generateDeliveredDataDataset (json, twelveWeeks, today);
//console.log("Data del dataset");
//console.log(delDataDataset);
drawDeliveredDataRunChart(delDataDataset, "data_del_rc", [], rcWidth, panelHeights, 30);
var bd = generateGenericBoxDataset(delDataDataset, 1);
drawBoxPlot(bd, "data_del_bp", panelHeights);
});
//window.setInterval(function() {
// //console.log("in cycling function");
// problems_displayed = (d3.select("#problem_panels").attr("style") == "display: block");
// if(problems_displayed) {
// d3.select("#problem_panels").attr("style", "display: none");
// d3.select("#status_panels").attr("style", "display: block");
// } else {
// d3.select("#status_panels").attr("style", "display: none");
// d3.select("#problem_panels").attr("style", "display: block");
//
// }
//}, 120000);
</script>
</body>
</html>