Last active
August 29, 2015 14:16
-
-
Save mgranberry/7f208d3fd35c1a185df3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function iobCalc(treatment, time) { | |
var dia=profile.dia; | |
var scalefactor = 1; | |
var peak; | |
if (dia == 3) { | |
peak=75; | |
} else { | |
// console.warn('DIA of ' + dia + ' not supported'); | |
peak = 75; | |
scalefactor = 3.0/dia; | |
} | |
var sens=profile.sens; | |
if (typeof time === 'undefined') { | |
var time = new Date(); | |
} | |
if (treatment.insulin) { | |
var bolusTime=new Date(treatment.created_at); | |
var minAgo=scalefactor*(time-bolusTime)/1000/60; | |
if (minAgo < 0) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment