Skip to content

Commit 81a2335

Browse files
Fix example functionality and add two default examples for sleep spindles.
1 parent 2b177dd commit 81a2335

File tree

1 file changed

+52
-4
lines changed

1 file changed

+52
-4
lines changed

lib/time-series-annotator.js

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,27 @@ $.widget('crowdcurio.TimeSeriesAnnotator', {
7676
showChannelNames: true,
7777
features: {
7878
examplesModeEnabled: false,
79-
examples: [],
79+
examples: [{
80+
recording: '1209153-1_P',
81+
channels_displayed: [0],
82+
channels: 0,
83+
type: 'sleep_spindle',
84+
start: 1925,
85+
end: 1928,
86+
annotator_experience: 1,
87+
confidence: 1,
88+
comment: 'Interesting!',
89+
}, {
90+
recording: '1209153-1_P',
91+
channels_displayed: [0],
92+
channels: 0,
93+
type: 'sleep_spindle',
94+
start: 2030,
95+
end: 2035,
96+
annotator_experience: 1,
97+
confidence: 1,
98+
comment: 'Interesting!',
99+
}],
80100
cheatSheetsEnabled: false,
81101
openCheatSheetOnPageLoad: true,
82102
scrollThroughExamplesAutomatically: true,
@@ -582,7 +602,7 @@ $.widget('crowdcurio.TimeSeriesAnnotator', {
582602
</button> \
583603
</div> \
584604
<div class="progress pull-right"> \
585-
<div class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" style="width: 0%"> \
605+
<div class="determinate progress-bar progress-bar-success progress-bar-striped" role="progressbar" style="width: 0%"> \
586606
</div> \
587607
</div> \
588608
</div> \
@@ -991,7 +1011,7 @@ $.widget('crowdcurio.TimeSeriesAnnotator', {
9911011
that.vars.cheatSheetOpenedBefore = true;
9921012
bootbox.dialog({
9931013
title: '<b>PLEASE READ CAREFULLY</b>',
994-
message: '<img style="width: 100%; height: auto;" src="/static/images/feature_cheat_sheets/' + firstExample.type + '.png">',
1014+
message: '<img style="width: 100%; height: auto;" src="https://s3.amazonaws.com/curio-media/crowdeeg/feature-cheat-sheets/' + firstExample.type + '.png">',
9951015
buttons: {
9961016
close: {
9971017
label: 'Close',
@@ -1867,7 +1887,7 @@ $.widget('crowdcurio.TimeSeriesAnnotator', {
18671887
}
18681888
});
18691889
if (that.options.features.examplesModeEnabled) {
1870-
that._displayAnnotations(that.options.features.examples);
1890+
that._displayAnnotations(that._turnExamplesIntoAnnotations(that.options.features.examples));
18711891
}
18721892
that._setupYAxisLinesAndLabels();
18731893
that._setupAnnotationInteraction();
@@ -2739,6 +2759,34 @@ $.widget('crowdcurio.TimeSeriesAnnotator', {
27392759
}
27402760
},
27412761

2762+
_turnExampleIntoAnnotation: function(example) {
2763+
var that = this;
2764+
var annotation = {
2765+
id: that._getUUID(),
2766+
label: example.type,
2767+
confidence: example.confidence,
2768+
position: {
2769+
start: example.start,
2770+
end: example.end,
2771+
channels: example.channels,
2772+
},
2773+
metadata: {
2774+
channels_displayed: example.channels_displayed,
2775+
comment: example.comment,
2776+
},
2777+
};
2778+
return annotation;
2779+
},
2780+
2781+
_turnExamplesIntoAnnotations: function(examples) {
2782+
var that = this;
2783+
var annotations = [];
2784+
examples.forEach(function(example) {
2785+
annotations.push(that._turnExampleIntoAnnotation(example));
2786+
});
2787+
return annotations;
2788+
},
2789+
27422790
_displayAnnotations: function(annotations) {
27432791
var that = this;
27442792

0 commit comments

Comments
 (0)