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

COB ratio capped at 1U:3gr #1453

Open
LiroyvH opened this issue Aug 7, 2023 · 3 comments
Open

COB ratio capped at 1U:3gr #1453

LiroyvH opened this issue Aug 7, 2023 · 3 comments

Comments

@LiroyvH
Copy link

LiroyvH commented Aug 7, 2023

Hi,

Turns out a couple of safety checks/guardrails are capping carb ratios to 1:3:

// disallow impossibly high/low carbRatios due to bad decoding
if (carbRatio < 3 || carbRatio > 150) {
console_error(final_result, "Error: carbRatio of " + carbRatio + " out of bounds.");
return;

oref0/bin/oref0-meal.js

Lines 88 to 92 in 88cf032

// disallow impossibly low carbRatios due to bad decoding
if ( typeof(profile_data.carb_ratio) === 'undefined' || profile_data.carb_ratio < 3 ) {
console_log(final_result, '{ "carbs": 0, "mealCOB": 0, "reason": "carb_ratio ' + profile_data.carb_ratio + ' out of bounds" }');
return console_error(final_result, "Error: carb_ratio " + profile_data.carb_ratio + " out of bounds");
}

// disallow impossibly low carbRatios due to bad decoding
if ( typeof(profile_data.carb_ratio) === 'undefined' || profile_data.carb_ratio < 2 ) {
if ( typeof(pumpprofile_data.carb_ratio) === 'undefined' || pumpprofile_data.carb_ratio < 2 ) {
console.log('{ "carbs": 0, "mealCOB": 0, "reason": "carb_ratios ' + profile_data.carb_ratio + ' and ' + pumpprofile_data.carb_ratio + ' out of bounds" }');
return console.error("Error: carb_ratios " + profile_data.carb_ratio + ' and ' + pumpprofile_data.carb_ratio + " out of bounds");
} else {
profile_data.carb_ratio = pumpprofile_data.carb_ratio;

However, for people with such 'impossibly low ratios' (damnit :P) such as myself - I need to go below it.
Of course it can be implemented differently in the app that I use and deviate from the oref0 standard, but consistency is nice so I was wondering if perhaps this could be refactored. Ideally, the app implementing oref0 will give a warning if people try to go below 1:3, but oref0 itself shouldn't put a limit on it as there simply are people that have insane insensitivity.

Thank you for your consideration.

@sulkaharo
Copy link
Collaborator

Scott correct me if I'm wrong, but AFAIK the reason the cap is in place is the algorithm would need separate analysis on its behaviour with lower sensitivities, so allowing for lower sensitivity is a lot more work than just removing the cap.

@scottleibrand
Copy link
Contributor

My memory from 5y ago is vague, but I think there might also have been some cases where data entry or mmol / mg/dL conversion issues could cause carb ratios that would be so low as to be unsafe to allow.

At this point I would probably shy away from modifying the main oref0 code to remove safety checks. Since this is the first instance we’ve seen where someone needed a CR that low, it would probably be better to modify the code/config locally as needed.

@LiroyvH
Copy link
Author

LiroyvH commented Aug 8, 2023

Ah that's too bad. :( Its so much easier when there's no need to deviate from the standards. But I understand if I'm the only one it'd have to be modified for.

Alright, thank you for considering it. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants