소스 검색

feat(algo): Pull in trio-oref change; remove short and long delta condition to allow looping past 45min unchanged 400 readings

Deniz Cengiz 6 달 전
부모
커밋
f8e3b858f4

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
Trio/Resources/javascript/bundle/determine-basal.js


+ 3 - 0
Trio/Sources/Localizations/Main/Localizable.xcstrings

@@ -10034,6 +10034,7 @@
       }
     },
     "%lld h" : {
+      "extractionState" : "stale",
       "localizations" : {
         "bg" : {
           "stringUnit" : {
@@ -136146,6 +136147,7 @@
       }
     },
     "Invalid CGM reading (HIGH)." : {
+      "extractionState" : "stale",
       "localizations" : {
         "bg" : {
           "stringUnit" : {
@@ -212825,6 +212827,7 @@
       }
     },
     "SMBs and Non-Zero Temp. Basal Rates are disabled." : {
+      "extractionState" : "stale",
       "localizations" : {
         "bg" : {
           "stringUnit" : {

+ 41 - 41
Trio/Sources/Modules/Home/View/Header/LoopStatusView.swift

@@ -53,49 +53,49 @@ struct LoopStatusView: View {
                 }
 
                 if let determination = state.determinationsFromPersistence.first {
-                    if determination.glucose == 400 {
-                        Text("Invalid CGM reading (HIGH).")
-                            .bold()
-                            .padding(.top)
-                            .foregroundStyle(Color.loopRed)
-                            .fixedSize(horizontal: false, vertical: true)
+//                    if determination.glucose == 400 {
+//                        Text("Invalid CGM reading (HIGH).")
+//                            .bold()
+//                            .padding(.top)
+//                            .foregroundStyle(Color.loopRed)
+//                            .fixedSize(horizontal: false, vertical: true)
+//
+//                        Text("SMBs and Non-Zero Temp. Basal Rates are disabled.")
+//                            .font(.subheadline)
+//                            .fixedSize(horizontal: false, vertical: true)
+//
+//                    } else {
+                    Text("Latest Raw Algorithm Output")
+                        .bold()
+                        .padding(.top)
+
+                    Text(
+                        "Trio is currently using these metrics and values as determined by the oref algorithm:"
+                    )
+                    .font(.subheadline)
+                    .lineLimit(nil)
+                    .multilineTextAlignment(.leading)
+                    .fixedSize(horizontal: false, vertical: true)
+
+                    TagCloudView(
+                        tags: getComputedTags(determination),
+                        shouldParseToMmolL: state.units == .mmolL
+                    )
 
-                        Text("SMBs and Non-Zero Temp. Basal Rates are disabled.")
-                            .font(.subheadline)
-                            .fixedSize(horizontal: false, vertical: true)
+                    Text("Current Algorithm Reasoning").bold().padding(.top)
 
-                    } else {
-                        Text("Latest Raw Algorithm Output")
-                            .bold()
-                            .padding(.top)
-
-                        Text(
-                            "Trio is currently using these metrics and values as determined by the oref algorithm:"
-                        )
-                        .font(.subheadline)
-                        .lineLimit(nil)
-                        .multilineTextAlignment(.leading)
-                        .fixedSize(horizontal: false, vertical: true)
-
-                        TagCloudView(
-                            tags: getComputedTags(determination),
-                            shouldParseToMmolL: state.units == .mmolL
-                        )
-
-                        Text("Current Algorithm Reasoning").bold().padding(.top)
-
-                        Text(
-                            self
-                                .parseReasonConclusion(
-                                    determination.reasonConclusion,
-                                    isMmolL: state.units == .mmolL
-                                )
-                        )
-                        .font(.subheadline)
-                        .lineLimit(nil)
-                        .multilineTextAlignment(.leading)
-                        .fixedSize(horizontal: false, vertical: true)
-                    }
+                    Text(
+                        self
+                            .parseReasonConclusion(
+                                determination.reasonConclusion,
+                                isMmolL: state.units == .mmolL
+                            )
+                    )
+                    .font(.subheadline)
+                    .lineLimit(nil)
+                    .multilineTextAlignment(.leading)
+                    .fixedSize(horizontal: false, vertical: true)
+//                    }
                 } else {
                     Text("No recent oref algorithm determination.")
                 }

+ 1 - 1
Trio/Sources/Modules/Stat/View/ViewElements/Insulin/BolusStatsView.swift

@@ -329,7 +329,7 @@ private struct BolusSelectionPopover: View {
     private func xOffset() -> CGFloat {
         // If the selected date is outside the visible domain, hide the popover
         guard selectedDate >= domain.start && selectedDate <= domain.end else { return 0 }
-        
+
         let domainDuration = domain.end.timeIntervalSince(domain.start)
         guard domainDuration > 0, chartWidth > 0 else { return 0 }
 

+ 4 - 4
trio-oref/lib/determine-basal/determine-basal.js

@@ -440,13 +440,13 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
         }
     }
 
-    if (bg <= 10 || bg === 38 || noise >= 3 || minAgo > 12 || minAgo < -5 || ( glucose_status.short_avgdelta === 0 && glucose_status.long_avgdelta === 0 ) ) {
+    if (bg <= 10 || bg === 38 || noise >= 3 || minAgo > 12 || minAgo < -5) {
         if (currenttemp.rate >= basal) { // high temp is running
-            rT.reason += ". Canceling high temp basal of " + currenttemp.rate;
+            rT.reason += ". Replacing high temp basal of "+currenttemp.rate+" with neutral temp of "+basal;
             rT.deliverAt = deliverAt;
             rT.temp = 'absolute';
-            rT.duration = 0;
-            rT.rate = 0;
+            rT.duration = 30;
+            rT.rate = basal;
             return rT;
             // don't use setTempBasal(), as it has logic that allows <120% high temps to continue running
             //return tempBasalFunctions.setTempBasal(basal, 30, profile, rT, currenttemp);