A blood glucose fluctuation trend prediction method combining diet and exercise

CN122762298APending Publication Date: 2026-09-15AFFILIATED HOSPITAL OF JIANGSU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611097350.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-23
Publication Date
2026-09-15

Smart Images

  • Figure CN122762298A_ABST
    Figure CN122762298A_ABST
Patent Text Reader

Abstract

The application discloses a blood glucose fluctuation trend prediction method fusing diet and exercise, and relates to the technical field of blood glucose monitoring. The method comprises the following steps: acquiring a continuous blood glucose monitoring sequence and diet and exercise event records; detecting trend turning points of a blood glucose curve, segmenting the blood glucose curve into trend segments, and marking event type hypotheses; establishing an individualized metabolic response base function library; after deducting a historical event residual response from blood glucose observation values, modeling the blood glucose observation values as superposition of diet and exercise event responses; solving and separating, by means of alternating optimization with mutual exclusion constraints, to obtain pure blood glucose response waveforms of each event and physiological effective time points of the events; and storing the decoupled events in an individual metabolic archive, performing initial correction on newly entered events, based on the pure response waveforms of the decoupled events, superimposing extrapolation, and outputting future blood glucose fluctuation trend prediction results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of blood glucose monitoring technology, and more specifically, to a method for predicting blood glucose fluctuation trends by integrating diet and exercise. Background Technology

[0002] Blood glucose levels are influenced by both dietary intake and exercise expenditure. Predicting blood glucose trends helps diabetic patients rationally plan their diet and exercise. Currently, blood glucose prediction methods that integrate dietary and exercise information typically use the time of events recorded by the user as a time reference, and take information such as carbohydrate content, fat ratio in the diet, and type and intensity of exercise as input features. A mapping from event features to blood glucose response curves is established through neural networks or physiological models.

[0003] These methods implicitly assume that the time of the event recorded by the user coincides with the actual moment when metabolic effects begin to occur in the body. However, in practice, this assumption often fails. For eating events, food needs to undergo gastric emptying before it can be absorbed into the intestines. The rate of gastric emptying is affected by various factors such as dietary fiber content, fat ratio, total food volume, and individual digestive function. There is a delay of minutes between the recording time of eating and the start of blood glucose rise, and this delay varies between different meals. For exercise events, the time when muscles begin to significantly absorb glucose is affected by factors such as exercise type, exercise intensity, digestion status of the previous meal, and individual metabolic level, and there is also a drift between the recording time and the effective time. Existing prediction methods do not address this time drift and directly use the recording time as the metabolic effective time, resulting in alignment bias at the input end of the model, affecting the accuracy of subsequent blood glucose trend prediction. Therefore, a method for predicting blood glucose fluctuation trends that integrates diet and exercise is proposed to address the above problems. Summary of the Invention

[0004] To overcome the aforementioned deficiencies of the prior art, embodiments of the present invention provide a method for predicting blood glucose fluctuation trends by integrating diet and exercise, aiming to solve the problem of unknown drift between the user-recorded time of diet and exercise events and the actual physiological effective time in the body, which leads to input alignment errors in blood glucose trend prediction.

[0005] To achieve the above objectives, the present invention provides the following technical solution: A method for predicting blood glucose fluctuation trends by integrating diet and exercise is based on the following concept: instead of directly using the recording time of a user's recorded diet or exercise events as the metabolic effective time of the event, the physiological effective time is used as the variable to be solved. The pure blood glucose response waveform and its true physiological effective time of each event are decoupled from continuous blood glucose monitoring data. Then, the decoupled pure response waveforms of the events are superimposed and extrapolated to predict future blood glucose fluctuation trends.

[0006] The method includes the following steps: S1: Acquire the user's continuous blood glucose monitoring sequence, as well as dietary event records and exercise event records with recording times. The dietary event records include carbohydrate content and fat percentage, and the exercise event records include exercise type and intensity.

[0007] S2: Detect trend inflection points in the continuous blood glucose monitoring sequence, divide the blood glucose curve into multiple trend segments, label each trend segment with an event type hypothesis, and use the time interval of the trend segment as a candidate effective time window.

[0008] Trend inflection point detection identifies the points where the blood glucose curve bends most sharply to pinpoint the moments when metabolic events may begin to exert their effects. When dietary or exercise events begin to affect blood glucose, the rate of change in the blood glucose curve changes significantly, and the point of maximum curvature corresponds to the starting point of this change. By dividing the blood glucose curve into trend segments according to inflection points, each trend segment corresponds to an independent period of influence from a metabolic event, thus providing a temporal search range for subsequent decoupling.

[0009] S3: Based on individual metabolic history data, establish a dietary response basis function library and an exercise response basis function library. The postprandial blood glucose response waveform in the dietary response basis function library is controlled by a first shape parameter, and the post-exercise blood glucose response waveform in the exercise response basis function library is controlled by a second shape parameter.

[0010] The shape of the response waveform can be dynamically adjusted according to the characteristics of the event. Diets with different carbohydrate contents and fat ratios will produce blood glucose response curves of different shapes; for example, the response waveform of a high-fat meal is usually flatter and longer. Different types and intensities of exercise will also produce blood glucose response curves of different shapes. By controlling waveform generation through shape parameters, the basis function library can characterize individualized metabolic response patterns.

[0011] S4: For each trend segment, retrieve decoupled historical events whose response validity period covers the current trend segment from the individual metabolic archive. Subtract the residual response of the decoupled historical events from the blood glucose observation values ​​within the trend segment, and represent them as the superposition of dietary event response and exercise event response. The physiological effective time and shape parameters of each event are used as variables to be solved.

[0012] By subtracting historical residual responses, the interference of known events on the current trend segment is eliminated, allowing the residual blood glucose curve to primarily reflect the effects of events within the current trend segment. This transforms a blood glucose fluctuation influenced by multiple factors into a superposition model containing only current dietary and exercise events, creating a clear analytical object for subsequent event decoupling.

[0013] S5: Alternately optimize the physiological effective time and shape parameters of dietary and exercise events, fixing one set of parameters while optimizing the other. After the alternation is complete, perform joint fine-tuning, where the loss function includes a fitting error term and a mutual exclusion constraint term. Separate the pure blood glucose response waveform and its physiological effective time for each event.

[0014] Alternating optimization, through a strategy of repeatedly fixing one side and optimizing the other, decomposes the complex multivariate joint problem into two relatively simple sub-problems, gradually approximating the true physiological effective time and waveform shape of each event. The fitting error term ensures that the superimposed waveforms after decoupling are consistent with the observed data, guaranteeing the accuracy of decoupling. The mutual exclusion constraint term applies physiological rationality constraints from two perspectives: on the one hand, it suppresses non-physiological mirror cancellation between the positive waveform of the diet response and the negative waveform of the exercise response; on the other hand, it constrains the temporal relationship of the peak times of the two events, preventing the optimization results from deviating from physiological reality.

[0015] S6: Store the isolated events as decoupled records in the individual metabolic archive. The stored content should include at least the event type, recording time, the determined physiological effective time, and the pure blood glucose response waveform.

[0016] The decoupled records provide two key supports for subsequent predictions: first, they allow for the overlay of historical events still having an effect from the archive during prediction; second, they provide a data foundation reflecting the user's physiological characteristics for the statistical analysis of the individual's average delay. As the method is used continuously, the number of decoupled events in the archive gradually increases, and the degree of individualization also improves.

[0017] S7: When a new dietary event or exercise event is recorded, an initial blood glucose response waveform is generated based on its nutrient or intensity information, and the average delay of the individual is statistically analyzed using the decoupled records in the individual metabolic archive, and the recording time is corrected to the estimated physiological effective time.

[0018] Newly entered events have not yet been decoupled, so their true physiological effective time cannot be directly obtained. By statistically analyzing the average offset between the recorded time and the physiological effective time of historical decoupled events, the recorded time of the new event is corrected, so that a more reasonable time estimate can be obtained even in the absence of decoupling results, thereby constructing an initial response waveform for prediction.

[0019] S8: Extract all decoupled, pure blood glucose response waveforms with response validity periods covering future prediction times from the individual metabolic archive, overlay them on the time axis with the blood glucose response waveform of the new event, and output the prediction result of future blood glucose fluctuation trends.

[0020] During prediction, each decoupled event uses a pure response waveform based on its actual physiological effective time, rather than an initial estimated waveform based on the recording time. Therefore, when superimposed on the timeline, the onset and decay processes of each event more closely match the actual metabolic processes in vivo, and the prediction process is unaffected by the drift between the recording time and the effective time.

[0021] Furthermore, the method for detecting trend inflection points in S2 is as follows: calculate the instantaneous curvature of the continuous blood glucose monitoring sequence at multiple scales, take the point of maximum curvature as the trend inflection point, and the blood glucose curve segments between adjacent trend inflection points constitute a trend segment.

[0022] Multi-scale detection can capture blood glucose change trends at different time granularities. Smaller scales detect short-term rapid fluctuations, while larger scales detect long-term slow changes. By requiring inflection points to be identified at multiple scales, it effectively filters out noise and false positives at a single scale. For trends where blood glucose levels are generally rising, they are labeled as a glycemic process dominated by dietary events; for trends where blood glucose levels are generally falling, they are labeled as a glycemic process dominated by exercise events. The direction of blood glucose change distinguishes event types, providing event hypotheses for subsequent superposition and decomposition models.

[0023] Furthermore, in S3, the shape parameters of the diet response basis function library are dynamically generated by the carbohydrate content and fat ratio of the diet event through a first mapping network, and the shape parameters of the motion response basis function library are dynamically generated by the motion type and motion intensity of the motion event through a second mapping network.

[0024] The mapping network establishes a mapping between event features and response waveform shapes by learning the correspondence between them in historical data. When new event features are input, the network can output corresponding shape parameters, enabling different events to generate response waveforms that conform to their individual metabolic characteristics, without the need for a pre-set fixed waveform template.

[0025] Furthermore, the alternating optimization solution in S5 is as follows: the recording time of the motion event plus the individual average motion onset delay is used as the initial motion physiological effective time. The second mapping network generates the initial second shape parameters and constructs the initial motion response waveform, providing a reasonable initial search point for alternating optimization.

[0026] With fixed exercise event parameters, the current exercise response estimate is subtracted from the blood glucose observations. The residual curve is then used to optimize the physiological effective time and first shape parameter of the exercise event, ensuring that the solution for the exercise event is performed on the curve after the exercise effect has been removed. Alternatively, with fixed exercise event parameters, the current diet response estimate is subtracted from the blood glucose observations. The residual curve is then used to optimize the physiological effective time and second shape parameter of the exercise event, ensuring that the solution for the exercise event is performed on the curve after the diet effect has been removed.

[0027] After multiple rounds of alternating optimization, the parameters for diet and exercise events are jointly fine-tuned. Alternating optimization provides an initial point close to the global optimum for joint fine-tuning, which then performs a refined search based on the alternating results, improving decoupling accuracy.

[0028] Furthermore, the time rationality constraint includes: the physiological effective time of the dietary event is after the event recording time and does not exceed the preset maximum physiological delay time, and is located within the candidate effective time window of the corresponding trend segment.

[0029] This constraint limits the solution range from three perspectives: recording the time ensures that the effective time will not be earlier than the eating action itself; the maximum physiological delay time limits the upper limit of the delay, eliminating outlier solutions that deviate excessively; and the candidate effective time window is based on the shape of the blood glucose curve, requiring that the solved effective time be consistent with the observed trend inflection interval. These three constraints work together to prevent the optimization results from deviating from physiological reality.

[0030] Furthermore, the loss function L used in the joint fine-tuning is composed of a weighted sum of the fitting error term L1 and the mutual exclusion constraint term R.

[0031] L1 represents the mean square error between the residual blood glucose curve and the composite waveform. The composite waveform is the sum of the postprandial blood glucose response waveform W1(t) and the post-exercise blood glucose response waveform W2(t). The residual blood glucose curve is the curve obtained by subtracting the historical residual response from the observed blood glucose value. This fitting error term ensures that the superposition of the two decoupled waveforms can accurately reconstruct the observed blood glucose changes.

[0032] R includes an overlap penalty term R1 and a peak-valley interlocking constraint term R2. R1 is the negative of the integral of the product of W1(t) and W2(t) over the overlapping period. Since dietary response raises blood glucose and exercise response lowers blood glucose, W1(t) and W2(t) have opposite signs, and their product is negative over the overlapping period. Taking the negative, this term has a larger value when the waveform amplitude is large and the overlap is deep. When the optimization attempts to cancel each other out by overlapping the two large-amplitude waveforms in time, the penalty imposed by R1 increases accordingly, thereby suppressing the occurrence of such non-physiological mirror cancellation solutions.

[0033] R² is the absolute value of the difference between t1 and t2. t1 is the time when the first derivative of W1(t) reaches its maximum value, corresponding to the moment when blood glucose rises the fastest; t2 is the time when the first derivative of W2(t) reaches its minimum value, corresponding to the moment when blood glucose falls the fastest. This constraint limits the time distance between the fastest rise in blood glucose due to diet and the fastest drop in blood glucose due to exercise, preventing the two peak moments from being excessively separated during optimization and maintaining their reasonable temporal relationship.

[0034] Furthermore, in step S6, the decoupled records stored in the individual metabolic archive are marked as decoupled to distinguish them from the original event records that have not yet undergone alternating optimization. Each decoupled record also includes the effective duration of the pure blood glucose response waveform, used to determine whether the event still has residual effects at a specific time during subsequent prediction.

[0035] Furthermore, the individual average delay is the individual average gastric emptying delay or exercise onset delay. When the number of decoupled records in the individual metabolic archive reaches a preset number, the individual average delay is the arithmetic mean of the differences between the physiological effective time and the recording time of each decoupled record, reflecting the average level of the offset between the recording time of the user's diet or exercise event and the physiological effective time.

[0036] When the number of decoupled records is less than a preset number, the average individual latency is set to a preset group statistical default value. This default value provides the basis for time correction when the method is first run or when there are insufficient decoupled records, ensuring that the method can still operate normally during the stage of insufficient individual data accumulation. As the number of decoupled records increases, the average individual latency gradually transitions from the default value to a statistical value based on the user's own data, thereby improving the correction accuracy.

[0037] Furthermore, the method for extracting the pure blood glucose response waveform of historical events in S8 is as follows: traverse the records in the decoupled state in the individual metabolic archive, and if the sum of the physiological effective time and effective duration of a certain record is later than the future prediction time, then calculate the amplitude of the pure blood glucose response waveform at the future prediction time.

[0038] All extracted amplitudes are summed with the individual's baseline blood glucose level and the amplitude of the blood glucose response waveform at the future prediction time to obtain the predicted blood glucose value at that time. This summation process treats the blood glucose value at the future prediction time as the superposition of all historical event responses still having an effect at that time and the current new event response, thereby achieving the prediction of future blood glucose values.

[0039] Furthermore, the future blood glucose fluctuation trend prediction result output in S8 includes a blood glucose prediction curve within a preset time period, as well as attribution information for the predicted blood glucose values ​​at each prediction time. The attribution information includes the recording time, physiological effective time, and response amplitude of each dietary or exercise event that constitutes the predicted value. Through the attribution information, users can understand which specific events' residual effects drive the current blood glucose change, and the direction and magnitude of each event's contribution.

[0040] The technical effects and advantages of this invention are as follows: First, this invention treats the physiological effective time of an event as the variable to be solved, decoupling the metabolic response of each event from continuous blood glucose monitoring data in reverse, rather than directly using the recording time as the metabolic effective time. Candidate effective time windows are determined by detecting trend inflection points in the blood glucose curve. An initial response waveform is generated using a personalized metabolic response basis function library. Then, through alternating optimization and joint fine-tuning with mutual exclusion constraints, the pure response waveforms and true physiological effective times of each event are separated from the superimposed blood glucose signals. This method avoids alignment errors introduced by the inconsistency between the recording time and the effective time.

[0041] Second, this invention utilizes decoupled event records accumulated in an individual metabolic archive to statistically analyze the individual's average gastric emptying delay and exercise onset delay, and then corrects the recording time of newly entered events. As decoupled records accumulate during use, this correction gradually approximates the user's individual physiological characteristics, helping to improve the timing accuracy of the initial response waveform of new events.

[0042] Third, this invention achieves prediction by superimposing and extrapolating the pure response waveforms of decoupled events, and outputs the attribution information of each event to the predicted value, so that users can understand which specific dietary or exercise events drive the current blood glucose change, which helps to provide users with an understandable reference for blood glucose management. Attached Figure Description

[0043] Figure 1 This is a schematic diagram of the overall working process of the method of the present invention; Figure 2 This is a detailed flowchart of the trend inflection point detection and trend segment marking of the present invention; Figure 3 This is a detailed flowchart of the alternating optimization decoupling of the present invention. Detailed Implementation

[0044] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0045] Example 1 As attached Figures 1 to 3 This paper presents a method for predicting blood glucose fluctuation trends that integrates diet and exercise. The specific implementation process is explained in detail below, with reference to steps S1 to S8.

[0046] S1: Obtain basic data Users obtain continuous blood glucose monitoring sequences through dynamic blood glucose monitoring devices. The sampling interval is 5 minutes. A sequence of blood glucose values ​​arranged in chronological order is denoted as . ,in For the first The blood glucose value at each sampling time, in mmol / L.

[0047] Dietary event records are entered by users via a smartphone app or a dedicated terminal, and each record includes the recording time. Carbohydrate content and fat ratio . The unit is g. The percentage of total energy from fat in the meal. Exercise event records are also entered by the user, with each record including the recording time. Exercise type coding and exercise intensity , It is represented by metabolic equivalents (METs). The exercise type is coded as a preset discrete value, such as brisk walking coded as 1, jogging coded as 2, and resistance training coded as 3, which can be expanded according to actual needs.

[0048] Individual baseline blood glucose level The method of obtaining the data is as follows: All blood glucose monitoring values ​​of the user during the period from 0:00 to 4:00 AM over several consecutive nights are collected, and their arithmetic mean is calculated as the average. During this period, users are in a fasting, resting state, and their blood glucose levels are relatively stable. If data for this period is missing, the timeframe is extended forward to 5:00 AM and backward to 11:00 PM the previous day, using the average of the available data as the mean. .

[0049] S2: Trend Reversal Point Detection and Trend Segment Marking Continuous blood glucose monitoring sequences Trend inflection point detection is performed by adaptively segmenting the blood glucose curve into multiple trend segments and labeling each segment with an event type hypothesis. This step automatically identifies the intervals of metabolic events from the morphological changes in the blood glucose curve, providing candidate time windows for subsequent decoupling.

[0050] In one implementation, a multi-scale curvature analysis method is used to complete the detection. Three time window scales are preset. , , ,satisfy ,generally Take 15 minutes. Take 30 minutes. The time frame is 45 minutes. For each window, a moving average smoothing is performed on the blood glucose values ​​within that window length to obtain a smoothed curve. Moving averages can effectively suppress the influence of measurement noise on curvature calculations.

[0051] exist The first derivative is calculated at each sampling point using the finite difference method. and second derivative The first derivative reflects the rate of change in blood glucose, and the second derivative reflects the change in the rate of change. Then, the instantaneous curvature is calculated:

[0052] curvature value The larger the value, the more drastic the curve bends at that point, and the more likely it corresponds to the starting point of a metabolic event.

[0053] In the curvature sequence, curvature values ​​greater than a preset threshold are... Points that are local maxima are considered candidate inflection points at that scale. Take the standard deviation of an individual's blood glucose over the past 24 hours If the data from the past 24 hours is insufficient, then .

[0054] This adaptive threshold can accommodate the fluctuations in blood glucose levels for different users. Points that are identified as candidate inflection points at at least two scales are determined as the final trend inflection points. The multi-scale consistency requirement can effectively filter out false positives from noise at a single scale.

[0055] The segment of the blood glucose curve between two adjacent trend inflection points constitutes a trend segment, and its time interval is a closed interval. This interval is defined as the candidate effective time window for events within the trend segment. For each trend segment, the total change is calculated. .

[0056] like If the value exceeds the rising threshold, it is marked as a dietary event-driven glycemic process; like If the blood sugar level is below the threshold and the preceding trend segment was a blood sugar-raising process, it is marked as a blood sugar-lowering process dominated by the exercise event.

[0057] The threshold for the increase is 0.3 times the average increase in postprandial blood glucose for an individual; if no historical data is available, it is 1.0 mmol / L. The threshold for blood glucose reduction is the negative value of 0.3 times the average reduction in blood glucose after exercise for an individual; if no historical data is available, it is -0.5 mmol / L.

[0058] In another implementation, trend inflection point detection can employ a slope sign change method combined with an amplitude threshold. The blood glucose sequence is traversed, and the difference between adjacent sampling points is calculated. When the sign of the difference changes from positive to negative or vice versa, that point is recorded as a candidate inflection point, and the total blood glucose change over the three sampling points before and after it is calculated. If the total change is greater than 0.3 mmol / L, it is determined as a valid trend inflection point. Subsequent trend segment division and labeling are performed in the same way. This method avoids the complex calculation of curvature and is suitable for terminal devices with limited computing resources.

[0059] S3: Establish a library of individualized metabolic response basis functions A base function library for dietary response and a base function library for exercise response are established based on individual metabolic history data. These are used to dynamically generate metabolic response waveforms based on event characteristics. (Postprandial blood glucose response waveform) From the first shape parameter Controlled generation of post-exercise blood glucose response waveform By the second shape parameter The generation of blood glucose is controlled by an impulse response function with physiological delay, which can characterize the physiological process of blood glucose rising and then falling or falling and then recovering.

[0060] Regarding dietary events, when hour,

[0061] when hour, .in The amplitude parameter determines the peak height; , For decay rate parameters, This ensures that the waveform rises first and then falls. The components are directly determined , , The value of is usually It is a three-dimensional vector, with three components corresponding to these three parameters.

[0062] For sports events, when hour,

[0063] when hour, .in For amplitude parameters, , For decay rate parameters, Since exercise lowers blood sugar, the magnitude of the drop is taken as a negative value. The components are directly determined , , The value of .

[0064] First shape parameter From the first mapping network generate, The input is and The output is Second shape parameter By the second mapping network generate, The input is the motion type code and The output is . and Both use a two-layer fully connected feedforward neural network with 8 hidden layer nodes and a modified linear unit activation function.

[0065] The training process of this network follows conventional techniques in the field. It uses features of a single-event blood glucose response segment selected from historical data as input, and the shape parameters obtained by fitting the segment as labels. The network is then trained using a mean squared error loss function and an Adam optimizer. When individual historical data is insufficient, the model is pre-trained using a population dataset and then fine-tuned using individual data, enabling the mapping network to learn the correspondence between event features and the shape of the metabolic response waveform.

[0066] S4: Establish a superposition decomposition model and subtract historical residual responses. For each trend segment obtained in step S2, establish an overlay decomposition model. Using the current trend segment... For example, the model interprets blood glucose changes within a trend segment as the superposition of the current event response and the residual effects of historical events.

[0067] First, decoupled historical events are retrieved from the individual metabolic archive. A decoupled historical event must meet two conditions simultaneously: it must be marked as decoupled in the archive, and... .in The physiological effective moment of decoupled historical events. For effective duration, it is defined as from From the moment the waveform amplitude decays to its peak amplitude The length of time that has elapsed. This is the end time of the response to the event. If this time is greater than... This indicates that the event occurred in There are still residual effects at any time.

[0068] For each historical event that meets the criteria, extract its pure blood glucose response waveform. The amplitude of each sampling point within the sample, and the sampling point and The sampling times are aligned. The amplitudes of all events that meet the conditions are summed at the same sampling point to obtain the historical residual response curve. If there are currently no decoupled historical events that meet the conditions, .

[0069] From blood glucose observation values deducting from The residual blood glucose curve was obtained. .Will The model is a superposition of dietary event responses and exercise event responses within the current trend segment:

[0070] in , For the physiological effective time and first shape parameter of the dietary event, , The four variables, namely the physiological effective time of the motion event and the second shape parameter, constitute the variables to be solved.

[0071] S5: Alternating Optimization Decoupling with Mutually Exclusive Constraints This step starts from The pure response waveform and physiological effective time of each event are separated, and a solution strategy of "initial estimation-alternating optimization-joint fine-tuning" is adopted.

[0072] S5.1: Initial Response Estimation for Generating Motion Events Alternating optimization begins with initialization of the motion event. First, the timing of the initial activation of the motion physiology is determined. Based on the recording time of the motion event Plus the average onset delay of exercise onset To obtain, that is . The meaning and acquisition method are explained in step S7. (Initial run) Use the default value of 10 minutes.

[0073] Then generate the initial shape parameters. Encode the type of exercise and the intensity of exercise. Input the second mapping network trained in step S3 , Output Finally, and Substitution The generating function is used to calculate the initial motion response waveform. , as a known quantity in the first round of alternation.

[0074] S5.2: First round of alternation – fix exercise parameters, optimize dietary parameters From the residual blood glucose curve Subtract the current motion response estimate from each sampling point The first residual curve is obtained. . It reflects the changes in blood glucose dominated by dietary events after deducting the effects of exercise.

[0075] by To fit the target, the dietary events and Optimize, with the goal of minimizing and The mean square error. Apply time rationality constraints: and This constraint will The timeframe is limited to a reasonable interval of 5 to 60 minutes after the dietary record is taken, and must fall within the candidate effective time window determined in step S2.

[0076] This constrained nonlinear least squares problem is solved using the L-BFGS quasi-Newton algorithm, a common numerical optimization method in this field. The objective function, the variables to be optimized, and the constraints are input into the algorithm, and the optimized result is output. and The dietary response waveform was obtained. .

[0077] S5.3: Second Alternation – Fix Dietary Parameters, Optimize Exercise Parameters from Subtracting the first round of optimization from the sampling points in the middle The second residual curve is obtained. . It reflects the blood glucose changes dominated by exercise events after adjusting for dietary effects.

[0078] by For the purpose of the motion event and Optimize, with the goal of minimizing and The mean square error. The constraint condition is... and The L-BFGS algorithm is also used to solve this problem, and the optimized output is given. and The motion response waveform is obtained. .

[0079] S5.4: Multiple rounds of alternating execution The above steps S5.2 and S5.3 constitute a complete alternation. This alternation process is repeated three times, with each round building upon the optimization results of the previous round. Through iterative iteration, the parameters of the diet and exercise events are gradually corrected, alternately approximating their true values. After three rounds of alternation, the parameters typically converge to a relatively optimal neighborhood, providing a good starting point for subsequent joint fine-tuning.

[0080] S5.5: Joint Fine-tuning After three rounds of alternation, for , , , Simultaneously, fine-tuning is performed jointly to obtain the globally optimal solution. The loss function for joint fine-tuning... It consists of a weighted sum of the fitting error term and the mutually exclusive constraint term, i.e. ,in is the weighting coefficient, set to 0.1, used to balance fitting accuracy and constraint strength.

[0081] For the fitting error term, . This represents the mean square error calculation, i.e. and The mean of the sum of squares of the differences at each sampling point. This term ensures that the observed blood glucose changes can be accurately reconstructed after the two decoupled waveforms are superimposed.

[0082] Mutual Exclusion Constraints .

[0083] For the effect overlap region penalty term, The integration interval is and The overlapping time period. The starting point of the overlapping time period is taken as... and The larger value in the middle, the endpoint is taken and The smaller value in and Each under the current parameters and The effective duration, calculation method and step S4 The definitions are the same.

[0084] If the starting point The endpoint indicates that the two waveforms do not overlap. Because dietary responses cause a rise in blood sugar ( Exercise response lowers blood sugar ( ), the product of the two After taking the negative When two waveforms have large amplitudes during the overlapping period and produce mirror cancellation, the absolute value of the product is very large. The value is also very large, thus imposing a penalty in the loss function, forcing the optimization to avoid this solution that does not conform to physiological common sense.

[0085] This is a peak-valley interlock constraint term. .in for The time when the first derivative reaches its maximum value corresponds to the point where blood sugar rises the fastest. for The time when the first derivative reaches its minimum corresponds to the point where blood glucose decreases most rapidly. This constraint penalizes cases where the two events are excessively separated on the time axis, ensuring that the two decoupled events conform to the actual metabolic interaction process in terms of time sequence.

[0086] The joint fine-tuning employs gradient descent, a standard optimization algorithm in this field. The loss function is then used. The algorithm takes four variables to be optimized as input, calculates the gradient of the loss function with respect to each variable, and iteratively updates the variable values ​​along the gradient descent direction. The learning rate is 0.01, and the maximum number of iterations is 50. After convergence, the algorithm outputs the dietary event. and and sports events and .

[0087] S6: Decoupling events are stored in the individual metabolic archive. Each event separated in step S5 is stored as a record in the individual metabolic profile. Each record includes: event type, recording time, and physiological effect time. Pure blood glucose response waveform (with) (Storage of amplitude sequences with the same sampling interval) and effective duration And information on nutrients or strength.

[0088] The event type is either diet or exercise. Diet event storage. and Motion events store motion type and Each record is marked as decoupled upon entry, distinguishing it from the original, undecoupled records. As the method continues to be used, decoupled events accumulate in the archive, providing a data foundation for individual latency statistics and predictive overlay.

[0089] S7: New Event Entry and Initial Correction When a user enters a new dietary event or a new exercise event, the first step is to... and enter Or encode the motion type and enter , to obtain the corresponding or Then, the waveform is substituted into the corresponding waveform generation function to obtain the initial response waveform.

[0090] Then, the average individual delay was statistically analyzed using historical decoupling records from the archive, and the recording time was corrected. Average individual gastric emptying delay for eating events. The statistical method is as follows: If the number of decoupled dietary event records in the archive is no less than 5 For each record and The arithmetic mean of the differences; If there are fewer than 5 items Use the default value of 20 minutes for the group.

[0091] Delay in the onset of motion events The statistical method is as follows: If the number of decoupled motion event records is no less than 5 For each record and The arithmetic mean of the differences; If there are fewer than 5 items The default value of 10 minutes is used for the group. When the method is run for the first time, there are no decoupling records in the archive, so the default value is used directly to ensure the method's cold start capability.

[0092] The estimated physiological timing of the new dietary event Predicted physiological activation time of new motor events By combining the estimated physiological response time with the initial response waveform, the complete initial response waveform of the new event can be obtained.

[0093] S8: Prediction and Attribution Output of Future Blood Glucose Fluctuation Trends Set prediction duration and step length Based on the last blood glucose sampling time Generate a predicted time series based on the baseline: , , .For example , ,but The predicted times are 12:15, 12:30, ..., 14:00.

[0094] For each prediction time Iterate through all decoupled event records in the archive. If a certain record... This indicates that the event occurred at time [time]. If residual effects still exist, extract the pure blood glucose response waveform. amplitude All those that meet the conditions Seeking peace has made a historical contribution. .

[0095] calculate Blood glucose prediction values: ,in The initial blood glucose response waveform for a new event is in The amplitude, if no new events are recorded. .

[0096] Repeat the above calculation for each prediction time to obtain the future. Hourly blood glucose prediction curve. It also outputs attribution information for each prediction time point, presented in list format. The components: The contribution value, the event type of each contribution history event, and the recording time. and The event type, recording time, estimated physiological effect time, and other details of the new event. Users can intuitively understand the composition of blood glucose values ​​at any given time through attribution information.

[0097] Scenario Example The following is a specific scenario to illustrate the overall process. The user records their lunch at 12:00 (…). g, ), 12:40 record of brisk walking ( METs).

[0098] In S2, the blood glucose curve for this period is divided into a blood glucose rising trend segment and a blood glucose falling trend segment.

[0099] In S5, the initial physiological activation time of exercise. 12:40 min After three rounds of alternating optimization and joint fine-tuning, the algorithm converged, and the physiological effect time of lunch was determined. The physiological effects of brisk walking .

[0100] The contribution of lunch residue response in the archive when predicting 13:30 blood glucose levels mmol / L, contribution of residual response during fast walking mmol / L, baseline blood glucose mmol / L, a new snack event was recorded at 13:00 ( g, Estimated contribution mmol / L, predicted blood glucose level mmol / L. Attribution information clearly shows the quantitative impact of each event on blood glucose.

[0101] The above embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. Any appropriate adjustments or equivalent substitutions made by those skilled in the art to the parameter values, optimization algorithm selection, and specific forms of basis functions involved in each step without departing from the technical concept should be included within the scope of protection of this invention.

Claims

1. A method of predicting blood glucose fluctuation trend by fusing diet exercise, characterized by, include: S1: Obtain the user's continuous blood glucose monitoring sequence, as well as dietary event records and exercise event records with recording time. The dietary event records include carbohydrate content and fat ratio, and the exercise event records include exercise type and exercise intensity. S2: Detect trend inflection points in the continuous blood glucose monitoring sequence, divide the blood glucose curve into multiple trend segments, label each trend segment with an event type hypothesis, and use the time interval of the trend segment as a candidate effective time window; S3: Based on individual metabolic history data, establish a dietary response basis function library and an exercise response basis function library. The postprandial blood glucose response waveform in the dietary response basis function library is controlled by a first shape parameter, and the post-exercise blood glucose response waveform in the exercise response basis function library is controlled by a second shape parameter. S4: For each trend segment, retrieve decoupled historical events whose response validity period covers the current trend segment from the individual metabolic archive. Subtract the residual response of the decoupled historical events from the blood glucose observation values ​​within the trend segment, and represent them as the superposition of dietary event response and exercise event response. The physiological effective time and shape parameters of each event are used as variables to be solved. S5: Alternately optimize the physiological timing and shape parameters of dietary and exercise events, and optimize the other parameter while keeping one parameter fixed during the alternation process; After the alternation is completed, joint fine-tuning is performed. The loss function of the joint fine-tuning includes a fitting error term and a mutual exclusion constraint term. The pure blood glucose response waveforms and their physiological activation times for each event were obtained by separation; S6: Store the separated events as decoupled records in the individual metabolic archive. The stored content should include at least the event type, recording time, the obtained physiological effective time, and the pure blood glucose response waveform. S7: When a new dietary event or exercise event is recorded, an initial blood glucose response waveform is generated based on its nutrient or intensity information, and the average delay of the individual is calculated using the decoupled records in the individual metabolic archive, and the recording time is corrected to the estimated physiological effective time. S8: Extract all decoupled, pure blood glucose response waveforms with response validity periods covering future prediction times from the individual metabolic archive, overlay them on the time axis with the blood glucose response waveform of the new event, and output the prediction result of future blood glucose fluctuation trends.

2. The method for predicting blood glucose fluctuation trends by integrating diet and exercise according to claim 1, characterized in that, The method for detecting trend turning points in S2 is as follows: Calculate the instantaneous curvature of the continuous blood glucose monitoring sequence at multiple scales, take the curvature maxima as trend inflection points, and the blood glucose curve segments between adjacent trend inflection points constitute a trend segment. For the overall upward trend of blood glucose levels, it is marked as a glycemic process dominated by dietary events; For the overall downward trend of blood glucose levels, it is marked as a glucose-lowering process dominated by exercise events.

3. The method for predicting blood glucose fluctuation trends by integrating diet and exercise according to claim 1, characterized in that, The shape parameters of the diet response basis function library in S3 are dynamically generated by the carbohydrate content and fat ratio of the diet event through the first mapping network, and the shape parameters of the motion response basis function library are dynamically generated by the motion type and motion intensity of the motion event through the second mapping network.

4. The method for predicting blood glucose fluctuation trends by integrating diet and exercise according to claim 1, characterized in that, The alternating optimization solution method in S5 is as follows: The initial physiological activation time of the movement is taken as the recording time of the movement event plus the individual average movement onset delay. The initial second shape parameters are generated by the second mapping network to construct the initial movement response waveform. With fixed exercise event parameters, the current exercise response estimate is subtracted from the blood glucose observation, the physiological effective time and first shape parameter of the diet event are optimized using the residual curve, and a time rationality constraint is applied. When the parameters of the dietary event are fixed, the current dietary response estimate is subtracted from the blood glucose observation, and the residual curve is used to optimize the physiological effective time and second shape parameters of the exercise event. After multiple rounds of alternating execution, the parameters for dietary and exercise events are jointly fine-tuned.

5. The method for predicting blood glucose fluctuation trends by integrating diet and exercise according to claim 4, characterized in that, The time reasonableness constraints include: The physiological effective time of the dietary event is determined to be after the event recording time and not exceeding the preset maximum physiological delay time, and is located within the candidate effective time window of the corresponding trend segment.

6. The method for predicting blood glucose fluctuation trends by integrating diet and exercise according to claim 4, characterized in that, The loss function L used in the joint fine-tuning is composed of a weighted sum of the fitting error term L1 and the mutual exclusion constraint term R, where: L1 is the mean square error between the residual blood glucose curve and the synthesized waveform. The synthesized waveform is the sum of the postprandial blood glucose response waveform W1(t) and the post-exercise blood glucose response waveform W2(t). The residual blood glucose curve is the curve after subtracting the historical residual response from the observed blood glucose value. R includes the effect overlap region penalty term R1 and the peak-valley interlocking constraint term R2; R1 is the negative of the integral of the product of W1(t) and W2(t) over the overlapping time interval; R2 is the absolute value of the difference between t1 and t2, t1 is the time when the first derivative of W1(t) reaches its maximum value, and t2 is the time when the first derivative of W2(t) reaches its minimum value.

7. The method for predicting blood glucose fluctuation trends by integrating diet and exercise according to claim 1, characterized in that, In S6, the decoupled records stored in the individual metabolic archive are marked as decoupled to distinguish them from the original event records that have not yet undergone alternating optimization. Each decoupled record also contains the effective duration of the pure blood glucose response waveform.

8. The method for predicting blood glucose fluctuation trends by integrating diet and exercise according to claim 7, characterized in that, The individual average delay is the individual average gastric emptying delay or the exercise onset delay. When the number of records in the individual metabolic archive that are in a decoupled state reaches a preset number, the average delay of the individual is the arithmetic mean of the difference between the physiological effective time and the recording time of each decoupled record. When the number of records in the decoupled state does not reach the preset number, the average delay of the individual is taken as the preset group statistical default value.

9. The method for predicting blood glucose fluctuation trends by integrating diet and exercise according to claim 7, characterized in that, The method for extracting the pure blood glucose response waveform of historical events in S8 is as follows: Traverse the decoupled records in the individual metabolic archive. If the sum of the physiological effective time and effective duration of a record is later than the future prediction time, calculate the amplitude of the pure blood glucose response waveform at the future prediction time. All extracted amplitudes are summed with the individual's baseline blood glucose value and the amplitude of the new event's blood glucose response waveform at the future prediction time to obtain the predicted blood glucose value at that prediction time.

10. The method for predicting blood glucose fluctuation trends by integrating diet and exercise according to claim 1, characterized in that, The future blood glucose fluctuation trend prediction result output in S8 includes the blood glucose prediction curve within a preset time period in the future, as well as the attribution information of the blood glucose prediction value at each prediction time. The attribution information includes the recording time, physiological effective time and response amplitude of each dietary event or exercise event that constitutes the prediction value.