GlucosePredictionAlgorithm.swift 743 B

123456789101112131415161718192021222324252627282930
  1. //
  2. // GlucosePredictionAlgorithm.swift
  3. // Learn
  4. //
  5. // Created by Pete Schwamb on 7/22/23.
  6. // Copyright © 2023 LoopKit Authors. All rights reserved.
  7. //
  8. import Foundation
  9. public protocol GlucosePredictionInput {
  10. var glucoseHistory: [StoredGlucoseSample] { get }
  11. var doses: [DoseEntry] { get }
  12. var carbEntries: [StoredCarbEntry] { get }
  13. }
  14. public protocol GlucosePrediction {
  15. var glucose: [PredictedGlucoseValue] { get }
  16. }
  17. public protocol GlucosePredictionAlgorithm {
  18. associatedtype InputType: GlucosePredictionInput
  19. associatedtype OutputType: GlucosePrediction
  20. static func generatePrediction(input: InputType, startDate: Date?) throws -> OutputType
  21. }
  22. extension LoopAlgorithm: GlucosePredictionAlgorithm {}