Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev branch into main #10

Open
wants to merge 63 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
05a1a2e
Updated oref2 files based on findings in minimised files in iAPS v3.0.3
jeremy-storring Feb 28, 2024
6cf69ec
Revert "Tzachi shared node phase2 (#1370)"
bjornoleh Feb 28, 2024
3ff4e0a
Rename script to webpack-cp.sh, commit webpack.config.js
bjornoleh Feb 28, 2024
1276c59
Merge pull request #2 from bjornoleh/revert_1370
JeremyStorring Feb 28, 2024
30549a0
Merge pull request #3 from bjornoleh/webpack
JeremyStorring Feb 28, 2024
fc0e748
Address review comments from Robert
jeremy-storring Feb 28, 2024
838038a
Merge pull request #4 from JeremyStorring/minify_fixes
JeremyStorring Mar 1, 2024
256662c
Adjusted min threshold, as min_bg for target of 80 is 60 (80 - (0.5*(…
JeremyStorring Mar 1, 2024
b8f5997
Merge pull request #6 from JeremyStorring/min_bg_threshold
JeremyStorring Mar 1, 2024
1f2b45f
fix for time calcs
mountrcg Mar 1, 2024
8d739f5
Merge pull request #7 from JeremyStorring/time-issues
mountrcg Mar 1, 2024
f295a47
fix from Deniz
mountrcg Mar 1, 2024
cf1bc34
Revert "fix for time calcs"
mountrcg Mar 1, 2024
559f96f
Merge pull request #8 from JeremyStorring/revert-7-time-issues
mountrcg Mar 1, 2024
1230e23
Merge remote-tracking branch 'remake/iaps' into time-issues
mountrcg Mar 1, 2024
e0714c5
fix for time calcs
mountrcg Mar 1, 2024
41c42c5
Bug fix for profile overrides not canceling SMBs
jeremy-storring Feb 28, 2024
f80c32a
Added comment for profile logic
jeremy-storring Mar 1, 2024
c496240
Merge pull request #5 from JeremyStorring/enableSmbBug
JeremyStorring Mar 1, 2024
5cdd17d
Merge branch 'iaps' into time-issues
JeremyStorring Mar 1, 2024
b2cf75b
move currentTime check up
mountrcg Mar 2, 2024
97b012a
Merge pull request #9 from JeremyStorring/time-issues
JeremyStorring Mar 3, 2024
3add4a1
duplication of SMB ratio for tags
mountrcg Mar 6, 2024
159b800
index.js: use correct value (160) in comment for half_basal_exercise_…
bjornoleh Mar 7, 2024
4f6de7c
Update webpack-cp.sh
bjornoleh Mar 7, 2024
47d2485
Merge pull request #3 from nightscout/webpack-cp_patch-1
bjornoleh Mar 7, 2024
1fda0fa
webpack-cp.sh: Set apsDIR=../Open-iAPS, fix path for source files
bjornoleh Mar 7, 2024
acf203c
Merge pull request #6 from nightscout/webpack-cp_patch-1
bjornoleh Mar 7, 2024
8a6051c
Merge pull request #5 from nightscout/half_basal_target
bjornoleh Mar 9, 2024
975245b
Add missing max limit = 1 for smb_ratio
bjornoleh Mar 14, 2024
f932754
Merge pull request #4 from nightscout/duplicate_SMBratio
JeremyStorring Mar 17, 2024
4b7676c
determine-basal.js smb_ratio log: if (smb_ratio != 0.5)
bjornoleh Mar 18, 2024
1990e37
Merge pull request #9 from nightscout/smb_ratio_log
JeremyStorring Apr 1, 2024
f10ef66
Edit issue templates
bjornoleh Apr 4, 2024
444903e
fix meal inputs with actualDate
avouspierre Apr 6, 2024
a42e58f
Revert "actualDate" changes to lib/meal/history.js
bjornoleh Apr 6, 2024
8d4f4ff
Merge pull request #14 from nightscout/revert_actualDate
bjornoleh Apr 7, 2024
f3faea6
allows to create Bundle directory for oiaps
avouspierre Apr 7, 2024
4edc26c
Merge remote-tracking branch 'upstream/dev' into dev
avouspierre Apr 7, 2024
d76ed48
Update config.yml
tmhastings Apr 8, 2024
4438013
Merge pull request #11 from nightscout/issue-template
tmhastings Apr 8, 2024
deefc58
Simplify cp in webpack-cp.sh to use with copy-rename-webpack-plugin
bjornoleh Apr 8, 2024
3c321e3
Remove old copy of minimised files previously committed
bjornoleh Apr 6, 2024
4aba4e0
webpack-cp.sh: git log --since=2024-01-01
bjornoleh Apr 10, 2024
b8aaf93
Merge pull request #15 from avouspierre/dev
bjornoleh Apr 10, 2024
b89a39b
Merge pull request #16 from bjornoleh/webpack-update
bjornoleh Apr 10, 2024
d898eb1
fix threshold console.error
MikePlante1 Apr 13, 2024
b777c77
Separate Adjustment Factors for Logarithmic and Sigmoid
MikePlante1 Apr 15, 2024
a29d9ce
rename smbIsAlwaysOff to smbIsScheduledOff
MikePlante1 Apr 13, 2024
e3a8d73
Merge pull request #17 from MikePlante1/console_error_refactor
bjornoleh May 1, 2024
5774155
Merge pull request #20 from MikePlante1/disable_smb_schedule
bjornoleh May 1, 2024
487bcbb
Merge pull request #21 from MikePlante1/separate_adjustment_factors
bjornoleh May 1, 2024
fc0ae69
tddAdjBasal pop-up correction
tmhastings May 2, 2024
fa373c9
Merge pull request #22 from nightscout/tmhastings-tddAdjBasal
MikePlante1 May 2, 2024
e023125
Replace Open-iAPS with Trio (#23)
MikePlante1 May 9, 2024
5b7affa
Github issue templates and config.yml: rename from Open-iAPS to Trio
bjornoleh May 10, 2024
5319e39
update Discord url
MikePlante1 May 12, 2024
b454837
Merge pull request #24 from nightscout/Trio_renames
bjornoleh May 13, 2024
d9f1662
fix `threshold_setting` typo
MikePlante1 May 22, 2024
d1dfb70
Merge pull request #26 from MikePlante1/typo
dnzxy May 23, 2024
8f5f820
Harmonise profile defaults with openaps/oref0
bjornoleh Jun 9, 2024
2d695e1
index.js: set enableUAM to false, and remove whitespace in L11
bjornoleh Aug 15, 2024
363fd11
Merge pull request #28 from bjornoleh/harmonise_defaults
MikePlante1 Aug 16, 2024
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
9 changes: 0 additions & 9 deletions .github/ISSUE_TEMPLATE/--individual-troubleshooting-help.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "\U0001F41BBug report"
name: "\U0001F41B Bug report"
about: Create a report to help us fix things

---
Expand All @@ -23,10 +23,9 @@ If applicable, add screenshots to help explain your problem.
**Smartphone (please complete the following information):**

**Setup Information (please complete the following information):**
* Pump type (e.g. Medtronic 722, v. 2.4A firmware)
* CGM type (e.g. Dexcom G4 via xDrip+)
* Rig type (e.g. Edison/Explorer Board rig)
* oref0 version (e.g. oref0 0.6.2 master, or 0.7.0-dev)
* Pump type
* CGM type and CGM app
* Trio version, branch and git reference (see Trio Settings)

**Additional context**
Add any other context about the problem here.
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
blank_issues_enabled: false
contact_links:
- name: "🆘 Individual troubleshooting help: Please go to the Discord Trio Server"
url: https://discord.gg/fCY5svg4
about: Are you having an issue with your individual setup? Please first go to the Discord Trio Server and post there, with details of your setup (App version, pump, CGM, and CGM app) and the issue you are observing

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "\U0001F4A1Feature request\U0001F4A1"
name: "\U0001F4A1 Feature request \U0001F4A1"
about: Suggest an idea for this project

---
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
dist/

#npx files
webpack.config.js
#webpack.config.js
Change source code in Oref0.rtf
package-lock.json
package.json
Expand Down
13 changes: 6 additions & 7 deletions bin/oref0-autosens-history.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env node
'use strict';

/*
Determine Basal
Expand All @@ -17,10 +16,10 @@
*/

var basal = require('../lib/profile/basal');
var detectSensitivity = require('../lib/determine-basal/autosens');
var detect = require('../lib/determine-basal/autosens');

if (!module.parent) {
//var detectsensitivity = init(); // I don't see where this variable is used, so deleted it.
var detectsensitivity = init();

var argv = require('yargs')
.usage("$0 <glucose.json> <pumphistory.json> <profile.json> <readings_per_run> [outputfile.json]")
Expand Down Expand Up @@ -136,16 +135,16 @@ if (!module.parent) {
var ratioArray = [];
do {
detection_inputs.deviations = 96;
var result = detectSensitivity(detection_inputs);
detect(detection_inputs);
for(i=0; i<readings_per_run; i++) {
detection_inputs.glucose_data.shift();
}
console.error(result.ratio, result.newisf, detection_inputs.glucose_data[0].dateString);
console.error(ratio, newisf, detection_inputs.glucose_data[0].dateString);

var obj = {
"dateString": detection_inputs.glucose_data[0].dateString,
"sensitivityRatio": result.ratio,
"ISF": result.newisf
"sensitivityRatio": ratio,
"ISF": newisf
}
ratioArray.unshift(obj);
if (output_file) {
Expand Down
31 changes: 9 additions & 22 deletions bin/oref0-calculate-iob.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
'use strict';

/*
Insulin On Board (IOB) calculations.

Expand All @@ -19,16 +19,13 @@
*/

var generate = require('../lib/iob');
var fs = require('fs');
function usage ( ) {
console.log('usage: ', process.argv.slice(0, 2), '<pumphistory-zoned.json> <profile.json> <clock-zoned.json> [autosens.json] [pumphistory-24h-zoned.json]');

}



var oref0_calculate_iob = function oref0_calculate_iob(argv_params) {
var argv = require('yargs')(argv_params)
if (!module.parent) {
var argv = require('yargs')
.usage("$0 <pumphistory-zoned.json> <profile.json> <clock-zoned.json> [<autosens.json>] [<pumphistory-24h-zoned.json>]")
.strict(true)
.help('help');
Expand All @@ -49,21 +46,21 @@ var oref0_calculate_iob = function oref0_calculate_iob(argv_params) {
var pumphistory_24_input = inputs[4];

var cwd = process.cwd();
var pumphistory_data = JSON.parse(fs.readFileSync(cwd + '/' + pumphistory_input));
var profile_data = JSON.parse(fs.readFileSync(cwd + '/' + profile_input));
var clock_data = JSON.parse(fs.readFileSync(cwd + '/' + clock_input));
var pumphistory_data = require(cwd + '/' + pumphistory_input);
var profile_data = require(cwd + '/' + profile_input);
var clock_data = require(cwd + '/' + clock_input);

var autosens_data = null;
if (autosens_input) {
try {
autosens_data = JSON.parse(fs.readFileSync(cwd + '/' + autosens_input));
autosens_data = require(cwd + '/' + autosens_input);
} catch (e) {}
//console.error(autosens_input, JSON.stringify(autosens_data));
}
var pumphistory_24_data = null;
if (pumphistory_24_input) {
try {
pumphistory_24_data = JSON.parse(fs.readFileSync(cwd + '/' + pumphistory_24_input));
pumphistory_24_data = require(cwd + '/' + pumphistory_24_input);
} catch (e) {}
}

Expand All @@ -80,16 +77,6 @@ var oref0_calculate_iob = function oref0_calculate_iob(argv_params) {
}

var iob = generate(inputs);
return(JSON.stringify(iob));
}

if (!module.parent) {
// remove the first parameter.
var command = process.argv;
command.shift();
command.shift();
var result = oref0_calculate_iob(command)
console.log(result);
console.log(JSON.stringify(iob));
}

exports = module.exports = oref0_calculate_iob
14 changes: 7 additions & 7 deletions bin/oref0-detect-sensitivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
var detectSensitivity = require('../lib/determine-basal/autosens');
var detect = require('../lib/determine-basal/autosens');

if (!module.parent) {
var argv = require('yargs')
Expand Down Expand Up @@ -112,14 +112,14 @@ if (!module.parent) {
};
console.error("Calculating sensitivity using 8h of non-exluded data");
detection_inputs.deviations = 96;
var result = detectSensitivity(detection_inputs);
var ratio8h = result.ratio;
var newisf8h = result.newisf;
detect(detection_inputs);
var ratio8h = ratio;
var newisf8h = newisf;
console.error("Calculating sensitivity using all non-exluded data (up to 24h)");
detection_inputs.deviations = 288;
result = detectSensitivity(detection_inputs);
var ratio24h = result.ratio;
var newisf24h = result.newisf;
detect(detection_inputs);
var ratio24h = ratio;
var newisf24h = newisf;
if ( ratio8h < ratio24h ) {
console.error("Using 8h autosens ratio of",ratio8h,"(ISF",newisf8h+")");
} else {
Expand Down
67 changes: 19 additions & 48 deletions bin/oref0-get-ns-entries.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env node
'use strict';

/*
oref0 Nightscout treatment fetch tool
Expand All @@ -26,16 +25,13 @@ var request = require('request');
var _ = require('lodash');
var fs = require('fs');
var network = require('network');
var shared_node = require('./oref0-shared-node-utils');
var console_error = shared_node.console_error;
var console_log = shared_node.console_log;
var initFinalResults = shared_node.initFinalResults;

var oref0_get_ns_engtires = function oref0_get_ns_engtires(argv_params, print_callback, final_result) {
var safe_errors = ['ECONNREFUSED', 'ESOCKETTIMEDOUT', 'ETIMEDOUT'];
var log_errors = true;
var safe_errors = ['ECONNREFUSED', 'ESOCKETTIMEDOUT', 'ETIMEDOUT'];
var log_errors = true;

var argv = require('yargs')(argv_params)
if (!module.parent) {

var argv = require('yargs')
.usage("$0 ns-glucose.json NSURL API-SECRET <hours>")
.strict(true)
.help('help');
Expand All @@ -49,7 +45,7 @@ var oref0_get_ns_engtires = function oref0_get_ns_engtires(argv_params, print_ca

if ([null, '--help', '-h', 'help'].indexOf(glucose_input) > 0) {
usage();
process.exit(0); //???????
process.exit(0);
}

var nsurl = params._.slice(1, 2).pop();
Expand Down Expand Up @@ -92,21 +88,21 @@ var oref0_get_ns_engtires = function oref0_get_ns_engtires(argv_params, print_ca
, headers: headers
};

if (log_errors) console_error(final_result, 'Connecting to ' + ip +', testing for xDrip API availability');
if (log_errors) console.error('Connected to ' + ip +', testing for xDrip API availability');

request(options, function(error, res, data) {
var failed = false;
if (res && res.statusCode == 403) {
console_error(final_result, "Load from xDrip failed: API_SECRET didn't match");
console.error("Load from xDrip failed: API_SECRET didn't match");
failed = true;
}

if (error) {
if (safe_errors.includes(error.code)) {
if (log_errors) console_error(final_result, 'Load from local xDrip timed out, likely not connected to xDrip hotspot');
if (log_errors) console.error('Load from local xDrip timed out, likely not connected to xDrip hotspot');
log_errors = false;
} else {
if (log_errors) console_error(final_result, "Load from xDrip failed", error);
if (log_errors) console.error("Load from xDrip failed", error);
log_errors = false;
failed = true;
}
Expand All @@ -115,18 +111,12 @@ var oref0_get_ns_engtires = function oref0_get_ns_engtires(argv_params, print_ca
}

if (!failed && data) {
console_error(final_result, "CGM results loaded from xDrip");
console.error("CGM results loaded from xDrip");
processAndOutput(data);
return true;
}

if (failed && callback) {
// printing will happen in the callback
callback();
} else {
print_callback(final_result);
}

if (failed && callback) callback();
});

return false;
Expand All @@ -141,7 +131,7 @@ var oref0_get_ns_engtires = function oref0_get_ns_engtires(argv_params, print_ca
fs.readFile(outputPath, 'utf8', function(err, fileContent) {

if (err) {
console_error(final_result, err);
console.error(err);
} else {
try {
glucosedata = JSON.parse(fileContent);
Expand All @@ -157,11 +147,10 @@ var oref0_get_ns_engtires = function oref0_get_ns_engtires(argv_params, print_ca
glucosedata = null;
}
} catch (e) {
console_error(final_result, e);
console.error(e);
}
}
loadFromNightscoutWithDate(lastDate, glucosedata);
// callback will happen in loadFromNightscoutWithDate
});
}

Expand Down Expand Up @@ -192,19 +181,18 @@ var oref0_get_ns_engtires = function oref0_get_ns_engtires(argv_params, print_ca
if (res && (res.statusCode == 200 || res.statusCode == 304)) {

if (data) {
console_error(final_result, "Got CGM results from Nightscout");
console.error("Got CGM results from Nightscout");
processAndOutput(data);
} else {
console_error(final_result, "Got Not Changed response from Nightscout, assuming no new data is available");
console.error("Got Not Changed response from Nightscout, assuming no new data is available");
// output old file
if (!_.isNil(glucosedata)) {
console_log(final_result, JSON.stringify(glucosedata));
console.log(JSON.stringify(glucosedata));
}
}
} else {
console_error(final_result, "Loading CGM data from Nightscout failed", error);
console.error("Loading CGM data from Nightscout failed", error);
}
print_callback(final_result);
});

}
Expand All @@ -215,28 +203,11 @@ var oref0_get_ns_engtires = function oref0_get_ns_engtires(argv_params, print_ca
sgvrecord.glucose = sgvrecord.sgv;
});

console_log(final_result, JSON.stringify(glucosedata));
console.log(JSON.stringify(glucosedata));
}

network.get_gateway_ip(function(err, ip) {
loadFromxDrip(nsCallback, ip);
});
}

function print_callback(final_result) {
console.log(final_result.stdout);
console.error(final_result.err);
}


if (!module.parent) {
var final_result = initFinalResults();

// remove the first parameter.
var command = process.argv;
command.shift();
command.shift();
var result = oref0_get_ns_engtires(command, print_callback, final_result)
}

exports = module.exports = oref0_get_ns_engtires
Loading