nightscout / Trio

MIT License
45 stars 125 forks source link

Set median of lower and upper correction range bound when importing L… #253

Closed kskandis closed 3 weeks ago

kskandis commented 1 month ago

Resolves NS Settings Import: Set median of lower and upper correction range bound when importing Loop settings by:

Sets Trio's target correction low and high to median of lower and upper target range when NS profile's enteredBy is Loop. Rounds median value to 0 or 1 significant digits depending on Glucose unit (0 for mg/dL, 1 for mmol/L).

EDIT: This issue probably applies to AAPS, too, since it also uses a low and high target. examples.json shows its profileJson with target_low and target_high. I cannot test it w/out having an actual "openaps://AndroidAPS" profile though.

I think merged PR, Remove unused Import Settings in JSON that cause errors decoding JSON #249, also applies to AAPS.

bjornoleh commented 1 month ago

I think perhaps AAPS targets should be handled the same way as Trio targets, using only / mainly the lower target, instead of the median of lower/upper target range, as seems to be the case in this PR currently. We use the same algorithm, and I would expect the same behaviour regarding targets.

From https://androidaps.readthedocs.io/en/latest/Configuration/Config-Builder.html#closed-loop: Please note: In closed loop mode a single target instead of target range (i.e. 5,5 mmol or 100 mg/dl instead of 5,0 - 7,0 mmol or 90 - 125 mg/dl) is recommended.

dnzxy commented 3 weeks ago

@marionbarker or @bjorkert – could you please test this, and if good, give your approval please?

marionbarker commented 3 weeks ago

Summary

Success: This PR worked as expected.

Testing Details

I applied this patch to dev (commit 4d6e102a).

After applying the patch and building again, I imported my settings again.

bjornoleh commented 3 weeks ago

Merging with two approvals