DailyStats.swift 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import Foundation
  2. struct DailyStats: JSON, Equatable {
  3. var date: Date
  4. var Pump: String
  5. var CGM: String
  6. var TIR_Percentage: Int
  7. var Hypoglucemias_Percentage: Int
  8. var Hyperglucemias_Percentage: Int
  9. var BG_daily_Average: Decimal
  10. var TDD: Decimal
  11. var Carbs_24h: Decimal
  12. var Algorithm: String
  13. var AdjustmentFactor: Decimal
  14. var insulinType: String
  15. var peakActivityTime: Decimal
  16. var FAX_Build_Version: String
  17. var FAX_Build_Date: Date
  18. var id: String
  19. init(
  20. date: Date,
  21. Pump: String,
  22. CGM: String,
  23. TIR_Percentage: Int,
  24. Hypoglucemias_Percentage: Int,
  25. Hyperglucemias_Percentage: Int,
  26. BG_daily_Average: Decimal,
  27. TDD: Decimal,
  28. Carbs_24h: Decimal,
  29. Algorithm: String,
  30. AdjustmentFactor: Decimal,
  31. insulinType: String,
  32. peakActivityTime: Decimal,
  33. FAX_Build_Version: String,
  34. FAX_Build_Date: Date,
  35. id: String
  36. ) {
  37. self.date = date
  38. self.Pump = Pump
  39. self.CGM = CGM
  40. self.TIR_Percentage = TIR_Percentage
  41. self.Hypoglucemias_Percentage = Hypoglucemias_Percentage
  42. self.Hyperglucemias_Percentage = Hyperglucemias_Percentage
  43. self.BG_daily_Average = BG_daily_Average
  44. self.TDD = TDD
  45. self.Carbs_24h = Carbs_24h
  46. self.Algorithm = Algorithm
  47. self.AdjustmentFactor = AdjustmentFactor
  48. self.insulinType = insulinType
  49. self.peakActivityTime = peakActivityTime
  50. self.FAX_Build_Version = FAX_Build_Version
  51. self.FAX_Build_Date = FAX_Build_Date
  52. self.id = id
  53. }
  54. }
  55. extension DailyStats {
  56. private enum CodingKeys: String, CodingKey {
  57. case date
  58. case Pump
  59. case CGM
  60. case TIR_Percentage
  61. case Hypoglucemias_Percentage
  62. case Hyperglucemias_Percentage
  63. case BG_daily_Average
  64. case TDD
  65. case Carbs_24h
  66. case Algorithm
  67. case AdjustmentFactor
  68. case insulinType
  69. case peakActivityTime
  70. case FAX_Build_Version
  71. case FAX_Build_Date
  72. case id
  73. }
  74. }