Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/determine-basal/cob.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ function detectCarbAbsorption(inputs) {
var slopeFromMinDeviation = 999;
var maxDeviation = 0;
var minDeviation = 999;
var allDeviations = [];
//console.error(bucketed_data);
for (var i=0; i < bucketed_data.length-3; ++i) {
var bgTime = new Date(bucketed_data[i].date);
Expand Down Expand Up @@ -142,6 +143,7 @@ function detectCarbAbsorption(inputs) {
currentDeviation = Math.round((avgDelta-bgi)*1000)/1000;
if (ciTime > bgTime) {
//console.error("currentDeviation:",currentDeviation,avgDelta,bgi);
allDeviations.push(currentDeviation);
}
if (currentDeviation/2 > profile.min_5m_carbimpact) {
//console.error("currentDeviation",currentDeviation,"/2 > min_5m_carbimpact",profile.min_5m_carbimpact);
Expand All @@ -159,7 +161,9 @@ function detectCarbAbsorption(inputs) {
minDeviation = avgDeviation;
}

//console.error("Deviations:",bgTime, avgDeviation, deviationSlope, slopeFromMaxDeviation, slopeFromMinDeviation, avgDelta,bgi);
//console.error("Deviations:",avgDeviation, avgDelta,bgi,bgTime);
allDeviations.push(avgDeviation);
//console.error(allDeviations);
}

// if bgTime is more recent than mealTime
Expand All @@ -184,6 +188,7 @@ function detectCarbAbsorption(inputs) {
, "minDeviation": minDeviation
, "slopeFromMaxDeviation": slopeFromMaxDeviation
, "slopeFromMinDeviation": slopeFromMinDeviation
, "allDeviations": allDeviations
}
return output;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/meal/total.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ function recentCarbs(opts, time) {
mealCOB = 0;
}


return {
carbs: Math.round( carbs * 1000 ) / 1000
, mealCOB: Math.round( mealCOB )
Expand All @@ -92,6 +91,7 @@ function recentCarbs(opts, time) {
, minDeviation: Math.round( c.minDeviation * 100 ) / 100
, slopeFromMaxDeviation: Math.round( c.slopeFromMaxDeviation * 1000 ) / 1000
, slopeFromMinDeviation: Math.round( c.slopeFromMinDeviation * 1000 ) / 1000
, allDeviations: c.allDeviations
};
}

Expand Down