A multi-agent reinforcement learning-based decision support system for high fat meals and aerobic exercises for individuals with type 1 diabetes
A multi-agent reinforcement learning system addresses the challenges of high fat meals and aerobic exercises in type 1 diabetes by optimizing insulin dosages based on real-time data, enhancing glucose control and reducing glycemic variability.
Patent Information
- Application Number
- PCT/IB2024/056587
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-07-07
- Filing Date
- 2024-07-05
- Publication Date
- 2025-01-16
AI Technical Summary
Individuals with type 1 diabetes face challenges in managing blood glucose levels due to the delayed gastric emptying caused by high fat meals and the increased glucose uptake during aerobic exercises, leading to unpredictable insulin requirements and a higher risk of dysglycemia, as current methods do not account for macronutrients like fat and exercise in insulin dosage calculations.
A multi-agent reinforcement learning-based decision support system that determines optimal insulin dosages by analyzing glucose monitoring data, mealtime data, and exercise information, using a processor connected to a glucose sensor and insulin providing device to adjust insulin delivery based on whether a meal is high in fat and if aerobic exercise is planned post-meal.
The system improves postprandial glucose control by reducing the 5-hour incremental area under the glucose levels curve after high fat meals and meals followed by exercise, decreasing the time spent with glucose levels below 3.9 mmol/L, and providing personalized insulin dose recommendations that align with clinical guidelines, thus reducing the risk of hypoglycemia and hyperglycemia.
Smart Images

Figure IB2024056587_16012025_PF_FP_ABST
Abstract
Description
[0001] A MULTI-AGENT REINFORCEMENT LEARNING-BASED DECISION SUPPORT SYSTEM FOR HIGH FAT MEALS AND AEROBIC EXERCISES FOR INDIVIDUALS WITH TYPE 1 DIABETES FIELD The present technology relates to drug monitoring systems in general and more specifically to a method and a system for determining an optimal and recommended dosage of insulin for an individual with type 1 diabetes in or around meals. BACKGROUND Type 1 diabetes is an autoimmune disease characterized by the destruction of insulin-producing beta cells in the pancreas. In the absence of insulin, individuals with type 1 diabetes develop persistent high blood glucose levels, known as hyperglycemia, which, if left untreated, can lead to a variety of complications such as nephropathy, neuropathy, retinopathy, and cardiovascular disease. Multiple daily injections (MDI) or continuous subcutaneous insulin infusion via an insulin pump reduce the risk, and delay the onset, of such complications. MDI and pump therapies remain the standard of care for type 1 diabetes, with MDI therapy being the most commonly used worldwide due to its lower cost and ease of access, among others. MDI therapy specifically refers to the use of 1 or 2 daily basal injections of long-acting insulin to control glycemia overnight and between meals, along with bolus injections of rapid-acting insulin at mealtimes to control postprandial blood glucose levels. Carbohydrate is the macronutrient with the greatest impact on postprandial glucose levels. However, recent studies in both children and adults have shown that high fat meals, regardless of fat type, delay the acute rise of blood glucose levels, possibly due to delayed gastric emptying, and lead to sustained hyperglycemia for up to 5 hours postprandially. These studies also report that high fat meals result in a smaller rise in glucose levels in the early postprandial period, potentially leading to hypoglycemia (low blood glucose levels) immediately after meal ingestions. While official guidelines are yet to be published on how to account for fats in the calculation of meal boluses, several studies have shown that increasing insulin by 25-75% with a split dosing strategy (upfront and late postprandial boluses) can avoid early hypoglycemia and late hyperglycemia. However, while carbohydrate ratios allow for flexibility in the meal carbohydrate content, no such concept exists for meal fat, which makes the split dosing strategy challenging to implement in practice due to the variability in inter-individual postprandial (early and late) insulin requirements for high fat meals. A separate, yet related, challenge that people with type 1 diabetes face is that of exercise. Regular exercise is recommended for people with type 1 diabetes since it is associated with less mortality, cardiovascular risk factor reduction, diabetes-related microvascular complications, and HbA1c levels. However, many people with type 1 diabetes do not exercise, largely due to the fear of hypoglycemia. During aerobic exercise (e.g., running, swimming, and cycling), the glucose uptake from the skeletal muscles increases by tenfold or more, which, in healthy individuals, is being provided by counter-regulatory mechanisms of the liver’s glycogen breakdown (through the reduction of endogenous insulin secretion) and the increase in endogenous glucagon secretion. However, in individuals with type 1 diabetes, this delicate and balanced alteration of hormonal secretions is absent, which often leads to hypoglycemia. Traditionally, meal insulin boluses are calculated based on the carbohydrate content of meals without considering macronutrients and postprandial exercises. However, high fat meals require more insulin to prevent postprandial hyperglycemia while meals followed by aerobic exercises require less insulin to prevent hypoglycemia. Moreover, the adjustments needed for high fat meals and postprandial exercises vary substantially between individuals and between exercises (e.g., running vs swimming), complicating the attainment of optimal glucose control and increasing the risk of dysglycemia. SUMMARY According to various aspects of the present invention, there is provided a system for determining an insulin dosage to provide to a user. The system includes a communications interface connected to a network, wherein the communications interface is configured to receive data from one user device. The system also includes a memory storage unit. The system further includes a processor connected to the communications interface and the memory storage unit. The processor is configured to receive glucose monitoring data from a glucose sensor, wherein the glucose sensor is configured to gather glucose monitoring data from the user. The processor is also configured to receive mealtime data associated with a meal and determine based on the mealtime data whether the meal is a high fat meal. If the meal is determined to be a high fat meal, the processor is configured to determine a fat ratio using a multi-agent reinforcement learning module and calculate the insulin dosage using the glucose monitoring data, mealtime data and the fat ratio. If the meal is determined not to be a high fat meal, the processor is further configured to calculate the insulin dosage using the glucose monitoring data and mealtime data. In one embodiment, the processor is further configured to, prior to the step of the processor determining based on the mealtime data whether the meal is a high fat meal, determine based on the mealtime data whether the user plans to perform postprandial exercise. The processor is also configured to determine an exercise ratio using the multi-agent reinforcement learning module and calculate the insulin dosage using the glucose monitoring data, mealtime data and the exercise ratio. In one embodiment, the postprandial exercise is exercise occurring within four hours after the meal. In yet another embodiment, the processor is further configured to, prior to determining an exercise ratio, determine if the postprandial exercise is occurring within ninety minutes after the meal. In another embodiment, the memory storage unit includes a log database of historical insulin dosages provided to the user, and the associated glucose monitoring data. In yet another embodiment, the log database is configured to be used by the multi-agent reinforcement module. In yet another embodiment, the high fat meal is a meal with over 20 grams of fat. In one embodiment, mealtime data associated with a meal includes the amount of carbohydrates consumed during the meal. In another embodiment, the system includes an insulin providing device. The processor is further configured to send instructions to the insulin providing device to provide the user with insulin in the amount of the insulin dosage, after the insulin dosage has been calculated. In one embodiment, the insulin providing device is an insulin pen. In an alternative embodiment, the insulin providing device is an insulin pump.
[0008] According to various aspects of the present invention, there is provided a computer-implemented method for determining an insulin dosage to provide to a user. The method includes receiving glucose monitoring data from a glucose sensor, wherein the glucose sensor is configured to gather glucose monitoring data from the user. The method also includes receiving mealtime data associated with a meal from a user device and determining based on the mealtime data whether the meal is a high fat meal. If the meal is determined to be a high fat meal, the method includes determining a fat ratio using a multi-agent reinforcement learning module and calculating the insulin dosage using the glucose monitoring data, mealtime data and the fat ratio. If the meal is determined not to be a high fat meal, the method includes calculating the insulin dosage using the glucose monitoring data and mealtime data. In one embodiment, the method further includes, prior to the step of the processor determining based on the mealtime data whether the meal was considered a high fat meal, determining based on the mealtime data whether the user plans to perform postprandial exercise. The method further includes determining an exercise ratio using the multi-agent reinforcement learning module and calculating the insulin dosage using the glucose monitoring data, mealtime data and the exercise ratio. In another embodiment, the postprandial exercise is exercise occurring within four hours after the meal. In yet another embodiment, the method includes, prior to determining an exercise ratio, determining if the postprandial exercise is occurring within ninety minutes after the meal. In yet another embodiment, the multi-agent reinforcement learning module is configured to access a log database. The log database includes historical insulin dosages provided to the user, and the associated glucose monitoring data. In one embodiment, the high fat meal is a meal with over 20 grams of fat. In another embodiment, the mealtime data associated with a meal includes the amount of carbohydrates consumed during the meal. In yet another embodiment, the method includes providing an insulin providing device. The method further includes sending instructions to the insulin providing device to provide the user with insulin in the amount of the insulin dosage, after the insulin dosage has been calculated. In yet another embodiment, the insulin providing device is an insulin pen. In an alternative embodiment, the insulin providing device is an insulin pump. According to various aspects of the present invention, there is provided a system for determining an insulin dosage to provide to a user. The system includes a communications interface connected to a network, wherein the communications interface is configured to receive data from one user device. The system also includes a memory storage unit. The system further includes a processor connected to the communications interface and the memory storage unit. The processor is configured to receive glucose monitoring data from a glucose sensor, wherein the glucose sensor is configured to gather glucose monitoring data from the user. The processor is further configured to receive mealtime data associated with a meal and determine based on the mealtime data whether the user plans to perform postprandial exercise. If the user plans to perform postprandial exercise, the processor is further configured to determine an exercise ratio using the multi-agent reinforcement learning modules, and calculate the insulin dosage using the glucose monitoring data, mealtime data and the exercise ratio. If the user does not plan to perform postprandial exercise, the processor is further configured to calculate the insulin dosage using the glucose monitoring data and mealtime data. In one embodiment, the postprandial exercise is exercise occurring within four hours after the meal. In yet another embodiment, the processor is further configured to, prior to determining an exercise ratio, determine if the postprandial exercise is occurring within ninety minutes after the meal. In another embodiment, the memory storage unit includes a log database of historical insulin dosages provided to the user, and the associated glucose monitoring data. In yet another embodiment, the log database is configured to be used by the multi-agent reinforcement module. In one embodiment, mealtime data associated with a meal includes the amount of carbohydrates consumed during the meal. In another embodiment, the system includes an insulin providing device. The processor is further configured to send instructions to the insulin providing device to provide the user with insulin in the amount of the insulin dosage, after the insulin dosage has been calculated. In one embodiment, the insulin providing device is an insulin pen. In an alternative embodiment, the insulin providing device is an insulin pump. According to various aspects of the present invention, there is provided a computer-implemented method for determining an insulin dosage to provide to a user. The method includes receiving glucose monitoring data from a glucose sensor, wherein the glucose sensor is configured to gather glucose monitoring data from the user. The method also includes receiving mealtime data associated with a meal from a user device and determining based on the mealtime data whether the user plans to perform postprandial exercise. If the user plans to perform postprandial exercise, the method includes determining an exercise ratio using the multi-agent reinforcement learning module and calculating the insulin dosage using the glucose monitoring data, mealtime data and the exercise ratio. If the user does not plan to perform postprandial exercise, the method includes calculating the insulin dosage using the glucose monitoring data and mealtime data. In another embodiment, the postprandial exercise is exercise occurring within four hours after the meal. In yet another embodiment, the method includes, prior to determining an exercise ratio, determining if the postprandial exercise is occurring within ninety minutes after the meal. In yet another embodiment, the multi-agent reinforcement learning module is configured to access a log database. The log database includes historical insulin dosages provided to the user, and the associated glucose monitoring data. In another embodiment, the mealtime data associated with a meal includes the amount of carbohydrates consumed during the meal. In yet another embodiment, the method includes providing an insulin providing device. The method further includes sending instructions to the insulin providing device to provide the user with insulin in the amount of the insulin dosage, after the insulin dosage has been calculated. In yet another embodiment, the insulin providing device is an insulin pen. In an alternative embodiment, the insulin providing device is an insulin pump. BRIEF DESCRIPTION OF THE DRAWINGS For a better understanding of the present technology, as well as other aspects and further features thereof, reference is made to the following description which is to be used in conjunction with the accompanying drawings, where: FIG.1 is a schematic diagram depicting an embodiment of a system for determining insulin dosage for an individual with type 1 diabetes who may ingest a high fat meal and / or perform exercise after said meal; FIG.2 is schematic diagram depicting an embodiment of a server including a glucose sensor monitoring database from the system in FIG.1; FIG.3 is a schematic diagram depicting an embodiment of a user device from the system in FIG.1; FIG.4 is a schematic diagram depicting an alternate embodiment of a system for determining insulin dosage for an individual with type 1 diabetes who may ingest a high fat meal and / or perform exercise after said meal; FIG.5 is a flowchart depicting an embodiment of a method for determining insulin dosage for an individual with type 1 diabetes with the example system of FIG. 1; FIG.6 depicts example graphical user interfaces of the user device of system of FIG.1; FIG.7 is a chart illustrating postprandial incremental glucose over time after high fat overall meals; FIG.8 is a chart illustrating postprandial incremental glucose over time after breakfast meals; FIG.9 is a chart illustrating postprandial incremental glucose over time after lunch meals; FIG.10 is a chart illustrating postprandial incremental glucose over time after dinner meals; FIG.11 is a chart illustrating weekly five (5) hour postprandial incremental area under the glucose levels curve (Mean ± standard error) after high fat meals; FIG.12 is a series of charts illustrating the percentage change in mealtime (e.g. breakfast, lunch or dinner) upfront fat ratio (FR) and later FR throughout a 16 week study duration; FIG.13 is a chart illustrating postprandial incremental glucose over time due to postprandial aerobic exercise after overall meals; FIG.14 is a chart illustrating postprandial incremental glucose over time due to postprandial aerobic exercise after breakfast meals; FIG.15 is a chart illustrating postprandial incremental glucose over time due to postprandial aerobic exercise after lunch meals; FIG.16 is a chart illustrating postprandial incremental glucose over time due to postprandial aerobic exercise after dinner meals; FIG.17 is a chart illustrating weekly five (5) hour postprandial incremental area under the glucose levels curve (Mean ± standard error) after meals followed by exercise; FIG.18 is a series of charts illustrating the individual changes in exercises ratios (ER) throughout a 16 week study duration; and FIG. 19 is a series of charts illustrating the individual changes in the carbohydrate ratios at mealtime (e.g. breakfast, lunch or dinner) and basal throughout a 16 week study duration. DETAILED DESCRIPTION The examples and conditional language recited herein are principally intended to aid the reader in understanding the principles of the present technology and not to limit its scope to such specifically recited examples and conditions. It will be appreciated that those skilled in the art may devise various arrangements which, although not explicitly described or shown herein, nonetheless embody the principles of the present technology and are included within its spirit and scope. Furthermore, as an aid to understanding, the following description may describe relatively simplified implementations of the present technology. As persons skilled in the art would understand, various implementations of the present technology may be of a greater complexity. In some cases, what are believed to be helpful examples of modifications to the present technology may also be set forth. This is done merely as an aid to understanding, and, again, not to define the scope or set forth the bounds of the present technology. These modifications are not an exhaustive list, and a person skilled in the art may make other modifications while nonetheless remaining within the scope of the present technology. Further, where no examples of modifications have been set forth, it should not be interpreted that no modifications are possible and / or that what is described is the sole manner of implementing that element of the present technology. Modifications and improvements to the above-described implementations of the present technology may become apparent to those skilled in the art. The foregoing description is intended to be exemplary rather than limiting. Several strategies have been proposed to prevent exercise induced hypoglycemia in type 1 diabetes, including reduction of premeal insulin bolus for postprandial exercise, and ingestion of carbohydrates prior to fasting exercise. These strategies were implemented in consensus guidelines and were also tailored to the types, timing, duration, and intensity of exercise. However, these strategies are population- based and executing them in practice remain a challenge due to the large inter- and intra-individual variability in the glycemic responses to exercise. System 100 is an advanced decision support system which contains two algorithms: (i) a multi-agent reinforcement learning algorithm that adjusts doses for high fat meals and provides sports-specific meal insulin bolus reductions to control postprandial aerobic exercise events, and (ii) a single-agent reinforcement learning algorithm that adjusts carbohydrate ratios (CR), and long-acting basal insulin. System 100 was assessed in a single-arm 16-week first outpatient study in 15 adults with type 1 diabetes undergoing sensor-augmented MDI therapy. System 100 includes server 104 in communication over network 136 with external server 120, glucose sensor 124, user device 128 and insulin providing device 132. Glucose sensor 124 may collect user glucose data and send the data to external server 120. Server 104 may retrieve the data from external server 120. User data is also collected on user device 128 and sent to server 104. Through a combination of calculations and reinforcement learning, server 104 provides directions as to the dosage amount, the dosage injection timing, and the number of overall injections (collectively hereinafter referred to as the “dosage protocol”) for providing insulin to the user. The dosage protocol may then be provided to insulin providing device 132, which may administer to the user the dosage protocol. FIG.1 depicts system 100 for determining dosage protocol for a user who may ingest a high fat meal and / or perform exercise after a meal. Specifically, server 104 of system 100 communicates with external server 120, glucose sensor 124, user device 128 and insulin providing device 132 via network 136. Components of system 100 will be discussed further in detail below. More specifically, server 104 is where user accounts may be created and stored, data pertaining to mealtime, including, but not limited to the amount of carbohydrates in the meal and whether the meal is considered a high fat meal, is received, data pertaining to whether postprandial exercise will be conducted by the user is received, and where the dosage protocols are calculated using reinforcement learning. Server 104 includes a processor 112 interconnecting a memory 116 and a communications interface 108. The processor can include a central-processing unit (CPU), a graphics processing unit (GPU), a microcontroller, a microprocessor, a processing core, a field-programmable gate array (FPGA), or similar. In some embodiments, the processor 112 can include multiple cooperating processors. The processor 112 can cooperate with non-transitory computer readable medium, such as the memory 116 to execute instructions to realize the functionality discussed herein. Memory 116 can include a combination of volatile memory (e.g. Random Access Memory or RAM) and non-volatile memory (e.g. non-volatile random-access memory, read only memory or ROM, Electrically Erasable Programmable Read Only memory or EEPROM, flash memory). All or some of the memory 116 can be integrated with processor 112. Memory 116 stores computer reasonable instructions for execution by processor 112. It will now be apparent that each element of memory 116 can be carried out by the processor 112 executing operations. In other words, functionality described below as being carried out by a module of memory 116 or a module of server 104 can be based on any known server environment or computer environment. In some embodiments, memory 116 stores a plurality of computer-readable data and programming instructions, accessible by processor 112, in the form of software objects, such as various applications, queries or types of data for use during the execution of those applications. In particular, the execution of the instructions in memory 116 by processor 112 allow for the creation of user accounts, providing a graphical user interface to receive user inputs pertaining to mealtime, and calculating dosage protocols using algorithms and reinforcement learning modules. A person skilled in the art will recognize the various forms of computer readable programming instructions stored in memory 116 that be executed by processor 112 as applications or queries. In at least some embodiments, memory 116 stores history database 156. History database 156 includes records associated with the user including, but not limited to, inputs provided by a user and variables attributed to the calculation of insulin dosages. For example, variables attributed to the calculation of insulin dosages may include, but is not limited to, the type of calculation performed, the blood glucose levels at the time of calculation, the target glucose level, the amount of carbohydrates in a meal, the type of meal, the carbohydrate ratio, and the correction factor. In the current embodiment, the type of calculation performed may specify the type of formula or algorithm used to calculate the dosage protocol. Each type of formula or algorithm may include different variables. The type of calculation may be influenced by the inputs provided by the user, which will then determine the type of calculation performed, which in turn affects the selection of variables stored in history database 156. The different types of calculation will be further discussed below. History database 156 may further include an array of historical values at different time steps for use in the reinforcement learning modules. Specifically, history database 156 may include observations, actions and rewards at different time steps. In an alternative embodiment, history database 156 may include states at different time steps for a Markov Decision Process. In yet another embodiment, history database 156 may include other variables or historical values at different time steps for the purposes of determining next actions or calculating rewards. A person skilled in the art will recognize the different variables or values that may be stored for each time step for different forms of reinforcement learning. In at least some embodiments, memory 116 stores input module 140 (also referred to herein as user input module 140). In a preferred embodiment, user input module 140 is accessed from user device 128. The execution of user input module 140 allows for the user to input and provide variables associated with mealtime and also whether or not the user intends to conduct postprandial exercise. The user input module 140 provides a graphical user interface, depicted with example screenshots 604, 608, 612 and 616 in FIG.6, for the user to enter information pertaining to the meal, and to display the recommended dosage protocol for the user. A person skilled in the art will recognize the different functions of user input module 140. In at least some embodiments, memory 116 stores bolus calculator module 144. In a preferred embodiment, bolus calculator module 144 determines the type of calculation to be performed based on the data received from the user device 128 in user input module 140, and then performs the calculation of the dosage protocol. In the current embodiment, there are four (4) types of calculation that may be performed: (i) a standard non high fat algorithm; (ii) a high fat algorithm; (iii) a postprandial exercise occurring within ninety (90) minutes algorithm; and (iv) a postprandial exercise occurring after ninety (90) minutes algorithm. Each of these four (4) types of calculation that may be performed will be further described below. The standard non high fat algorithm is selected by bolus calculator module 144 when the meal is not a high fat meal, and when there is no postprandial exercise. Specifically, the standard non high fat algorithm is provided as Equation 1 as follows: ^^ =^ுை+ீ^ିீ^− ^^ ^^ ^^ Variables of Equation 1 include B as the dosage amount of insulin to provide to the user. A person skilled in the art will recognize that the dosage amount of insulin may be provided to insulin provider device 132 either manually or automatically via network 136. Equation 1 also includes G୫as the blood glucose level (mmol / L) as taken from the glucose sensor 124 at mealtime, G^as the target glucose level (mmol / L) as set by a physician or by the user, CHO as the amount of carbohydrates in the meal (g) as input by the user in input module 140, CR as a carbohydrate ratio which defines how many grams of carbohydrate are covered by 1 unit of insulin (and is typically different for breakfast, lunch, and dinner) and is calculated using a single agent reinforcement learning module 148, CF as a correction factor that defines how much 1 unit of insulin is expected to lower glucose levels as provided by a physician, and IOB as the insulin- on-board that is still working from previous insulin doses as may be taken from readings or sensors from the insulin provider device 132. A person skilled in the art will recognize that the variables of Equation 1 are not limited to being received by server 104 via the above-mentioned sources, and other sources for the variables may be contemplated. For example, there are other ways of calculating CR, or alternatively, CR may be a manual input through input module 140. The high fat algorithm is selected by bolus calculator module 144 when the meal is a high fat meal, and when there is no postprandial exercise. A high fat meal is defined as any meal greater than or equal to 20 grams of fat (i.e. if fat is ≥ 20g). Specifically, the standard high fat algorithm is provided as Equations 2 and 3 as follows, where Equation 2 provides an upfront insulin dosage U^and Equation 3 provides a later insulin dosage L^: U^= ^^ ^^ ^^ ^^ ^^ (1 + F௨) + ^^^− ^^்^^ ^^ − ^^ ^^ ^^ (2) (3) Variables in Equation 1 with, the addition of the fat ratios F௨and F^. The fat ratios are different for each main meal for the upfront and later boluses, respectively, and are provided by the Multi-agent Reinforcement Learning Module 152. Upfront insulin dosage U^is administered to the user in proximity to mealtime (during or immediately after mealtime) whereas later insulin dosage L^is administered to the user approximately two (2) hours after mealtime. The high fat effect from a meal typically starts appearing after ninety (90) minutes, and as such, a two (2) hour time frame after mealtime is clinically appropriate to administer a later insulin dosage. The postprandial exercise occurring within ninety (90) minutes of mealtime algorithm is selected by bolus calculator module 144 when there is postprandial exercise occurring within ninety (90) minutes of mealtime, regardless of whether the meal is considered a high fat meal or not. In the current embodiment, postprandial exercise is a postprandial aerobic exercise, however, a person skilled in the art will recognize that postprandial exercise may be exercise of any type such as but not limited to strength-training, and flexibility. Specifically, the postprandial exercise occurring within ninety (90) minutes of mealtime algorithm which provides the amount of upfront insulin dosage Uw90to be provided to the user during or after mealtime if the user is planning to perform postprandial exercise within ninety (90) minutes is provided as Equation 4 as follows: U௪ଽ^= ^^ ^^ ^^ ^^^− ^^்^^ ^^ (1 − ^^௪ଽ^) + ^^ ^^− ^^ ^^ ^^(4)Variables 1, 2 and 3 with, the addition of variable ^^௪ଽ^as the exercise specific ratio (different for distinct exercises and for each main meal) for exercises occurring within ninety (90) mins of mealtime adjusted by the multi-agent reinforcement learning algorithm. Exercises that are considered in the current embodiment are exercises that reduce glucose levels (such as mild or moderate aerobic exercises). The postprandial exercise occurring later than ninety (90) minutes of mealtime algorithm is selected by bolus calculator module 144 when there is postprandial exercise occurring later than ninety (90) minutes of mealtime, regardless of whether the meal is considered a high fat meal or not. In the current embodiment, the definition of postprandial exercise is exercise within four (4) hours after a meal. As such, postprandial exercise occurring later than ninety (90) minutes of mealtime is exercise occurring between ninety (90) minutes after a meal and four (4) hours after a meal. Similar to postprandial exercise occurring within ninety (90) minutes, in the current embodiment, the postprandial exercise is a postprandial aerobic exercise, however, a person skilled in the art will recognize that postprandial exercise may be exercise of any type such as but not limited to strength-training, and flexibility. Specifically, the postprandial exercise occurring later than ninety (90) minutes of mealtime algorithm which provides the amount of upfront insulin dosage UL90to be provided to the user during or after mealtime if the user is planning to perform postprandial exercise later than ninety (90) minutes is provided as Equation 5 as follows: ^^^ଽ^= ^^ ^^ ^^ ^^^− ^^்^^ ^ (1 − ^^^ଽ^) +− ^^ ^^ ^^(5)^ ^^ ^^ Variables 1, 2, 3 and 4 with, the addition of variable ^^^ଽ^as the exercise specific ratio (different for distinct exercises and for each main meal) for exercises occurring later than ninety (90) mins of mealtime adjusted by the multi-agent reinforcement learning algorithm. Similar to Equation 4, exercises that are considered in the current embodiment are exercises that reduce glucose levels (such as mild or moderate aerobic exercises). A person skilled in the art will recognize that bolus calculator module 144 is not limited to selecting the four (4) types of calculations, and that other algorithms may be contemplated based on different user inputs through user input module 140. In at least some embodiments, memory 116 stores single agent reinforcement learning module 148. In a preferred embodiment, single agent reinforcement learning module 148 determines CR for aforementioned equations 1 to 5. In the current embodiment, a discrete Markov decision process is used to determine CR. Specifically, in using a discrete Markov decision process ( ^^, ^^, ^^, ^^, γ), the variables include state space S (CR values), action space A (adjustment in CR values), transition dynamics ^^( ^^^ା^| ^^^, ^^^), reward ^^ (improvement in glycemic outcomes), and a discount factor γ. The Markov decision process is known to a person skilled in the art. In at least some embodiments, memory 116 stores multi-agent reinforcement learning module 152. In a preferred embodiment, multi-agent reinforcement module 152 determines the fat ratios and exercise ratios for equations 2, 3, 4, and 5. In the current embodiment, a discrete Markov decision process is used to determine fat ratios F௨and F^and exercise specific ratios ^^௪ଽ^and ^^^ଽ^. A single agent reinforcement algorithm is inefficient due to data scarcity per each main meal in real world settings. For example, some users may eat lunch and dinner more often than breakfast. As such, there may be more historical data on glucose levels associated with lunch and dinner than with breakfast. Furthermore, each main meal has different characteristics and factors that may lead to requiring different amounts of insulin. For example, high fat meals may more likely occur at lunch and dinner than at breakfast. In another example, it may also be more likely that a user exercises after dinner instead of after lunch. As such, to ensure both efficiency and also accuracy of calculation, a multi- agent reinforcement learning algorithm is used, where the environment consists of three agents for high fat meals, specifically, one agent for breakfast, one agent for lunch and one agent for dinner, and six agents for postprandial aerobic exercises (2 per each meal). More specifically, the six agents for postprandial aerobic exercises included at least one agent for exercises within ninety (90) minutes of breakfast; one agent for exercises within ninety (90) minutes of lunch; one agent for exercises within ninety (90) minutes of dinner; one agent for exercises later than ninety (90) minutes after breakfast; one agent for exercises later than ninety (90) minutes after lunch; and one agent for exercises later than ninety (90) minutes after dinner. As such, each user has nine (9) agents, one for each of the above-mentioned use cases. Each agent while separate for each use case of a type of high fat meal and for each type of meal with each type of postprandial exercise has an agent per meal for accuracy, however, each agent may also share learning depending on the amount of historical data from history database 156 that is available for said use case. This will be further discussed below. At any mealtime, there will be one agent that interacts with the environment using the action policy evaluated by a global Q-value function. The global Q-value function for a multi-agent reinforcement learning algorithm will be further discussed below. In the current embodiment, the multi-agent reinforcement learning module 152 begins with a single agent reinforcement learning algorithm. A discrete Markov decision process ( ^^, ^^, ^^, ^^, γ) is provided, with state space ^^ (physiological state), action space ^^ (insulin adjustments), transition dynamics ^^( ^^^ା^| ^^^, ^^^), reward ^^ (improvement in glycemic outcomes), and a discount factor γ. The agent (the user) in the environment receives a reward ^^^( ^^^, ^^^, ^^^ା^) ^^ℝ by taking an action ^^^in a state ^^^and reaching at a state ^^^ା^, where k denotes a discrete timestep and k+1 denotes the next incremental discrete time step. The goal of the agent is to maximize the accumulated reward: ^^^=∑^^ୀ^γ^ି^^^^( ^^^, ^^^, ^^^ା^) (6) ^^^గ: ^^ → ℝ under a policy ^^, where J can be defined as the expected return in the future time interval ^^ when the policy ^^ is followed: ^^^గ(^^^)= ^^గ^∑^^ୀା^்γ^ି^^^^| ^^ = ^^^൧ (7) The optimal . Alternatively, the optimal policy ^^∗for the state-action pair ( ^^^, ^^^) can be found using the optimal action-value function, where Q denotes action-value function.: ^^^∗( ^^^, ^^^) = ∑^ೖశభఢௌ^^ ^ ^ೖೖ^ೖశభ[ ^^^+ γ m^a ೠx ^^^∗( ^^^ା^)] (8) solving the Bellman optimality equation: ^^^ା^( ^^^, ^^^) = ^^^( ^^^, ^^^) + ^^[ ^^^+ γ m^aೠx ^^^( ^^^ା^, ^^௨) − ^^^( ^^^, ^^^)] (9) a it is assumed that each agent j receives its own reward ^^^^based on its individual action ^^^^in a state ^^^^using a global Q-value function (weighted average Q-values of all agents). More specifically, the Q-value of each agent j can be updated as: ^^^^ା^ ൫^^^^, ^^^^൯= ^^^^൫^^^^, ^^^^൯+ ^^[ ^^^^ା^+ఊே ma ೕx ^^^ீ൫^^^^ା^, ^^௨^൯− ^^^^൫^^^^, ^^^^ ൯](10) where N equals the number of agents. The global Q-value ^^^ீ൫ ^^^^, ^^௨^൯ is the weighted sum of all agents’ Q-values as follows: ே ^^^ீ( ^^^^, ^^^^) =^^^^൫^^^^, ^^^^൯^^^^൫^^^^, ^^^^൯(11) where the weight ^^^for as a agent to use. For example, an agent for high fat breakfast may not have enough historical data and as such may need to use data from agents from the other meal types. In the current embodiment, the weight ^^^for each agent j is defined as: ^^^൫ ^^^^, ^^^^൯ = c c times the agent j visited the state-action pair ( ^^^^, ^^^^), ^^ ^^ ^^ ^^^( ^^^^, ^^^^) is a counter that increments by 0.2 when the agent j visits the state-action pair ( ^^^^, ^^^^) and ^^( ^^^^, ^^^^) is the relative experience of agent j at the state-action pair ( ^^^^, ^^^^) calculated by dividing the total number of visits of agent j by the total number of visits by other agents to the state-action pair ( ^^^^, ^^^^) as follow: ^^ ^^ ^^^ ^ ^^^ ^^ ^^ ^^ ^^^^^^= ൫ ^^^, ^^^൯ As an example of the above weight ^^^for each agent j, if agent j was the agent for high fat breakfast, and if there were fewer than four (4) counts of previous breakfasts, then the agent for high fat breakfast would rely on using the higher of either data from the agent for high fat lunch or the agent for high fat dinner. If there were between four (4) to eight (8) counts of previous breakfasts, then the weight applied to breakfast data would be calculated using the below formula taken from Equation 12: ^^ ^^ ^ ^^1 + ^^ ^^ ^^ ^^^൫ ^^^^, ^^^^൯^ ^ ^^ ^^ ^^ ൫ ^^^, ^^^൯ ^^ ^^ ^^ ^^ ൯ (8) counts of previous breakfasts, then the weight applied to lunch and dinner data (as shared from different agents), would be calculated using the below formula taken from Equation 12: ^^൫ ^^^, ^^^൯൫2 − ^^ ^^ ^^ ^^ ^^^, ^^^)൯ ^^ ^ ^^ ^ ^(^ ^^ ^^ ^^ ^^ ^^ ( ^^^, ^^^) ) As previous breakfast data, the agent j for breakfast data would learn from the data from lunch and dinner provided by different agents, effectively providing a shared data source for learning if there is not enough data for a particular use case for a user. Similarly, if there is enough breakfast data for agent j (more than 8 breakfast data points), the weight ^^^may use the below formula from Equation 12 which indicates that the agent j may rely on all historical breakfast data points and none of the points from the other agents for different mealtimes: 1 ∀ ^^ = c, 0 ∀ ^^ ≠ c The above global Q-value in equation 11 is then used in the individual agent’s Q-value as an action-value function (equation 10) for the determination of fat ratios F௨and F^and exercise specific ratios ^^௪ଽ^and ^^^ଽ^, while rewards are fed back into the equation to further optimize the global Q-value and also individual agent’s Q- value. This will be further discussed below as part of method 500. Turning now to communications interface 108, it allows for processor 112 to communicate with network 136. Communications interface 108 includes suitable hardware (e.g. transmitters, receivers, network interface controllers and the like) allowing server 104 to communicate with other components in system 100, such as external server 120, glucose sensor 124, user device 128 and insulin provider device 132. The specific components of communications interface 108 may be selected based on the type of network or other links server 104 may be required to communicate over. Server 104 may also include input devices that connect to processor 112, such as a keyboard and mouse, as well as output devices, such as a display. Alternatively, or in addition, the input and output devices can be connected to processor 112 via communications interface 108 via another computer device. In other words, input and output devices can be local to server 104 or remote. In the preferred embodiment, network 136 is a wide area network (WAN) but a person skilled in the art will recognize that network 136 is not particularly limited in its configuration. Network 136 may be any form of network, including a local area network (LAN), or the Internet, and may be accessed by computers, mobile devices or the components of system 100. Computers, such as server 104, external server 120, glucose sensor 124, user device 128 and insulin provider device 132 can operate in a networked environment using logical connections to one or more remote computers or other devices, such as a server, a router, a network personal computer, a personal computer, a peer device or other common network node, a wireless telephone or wireless personal digital assistant. In the current embodiment, network 136 may be implemented over the Internet. The standards or protocols used for the network may include any form of transmission, such as Transmission Control Protocol / Internet Protocol (TCP / IP), User Datagram Protocol / Internet Protocol (UDP / IP), Hyper Text Markup Language (HTML) and Hyper Text Transfer Protocol (HTTP). In addition, any desired levels and types of security and encryption protocols are contemplated and can be implemented over network 136. A person skilled in the art will recognize the different potential network types and different potential network configurations that may be used, along with the different standards and protocols of transmission within the network, and the different forms of security and encryption protocols available. Furthermore, as the data being transmitted between components of system 100, including between server 104, external server 120, glucose sensor 124, user device 128 and insulin provider device 132 may be considered sensitive personal information and real-time location data, industry standards for encryption in flight and encryption at rest may be applied or used. In a preferred embodiment, communication between the components of system 100 occur over network 136. Specifically, communication between any one of the external server 120, glucose sensor 124, user device 128 and insulin provider device 132 or other instructions to be executed by processor 112, with any one of the other components of system 100 external to server 104, communicate using communications interface 108 over network 136. As an example, in the current embodiment, glucose sensor 124 uploads all glucose monitoring data to external server 120, the glucose monitoring data is then retrieved by processor 112 via communications interface 108 over network 136. User input data is also sent from user device 128 to processor 112 via communications interface 108 over network 136. User device 128 then receives a recommended dosage protocol over network 136, upon which the dosage protocol may be sent automatically to an insulin provider device 132 to be administered to the user. A person skilled in the art will recognize the other potential functions or instructions provided to processor 112 that may use communications interface 108 and network 136. Referring to FIG.2, external server 120 may be a computer device such as, but not limited to, a desktop computer, a laptop computer, another server, a kiosk, a cell phone, a tablet, a mobile device, a monitor or other suitable device. In a preferred embodiment, external server 120 is a server. A person skilled in the art will also appreciate that other, different configurations of external server 120 are contemplated. It will also occur to a person skilled in the art that system 100 may include more than one external server 120. External server 120 may include input devices and output devices. In the present embodiment, external server 120 may include a display that outputs graphical user interfaces. External server 120 further includes glucose log database 220. In the current embodiment, glucose log database 220 records glucose monitoring data received from glucose sensor 124 over time and may also include a graphical user interface for interaction with the glucose monitoring data. In a preferred embodiment, the glucose log database 220 may be part of third party diabetes management systems, such as LibreView. A person skilled in the art will recognize the different glucose log databases or glucose monitoring systems contemplated. Returning to FIG. 1, system 100 further includes glucose sensor 124. Glucose sensor 124 monitors the amount of glucose in a user’s body. In the current embodiment, the glucose sensor 124 may be a freestyle libre 2 The glucose monitoring data collected by glucose sensor 124 may be sent to external server 120 to be stored in glucose log database 220. Glucose monitoring data may be sent over network 136 to external server 120. In alternative embodiments, glucose monitoring data may be sent wirelessly over Bluetooth or other means of communication to be stored in glucose log database 220. A person skilled in the art will recognize the different types of glucose sensors 124 contemplated, and will also recognize the different methods of providing glucose monitoring data to glucose log database 220 that are contemplated. A person skilled in the art will also recognize that multiple glucose sensors 124 maybe connected to components of system 100. User device 128 may be a computer device such as, but not limited to a desktop computer, a laptop computer, a server, a kiosk, a cell phone, a tablet, a mobile device, a monitor or other suitable device. In a preferred embodiment, user device 128 is a mobile device. A person skilled in the art will also appreciate that other, different configurations of user device 128 are contemplated. It will also occur to a person skilled in the art that system 100 may include more than one user device 128. User device 128 may include input devices and output devices. In the present embodiment, user device 128 that outputs graphical user interfaces. Specifically, user device 128 may receive graphical interfaces to display from input module 140. Referring to FIG.3, an alternate embodiment of user device 128 is depicted where local input application 320 is local on user device 128. In this embodiment, user device 128 includes processor 312, interconnecting memory 316 and communications interface 308. Communications Interface 308 is connected to network 136 to communicate with server 104 and other components or devices of system 100. Processor 312, memory 316 and communications interface 308 are similar to processor 112, memory 116 and communications interface 108 in function, configuration, arrangement, variations and embodiments, however, memory 316 does not include the modules and databases stored in memory 116. Rather, memory 316 stores local input application 320. When executed by processor 312, local input application 320 provides a graphical user interface depicted with example screenshots in FIG.6, which provides similar functions of previously described input module 140. However, data that is input via local input application 320 is sent to server 104 via communications interface 308 for processing, and data may also be received via communications interface 308 from server 104 to be displayed on the graphical interface of local input application 320. More specifically, in FIG.1 system 100 depicts an example embodiment where the graphical user interface may be provided by server 104 through a browser or other means of providing display information from server 104 to user device 128. In an alternative embodiment, the graphical user interface may be provided as a web application. In yet another alternative embodiment of FIG. 3, the graphical user interface may be local on user device 128, where information is transmitted between server 104 and user device 128 through a secure connection or via an Application Programming Interface (API). Additionally, in yet another embodiment, also depicted in FIG.3, memory 316 may include insulin provider device application 324. In a preferred embodiment, insulin provider device application 324 may provide instructions to insulin provider device 132. For example, once a dosage protocol has been determined / calculated, instructions for the dosage amount and the dosage injection time may be provided from server 104 to insulin provider device application 324 in user device 128. The instructions may then be relayed from insulin provider device application 324 to insulin provider device 132 for administration of the correct dosage protocol to the user. In alternate embodiments, where insulin provider device application 324 is not present, the dosage protocol may be manually set on insulin provider device 132. For example, an insulin pen that is not wirelessly connected may be manually adjusted to administer a dosage to the user. A person skilled in the art will recognize the different methods contemplated in providing instructions to various insulin provider devices 132. Returning to FIG.1, system 100 may also include insulin provider device 132. Insulin provider device 132 may be any form of device that can administer insulin to a user, including, but not limited to, insulin pens and insulin pumps. In the current embodiment, insulin provider device 132 may be connected to server 104 to receive instructions via network 136. In an alternative embodiment, insulin provider device 132 may be connected to user device 128 either via network 136 or via other wireless means such as Bluetooth, to receive instructions. In yet another alternative embodiment, insulin provider device 132 may not be digitally connected to the components of system 100, and is instead a non-connected device that a user may operate to manually administer insulin to themselves. A person skilled in the art will recognize that different types of insulin provider devices 132 and different method of connecting insulin provider device 132 to components of system 100 are contemplated. A person skilled in the art will also recognize that more than one insulin provider device 132 may be connected to system 100. Referring to FIG.4, data flow diagram 100A depicts the flow of data in system 100. In the current embodiment, the inputs of mealtime, carbohydrate, high fat information, anticipated postprandial exercise type and timing, and mealtime glucose value and trend are provided by the user through a graphical user interface on user device 128 via input module 140. CR and Basal are calculated using single agent reinforcement learning module 148 which resides on server 104. Fat and exercise ratios are calculated using multi-agent reinforcement learning module 152 which resides on server 104. Glucose sensor data provided from glucose sensor 124 is downloaded and received by user device 128 via an external server 120. Once the bolus is calculated, it is then administered via insulin provider device 132 to the user (diabetes patient). A person skilled in the art will recognize that different arrangements and configurations of data flow in the layout of components of system 100 may be contemplated. Referring to FIG. 5, a method for server 104 to determine the dosage protocol for insulin is provided. At block 505, glucose monitoring data is received by server 104 from glucose sensor 124. In the current embodiment of system 100, glucose monitoring data collected glucose sensor 124 is uploaded to glucose log database 220 on external server 120. The glucose monitoring data may then be retrieved from glucose log database 220 via server 104 via network 136 through different means, including, but not limited to, using an API, a query or a data import tool. At block 510, server 104 receives mealtime details and exercise details from user device 128. In the current embodiment, input module 140 provides a graphical user interface to user device 128 to prompt a user for variables to be used in future calculations. Referring to FIG. 6, screenshots 604, 608, 612 and 616 are example screenshots of said graphical user interface. In screenshot 604, a user may be prompted to determine which insulin dosage calculator they may be interested in. The calculations associated with system 100 may be accessed via button 620 with the label “Meal Bolus”. In screenshot 608, a user may select at interface 624 what type of meal they are having / about to have. In the current embodiment, a user may select between four (4) different types of meals: breakfast; lunch; dinner; and bedtime. In alternate embodiments, the selection of meal types may be limited to breakfast, lunch and dinner. Each meal type is associated with an agent for the reinforcement learning modules 148 and 152. A person skilled in the art will recognize that additional meal types may be contemplated and accordingly agents for each of said meal types may also be contemplated. At text field 628, the blood glucose level may be entered. In the current embodiment, this field may be automatically entered based on glucose monitoring data from glucose sensor 124. At text field 632, the carbohydrates of the meal may be entered in grams. At selection 636, the user may select whether the meal is a high fat meal or not. As indicated previously, a high fat meal is a meal that includes more than 20 grams of fat. In screenshot 612, a user may select at interface 640 whether they anticipate exercising within the next four (4) hours after the meal. If the user selects yes, the user may be directed to interface 644 where the user may indicate whether the exercise will occur within ninety (90) minutes after the meal or later than ninety (90) minutes after the meal. At field 648, a user may select the type of exercise that they will be performing. Different exercises may provide different exercise ratios, and multi-agent reinforcement learning module 152 may compensate for different intensities of exercises based on the exercise type. Furthermore, different meal types (e.g. breakfast, lunch or dinner) may also provide different exercise ratios, and multi-agent reinforcement learning module 152 may also compensate for the different meal types. Once the user has completed entering the data, they may select the calculate button. Returning to FIG.5, at block 515, the CR is calculated using single agent reinforcement learning module 148. As discussed above, a Markov decision process may be used to determine the CR and basal insulin based on historical data from history database 156. At block 520, processor 112 of server 104 determines based on the data received from input module 140 whether postprandial exercise is being performed. As previously mentioned, postprandial exercise includes exercise that is performed within four (4) hours after a meal. If postprandial exercise is being performed, processor 112 then determines based on data received from input module 140 whether the postprandial exercise is occurring within ninety (90) minutes of mealtime. This is depicted at block 525. If postprandial exercise is being performed within ninety (90) minutes of mealtime, at block 530, the exercise specific ratio ^^௪ଽ^is calculated using multi-agent reinforcement learning module 152. Calculation of the exercise specific ratio ^^௪ଽ^will be discussed further below. At block 535, once the exercise specific ratio ^^௪ଽ^has been calculated, the insulin dosage for postprandial exercise within ninety (90) minutes may be calculated using equation 4 by bolus calculator module 144. If postprandial exercise is being performed later than ninety (90) minutes after mealtime, at block 540, the exercise specific ratio ^^^ଽ^is calculated using multi- agent reinforcement learning module 152. Calculation of the exercise specific ratio ^^^ଽ^will be discussed further below. At block 545, once the exercise specific ratio ^^^ଽ^has been calculated, the insulin dosage for postprandial exercise later than ninety (90) minutes may be calculated using equation 5 by bolus calculator module 144. Calculation of the exercise specific ratios ^^௪ଽand ^^^ଽ^is performed with the below definitions for the states, actions, and rewards for the multi-agent Q-learning algorithm as part of multi-agent reinforcement learning module 152 to be executed by processor 112. State space Each state vector is a vector of glucose related features. The state vector ^^^௪or ^^^^of each agent ^^ or ^^ (for postprandial aerobic exercise happening within 90 minutes or later than 90 minutes of mealtime) is composed of (i) the 5-hour postprandial percentage time spent with glucose levels below 3.9 mmol / L (hypoglycemia), ^^ ^^ ^^ ^^ ^^^௧, (ii) the postprandial error in glucose levels, ^^^௧, similar to (21), where the postprandial error reflects the performance, (iii) hypoglycemia treatments in the period 5-hour after meal, ℎ ^^ ^^ ^^ ^^ ^^^௧, and (iv) the rate of change of glucose levels in the 1-hour period following the minimum glucose level in the period 1 to 5-hour after meal, ^^ ^^ ^^^௧. For each agent t, the discretized state vector is defined as: ^^^^= { ^^^^| ^^^^ ^^ ^^ ^^=൫^^ ^^ ^^ ^^ ^^^௧,^, ^^^௧,^, ℎ ^^ ^^ ^^ ^^ ^^^௧,^, ^^ ^^ ^^^௧,^ ൯, ^^ ^^[1,2, … , ^^], ^^ ^^[1,2, … , ^^], ^^ ^^[1,2, … , ^^], (13) ^^ ^^^௧and ^^ ^^ ^^^௧, respectively. The superscripts t=w and t=l denotes the learning agents for postprandial aerobic exercises happening within and later than 90 minutes after meal, respectively. The goal state for the agent w may be defined as, ^^^௧, as ^^ ^^ ^^ ^^ ^^^௧= 0,|^^^௧|≤ 1.2 mmol / L, ℎ ^^ ^^ ^^ ^^ ^^^௧=0, and|^^ ^^ ^^^௧|≤ 0.02 ^^^^ ^ ^^^. actions at states ^^^^and ^^^^, respectively. For all states, the chosen action space ^^௪and ^^^is as follows: ^^௪( ^^^^) = { ^^௪|1, −1,0} (14) ^^^^^ = where 1, −1, 0 denote and ^^^^ଽ^values relative to previous day’s values. The mappings from the agents’ actions to ^^^௪ଽ^,^ା^and ^^^^ଽ^,^ା^changes are as follows: ^^^௪ଽ^,^ା^= ^^^௪ଽ^,^+ ^^௪^^^^^^௪ଽ^,^ (16)^^^(17) where ^^௪ increasing, decreasing, and unchanging ^^^௪ଽ^and ^^^௪ଽ^values relative to previous day’s values, respectively, and ^^^= |0.05| ^^^௧| − 0.05|. The values of ^^^௪ଽ^and ^^^௪ଽmay then be inserted as ^^௪ଽ^and ^^^ଽ^in equations 4 and 5, respectively. Reward Function After taking an action ^^^௧, the agent, the next day, receives a reward ^^^௧ା^as follows: ì10 ^^ห∆ாೖ^ห^^if ( ^^ ^^ ^^ ^^ ^^௧< ^^ ^^ ^^ ^^ ^^௧) & (| ^^௧| ≤ | ^^௧|) & ( ^^ ^^ ^^௧≤ ^^ ^^ ^^௧) ï^ା^ ^ ^ା^ ^ ^ା^ ^^^^^^= ^^^^^^ The agent receives a positive reward for its action if ^^ ^^ ^^ ^^ ^^^௧ା^, | ^^^௧ା^|, and ^^ ^^ ^^^௧ା^are dampened. If the action led to the goal state ^^^௧, then the agent receives a large positive reward. If the action did not lead to a change in the state and ^^ ^^ ^^ ^^ ^^^௧= 0, the agent receives a small positive reward. In all other cases, the agent receives a negative reward. The global Q-value in the multi-agent learning algorithm for postprandial aerobic exercise managemt with N=3 is calculated as follows: ே ே ^^ீ( ^^^௧, ^^^௧) = ^^^ ^^^௪( ^^^௪, ^^^௪) ^^௪( ^^^௪, ^^^௪) + ^^ଶ ^^^^൫^^^^, ^^^^൯^^^൫^^^^, ^^^^൯(19) where as: ௪(௪ ௪)^ ^ ^(20) [ ^^^^^ଶ] = [ ^^ ^^ ^^ ^^ ^^ ^^^, ^^^^^ ^^ ^^ ^^ ^^ ൫ ^^^, ^^^൯ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^] postprandial exercise occurring within ninety (90) minutes of mealtime or postprandial exercise occurring later than ninety (90) minutes of mealtime, processor 112 of server 104 may return to receiving data from the glucose sensor 124 at block 505 for the next mealtime calculation. Returning to block 520, if no postprandial exercise is being performed, processor 112 of server 104 determines based on the data received from input module 140 whether the meal is a high fat meal. This is depicted at block 550. If the meal is a high fat meal as determined at block 550, then at block 555, the fat ratios F௨and F^are calculated using multi-agent reinforcement learning module 152. Calculation of fat ratios F௨and F^is performed with the below definitions for the states, actions and rewards for the multi-agent Q-learning algorithm as part of multi-agent reinforcement learning module 152 to be executed by processor 112. State space The state vector ^^^^of each agent j for each main meal (breakfast, lunch, and dinner) is composed of (i) the 5-hour postprandial percentage time spent with glucose levels below 3.9 mmol / L, ^^ ^^ ^^ ^^^^, (ii) the ratio of postprandial incremental area under the glucose levels curve (iAUC) in the period 0 and 2-hour to the period 2 and 5-hour er meal, ^^^=^_ଶ^ೕ aft^ _^^^^ೖଶ_ହ^_^^^^ೕೖ, and (iii) the postprandial error in glucose levels defined as: ^^^^= ( ^^^^^( ^^) − ^^்) (21) where ^^^^^( ^^) is the minimum glucose level in the period 3-6 hours after the meal. For each agent j, the discretized state vector is defined as: ^^^^= { ^^^^| ^^^^ ^^ ^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ } (22) of ^^ ^^ ^^ ^^^^, ^^^^, and ^^^^, respectively. The choice of N, M, and O is a trade-off between the learning period and the accuracy. The goal state for the agent j may be defined as, ^^^^, as ^^ ^^ ^^ ^^^^= 0%,ห^^^^ห≤ 1.8, andห^^^^ห≤ 1.2 mmol / L. Action space Let ^^^( ^^^^) represents the set of possible actions at state ^^^^defined as: ^^^( ^^^^) = { ^^^|1,2,3,4,5,6} (23) The mapping^ ^ ^^௨^,^ା^= ^^௨^,^+ ^^^( ^^^) ^^^^^௨^,^(24) ^^^^,^ା^= ^^^^,^+ ^^ଶ( ^^^) ^^ଶ^^^^,^(25) where ^^^( ^^^) 1, −1 or 0, denote increasing, decreasing, and unchanging ^^௨^and ^^^^values relative to previous day’s values, respectively, and ^^^= ห0.05ห ^^^^ห − 0.05ห and ^^ଶ= ^.ଶ ^^௫(^ோೖೕ^,^.ଶ) are gain parameters for increasing or decreasing a proportionate the glucose related features as provided from clinical data and below. The mapping from the agent’s action ^^^to ^^^( ^^^) and ^^ଶ( ^^^) is given in Table 1. from agent’s action to the qualitative changes in fat ratios Action ^^^^Qualitative changes in upfront and later bolus ratios by ^^^^( ^^^^) and ^^^^( ^^^^) 1 ^^^( ^^^) = 0 and ^^ଶ( ^^^) = 0 2 ^^^( ^^^) = −1 and ^^ଶ( ^^^) = −1 0 For safety reason, and in the face of abnormal days, updates in ^^௨^and ^^^^values are restricted to be within ±15% of previous day’s values. Moreover, the algorithm modifies the later bolus based on the glucose value at 2 hours after the meal ^^^^ାଶ^as follows: ì 0 if ^^ ^ ^^^ ^^ ^^ ^^ ାଶ^≤ 6 ^^ As indicated in equation 26, for safety reasons, if the glucose value as detected by glucose sensor 124 is less than 6 mmol / L, then no insulin is provided despite the calculations provided by bolus calculator module 144. If the glucose value as detected by glucose sensor 124 is greater than 6 mmol / L less than and equal to 7 mmol / L, then only 50% of the calculated dosage from bolus calculator module 144 is provided as a later dosage. If the glucose value is above 7 mmol / L, then the full calculated dosage amount from bolus calculator module 144 is provided. Reward Function After taking an action ^^^^, the agent receives a reward ^^^^ା^as follows: ^^^^ା^=ì10 ^^ฬ∆ಶ ೕೖฬభబif ൫ห ^^^^ା^ห < ห ^^^^ห൯ & ൫ ^^ ^^ ^^ ^^^^ା^< ^^ ^^ ^^ ^^^^൯ & (ห ^^^^ା^ห ≤ ห ^^^^ห) where ^^ equals to 1 if ^^ ^^ ^^ ^^^^> 0 and equals to 2 otherwise. The agent receives a positive reward for its action if ห ^^^^ା^ห, ^^ ^^ ^^ ^^^^ା^, and ^^^^ା^are dampened. If the action led to the goal state ^^^^, then the agent receives a large positive reward. If the action did not lead to change in the state and ^^ ^^ ^^ ^^^^= 0, the agent receives a small positive reward. In all other cases, the agent receives a negative reward. More specifically, the hypoglycemia levels are measured before and after to determine the amount of reward to pass back through the multi-agent reinforcement learning module 152. Specifically, post-meal hypoglycemia, post-meal glucose error, and the rate of post-meal glucose level changes serve as three metrics for evaluating post-meal glucose control outcomes. These metrics are measured both before and after new parameters to determine the reward to be propagated through the multi-agent reinforcement learning module 152. If the desired target glucose outcomes are achieved, a scalar reward of 10 is propagated through the module. Conversely, if there is no change in the post-meal glucose outcomes, a scalar reward of 1 is passed back. In cases where post-meal glucose outcomes worsen, a negative reward proportional to the degree of worsening is passed through the module and vice versa. The global Q-value in the multi-agent learning algorithm for high fat meals is calculated from (7) with N=3. At block 560, once the fat ratios F௨and F^have been calculated, the upfront insulin dosage of equation 2 and the later insulin dosage of equation 3 may be calculated by bolus calculator module 144. If at block 550, the meal is not considered a high fat meal, then at block 565, the standard non-high fat algorithm at equation 1 is used by bolus calculator module 144 to calculate the insulin dosage. After calculating the insulin dosage for either a high fat meal at block 560 or a non-high fat meal at block 565, processor 112 of server 104 may return to receiving data from the glucose sensor 124 at block 505 for the next mealtime calculation. Referring to FIG.6, in screenshot 616, the recommended insulin dosage is provided. This may be the insulin dosage provided at blocks 535, 545, 560, 565. Text field 652 allows the user to provide notes associated with the recommended insulin dosage. The user may then confirm the recommended dose, which in some embodiments will lead to instructing the insulin provider device 132 to administer the recommended insulin dosage to the user. A user may also override the recommended insulin dosage in screenshot 616 and enter their own insulin dosage. The below is an embodiment of pseudocode for blocks 530, 540 or 555, where the multi-agent reinforcement learning module 152 is executed by processor 112 to calculate either the fat ratios F௨and F^or the exercise specific ratios ^^௪ଽand ^^^ଽ^. Algorithm 1: Multi-agent Q-learning algorithm 1. Initialize γ = 0.5, α = 0.55, ^^ = 0.9 2. Initialize ^^௭( ^^^௭, ^^^௭), ∀ ^^௭^^ ^^௭, ∀ ^^௭^^ ^^௭using common clinical guidelines, where z=j denotes the agent for high fat meals and z=t denotes the agent for postprandial aerobic exercises. 3. Evaluate current state ^^^௭. 4. Repeat a. Choose action ^^^௭from ^^^௭^using ^^-greedy policy. b. From an action ^^^௭, obtain ( ^^௪௪ଽ^and ^^^^ଽ^) or ( ^^௨^and ^^^^) using equations (16-17) or (24-25). c. Apply ൫ ^^௪௪ଽ^and ^^^^ଽ^൯or ൫ ^^௨^and ^^^^൯, observe the ^^^௭ା^and the next state ^^^௭^ା ^^. d. Update the action value function ^^^௭ା^( ^^^௭^, ^^^௭) ← ^^^௭( ^^^௭^, ^^^௭) + ^^[ ^^^௭ఊ ା^+ீ^ ma ೕx ^^^( ^^^௭^ା ^^, ^^௨௭) − ^^^௭( ^^^௭^, ^^^௭) ^ೠ]. The above learning algorithm is run on a full week data of glucose levels, meals, and insulin doses to adjust the basal doses, carbohydrate ratios / fixed doses, fat ratios, and exercise ratios. The final weekly recommendations are determined using the median of the daily recommendations. To avoid double adjustments in the meal bolus calculation (due to the simultaneous adjustments of carbohydrate ratios alone with fat and exercise ratios), the final fat and exercise ratios are modified as follows: ^^ ^^ ^^ ^^ ^^ ^^^^,^ା^= ^^ ^^^ା^^(27)^^ ^^^^^^,^ା^) ) In the current embodiment, only seven (7) days of data are considered in when using multi-agent reinforcement learning module 152, however, a person skilled in the art will recognize that any number of days of data may be considered when using multi- agent reinforcement learning module 152. A person skilled in the art will also recognize that despite only using seven (7) days of data in the current embodiment, the multi- agent reinforcement learning module 152 still benefits from the rewards and hence generating a Q and a policy that has all the data from the beginning of the agents being used in reinforcement learning module 152 for the user. Experiments Studies were also performed using system 100. The research reports on the outcomes of a single-center, single-arm 16-week outpatient study in 15 adults with type 1 diabetes on multiple daily injections therapy. Participants were required to have a diagnosis of type 1 diabetes for at least 1 year, be using MDI therapy, and have a self- reported diet containing at least three high fat meals per week and / or at least two postprandial aerobic exercise sessions per week, each at least 30 minutes long. Exclusion criteria included any non-insulin anti-hyperglycemic medication (e.g., SGLT2 inhibitors, GLP-1 receptor agonists, metformin), pregnancy, severe hypoglycemia and / or diabetes ketoacidosis within one month of enrollment, and clinically significant complications including neuropathy, nephropathy, and retinopathy. Procedures MDI therapy parameters (long-acting basal dose, correction factors, and carbohydrate ratios / fixed mealtime doses) of the participants were recorded. The enrollment visit also included training participants on hypoglycemia and hyperglycemia management, high fat meals assessment, and use of a Freestyle Libre 1 sensor as glucose sensor 124 and use of the user device 128. Throughout the study duration (16-week), participants were scanning the Freestyle Libre 1 sensor (glucose sensor 124) a minimum of five times per day (to avoid missing data). To calculate their meal boluses, participants used the user device 128 and input module 140 by entering the amount of meals carbohydrate (if participants were carbohydrate counters), announcing the high fat status (if fat is ≥20g), and indicating whether a postprandial aerobic exercise is anticipated, along with the exercise type (e.g., jogging, running), and the timing of the exercise (within or later than 90 minutes after mealtime). The carbohydrate ratios / fixed doses were used to calculate meal boluses while the fat and exercise ratios were used to adjust boluses for high fat meals and anticipated postprandial aerobic exercise. The single agent reinforcement learning module 148 and the multi-agent reinforcement learning module 152 provided personalized recommendations for dosing parameters (long-acting insulin doses, carbohydrate ratios / fixed mealtime doses, fat ratios, and exercise ratios). Every week, the learning algorithm of single agent reinforcement learning module 148 and of multi-agent reinforcement learning module 152 was run on the cloud using participant’s glucose sensor data and basal and bolus insulin data (including high fat meals, postprandial aerobic exercise, and meals' carbohydrates) as entered in the user device 128 through input module 140. The new therapy parameters (carbohydrate ratios / fixed doses for breakfast, lunch, and dinner, basal doses, fat ratios and / or exercise ratios) were then automatically pushed into the user device 128. Participants received a notification on user device 128 and were required to confirm for acknowledgment and continued their next week with the new parameters. The new therapy parameters were reviewed and approved by the clinical team, before being pushed to the user device 128, if the cumulative change from the initial values and / or previously approved ones was ≥30%. A blood draw was taken at the enrollment and the end-study visits to assess HbA1c. Baseline surveys (diabetes treatment satisfactory questionnaire, hypoglycemia fear survey), mid-study surveys (diabetes treatment satisfactory Questionnaire, hypoglycemia fear survey), end-study surveys (diabetes treatment satisfactory questionnaire, hypoglycemia fear survey, and mobile application useability questionnaire) were completed by the participants. Four telephone follow ups were conducted at the end of Weeks 1, 3, 5, and 7 in case of any technical difficulties or questions. Outcomes As this is a pilot study, all outcomes are exploratory, and include (i) a comparison between the evaluation period (last four weeks of the available high fat meals data) versus the baseline period (first three weeks of the available high fat meal data) in 5-hour postprandial incremental area under the sensor glucose levels curve after high fat meals, (ii) a comparison between the evaluation period (last 3 weeks of the available exercise data) versus the baseline period (the period, capped at 4 weeks, where the algorithm’s recommendations ≤ 20% of the initial values) in 5-hour postprandial incremental area under the sensor glucose levels curve after meals followed by postprandial aerobic exercise events, (iii) change in an HbA1c from baseline, and (iv) the percentage of time that the sensor glucose readings were in the target range (3.9– 10.0 mmol / L), above target range, and below target range. Statistical analysis For the postprandial outcomes after high fat meals and meals followed by postprandial aerobic exercise, a linear mixed model was used while controlling for the following confounding variables: sex, and evaluation period (baseline or evaluation period). Residual values from the model were examined for an approximate normal distribution. If values were highly skewed, a transformation was used to normalize the distribution. For the combined (postprandial plus fasting) outcomes a paired t-test was used for outcomes with normally distributed data and a Wilcoxon rank-test for outcomes with non-normally distributed data. For normally distributed outcomes, means and standard deviations (SD) were reported, and for non-normally distributed outcomes, medians and interquartile ranges (IQR) were reported. Since this is an exploratory study, no corrections were applied for multiple comparisons. Results15 participants were enrolled (six females, mean age 38 (13) years, HbA1c 8.5% (1.1%), duration of diabetes 20 (12) years, total daily insulin 53 (17) U; Table 2). 14 participants completed the study and one participant withdrew after 2 weeks due to a schedule conflict. Table 2. Participants’ baseline characteristics (n=15). Characteristic Mean (SD) or frequency Range (min-max) (%) Female sex 6 – Participants using fixed dose 9 (60%) – *Weight and BMI were calculated based on data of 9 participants. The first 6 participants were enrolled on a previous protocol version that did not include weight measurements. Outcomes after the intake of high fat meals FIGS.7, 8, 9 and 10 shows the 5-hour incremental postprandial glucose levels after high fat meals (overall 700 at FIG.7, breakfast 800 at FIG.8, lunch 900 at FIG.9, and dinner 1000 at FIG.10, respectively). Comparing the baseline period to the evaluation period, the overall 5-hour postprandial incremental area under the glucose levels curve was reduced by 90% (378±222 vs 38±223 mmol / L / min, p=0.03; Table 3). Sub-analysis also showed numerical reductions by 33% after breakfast (998±440 vs 672±467 mmol / L / min, p=0.36), 55% after lunch (573±297 vs 255±313 mmol / L / min, p=0.30), and 99% after dinner (306±264 vs 0.30±279 mmol / L / min, p=0.15; Table 3), though these reductions were not statistically significant. The overall 5-hour postprandial percentage time spent with glucose levels below 3.9 mmol / L was reduced by 54% (5.0±1.5 vs 2.3±1.5, p=0.01; Table 3), with numerical reductions of 22% after breakfast (1.79±1.7 vs 1.39±2.2, p=0.84), 87% after lunch (5.3±1.5 vs 0.7±1.6, p=0.01), and 63% after dinner (4.9±2.3 vs 1.8±2.2, p=0.10; Table 3). Table 3. Comparison of the baseline period versus the evaluation period in postprandial outcomes after high fat meals. Evaluation Overall Baseline period period P value Number of High fat Meals 111 120 - iAUC 0-300 min (mmol / L / min) 378±222 38±223 0.03 iAUC 240-300 min (mmol / L / min) 137±52 4±52 0.01 TBR < 3.9 mmol / L 5.0±1.5 2.3±1.5 0.01 Mealtime Insulin (U) 10.5±1.1 9.3±1.2 0.09 Later Bolus Insulin (U) 0.3±1.0 1.5±1.5 <0.001 Correction Bolus Insulin (U) 0.9±0.3 0.5±0.2 0.06 Breakfast Number of High fat Meals 26 23 - iAUC 0-300 min (mmol / L / min) 998±440 672±467 0.36 iAUC 240-300 min (mmol / L / min) 99±122 0.13 TBR < 3.9 mmol / L 1.39±1.8 0.84 Mealtime Bolus Insulin (U) 10.1±3.1 0.57 Later Bolus Insulin (U) 0.4±0.2 0.6±0.2 0.33 Correction Bolus Insulin (U) 1.7±1.2 0.9±1.1 0.08 Lunch Number of High fat Meals 37 46 - iAUC 0-300 min (mmol / L / min) 573±297 255±313 0.30 iAUC 240-300 min (mmol / L / min) 177±85 38±89 0.12 TBR < 3.9 mmol / L 5.3±1.5 0.67±1.6 0.01 Mealtime Bolus Insulin (U) 9.7±1.6 9.0±1.7 0.28 Later Bolus Insulin (U) 0.1±0.2 2.0±0.3 <0.001 Correction Bolus Insulin (U) 0.6±0.3 0.4±0.3 0.70 Dinner Number of High fat Meals 48 51 - iAUC 0-300 min (mmol / L / min) 306±264 0.3±279 0.15 iAUC 240-300 min (mmol / L / min) 99±66 22±67 0.28 TBR < 3.9 mmol / L 4.9±2.3 1.8±2.3 0.10 Mealtime Bolus Insulin (U) 9.7±5.0 8.8±4.0 0.25 Later Bolus Insulin (U) 0.5±0.3 1.3±0.3 0.002 Correction Bolus Insulin (U) 0.9±0.4 0.6±0.3 0.26 Outcomes are reported as mean ± standard error. FIG.11 shows the weekly 5-hour postprandial incremental area under the curve for high fat meals, demonstrating a continuous trend towards lower values albeit with high variability. The numbers presented in the top of the line graph 1100 denote the number of high fat meals. FIG. 12 shows the change in fat ratios throughout the 16-week study duration. Specifically, chart 1204 shows the percentage change in breakfast fat ratio throughout the 16 week study duration. Chart 1212 shows the percentage change in lunch fat ratio throughout the 16 week study duration. Chart 1220 shows the percentage change in dinner fat ratio throughout the 16 week study duration. Chart 1208 shows the percentage change in later fat ratio after breakfast (two (2) hours after mealtime) throughout the 16 week study duration. Chart 1216 shows the percentage change in later fat ratio after lunch (two (2) hours after mealtime) throughout the 16 week study duration. Chart 1224 shows the percentage change in later fat ratio after dinner (two (2) hours after mealtime) throughout the 16 week study duration. Mealtime fat ratio is used to calculate additional insulin at mealtime (total insulin at mealtime equals to mealtime insulin calculated by the CR*(1+ mealtime FR)), whereas later FR is to calculate a later bolus two (2) hour after the meal (later bolus insulin equals to mealtime insulin calculated by the carbohydrate ratio times*later FR). The initial recommendations for all mealtime’s FR and later FR were zero. Compared to baseline, participants needed similar insulin doses at mealtimes (10.5±1.1 vs 9.3±1.2, p=0.09; Table 3) and an additional bolus two (2) hours after the meals (0.3±1.0 vs 1.5±1.5, p<0.001; Table 3). Table 4 shows dose recommendations for high fat meals at the end of the study duration, demonstrating large variability among participants in their insulin needs, varying from -71% to +30% of their usual dose at mealtime and up to +128% of their usual dose two (2) hours after the meal. Table 4. Dose change recommendations for high fat meals at the end of the study duration Breakfast Lunch Recommendations Dinner Recommendations Recommendations High High High Participa Mealti Laterfat Mealti L fat Mealti fat nt IDmemealmeatermealmeLatermeal s s s 202 +0% 5 +30% 30 +0% 22 203 -23% +48% 28 -28% +98% 22 -34% +128% 43 205 -20% +0% 8 – – – – – – 206 – – – – – – -71% +19% 27 207 -60% +0% 38 -12% +0% 11 -13% +15% 26 208 – – – – – – – – – 209 – – – -39% +38% 55 -28% +0% 50 Outcomes for meals followed by exercise FIGS.13, 14, 15, and 16 show the 5-hour postprandial incremental glucose levels after meals preceding exercise (overall 1300 at FIG.13, breakfast 1400 at FIG. 14, lunch 1500 at FIG.15, and dinner 1600 at FIG.16). Comparing the baseline to the evaluation period, the overall 5-hour postprandial incremental area under the glucose levels curve following meals preceding exercise was improved by 133% (-395±192 vs 132±181 mmol / L / min, p=0.007; Table 5). Sub-analysis also showed improvement of 102% after breakfast (-717±390 vs 17±353 mmol / L / min, p=0.03), of 196% after lunch (-222±181 vs 215±197 mmol / L / min, p=0.08), and 113% after dinner (-479±420 vs 65±346 mmol / L / min, p=0.16; Table 5). The overall 5-hour postprandial percentage time spent with glucose levels below 3.9 mmol / L was reduced by 73% (5.3±1.2 vs 1.4±1.1, p=0.003; Table 5), with numerical reductions of 85% after breakfast (8.5±1.6 vs 1.3±1.2, p<0.001), of 50% after lunch (3.2±1.0 vs 1.6±1.0, p=0.11), and of 53% after dinner (8.0±4.7 vs 3.7±3.7, p=0.48; Table 5). Table 5. Comparison of the baseline period versus the evaluation period in postprandial outcomes with exercises. Baseline Evaluation Overall period period P value Number of Exercise Sessions 82 93 - iAUC 0-300 min (mmol / L / min) -395±192 132±181 0.007 iAUC 240-300 min (mmol / L / min) -147±51 -8±47 0.01 TBR < 3.9 mmol / L 5.3±1.2 1.4±1.1 0.003 Mealtime Insulin (U) 10.0±1.3 8.0±1.4 <0.001 Correction Bolus Insulin (U) 0.1±0.1 0.3±0.2 0.28 Breakfast Number of Exercise Sessions 26 39 - iAUC 0-300 min (mmol / L / min) -717±390 17±353 0.03 iAUC 240-300 min (mmol / L / min) -267±102 -91±90 0.06 TBR < 3.9 mmol / L 8.5±1.6 1.3±1.2 <0.01 Mealtime Bolus Insulin (U) 10±1.4 8.0±1.3 <0.001 Correction Bolus Insulin (U) 0.1±0.1 0.06±0.1 0.62 Lunch Number of Exercise Sessions 47 36 - iAUC 0-300 min (mmol / L / min) -222±181 215±197 0.08 FIG.17 shows the weekly 5-hour postprandial incremental area under the curve, demonstrating a rapid improvement within two weeks. The numbers presented above the vertical lines in graphical chart 1700 denote the number of exercise sessions. The last two weeks included a smaller number of exercise sessions. FIG.18 shows the change in exercise ratios throughout the 16-week study duration. Specifically, chart 1804 shows the individual changes in exercise ratio in exercise after breakfast thought the 16 week study duration. Chart 1808 shows the individual changes in exercise ratio in exercise after lunch throughout the 16 week study duration. Chart 1812 shows the individual changes in exercise ratio in exercise after dinner throughout the 16 week study duration. Overall, participants needed less insulin at mealtimes (10.0±1.3 vs 8.0±1.4, p<0.001; Table 5) in the evaluation period compared to baseline. Table 6 shows the dose recommendations for postprandial aerobic exercises at the end of the study period, showing a large variability among participants in their insulin needs, with exercise dependent bolus doses being reduced up to 53% at mealtimes. Table 6. Dose recommendations at the end of the study period for meals followed by postprandial aerobic exercise Breakfast Recommendations LRuecnocmhDinner mendationsRecommendations Participant ID Mealtime Exercise Mealtime Exercise Mealtime Exercise Sessions Sessions Sessions 202 – – – –– – – 203 – – – – – – 205 Cardio: -53% 8 Cardio: -35% 21 – – 206 Walking: -21% 4 – – Walking: - 8 32% 207 ErgC6: -41% 6 Cardio: -35% 6 ErgC6: -15% 6 208 Walking: -10% 5 Walking: - 8 Walking: - 9 – – 20% 5 38% Running: - 10% 209 Walking: -48% 32 – – Walking: - 9 25% 210 – – Walking: - 10 – – 17% 211 – – Walking: - 73 – – 20% 212 Walking: -26% 8 Walking: - 8 – – Gym: -36% 6 25% 5 – Gym: -10% 213 Walking: -30% 23 Walking: - 11 Walking: - 4 40% 19% 214 – – – – – – 215 – – – – – – 216 – – – – – – Average -33±14% 12±10 -24±13% 16±22 -26±9% 7±2 Combined Outcomes Table 7 shows the glycemic and insulin outcomes over the 24-hour, daytime, and nighttime periods, comparing the last to the first 10 days of the study period. The percentage time with glucose levels spent between 3.9-10 mmol / L was not different (47.9±13.1 vs 48.9±13.6, p=0.73; Table 7). The percentage time with glucose levels spent below 3.9 mmol / L was also unchanged (6.3±5.8 vs 6.0±4.0, p=0.86; Table 7). There was a numerical reduction of 0.3% in HbA1c at the end of study period compared to the baseline (8.2±1.0 vs 8.5±1.1, p=0.12; Table 7). FIG.19 shows the changes in carbohydrate ratios and basal doses throughout the 16-week study duration. Specifically, chart 1904 shows individual changes in the CR for breakfast throughout the 16 week study duration. Chart 1908 shows individual changes in the CR for lunch throughout the 16 week study duration. Chart 1912 shows individual changes in the CR for dinner throughout the 16 week study duration. Chart 1916 shows individual changes in the CR for basal throughout the 16 week study duration. There were no episodes of severe hypoglycemia, diabetic ketoacidosis, or other serious adverse events throughout the study. Table 7. Comparison of glucose and insulin outcomes between the first 10 days and the last 10 days. First 10 days Last 10 days (n=15)(n=15)Difference, p value 24H OUTCOMES (08:00-08:00) Time spent at glucose levels (%): 3.9–10 mmol / L 48.9±13.6 47.9±13.1 -1.0 (11.6), 0.73 3.9–7.8 mmol / L 30.2±9.8 30.9±9.7 -0.6 (9.3), 0.80 < 3.0 mmol / L 2.4±2.9 1.9±2.2 0.4 (1.9), 0.41 < 3.9 mmol / L 6.3±5.8 6.0±4.1 0.3 (5.4), 0.86 > 7.8 mmol / L 64.5±12.5 64.0±11.9 0.5 (14.0), 0.89 > 10.0 mmol / L 45.0±14.7 46.1±14.9 -1.1 (14.9), 0.75 > 13.9 mmol / L 20.9±14.7 22.0±13.6 -1.0 (12.7), 0.68 Mean glucose (mmol / L) 10.2±1.9 10.3±1.8 0.1 (1.8), 0.86 SD of glucose (mmol / L) 4.3±1.2 4.5±0.9 -0.2 (0.9), 0.45 CV of glucose (%) 43.0±7.7 44.0±5.4 -1.0 (7.4), 0.40 Basal Insulin (U / day) 29.0±12.0 32.0±17.0 -3.0 (10.1), 0.27 Bolus Insulin (U / day) 25.1±9.9 24.6±7.7 0.47 (5.9), 0.77 Total Insulin (U / day) 54.1±19.0 56.7±17.2 -2.6 (8.9), 0.29 DAY OUTCOMES (08:00-23:00) Time spent at glucose levels (%): 3.9–10.0 mmol / L 48.4±14.7 47.6±14.5 0.7 (13.1), 0.82 3.9–7.8 mmol / L 29.9±10.0 29.2±10.8 0.8 (10.3), 0.76 < 3.3 mmol / L 2.9±4.4 1.8±2.2 1.0 (3.2), 0.23 < 3.9 mmol / L 5.8±6.4 4.4±3.9 1.4 (5.8), 0.38 > 7.8 mmol / L 65.3±13.3 67.3±13.3 -2.0 (14.6), 0.60 > 10.0 mmol / L 45.8±16.0 47.9±16.5 -2.1 (15.6), 0.61 > 13.9 mmol / L 21.7±16.2 23.0±13.6 -1.3 (13.2), 0.64 Mean glucose (mmol / L) 10.3±2.2 10.5±1.9 -0.2 (1.9), 0.53 SD of glucose (mmol / L) 4.3±1.2 4.5±1.0 -0.2 (1.2), 0.46 CV of glucose (%) 42.1±8.04 43.0±6.7 -0.9 (8.3), 0.62 Bolus Insulin (U / day) 22.3±8.6 19.6±6.8 2.7 (8.6), 0.26 OVERNIGHT OUTCOMES (23:00-0T8im:0e0)spent at glucose levels (%): 3.9–10.0 mmol / L 49.9±15.6 48±17.2 1.9 (17.2), 0.68 3.9–7.8 mmol / L 30.8±12.7 34.1±13.0 -3.2 (12.9), 0.36 < 3.3 mmol / L 2.9±3.0 3.0±3.2 -0.1 (2.6), 0.80 < 3.9 mmol / L 7.1 (6.3) 8.8±5.5 -1.7 (6.6), 0.34 > 7.8 mmol / L 63.0±15.0 57.8±14.9 5.2 (18.3), 0.31 > 10.0 mmol / L 43.0±16.9 43.1±19.2 -0.19 (21.9), 0.97 > 13.9 mmol / L 18.6±16.2 20.0±17.5 -1.4 (21.9), 0.79 Mean glucose (mmol / L) 9.9±2.0 9.6±2.1 0.3 (2.8), 0.69 SD of glucose (mmol / L) 4.2±1.2 4.2±1.0 0.0 (1.0), 0.95 CV of glucose (%) 41.9±8.8 43.7±7.5 -1.8 (6.3), 0.23 Bolus Insulin (U / day) 2.9±3.4 5.0±6.8 -2.1 (5.5), 0.18 HbA1c (%) 8.5±1.1 8.2±1.0 -0.3±0.9, 0.12 Outcomes are reported as mean ± standard deviation. Discussion High fat meals and postprandial aerobic exercise are common challenges that individuals with type 1 diabetes face to control their postprandial glucose levels. This pilot clinical study demonstrated that with the use of an advanced decision support system based on reinforcement learning, postprandial glucose control may be improved in the context of high fat meals and postprandial aerobic exercise. However, as this is an uncontrolled study, findings would need to be confirmed in randomized controlled trials. This study highlights the needs for individualized dose recommendations for both high fat meals and meals followed by exercise. Although the average recommendations (Table 4 and 6) are in line with clinical guidelines, there was a significant intra-individual variability. For high fat meals, individuals’ insulin needs at mealtimes (upfront) varied among individuals between -60% to 0% for breakfast, -39% to +30% for lunch, and -71% to +10% for dinner, and 2 hours after the meal 0% to +48% for breakfast, 0% to +98% for lunch, and 0% to +128% for dinner. Similarly, for meals followed by exercise, individuals’ insulin dose reductions varied between -10% to -50%. Another interesting finding from the study is that the learning algorithm’s recommendations from single agent reinforcement learning module 148 and multi- agent reinforcement learning module 152 for high fat meals and exercise converged after 5-6 and 3-4 weeks, respectively (FIGS.12 and 18). This may have implication on the design of the length of future clinical trials assessing similar learning algorithms. This also suggests that 4-6 weeks of glycemic and insulin data might be needed for the clinical optimization of individual strategies for the management of high fat meals and exercise. Improvements in daytime outcomes were expected due to the improved postprandial glucose control. However, daytime outcomes for the last 10 days of the intervention were similar to the first 10 days of intervention. This might be due to the insufficient number of high fat meals (2 per participant) and exercise data (0.7 per participant) accumulated over the last 10 days, which led to a negligible improvement in the daytime outcomes. Current approaches of insulin dose adjustments for high fat meals and exercises management were tested only in supervised hospital stays of short duration. This is the first outpatient unsupervised study testing a strategy to adjust insulin doses for high fat meals and postprandial aerobic exercise. Furthermore, in contrast to previous approaches, system 100 provides personalized suggestions for (i) meal- specific (i.e., breakfast, lunch, and dinner) insulin bolus doses for high fat meals, (ii) exercise specific (e.g., hockey, jogging) insulin bolus dose reduction recommendations, and (iii) adjustments to usual therapy parameters CRs / fixed meal doses (in meals without high fat and postprandial aerobic exercise) and long acting basal dose so as to remove any effect of suboptimal usual therapy parameters on insulin adjustments for 5 high fat meals and postprandial aerobic exercise. In conclusion, the study results show that system 100 has the potential to improve postprandial glycemia after high fat meals and meals followed by postprandial aerobic exercise with the use of personalized insulin bolus dose recommendations. Future work will include the testing of the advanced decision support system in large 10 and longer randomized control trials. A person skilled in the art will recognize that system 100 is not limited to users with type 1 diabetes, but may be applicable to users with type 2 diabetes as well. Although the foregoing description and accompanying drawings to specific preferred embodiments of the present invention as presently contemplated by the 15 inventor, it will be understood that various changes, modifications and adaptations, may be made without departing from the spirit of the invention.
Claims
CLAIMS 1. A system for determining an insulin dosage to provide to a user, the system comprising: a communications interface connected to a network, wherein the communications interface is configured to receive data from a user device; a memory storage unit; a processor connected to the communications interface and the memory storage unit, the processor configured to: receive glucose monitoring data from a glucose sensor, the glucose sensor being configured to gather glucose monitoring data from the user; receive mealtime data associated with a meal; determine based on the mealtime data whether the meal is a high fat meal; if the meal is determined to be a high fat meal: determine a fat ratio using a multi-agent reinforcement learning module; calculate the insulin dosage using the glucose monitoring data, mealtime data and the fat ratio; and if the meal is determined not to be a high fat meal: calculate the insulin dosage using the glucose monitoring data and mealtime data.
2. The system of claim 1, the processor further configured to, prior to the step of the processor determining based on the mealtime data whether the meal is a high fat meal:determine based on the mealtime data whether the user plans to perform postprandial exercise; determine an exercise ratio using the multi-agent reinforcement learning module; and calculate the insulin dosage using the glucose monitoring data, mealtime data and the exercise ratio.
3. The system of claim 2, wherein the postprandial exercise is exercise occurring within four hours after the meal.
4. The system of claim 2 or 3, the processor further configured to prior to determining an exercise ratio: determine if the postprandial exercise is occurring within ninety minutes after the meal.
5. The system of any one of claims 1 to 4, wherein the memory storage unit includes a log database of historical insulin dosages provided to the user, and the associated glucose monitoring data.
6. The system of claim 5, wherein the log database is configured to be used by the multi-agent reinforcement module.
7. The system of any one of claims 1 to 6, wherein the high fat meal is a meal with over 20 grams of fat.
8. The system of any one of claims 1 to 7, wherein the mealtime data associated with a meal includes the amount of carbohydrates consumed during the meal.
9. The system of any one of claims 1 to 8 further comprising an insulin providing device, wherein after the insulin dosage has been calculated, the processor being further configured to send instructions to the insulin providing device to provide the user with insulin in the amount of the insulin dosage.
10. The system of claim 9, wherein in the insulin providing device is an insulin pen.
11. The system of claim 9, wherein the insulin providing device is an insulin pump.
12. A computer-implemented method for determining an insulin dosage to provide to a user, the method comprising: receiving glucose monitoring data from a glucose sensor, the glucose sensor being configured to gather glucose monitoring data from the user; receiving mealtime data associated with a meal from a user device; determining based on the mealtime data whether the meal is a high fat meal; if the meal is determined to be a high fat meal: determining a fat ratio using a multi-agent reinforcement learning module; calculating the insulin dosage using the glucose monitoring data, mealtime data and the fat ratio; if the meal is determined not to be a high fat meal: calculating the insulin dosage using the glucose monitoring data and mealtime data.
13. The method of claim 12 further comprising, prior to determining based on the mealtime data whether the meal was considered a high fat meal: determining based on the mealtime data whether the user plans to perform postprandial exercise; determining an exercise ratio using the multi-agent reinforcement learning module; and calculating the insulin dosage using the glucose monitoring data, mealtime data and the exercise ratio.
14. The method of claim 13 wherein the postprandial exercise is exercise occurring within four hours after the meal.
15. The method of claim 13 or 14 further comprising, prior to determining an exercise ratio: determining if the postprandial exercise is occurring within ninety minutes after the meal.
16. The method of any one of claims 12 to 15, wherein the multi-agent reinforcement learning module is configured to access a log database, the log database including historical insulin dosages provided to the user, and the associated glucose monitoring data.
17. The method of any one of claims 12 to 16, wherein the high fat meal is a meal with over 20 grams of fat.
18. The method of any one of claims 12 to 17, wherein the mealtime data includes the amount of carbohydrates consumed during the meal.
19. The method of any one of claims 12 to 18 further comprising: providing an insulin providing device; and sending instructions to the insulin providing device to provide the user with insulin in the amount of the insulin dosage.
20. The method of claim 19, wherein the insulin providing device is an insulin pen.
21. The method of claim 19, wherein the insulin providing device is an insulin pump.
22. A system for determining an insulin dosage to provide to a user, the system comprising: a communications interface connected to a network, wherein the communications interface is configured to receive data from a user device; a memory storage unit; a processor connected to the communications interface and the memory storage unit, the processor configured to:receive glucose monitoring data from a glucose sensor, the glucose sensor being configured to gather glucose monitoring data from the user; receive mealtime data associated with a meal; determine based on the mealtime data whether the user plans to perform postprandial exercise; if the user plans to perform postprandial exercise: determine an exercise ratio using the multi-agent reinforcement learning module; and calculate the insulin dosage using the glucose monitoring data, mealtime data and the exercise ratio; if the user does not plan to perform postprandial exercise: calculate the insulin dosage using the glucose monitoring data and mealtime data.
23. The system of claim 22, wherein the postprandial exercise is exercise occurring within four hours after the meal.
24. The system of claim 22 or 23, the processor further configured to prior to determining an exercise ratio: determine if the postprandial exercise is occurring within ninety minutes after the meal.
25. The system of any one of claims 22 to 24, wherein the memory storage unit includes a log database of historical insulin dosages provided to the user, and the associated glucose monitoring data.
26. The system of claim 25, wherein the log database is configured to be used by the multi-agent reinforcement module.
27. The system of any one of claims 22 to 26, wherein the mealtime data associated with a meal includes the amount of carbohydrates consumed during the meal.
28. The system of any one of claims 22 to 27 further comprising an insulin providing device, wherein after the insulin dosage has been calculated, the processor being further configured to send instructions to the insulin providing device to provide the user with insulin in the amount of the insulin dosage.
29. The system of claim 28, wherein in the insulin providing device is an insulin pen.
30. The system of claim 28, wherein the insulin providing device is an insulin pump.
31. A computer-implemented method for determining an insulin dosage to provide to a user, the method comprising: receiving glucose monitoring data from a glucose sensor, the glucose sensor being configured to gather glucose monitoring data from the user; receiving mealtime data associated with a meal from a user device; determining based on the mealtime data whether the user plans to perform postprandial exercise; if the user plans to perform postprandial exercise: determining an exercise ratio using the multi-agent reinforcement learning module; and calculating the insulin dosage using the glucose monitoring data, mealtime data and the exercise ratio; if the user does not plan to perform postprandial exercise: calculating the insulin dosage using the glucose monitoring data and mealtime data.
32. The method of claim 31 wherein the postprandial exercise is exercise occurring within four hours after the meal.
33. The method of claim 31 or 32 further comprising, prior to determining an exercise ratio:determining if the postprandial exercise is occurring within ninety minutes after the meal.
34. The method of any one of claims 31 to 33, wherein the multi-agent reinforcement learning module is configured to access a log database, the log database 5 including historical insulin dosages provided to the user, and the associated glucose monitoring data.
35. The method of any one of claims 31 to 34, wherein the mealtime data includes the amount of carbohydrates consumed during the meal.
36. The method of any one of claims 31 to 35 further comprising:10providing an insulin providing device; and sending instructions to the insulin providing device to provide the user with insulin in the amount of the insulin dosage.
37. The method of claim 36, wherein the insulin providing device is an insulin pen. 15 38. The method of claim 36, wherein the insulin providing device is an insulin pump.
Citation Information
Patent Citations
Preprandial insulin dosage learning optimization decision-making system assisted by expert experience
CN112927802A
Insulin dose recommendation system integrating deep learning and medical knowledge
CN115985458A
Method and apparatus for glucose control and insulin dosing for diabetics
US20050272640A1
Glucose level control system with offline control based on preceding periods of online control
US20160331898A1
Systems and methods for optimizing medicament dosing
US20220168506A1