Skip to content

Commit

Permalink
Merge branch 'release/0.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Calabrese committed Sep 19, 2014
2 parents 1728cdd + 22678fd commit b8bc46e
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 30 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nightscout",
"version": "0.4.0",
"version": "0.4.2",
"dependencies": {
"angularjs": "1.3.0-beta.19",
"bootstrap": "~3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Nightscout",
"version": "0.4.1",
"version": "0.4.2",
"description": "Nightscout acts as a web-based CGM (Continuous Glucose Montinor) to allow multiple caregivers to remotely view a patients glucose data in realtime.",
"license": "MIT",
"author": "Nightscout Team",
Expand Down
19 changes: 9 additions & 10 deletions static/css/drawer.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
color: #eee;
display: none;
font-size: 16px;
height: calc(100% - 45px);
height: 100%;
overflow-y: auto;
position: absolute;
margin-top: 45px;
Expand All @@ -25,7 +25,7 @@
color: #eee;
display: none;
font-size: 16px;
height: calc(100% - 45px);
height: 100%;
overflow-y: auto;
position: absolute;
margin-top: 45px;
Expand Down Expand Up @@ -144,21 +144,20 @@ h1, legend,
margin-top: 0;
margin-left: 42px;
padding-top: 10px;
padding-right: 150px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
#buttonbar {
padding-right: 10px;
float: right;
height: 44px;
opacity: 0.75;
vertical-align: middle;
width: 20ex;
}
#buttonbar div {
border-radius: 5px;
float: left;
height: 44px;
width: 44px;
position: absolute;
right: 0;
}

#buttonbar a,
#buttonbar i {
color: #ccc;
Expand Down
9 changes: 4 additions & 5 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
<link rel="apple-touch-icon" href="/images/logomobile.png">
<title>NightScout</title>
<link href="/images/round1.png" rel="icon" id="favicon" type="image/png" />
<link rel="stylesheet" type="text/css" href="/css/main.css?v=0.4.0" />
<link rel="stylesheet" type="text/css" href="/css/main.css?v=0.4.2" />
<link rel="stylesheet" type="text/css" href="/css/dropdown.css" />
<link rel="stylesheet" type="text/css" href="/css/drawer.css?v=0.4.0" />
<link rel="stylesheet" type="text/css" href="/css/drawer.css?v=0.4.2b" />
<link rel="stylesheet" type="text/css" href="/bower_components/tipsy-jmalonzo/src/stylesheets/tipsy.css" />
</head>
<body>
<div id="toolbar">
<div id="buttonbar">
<div style="visibility:hidden" id="battery" class="tip" original-title="Uploader Battery 75%"><i class="icon-battery-75"></i></div>
<a id="testAlarms" class="tip" original-title="Alarm Test / Smartphone Enable" href="#"><i class="icon-volume"></i></a>
<a id="hideToolbar" class="tip" original-title="Hides the toolbar" href="#"><i class="icon-angle-double-up"></i></a>
<a id="drawerToggle" class="tip" original-title="Settings" href="#"><i class="icon-cog"></i></a>
Expand Down Expand Up @@ -180,8 +179,8 @@ <h1 class="customTitle">Nightscout</h1>
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
<script src="/bower_components/jQuery-Storage-API/jquery.storageapi.min.js"></script>
<script src="/bower_components/tipsy-jmalonzo/src/javascripts/jquery.tipsy.js"></script>
<script src="/js/ui-utils.js?v=0.4.0"></script>
<script src="/js/client.js?v=0.4.0"></script>
<script src="/js/ui-utils.js?v=0.4.2"></script>
<script src="/js/client.js?v=0.4.2"></script>
<script src="/js/experiments.js"></script>
</body>
</html>
42 changes: 29 additions & 13 deletions static/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,22 @@
var nowData = data.filter(function(d) {
return d.date.getTime() >= brushExtent[1].getTime() - FORTY_TWO_MINS_IN_MS &&
d.date.getTime() <= brushExtent[1].getTime() - TWENTY_FIVE_MINS_IN_MS &&
d.color != 'none';
d.type == 'sgv';
});
if (nowData.length > 1) {
var prediction = predictAR(nowData);
focusData = focusData.concat(prediction);
var focusPoint = nowData[nowData.length - 1];
$('.container .currentBG')
.text(focusPoint.sgv)
.css('text-decoration','line-through');

//in this case the SGV is scaled
if (focusPoint.sgv < scaleBg(40))
$('.container .currentBG').text('LOW');
else if (focusPoint.sgv > scaleBg(400))
$('.container .currentBG').text('HIGH');
else
$('.container .currentBG').text(focusPoint.sgv);

$('.container .currentBG').css('text-decoration','line-through');
$('.container .currentDirection')
.html(focusPoint.direction)
} else {
Expand All @@ -260,7 +267,7 @@
} else {
// if the brush comes back into the current time range then it should reset to the current time and sg
var nowData = data.filter(function(d) {
return d.color != 'none' && d.color != 'red';
return d.type == 'sgv';
});
nowData = [nowData[nowData.length - 2], nowData[nowData.length - 1]];
var prediction = predictAR(nowData);
Expand Down Expand Up @@ -304,9 +311,15 @@
var secsSinceLast = (Date.now() - new Date(latestSGV.x).getTime()) / 1000;
$('#lastEntry').text(timeAgo(secsSinceLast)).toggleClass('current', secsSinceLast < 10 * 60);

$('.container .currentBG')
.text(scaleBg(latestSGV.y))
.css('text-decoration', '');
//in this case the SGV is unscaled
if (latestSGV.y < 40)
$('.container .currentBG').text('LOW');
else if (latestSGV.y > 400)
$('.container .currentBG').text('HIGH');
else
$('.container .currentBG').text(scaleBg(latestSGV.y));

$('.container .currentBG').css('text-decoration', '');
$('.container .currentDirection')
.html(latestSGV.direction);

Expand Down Expand Up @@ -336,7 +349,7 @@
.attr('cy', function (d) { return yScale(d.sgv); })
.attr('fill', function (d) { return d.color; })
.attr('opacity', function (d) { return futureOpacity(d.date - latestSGV.x); })
.attr('r', 3);
.attr('r', function(d) { if (d.type == 'mbg') return 6; else return 3;});

focusCircles.exit()
.remove();
Expand Down Expand Up @@ -731,7 +744,7 @@
.attr('cy', function (d) { return yScale2(d.sgv); })
.attr('fill', function (d) { return d.color; })
.style('opacity', function (d) { return highlightBrushPoints(d) })
.attr('r', 2);
.attr('r', function(d) { if (d.type == 'mbg') return 4; else return 2;});

contextCircles.exit()
.remove();
Expand Down Expand Up @@ -800,15 +813,17 @@
}
}
data = d[0].map(function (obj) {
return { date: new Date(obj.x), y: obj.y, sgv: scaleBg(obj.y), direction: obj.direction, color: sgvToColor(obj.y)}
return { date: new Date(obj.x), y: obj.y, sgv: scaleBg(obj.y), direction: obj.direction, color: sgvToColor(obj.y), type: 'sgv'}
});
// TODO: This is a kludge to advance the time as data becomes stale by making old predictor clear (using color = 'none')
// This shouldn't have to be sent and can be fixed by using xScale.domain([x0,x1]) function with
// 2 days before now as x0 and 30 minutes from now for x1 for context plot, but this will be
// required to happen when "now" event is sent from websocket.js every minute. When fixed,
// remove all "color != 'none'" code
data = data.concat(d[1].map(function (obj) { return { date: new Date(obj.x), y: obj.y, sgv: scaleBg(obj.y), color: 'none'} }));
data = data.concat(d[2].map(function (obj) { return { date: new Date(obj.x), y: obj.y, sgv: scaleBg(obj.y), color: 'red'} }));
data = data.concat(d[1].map(function (obj) { return { date: new Date(obj.x), y: obj.y, sgv: scaleBg(obj.y), color: 'none', type: 'server-forecast'} }));

//Add MBG's also, pretend they are SGV's
data = data.concat(d[2].map(function (obj) { return { date: new Date(obj.x), y: obj.y, sgv: scaleBg(obj.y), color: 'red', type: 'mbg'} }));

data.forEach(function (d) {
if (d.y < 39)
Expand Down Expand Up @@ -1092,6 +1107,7 @@
color: predictedColor
};
predicted.forEach(function (d) {
d.type = 'forecast';
if (d.sgv < BG_MIN)
d.color = "transparent";
})
Expand Down

0 comments on commit b8bc46e

Please sign in to comment.