Skip to content

Commit 3137445

Browse files
authored
Rename Min BG Guard to suspend threshold (#575)
1 parent fa94821 commit 3137445

File tree

8 files changed

+60
-60
lines changed

8 files changed

+60
-60
lines changed

DoseMathTests/DoseMathTests.swift

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class RecommendTempBasalTests: XCTestCase {
8989
return InsulinSensitivitySchedule(unit: HKUnit.milligramsPerDeciliter(), dailyItems: [RepeatingScheduleValue(startTime: 0.0, value: 60.0)])!
9090
}
9191

92-
var minimumBGGuard: GlucoseThreshold {
92+
var suspendThreshold: GlucoseThreshold {
9393
return GlucoseThreshold(unit: HKUnit.milligramsPerDeciliter(), value: 55)
9494
}
9595

@@ -107,7 +107,7 @@ class RecommendTempBasalTests: XCTestCase {
107107
let dose = glucose.recommendedTempBasal(
108108
to: glucoseTargetRange,
109109
at: glucose.first!.startDate,
110-
suspendThreshold: minimumBGGuard.quantity,
110+
suspendThreshold: suspendThreshold.quantity,
111111
sensitivity: insulinSensitivitySchedule,
112112
model: insulinModel,
113113
basalRates: basalRateSchedule,
@@ -124,7 +124,7 @@ class RecommendTempBasalTests: XCTestCase {
124124
var dose = glucose.recommendedTempBasal(
125125
to: glucoseTargetRange,
126126
at: glucose.first!.startDate,
127-
suspendThreshold: minimumBGGuard.quantity,
127+
suspendThreshold: suspendThreshold.quantity,
128128
sensitivity: insulinSensitivitySchedule,
129129
model: insulinModel,
130130
basalRates: basalRateSchedule,
@@ -146,7 +146,7 @@ class RecommendTempBasalTests: XCTestCase {
146146
dose = glucose.recommendedTempBasal(
147147
to: glucoseTargetRange,
148148
at: glucose.first!.startDate,
149-
suspendThreshold: minimumBGGuard.quantity,
149+
suspendThreshold: suspendThreshold.quantity,
150150
sensitivity: insulinSensitivitySchedule,
151151
model: insulinModel,
152152
basalRates: basalRateSchedule,
@@ -164,7 +164,7 @@ class RecommendTempBasalTests: XCTestCase {
164164
var dose = glucose.recommendedTempBasal(
165165
to: glucoseTargetRange,
166166
at: glucose.first!.startDate,
167-
suspendThreshold: minimumBGGuard.quantity,
167+
suspendThreshold: suspendThreshold.quantity,
168168
sensitivity: insulinSensitivitySchedule,
169169
model: insulinModel,
170170
basalRates: basalRateSchedule,
@@ -185,7 +185,7 @@ class RecommendTempBasalTests: XCTestCase {
185185
dose = glucose.recommendedTempBasal(
186186
to: glucoseTargetRange,
187187
at: glucose.first!.startDate,
188-
suspendThreshold: minimumBGGuard.quantity,
188+
suspendThreshold: suspendThreshold.quantity,
189189
sensitivity: insulinSensitivitySchedule,
190190
model: insulinModel,
191191
basalRates: basalRateSchedule,
@@ -212,7 +212,7 @@ class RecommendTempBasalTests: XCTestCase {
212212
var dose = glucose.recommendedTempBasal(
213213
to: glucoseTargetRange,
214214
at: glucose.first!.startDate,
215-
suspendThreshold: minimumBGGuard.quantity,
215+
suspendThreshold: suspendThreshold.quantity,
216216
sensitivity: insulinSensitivitySchedule,
217217
model: insulinModel,
218218
basalRates: basalRateSchedule,
@@ -226,7 +226,7 @@ class RecommendTempBasalTests: XCTestCase {
226226
dose = glucose.recommendedTempBasal(
227227
to: glucoseTargetRange,
228228
at: glucose.first!.startDate,
229-
suspendThreshold: minimumBGGuard.quantity,
229+
suspendThreshold: suspendThreshold.quantity,
230230
sensitivity: insulinSensitivitySchedule,
231231
model: insulinModel,
232232
basalRates: basalRateSchedule,
@@ -243,7 +243,7 @@ class RecommendTempBasalTests: XCTestCase {
243243
let dose = glucose.recommendedTempBasal(
244244
to: glucoseTargetRange,
245245
at: glucose.first!.startDate,
246-
suspendThreshold: minimumBGGuard.quantity,
246+
suspendThreshold: suspendThreshold.quantity,
247247
sensitivity: insulinSensitivitySchedule,
248248
model: insulinModel,
249249
basalRates: basalRateSchedule,
@@ -261,7 +261,7 @@ class RecommendTempBasalTests: XCTestCase {
261261
var dose = glucose.recommendedTempBasal(
262262
to: glucoseTargetRange,
263263
at: glucose.first!.startDate,
264-
suspendThreshold: minimumBGGuard.quantity,
264+
suspendThreshold: suspendThreshold.quantity,
265265
sensitivity: insulinSensitivitySchedule,
266266
model: insulinModel,
267267
basalRates: basalRateSchedule,
@@ -282,7 +282,7 @@ class RecommendTempBasalTests: XCTestCase {
282282
dose = glucose.recommendedTempBasal(
283283
to: glucoseTargetRange,
284284
at: glucose.first!.startDate,
285-
suspendThreshold: minimumBGGuard.quantity,
285+
suspendThreshold: suspendThreshold.quantity,
286286
sensitivity: insulinSensitivitySchedule,
287287
model: insulinModel,
288288
basalRates: basalRateSchedule,
@@ -300,7 +300,7 @@ class RecommendTempBasalTests: XCTestCase {
300300
let dose = glucose.recommendedTempBasal(
301301
to: glucoseTargetRange,
302302
at: glucose.first!.startDate,
303-
suspendThreshold: minimumBGGuard.quantity,
303+
suspendThreshold: suspendThreshold.quantity,
304304
sensitivity: insulinSensitivitySchedule,
305305
model: insulinModel,
306306
basalRates: basalRateSchedule,
@@ -318,7 +318,7 @@ class RecommendTempBasalTests: XCTestCase {
318318
let dose = glucose.recommendedTempBasal(
319319
to: glucoseTargetRange,
320320
at: glucose.first!.startDate,
321-
suspendThreshold: minimumBGGuard.quantity,
321+
suspendThreshold: suspendThreshold.quantity,
322322
sensitivity: insulinSensitivitySchedule,
323323
model: insulinModel,
324324
basalRates: basalRateSchedule,
@@ -336,7 +336,7 @@ class RecommendTempBasalTests: XCTestCase {
336336
let dose = glucose.recommendedTempBasal(
337337
to: glucoseTargetRange,
338338
at: glucose.first!.startDate,
339-
suspendThreshold: minimumBGGuard.quantity,
339+
suspendThreshold: suspendThreshold.quantity,
340340
sensitivity: insulinSensitivitySchedule,
341341
model: insulinModel,
342342
basalRates: basalRateSchedule,
@@ -354,7 +354,7 @@ class RecommendTempBasalTests: XCTestCase {
354354
var dose = glucose.recommendedTempBasal(
355355
to: glucoseTargetRange,
356356
at: glucose.first!.startDate,
357-
suspendThreshold: minimumBGGuard.quantity,
357+
suspendThreshold: suspendThreshold.quantity,
358358
sensitivity: self.insulinSensitivitySchedule,
359359
model: insulinModel,
360360
basalRates: basalRateSchedule,
@@ -371,7 +371,7 @@ class RecommendTempBasalTests: XCTestCase {
371371
dose = glucose.recommendedTempBasal(
372372
to: glucoseTargetRange,
373373
at: glucose.first!.startDate,
374-
suspendThreshold: minimumBGGuard.quantity,
374+
suspendThreshold: suspendThreshold.quantity,
375375
sensitivity: insulinSensitivitySchedule,
376376
model: insulinModel,
377377
basalRates: basalRateSchedule,
@@ -389,7 +389,7 @@ class RecommendTempBasalTests: XCTestCase {
389389
let dose = glucose.recommendedTempBasal(
390390
to: glucoseTargetRange,
391391
at: glucose.first!.startDate,
392-
suspendThreshold: minimumBGGuard.quantity,
392+
suspendThreshold: suspendThreshold.quantity,
393393
sensitivity: insulinSensitivitySchedule,
394394
model: insulinModel,
395395
basalRates: basalRateSchedule,
@@ -407,7 +407,7 @@ class RecommendTempBasalTests: XCTestCase {
407407
let dose = glucose.recommendedTempBasal(
408408
to: glucoseTargetRange,
409409
at: glucose.first!.startDate,
410-
suspendThreshold: minimumBGGuard.quantity,
410+
suspendThreshold: suspendThreshold.quantity,
411411
sensitivity: insulinSensitivitySchedule,
412412
model: insulinModel,
413413
basalRates: basalRateSchedule,
@@ -424,7 +424,7 @@ class RecommendTempBasalTests: XCTestCase {
424424

425425
let dose = glucose.recommendedTempBasal(
426426
to: glucoseTargetRange,
427-
suspendThreshold: minimumBGGuard.quantity,
427+
suspendThreshold: suspendThreshold.quantity,
428428
sensitivity: insulinSensitivitySchedule,
429429
model: insulinModel,
430430
basalRates: basalRateSchedule,
@@ -475,7 +475,7 @@ class RecommendBolusTests: XCTestCase {
475475
return InsulinSensitivitySchedule(unit: HKUnit.milligramsPerDeciliter(), dailyItems: [RepeatingScheduleValue(startTime: 0.0, value: 60.0)])!
476476
}
477477

478-
var minimumBGGuard: GlucoseThreshold {
478+
var suspendThreshold: GlucoseThreshold {
479479
return GlucoseThreshold(unit: HKUnit.milligramsPerDeciliter(), value: 55)
480480
}
481481

@@ -493,7 +493,7 @@ class RecommendBolusTests: XCTestCase {
493493
let dose = glucose.recommendedBolus(
494494
to: glucoseTargetRange,
495495
at: glucose.first!.startDate,
496-
suspendThreshold: minimumBGGuard.quantity,
496+
suspendThreshold: suspendThreshold.quantity,
497497
sensitivity: insulinSensitivitySchedule,
498498
model: insulinModel,
499499
pendingInsulin: 0,
@@ -509,7 +509,7 @@ class RecommendBolusTests: XCTestCase {
509509
let dose = glucose.recommendedBolus(
510510
to: glucoseTargetRange,
511511
at: glucose.first!.startDate,
512-
suspendThreshold: minimumBGGuard.quantity,
512+
suspendThreshold: suspendThreshold.quantity,
513513
sensitivity: insulinSensitivitySchedule,
514514
model: insulinModel,
515515
pendingInsulin: 0,
@@ -525,7 +525,7 @@ class RecommendBolusTests: XCTestCase {
525525
let dose = glucose.recommendedBolus(
526526
to: glucoseTargetRange,
527527
at: glucose.first!.startDate,
528-
suspendThreshold: minimumBGGuard.quantity,
528+
suspendThreshold: suspendThreshold.quantity,
529529
sensitivity: insulinSensitivitySchedule,
530530
model: insulinModel,
531531
pendingInsulin: 0,
@@ -541,7 +541,7 @@ class RecommendBolusTests: XCTestCase {
541541
let dose = glucose.recommendedBolus(
542542
to: glucoseTargetRange,
543543
at: glucose.first!.startDate,
544-
suspendThreshold: minimumBGGuard.quantity,
544+
suspendThreshold: suspendThreshold.quantity,
545545
sensitivity: insulinSensitivitySchedule,
546546
model: insulinModel,
547547
pendingInsulin: 0,
@@ -557,7 +557,7 @@ class RecommendBolusTests: XCTestCase {
557557
let dose = glucose.recommendedBolus(
558558
to: glucoseTargetRange,
559559
at: glucose.first!.startDate,
560-
suspendThreshold: minimumBGGuard.quantity,
560+
suspendThreshold: suspendThreshold.quantity,
561561
sensitivity: insulinSensitivitySchedule,
562562
model: insulinModel,
563563
pendingInsulin: 0,
@@ -579,7 +579,7 @@ class RecommendBolusTests: XCTestCase {
579579
let dose = glucose.recommendedBolus(
580580
to: glucoseTargetRange,
581581
at: glucose.first!.startDate,
582-
suspendThreshold: minimumBGGuard.quantity,
582+
suspendThreshold: suspendThreshold.quantity,
583583
sensitivity: insulinSensitivitySchedule,
584584
model: insulinModel,
585585
pendingInsulin: 0,
@@ -597,7 +597,7 @@ class RecommendBolusTests: XCTestCase {
597597
let dose = glucose.recommendedBolus(
598598
to: glucoseTargetRange,
599599
at: glucose.first!.startDate,
600-
suspendThreshold: minimumBGGuard.quantity,
600+
suspendThreshold: suspendThreshold.quantity,
601601
sensitivity: insulinSensitivitySchedule,
602602
model: insulinModel,
603603
pendingInsulin: 1,
@@ -613,7 +613,7 @@ class RecommendBolusTests: XCTestCase {
613613
let dose = glucose.recommendedBolus(
614614
to: glucoseTargetRange,
615615
at: glucose.first!.startDate,
616-
suspendThreshold: minimumBGGuard.quantity,
616+
suspendThreshold: suspendThreshold.quantity,
617617
sensitivity: insulinSensitivitySchedule,
618618
model: insulinModel,
619619
pendingInsulin: 0,
@@ -629,7 +629,7 @@ class RecommendBolusTests: XCTestCase {
629629
let dose = glucose.recommendedBolus(
630630
to: glucoseTargetRange,
631631
at: glucose.first!.startDate,
632-
suspendThreshold: minimumBGGuard.quantity,
632+
suspendThreshold: suspendThreshold.quantity,
633633
sensitivity: insulinSensitivitySchedule,
634634
model: insulinModel,
635635
pendingInsulin: 0,
@@ -645,7 +645,7 @@ class RecommendBolusTests: XCTestCase {
645645
let dose = glucose.recommendedBolus(
646646
to: glucoseTargetRange,
647647
at: glucose.first!.startDate,
648-
suspendThreshold: minimumBGGuard.quantity,
648+
suspendThreshold: suspendThreshold.quantity,
649649
sensitivity: insulinSensitivitySchedule,
650650
model: insulinModel,
651651
pendingInsulin: 0,
@@ -661,7 +661,7 @@ class RecommendBolusTests: XCTestCase {
661661
var dose = glucose.recommendedBolus(
662662
to: glucoseTargetRange,
663663
at: glucose.first!.startDate,
664-
suspendThreshold: minimumBGGuard.quantity,
664+
suspendThreshold: suspendThreshold.quantity,
665665
sensitivity: insulinSensitivitySchedule,
666666
model: insulinModel,
667667
pendingInsulin: 0,
@@ -675,7 +675,7 @@ class RecommendBolusTests: XCTestCase {
675675
dose = glucose.recommendedBolus(
676676
to: glucoseTargetRange,
677677
at: glucose.first!.startDate,
678-
suspendThreshold: minimumBGGuard.quantity,
678+
suspendThreshold: suspendThreshold.quantity,
679679
sensitivity: insulinSensitivitySchedule,
680680
model: insulinModel,
681681
pendingInsulin: 0.8,
@@ -691,7 +691,7 @@ class RecommendBolusTests: XCTestCase {
691691
var dose = glucose.recommendedBolus(
692692
to: glucoseTargetRange,
693693
at: glucose.first!.startDate,
694-
suspendThreshold: minimumBGGuard.quantity,
694+
suspendThreshold: suspendThreshold.quantity,
695695
sensitivity: self.insulinSensitivitySchedule,
696696
model: insulinModel,
697697
pendingInsulin: 0,
@@ -706,7 +706,7 @@ class RecommendBolusTests: XCTestCase {
706706
dose = glucose.recommendedBolus(
707707
to: glucoseTargetRange,
708708
at: glucose.first!.startDate,
709-
suspendThreshold: minimumBGGuard.quantity,
709+
suspendThreshold: suspendThreshold.quantity,
710710
sensitivity: insulinSensitivitySchedule,
711711
model: insulinModel,
712712
pendingInsulin: 0,
@@ -722,7 +722,7 @@ class RecommendBolusTests: XCTestCase {
722722
let dose = glucose.recommendedBolus(
723723
to: glucoseTargetRange,
724724
at: glucose.first!.startDate,
725-
suspendThreshold: minimumBGGuard.quantity,
725+
suspendThreshold: suspendThreshold.quantity,
726726
sensitivity: insulinSensitivitySchedule,
727727
model: insulinModel,
728728
pendingInsulin: 0,
@@ -738,7 +738,7 @@ class RecommendBolusTests: XCTestCase {
738738

739739
let dose = glucose.recommendedBolus(
740740
to: glucoseTargetRange,
741-
suspendThreshold: minimumBGGuard.quantity,
741+
suspendThreshold: suspendThreshold.quantity,
742742
sensitivity: insulinSensitivitySchedule,
743743
model: insulinModel,
744744
pendingInsulin: 0,

Loop/Extensions/NSUserDefaults.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ extension UserDefaults {
124124
glucoseTargetRangeSchedule = nil
125125
}
126126

127-
let minimumBGGuard: GlucoseThreshold?
127+
let suspendThreshold: GlucoseThreshold?
128128
if let rawValue = dictionary(forKey: "com.loopkit.Loop.MinimumBGGuard") {
129-
minimumBGGuard = GlucoseThreshold(rawValue: rawValue)
129+
suspendThreshold = GlucoseThreshold(rawValue: rawValue)
130130
} else {
131-
minimumBGGuard = nil
131+
suspendThreshold = nil
132132
}
133133

134134
var maximumBasalRatePerHour: Double? = double(forKey: "com.loudnate.Naterade.MaximumBasalRatePerHour")
@@ -146,7 +146,7 @@ extension UserDefaults {
146146
glucoseTargetRangeSchedule: glucoseTargetRangeSchedule,
147147
maximumBasalRatePerHour: maximumBasalRatePerHour,
148148
maximumBolus: maximumBolus,
149-
minimumBGGuard: minimumBGGuard,
149+
suspendThreshold: suspendThreshold,
150150
retrospectiveCorrectionEnabled: bool(forKey: "com.loudnate.Loop.RetrospectiveCorrectionEnabled")
151151
)
152152
self.loopSettings = settings

Loop/Managers/AnalyticsManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ final class AnalyticsManager: IdentifiableClass {
108108
logEvent("Maximum bolus change")
109109
}
110110

111-
if newValue.minimumBGGuard != oldValue.minimumBGGuard {
111+
if newValue.suspendThreshold != oldValue.suspendThreshold {
112112
logEvent("Minimum BG Guard change")
113113
}
114114
}

Loop/Managers/LoopDataManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ final class LoopDataManager {
868868
lastRequestedBolus == nil, // Don't recommend changes if a bolus was just set
869869
let tempBasal = predictedGlucose.recommendedTempBasal(
870870
to: glucoseTargetRange,
871-
suspendThreshold: settings.minimumBGGuard?.quantity,
871+
suspendThreshold: settings.suspendThreshold?.quantity,
872872
sensitivity: insulinSensitivity,
873873
model: model,
874874
basalRates: basalRates,
@@ -913,7 +913,7 @@ final class LoopDataManager {
913913

914914
let recommendation = predictedGlucose.recommendedBolus(
915915
to: glucoseTargetRange,
916-
suspendThreshold: settings.minimumBGGuard?.quantity,
916+
suspendThreshold: settings.suspendThreshold?.quantity,
917917
sensitivity: insulinSensitivity,
918918
model: model,
919919
pendingInsulin: pendingInsulin,

Loop/Models/BolusRecommendation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extension BolusRecommendationNotice {
2424
case .glucoseBelowSuspendThreshold(minGlucose: let minGlucose):
2525
let glucoseFormatter = NumberFormatter.glucoseFormatter(for: unit)
2626
let bgStr = glucoseFormatter.describingGlucose(minGlucose.quantity, for: unit)!
27-
return String(format: NSLocalizedString("Predicted glucose of %1$@ is below your suspend threshold setting.", comment: "Notice message when recommending bolus when BG is below minimum BG guard. (1: glucose value)"), bgStr)
27+
return String(format: NSLocalizedString("Predicted glucose of %1$@ is below your suspend threshold setting.", comment: "Notice message when recommending bolus when BG is below the suspend threshold. (1: glucose value)"), bgStr)
2828
case .currentGlucoseBelowTarget(glucose: let glucose):
2929
let glucoseFormatter = NumberFormatter.glucoseFormatter(for: unit)
3030
let bgStr = glucoseFormatter.describingGlucose(glucose.quantity, for: unit)!

0 commit comments

Comments
 (0)