-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit calibration assistant
This commit introduces a calibration assistant function to xdripswift. When the user clicks calibrate, the previous x minutes of BG data is analysed (delta change, std deviation and current BG level), weightings are applied to the deviations calculated from the programmed limits and a result is output. Based upon this result to user is allowed to calibrate normally or they are asked to consider waiting, or they are told directly to not calibrate. A debug option is in developer settings to show the calculations in the UIAlert to allow troubleshooting. The results and recommendation are also logged to the trace file. The user can enable a visual assistant that will change the calibration icon colour (every time a new BG is processed) to indicate if it is a good time to calibrate or not. EN and ES translations are included
- Loading branch information
Showing
13 changed files
with
532 additions
and
23 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// | ||
// ConstantsCalibrationAssistant.swift | ||
// xdrip | ||
// | ||
// Created by Paul Plant on 26/6/22. | ||
// Copyright © 2022 Johan Degraeve. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
/// constants used by the calibration assistant | ||
enum ConstantsCalibrationAssistant { | ||
|
||
/// the number of minutes of readings that we should use for the calibration assistant calculations | ||
static let minutesToUseForCalculations: Double = 20 | ||
|
||
// Delta | ||
/// the value over which we will consider that the delta change is significant to display as a concern to the user | ||
static let deltaResultLimit: Double = 90 | ||
|
||
/// the weighting that will be applied to the delta change value to push the result up | ||
static let deltaMultiplier: Double = 30 | ||
|
||
|
||
// Standard Deviation | ||
/// the value over which we will consider that the variation in change is significant to display as a concern to the user | ||
static let stdDeviationResultLimit: Double = 60 | ||
|
||
/// the weighting that will be applied to the standard deviation value to push the result up | ||
static let stdDeviationMultiplier: Double = 50 | ||
|
||
|
||
// Very high BG levels | ||
/// the upper higher BG level at which the user should never calibrate. A bigger multiplier will be used for values over this amount | ||
static let higherBgUpperLimit: Double = 160 | ||
|
||
/// the weighting that will be applied to very high BG values to push the result up | ||
static let higherBgUpperMultiplier: Double = 15 | ||
|
||
|
||
// Higher BG levels | ||
/// the higher BG level at which the user should be careful when calibrating. A smaller multiplier will be applied to values over this amount | ||
static let higherBgRecommendedLimit: Double = 130 | ||
|
||
/// the weighting that will be applied to moderately high BG values to push the result up | ||
static let higherBgRecommendedMultiplier: Double = 10 | ||
|
||
|
||
// Lower BG levels | ||
/// the lower BG level at which the user should be careful when calibrating. A smaller multiplier will be applied to values below this amount | ||
static let lowerBgRecommendedLimit: Double = 90 | ||
|
||
/// the weight that will be applied to moderately low BG values to push the result up | ||
static let lowerBgRecommendedMultiplier: Double = 10 | ||
|
||
|
||
// Very low BG levels | ||
/// the lower BG level at which the user should never calibrate. A bigger multiplier will be used for values under this amount | ||
static let lowerBgLowerLimit: Double = 75 | ||
|
||
/// the weighting that will be applied to very low BG values to push the result up | ||
static let lowerBgLowerMultiplier: Double = 15 | ||
|
||
|
||
// Limits | ||
/// the limit below which the calibration result will be considered as OK | ||
static let okToCalibrateLimit: Double = 130 | ||
|
||
/// the limit below which (and above okToCalibrateLimit) when the calibration result will be considered as "Not Ideal" and the user will be warned to be careful and calibrate later | ||
static let notIdealToCalibrateLimit: Double = 200 | ||
|
||
} |
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
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
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
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
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
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
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
Oops, something went wrong.