Skip to content

Commit 80abe96

Browse files
author
Cris
committed
Adding Exchangeable/Independent/Autocorrelation cov. structures
1 parent 98b9478 commit 80abe96

27 files changed

+19504
-10239
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ app.on('ready', function () {
120120
});
121121
//mainWindow.maximize();
122122
//
123-
//mainWindow.toggleDevTools();
123+
//
124+
mainWindow.toggleDevTools();
124125
//modalWindow.toggleDevTools();
125126

126127

package-lock.json

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

resources/main.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
-->
5050

5151
<!-- Bootload scripts -->
52-
<script src="./dist/main.js"></script>
53-
<!--
5452
<script src="./main.js"></script>
53+
<!--
54+
<script src="./dist/main.js"></script>
5555
-->
5656

5757
</body>

resources/src/[email protected]/compile_tags.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
riot=node_modules/.bin/riot
3+
riot=../../node_modules/.bin/riot
44
function compile_riot(){
55
file=$1
66
cp $file ${file%.*}.tag

resources/src/[email protected]/components/[email protected]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
<div class="paper-model-1 paper-pdf w-100 h-100 main-panel-container hidden">
4242
<iframe class="w-100 h-100"
43-
src="./lib/[email protected]/adapted/web/viewer.html?file=../../../../../model/1707.01861.pdf#zoom=page-width&"></iframe>
43+
src="./lib/[email protected]/adapted/web/viewer.html?file=../../../../../stats-model/papers/1707.01861 - A Robust Interrupted Time Series Model for Analyzing Complex Healthcare Intervention Data.pdf#zoom=page-width&"></iframe>
4444
</div>
4545

4646
<div class="report-container main-panel-container paper-style hidden">

resources/src/[email protected]/components/compile_tags.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/bash
22

3+
RIOTC="node ../../../../node_modules/riot-cli/lib/index.js"
4+
35
function compile_riot(){
46
file=$1
57
cp $file ${file%.*}.tag
6-
riot ${file%.*}.tag ${file%.*}.js
8+
$RIOTC ${file%.*}.tag ${file%.*}.js
79
rm ${file%.*}.tag
810
}
911

resources/src/[email protected]/components/components.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require('./[email protected]');
12
require('./[email protected]');
23
require('./[email protected]');
34
require('./[email protected]');
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<rts-configuration-covariance-structure>
2+
<div class="panel-title">
3+
Type of covariance structure
4+
</div>
5+
<form>
6+
<div class="form-group">
7+
<label><span class="icon"><i class="ms-Icon ms-Icon--GroupedAscending"></i></span> From</label>
8+
<input type="text" data-role="calendarpicker" data-format="%d %B %Y" ref="start_input">
9+
</div>
10+
<div class="form-group">
11+
<label><span class="icon"><i class="ms-Icon ms-Icon--GroupedDescending"></i></span> To</label>
12+
<input type="text" data-role="calendarpicker" data-format="%d %B %Y" ref="end_input">
13+
</div>
14+
</form>
15+
16+
<style>
17+
.panel-title {
18+
background-color: rgba(58, 139, 199, 1);
19+
color: white;
20+
padding: 5px 5px;
21+
font-size: 12px;
22+
}
23+
24+
.input.calendar-picker .calendar *{
25+
cursor: default!important;
26+
}
27+
28+
</style>
29+
30+
<script>
31+
/* globals opts: false */
32+
/* globals jQuery: false */
33+
/* globals FileReader: false */
34+
//! class RTSConfigurationDatePanel
35+
//! <<UIComponent>> RTSConfigurationDatePanel
36+
37+
/**************************************************************************
38+
* Helpers
39+
**************************************************************************/
40+
41+
42+
/**************************************************************************
43+
* Main script
44+
**************************************************************************/
45+
const self = this;
46+
const config = opts;
47+
48+
//! RTSConfigurationDatePanel: -create_event_on_calendar_inputs()
49+
const create_event_on_calendar_inputs = () => {
50+
const input_dates = ["start_input", "end_input"];
51+
const event_names = ["start", "end"];
52+
input_dates.forEach((input_date, k) => {
53+
//self.refs[input_date].onchange = (e) => self._trigger_event(event_names[k], jQuery(self.refs[input_date]).data("calendarpicker").val());
54+
self.refs[input_date].onchange = self._trigger_event(event_names[k], () => jQuery(self.refs[
55+
input_date]).data("calendarpicker").val());
56+
});
57+
};
58+
59+
//! RTSConfigurationDatePanel: -trigger_event(name, value)
60+
self._trigger_event = (name, _value) => {
61+
return () => self.trigger('app:request:change:model:date:' + name.toLowerCase(), {
62+
date: _value()
63+
});
64+
};
65+
66+
//! RTSConfigurationDatePanel: +on_mount()
67+
self.on("mount", () => {
68+
create_event_on_calendar_inputs();
69+
});
70+
</script>
71+
</rts-configuration-covariance-structure>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
riot.tag2('rts-configuration-covariance-structure', '<div class="panel-title"> Type of covariance structure </div> <form> <div class="form-group"> <label><span class="icon"><i class="ms-Icon ms-Icon--GroupedAscending"></i></span> From</label> <input type="text" data-role="calendarpicker" data-format="%d %B %Y" ref="start_input"> </div> <div class="form-group"> <label><span class="icon"><i class="ms-Icon ms-Icon--GroupedDescending"></i></span> To</label> <input type="text" data-role="calendarpicker" data-format="%d %B %Y" ref="end_input"> </div> </form>', 'rts-configuration-covariance-structure .panel-title,[data-is="rts-configuration-covariance-structure"] .panel-title{ background-color: rgba(58, 139, 199, 1); color: white; padding: 5px 5px; font-size: 12px; } rts-configuration-covariance-structure .input.calendar-picker .calendar *,[data-is="rts-configuration-covariance-structure"] .input.calendar-picker .calendar *{ cursor: default!important; }', '', function(opts) {
2+
3+
4+
const self = this;
5+
const config = opts;
6+
7+
const create_event_on_calendar_inputs = () => {
8+
const input_dates = ["start_input", "end_input"];
9+
const event_names = ["start", "end"];
10+
input_dates.forEach((input_date, k) => {
11+
12+
self.refs[input_date].onchange = self._trigger_event(event_names[k], () => jQuery(self.refs[
13+
input_date]).data("calendarpicker").val());
14+
});
15+
};
16+
17+
self._trigger_event = (name, _value) => {
18+
return () => self.trigger('app:request:change:model:date:' + name.toLowerCase(), {
19+
date: _value()
20+
});
21+
};
22+
23+
self.on("mount", () => {
24+
create_event_on_calendar_inputs();
25+
});
26+
});

resources/src/[email protected]/components/[email protected]

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
</li>
7171
-->
7272
<!---->
73-
<li class="menu-title">Change in adjacent correlation estimate</li>
73+
<li class="menu-title">Change in {correlation_change_label} estimate</li>
7474
<li class="info-before-TET">
7575
{mean_estimate['autocorrelation'](opts.model, 0)}
7676
</li>
@@ -238,7 +238,15 @@
238238
self.change_point = (model) => moment(model.dates[model.estimations.change_point_index]).format(
239239
"MMM DD, YYYY");
240240
console.log(config)
241-
window.__config=config
241+
//window.__config=config
242+
const covariance_structure_type = config.model == null? "autocorrelation": config.model.covariance_structure_type;
243+
self.correlation_change_label = (
244+
covariance_structure_type == "autocorrelation"? "adjacent correlation": (
245+
covariance_structure_type == "independent"? "variance": (
246+
covariance_structure_type == "exchangeable"? "correlation": "<<UNKNOWN TYPE>>"
247+
)
248+
)
249+
);
242250

243251
//const rnd = (f) => Math.round(f * 1000) / 1000;
244252
const rnd = (f) => f.fmt("7.4g")
@@ -314,7 +322,7 @@ <h4 class="text-light">Data summary</h4>
314322
<div>Estimate of level change</div>
315323
</div>
316324
<div class="cell-3">
317-
<div>Estimated change in adjacent correlation</div>
325+
<div>Estimated change in {correlation_change_label}</div>
318326
</div>
319327
</div>
320328
</li>
@@ -479,7 +487,14 @@ <h4 class="text-light">Data summary</h4>
479487
const self = this;
480488
const config = opts;
481489
config.models = !!config.models ? config.models : [];
482-
490+
491+
const covariance_structure_type = config.models.length == 0 || config.models[0] == null? "autocorrelation": config.models[0].covariance_structure_type;
492+
self.correlation_change_label = covariance_structure_type == "autocorrelation"? "adjacent correlation": (
493+
covariance_structure_type == "independent"? "variance": (
494+
covariance_structure_type == "exchangeable"? "correlation": "<<UNKNOWN TYPE>>"
495+
)
496+
);
497+
483498
self.changepoint_is_significant = (model) => model.estimations.existence_change_point_hypothesis.p_value < 0.05
484499
self.changepoint_significance_stars = (model) => (
485500
model.estimations.existence_change_point_hypothesis.p_value >= 0.1 ? "" : (

0 commit comments

Comments
 (0)