LOOP-4665 Functional Algorithm#542
Merged
Merged
Conversation
Tidepool sync
Carb entry & favorite foods textfield fix
Fix Swift 6 warning
Updated translations from Lokalise on Sat Aug 19 14:25:48 CDT 2023
Carb entry updates
Prevent negative duration doses.
…to glucoseEffects methods
…t/LoopKit into functional-loop-algorithm
…xponentialInsulinModelPreset debugDescription
Functional loop algorithm
This was referenced Sep 6, 2023
nhamming
approved these changes
Sep 7, 2023
Comment on lines
+80
to
+85
| // let effectDates = input.glucoseHistory.map { $0.startDate } | ||
| // let insulinEffectsAtGlucoseTimestamps = annotatedDoses.glucoseEffects( | ||
| // insulinModelProvider: insulinModelProvider, | ||
| // longestEffectDuration: input.insulinActivityDuration, | ||
| // insulinSensitivityTimeline: input.sensitivity, | ||
| // effectDates: effectDates) |
Author
There was a problem hiding this comment.
Thanks. added https://tidepool.atlassian.net/browse/LOOP-4727 to keep track and will remove this commented code.
Comment on lines
+174
to
+176
| // // TODO: Generate recommendation from a prediction | ||
| // public static func generateRecommendation(prediction: LoopPrediction) throws -> LoopDosingRecommendation { | ||
| // } |
Camji55
approved these changes
Sep 7, 2023
|
|
||
| public struct GlucoseMath { | ||
| public static let momentumDataInterval: TimeInterval = .minutes(15) | ||
| public static let momentumDataInterval: TimeInterval = .minutes(16) |
Author
There was a problem hiding this comment.
Actually, going to revert this. This does change some behavior unintentionally.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://tidepool.atlassian.net/browse/LOOP-4665
Adding a functional version of the Loop algorithm, to simplify testing, and simplify running of exploratory forecasts, like in the bolus calculator, without mucking with LoopDataManager state.
The new functional version is not used in any user facing code yet; it is simply run in a test to verify that it produces the same forecast as the existing LoopDataManager does for the same input data.
The input data is stored in a single file that contains all the diabetes data and Loop Algorithm settings needed to produce one forecast, and the expected output prediction is also stored in a fixture. Both the LoopDataManager and the functional LoopAlgorithm tests use the same fixtures.
LoopAlgorithmInputtype, which contains everything needed to run a prediction and dosing recommendation in the Loop Algorithm.GlucosePredictionAlgorithmtype added. Not currently used; just an illustration of how future alternate algorithms could conform to a common prototype.Additional changes included (brought in to sync with DIY):
CarbValuerefactored to hold double, instead of HKQuantity, as we don't actually support any other units than grams.StoredCarbEntryrefactored to allow some fields to be optional, which simplifies the fixtures that encode this type. Also, the non-optional fields were moved to the beginning of the constructor.