LoopAlgorithm predicts future blood glucose from insulin, carb, and historic glucose data, and generates dosing recommendations.
Please understand that this project:
- Is highly experimental
- Is not approved for therapy
The entry point is Algorithm.run(input:), which takes any type conforming to AlgorithmInput and returns the
glucose forecast, the effects behind it, and a dose recommendation. The API takes plain numbers in fixed units:
| Quantity | Unit |
|---|---|
| Glucose, targets, suspend threshold | mg/dL |
| Insulin sensitivity | mg/dL per unit |
| Carbs | grams |
| Carb ratio | grams per unit |
| Insulin | units |
| Basal rates | U/h |
Apps that store values in other units (mmol/L) convert before calling. Algorithm.generatePrediction produces a
forecast without a recommendation.
There is a command line utility that will run the algorithm with a scenario input file:
swift build
./.build/debug/LoopAlgorithmRunner Tests/LoopAlgorithmTests/Fixtures/suspend_scenario.json > output.json