A dynamic blood glucose prediction and management method, system, device and medium
By integrating multi-source data and using online transfer learning, the problem of insufficient accuracy in blood glucose prediction has been solved, enabling personalized and safe blood glucose management, improving blood glucose control effectiveness and automation, and reducing the risk of acute illness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING HUAYI JINGDIAN BIOTECHNOLOGY CO LTD
- Filing Date
- 2026-02-24
- Publication Date
- 2026-06-05
AI Technical Summary
Existing technologies lack effective mechanisms for integrating and collaboratively analyzing multi-source data, resulting in insufficient accuracy in predicting blood glucose changes and making it difficult to achieve personalized and forward-looking interventions. Furthermore, existing solutions suffer from low levels of automation and insufficient safety, increasing the medical burden and delaying the timing of interventions.
The system receives multi-source data streams through an IoT gateway, performs data cleaning and timestamp alignment, extracts time-domain, frequency-domain, and nonlinear features, constructs high-dimensional feature vectors, and generates personalized blood sugar control solutions by combining pre-trained models and near-end strategy optimization algorithms. The model is then updated through online transfer learning to ensure both safety and personalization.
It achieves high-precision and forward-looking blood glucose management, improves blood sugar control, reduces the risk of emergencies, alleviates the burden on medical staff and patients, ensures safety and automation, and realizes the intelligentization of precision medicine.
Smart Images

Figure CN122153618A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of medical artificial intelligence technology, and in particular to a method, system, device and medium for dynamic blood glucose prediction and management. Background Technology
[0002] As diabetes has become one of the major chronic diseases threatening human health worldwide, its management has gradually shifted from traditional intermittent monitoring and static protocol adjustments towards digitalization and continuous management. In recent years, the widespread adoption of continuous glucose monitoring, wearable devices, and mobile health applications has made it possible to collect massive amounts of real-time physiological data from patients, laying the technological foundation for precision glucose management. Medical institutions and researchers increasingly hope to leverage this multidimensional data to gain a more comprehensive and dynamic understanding of patients' blood glucose fluctuations, thereby providing more effective individualized interventions and improving overall disease management efficiency and patients' quality of life.
[0003] However, despite enhanced data acquisition capabilities, the lack of effective integration and collaborative analysis mechanisms within existing technological frameworks, stemming from the often isolated nature of data from different devices and sources, leads to a fragmented understanding of patient health and hinders the formation of a holistic view. Secondly, for dynamic changes in physiological indicators like blood glucose, which are intricately influenced by factors such as diet, exercise, emotions, and medications, the predictive accuracy and foresight are often insufficient, making it difficult to support effective early intervention. In the decision-making process, existing solutions either have limited automation, still requiring frequent manual adjustments by healthcare professionals, resulting in delayed responses; or lack sufficient safety barriers to ensure the absolute reliability of personalized solutions generated by algorithms, thus limiting their application in critical medical scenarios. This not only increases the burden on healthcare but also delays intervention opportunities. Summary of the Invention
[0004] To address the aforementioned technical issues, this application provides a method, system, device, and medium for dynamic blood glucose prediction and management.
[0005] Firstly, this application provides a method for dynamic blood glucose prediction and management, employing the following technical solution: A method for dynamic blood glucose prediction and management, the method comprising: The system receives raw user data streams via an IoT gateway; these raw user data streams include time-series blood glucose data, physiological parameter data, environmental indicator data, and dietary logs and medication dosage data from the user's terminal. Perform data cleaning and timestamp alignment on the user's raw data stream to generate a time-aligned multi-source dataset; Time-domain statistical features, frequency-domain transformation features, and metabolic stability nonlinear features are extracted from the multi-source dataset to construct a high-dimensional feature vector. The high-dimensional feature vector is input into a pre-trained blood glucose prediction model, which outputs a sequence of predicted blood glucose values for a specified future time period. The system acquires current blood glucose levels, real-time carbohydrate intake, and exercise intensity data. Combined with the blood glucose prediction sequence, it generates insulin dose adjustment instructions and dietary recommendations through a proximal strategy optimization algorithm to obtain a personalized blood glucose control plan. The personalized blood sugar control plan is validated by calling a preset clinical rule base, and a validated safe blood sugar control plan is generated. The safe blood sugar control plan is distributed to the user terminal and the doctor monitoring platform; Collect time-series blood glucose data after the user implements the safe blood glucose control plan, and update the weight matrix of the blood glucose prediction model through online transfer learning.
[0006] By adopting the above-mentioned technical solution, traditional passive-response blood glucose management is elevated to a proactive, highly personalized, and continuously optimizing precision medical intervention. This technical solution not only improves the rate of achieving blood glucose control targets and reduces the risk of emergencies, but also reduces the burden on both doctors and patients through human-machine collaboration. Ultimately, while ensuring the highest level of safety, it achieves intelligent and automated diabetes management, which has significant clinical value and practical significance.
[0007] Optionally, the step of extracting time-domain statistical features, frequency-domain transform features, and metabolic stability nonlinear features from the multi-source dataset to construct a high-dimensional feature vector includes: The time-aligned multi-source dataset is segmented using a sliding window to generate a set of equal-length time series segments of physiological parameters. Perform time-domain statistical processing on each time series segment, calculate the mean, variance, range and autocorrelation coefficient, and generate a subset of time-domain statistical features; Perform frequency domain transformation on each time series segment to extract frequency domain energy distribution features and the amplitude of the dominant frequency component, and generate a subset of frequency domain transformation features. Nonlinear dynamic analysis is performed on each time series segment to quantify the degree of metabolic homeostasis fluctuation and generate a subset of nonlinear features of metabolic stability. The time-domain statistical feature subset, frequency-domain transform feature subset, and metabolic stability nonlinear feature subset of the same time segment are concatenated into vectors to generate a single-window feature vector; The high-dimensional feature vector is constructed by aggregating the single-window feature vectors of all time segments.
[0008] By adopting the above technical solutions, the understanding depth and pattern recognition ability of subsequent blood glucose prediction models for complex physiological signals are fundamentally improved. This enables the models to not only capture explicit statistical regularities, but also to understand implicit periodic rhythms and intrinsic dynamic stability. This is the core technical foundation for achieving high-precision, forward-looking, and personalized blood glucose management, and significantly enhances the intelligence level and clinical applicability of the entire system.
[0009] Optionally, the step of inputting the high-dimensional feature vector into a pre-trained blood glucose prediction model and outputting a sequence of predicted blood glucose values for a specified future time period includes: The high-dimensional feature vector input is sliced in the time dimension to generate a sequence of feature segments synchronized with the physiological cycle, which is then input into a pre-trained blood glucose prediction model. The feature segment sequence is analyzed layer by layer by the temporal feature extraction module to capture the long-term dependency of blood glucose changes and generate hidden state temporal codes. An attention-weighted operation is performed on the hidden state temporal encoding to highlight the influence weight of key time nodes on the prediction target, and a weighted feature representation is generated. The weighted feature representation is input into a fully connected regression layer to calculate the predicted blood glucose values for multiple consecutive time points in the future. The predicted blood glucose values at multiple consecutive time points are aggregated in chronological order to generate a sequence of predicted blood glucose values for the specified future time period.
[0010] By adopting the above technical solutions, we can not only extract deep dynamic patterns related to blood glucose changes from complex multimodal time-series data, but also intelligently focus on the impact of key physiological events and have the ability to self-optimize in response to individual differences and metabolic state drift, thereby transforming blood glucose management from passive responsive monitoring to proactive, personalized, and precise intervention.
[0011] Optionally, the steps of acquiring current blood glucose levels, real-time carbohydrate intake, and exercise intensity data, and combining them with the predicted blood glucose value sequence to generate insulin dose adjustment instructions and dietary recommendations through a proximal strategy optimization algorithm to obtain a personalized blood glucose control plan include: Obtain current blood glucose levels, real-time carbohydrate intake, and exercise intensity data; The current blood glucose value is superimposed onto the starting time point of the predicted blood glucose value sequence to construct a complete blood glucose time series trajectory; Integrate the blood glucose time-series trajectory, real-time carbohydrate intake, and exercise intensity data to generate a current metabolic state feature vector; Based on pre-stored user vital signs data, metabolic equivalent parameters and insulin sensitivity coefficients are calculated to generate individualized physiological regulatory factors; The current metabolic state feature vector and individualized physiological regulatory factors are input into a pre-trained proximal strategy optimization algorithm model, which outputs the insulin dose adjustment and carbohydrate supplementation amount in a constrained action space. The insulin dose adjustment and carbohydrate supplementation amounts are converted into insulin dose adjustment instructions and dietary recommendation instructions; The personalized blood sugar control plan is constructed by combining the insulin dose adjustment instructions and dietary advice instructions and then marked with a timestamp.
[0012] By adopting the above technical solutions, complex clinical decision-making problems under multi-objective constraints are transformed into a computable, data-driven optimization process. This not only ensures the forward-looking and scientific nature of intervention measures, but also, through strict individualized calibration and safety constraints, makes them both accurate and safe, achieving a deep integration of precision medicine and digital health technology.
[0013] Optionally, the step of calling a preset clinical rule base to perform safety rule verification on the personalized blood sugar control plan and generating a verified safe blood sugar control plan includes: Analyze the insulin dose adjustment instructions and dietary recommendation instructions in the personalized blood sugar control plan, and extract the blood sugar control parameters to be executed; Obtain the user's current physiological state data and match the corresponding safety threshold rule set from the preset clinical rule base; The sugar control parameters to be executed are dynamically compared with the safety threshold rule set to detect whether there is a risk of parameters going out of bounds; If a risk of parameter out-of-bounds is detected, the sugar control parameters to be executed are corrected based on a predefined constraint optimization strategy to generate corrected sugar control parameters. Reconstruct insulin dosage adjustment instructions and dietary recommendations based on the revised blood sugar control parameters; The reconstructed instructions are combined and bound with a verification timestamp to generate the safe sugar control scheme.
[0014] By adopting the above technical solutions, it is ensured that every output blood sugar control plan not only theoretically pursues optimal blood sugar control effects, but also absolutely meets the individualized safety constraints of patients in practice. The safety knowledge and experience of clinical experts are transformed into automatically executable computer algorithms, achieving full automation, real-time monitoring, and precision in safety supervision, providing core technical guarantees for the safe and reliable deployment of this system in critical medical scenarios.
[0015] Optionally, the step of collecting time-series blood glucose data after the user implements the safe blood glucose control plan and updating the weight matrix of the blood glucose prediction model through online transfer learning includes: Receive execution feedback data stream uploaded by the user terminal, including continuous blood glucose monitoring values, real-time physiological parameters and environmental indicators after the user executes the safe blood sugar control plan; The execution feedback data stream is correlated and aligned with the execution time interval of the corresponding safe sugar control scheme to generate a labeled incremental training dataset; The online learner is initialized based on the current weight matrix of the blood glucose prediction model, and the feature distribution benchmark of the historical training data is loaded. The online learner is used to perform forward inference on the incremental training dataset to calculate the error loss function between the predicted blood glucose value and the actual blood glucose monitoring value. The weight parameters of the online learner are updated using the gradient backpropagation algorithm, and the parameter update magnitude is constrained by a dynamic learning rate decay strategy. The updated weight parameters are integrated into the weight matrix of the blood glucose prediction model, overriding the original model parameters to complete online transfer learning.
[0016] By adopting the above technical solutions, it can be ensured that after deployment, the model is no longer a static tool that gradually becomes detached from the user's physiological changes, but an intelligent entity capable of learning from each intervention practice, dynamically tracking the user's metabolic state drift, and continuously self-calibrating. This capability enables the system's predictions and decisions to become increasingly accurate and personalized over time, thereby maximizing long-term clinical efficacy while ensuring safety and reliability.
[0017] Optionally, after the step of collecting time-series blood glucose data after the user executes the safe blood glucose control plan, the method further includes: Calculate the difference between the newly collected time-series blood glucose data and the blood glucose prediction value sequence to generate a residual vector; The residual vector is input into a pre-constructed variational autoencoder network to generate a latent space feature distribution; Obtain the pre-stored historical normal metabolic state feature distribution; Calculate the KL divergence between the latent space feature distribution and the historical normal metabolic state feature distribution; If the KL divergence value is greater than the dynamic adjustment threshold, the online transfer learning update of the blood glucose prediction model is triggered.
[0018] By adopting the above technical solutions, the decision-making for model updates is elevated from a passive response based on fixed time intervals or simple error thresholds to an active perception and intelligent decision-making level based on probability distribution difference analysis. This not only enables more sensitive detection of clinically significant metabolic pattern changes, but also improves the utilization efficiency of computing resources through the on-demand update strategy.
[0019] Secondly, this application provides a dynamic blood glucose prediction and management system, which adopts the following technical solution: A dynamic blood glucose prediction and management system, the system comprising: A multi-source data receiving module is used to receive raw user data streams through an IoT gateway; wherein, the raw user data streams include time-series blood glucose data, physiological parameter data, environmental indicator data, and dietary logs and medication dosage data from the user terminal; The data processing module is used to perform data cleaning operations and timestamp alignment on the user's raw data stream to generate a time-aligned multi-source dataset. The multidimensional feature extraction module is used to extract time-domain statistical features, frequency-domain transformation features, and metabolic stability nonlinear features from the multi-source dataset to construct a high-dimensional feature vector. The blood glucose time series prediction module is used to input the high-dimensional feature vector into a pre-trained blood glucose prediction model and output a sequence of predicted blood glucose values for a specified future time period. The blood sugar control plan decision module is used to obtain current blood glucose value, real-time carbohydrate intake and exercise intensity data, and combine them with the blood glucose prediction value sequence to generate insulin dose adjustment instructions and dietary advice instructions through the proximal strategy optimization algorithm, so as to obtain a personalized blood sugar control plan. The clinical safety rule verification module is used to call a preset clinical rule base to perform safety rule verification on the personalized blood sugar control plan and generate a verified safe blood sugar control plan. The solution distribution module is used to distribute the safe blood sugar control solution to the user terminal and the doctor monitoring platform; The model adaptive update module is used to collect time-series blood glucose data after the user implements the safe blood glucose control plan, and update the weight matrix of the blood glucose prediction model through online transfer learning.
[0020] Thirdly, this application provides a computer device, which adopts the following technical solution: A computer device includes a memory, a processor, and a computer program stored in the memory, the processor executing the computer program to perform the steps of the method as described in the first aspect.
[0021] Fourthly, this application provides a computer-readable storage medium, which adopts the following technical solution: A computer-readable storage medium storing a computer program that can be loaded by a processor and executed as in any of the methods in the first aspect. Attached Figure Description
[0022] Figure 1 This is a schematic diagram of the first process of a dynamic blood glucose prediction and management method according to one embodiment of this application.
[0023] Figure 2 This is a schematic diagram of the second process of a dynamic blood glucose prediction and management method according to one embodiment of this application.
[0024] Figure 3 This is a schematic diagram of the third process of a dynamic blood glucose prediction and management method according to one embodiment of this application.
[0025] Figure 4 This is a schematic diagram of the fourth process of a dynamic blood glucose prediction and management method according to one embodiment of this application.
[0026] Figure 5 This is a schematic diagram of the fifth process of a dynamic blood glucose prediction and management method according to one embodiment of this application.
[0027] Figure 6 This is a schematic diagram of the sixth process of a dynamic blood glucose prediction and management method according to one embodiment of this application.
[0028] Figure 7 This is a schematic diagram of the seventh process of a dynamic blood glucose prediction and management method according to one embodiment of this application. Detailed Implementation
[0029] To make the purpose, technical solution, and advantages of this application clearer, the following description is provided in conjunction with the appendix. Figures 1-7 The present application will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the application.
[0030] This application discloses a method for dynamic blood glucose prediction and management.
[0031] Reference Figure 1 A dynamic blood glucose prediction and management method, specifically including: Step S101: Receive raw user data stream through IoT gateway; wherein, raw user data stream includes time-series blood glucose data, physiological parameter data, environmental indicator data, and diet logs and medication dosage data from user terminal; Specifically, an IoT gateway is not simply a data receiver, but a central hub for protocol conversion and data aggregation. Different medical devices and sensors (such as continuous glucose monitors, smart bracelets, and environmental sensors) typically use different communication protocols (such as Bluetooth, Wi-Fi, and ZigBee). An IoT gateway converts these heterogeneous protocols into a unified, standard protocol suitable for transmission over the internet (such as MQTT or HTTP), thereby enabling standardized data access.
[0032] In addition, the received data streams have clear physiological significance: time-series blood glucose data is the core dynamic dependent variable; physiological parameter data (such as heart rate and exercise volume) are covariates reflecting energy consumption and metabolic state; environmental indicator data (such as temperature and humidity) may indirectly interfere with blood glucose by affecting vasodilation or stress levels; and diet logs and drug dosage data are the decisive input variables that directly lead to changes in blood glucose.
[0033] Step S102: Perform data cleaning and timestamp alignment on the user's original data stream to generate a time-series aligned multi-source dataset; The logical principle of data cleaning is to apply a series of algorithms (such as outlier detection based on interquartile range, and missing value imputation based on K-nearest neighbors or generative adversarial networks) to "repair" the data and improve its quality. More crucial is timestamp alignment. Because each device operates independently and has different sampling frequencies (e.g., CGM every 5 minutes, a fitness tracker may sample every second, and dietary logs are manually entered), direct mixing and analysis would lead to serious logical inconsistencies. This step uses algorithms such as dynamic time warping to calculate the time offset between different data streams and, through interpolation and resampling techniques, unifies all data points onto the same timeline, generating a time-aligned multi-source dataset.
[0034] Step S103: Extract time-domain statistical features, frequency-domain transformation features, and metabolic stability nonlinear features from the multi-source dataset to construct a high-dimensional feature vector; Among these, feature engineering extracts higher-dimensional information that better characterizes the intrinsic patterns of blood glucose changes from the raw data, which can be divided into three dimensions: Time-domain statistical features (such as mean, variance, and first difference) are used to characterize the overall level, fluctuation range, and short-term trend of blood glucose levels.
[0035] Frequency domain transformation features (usually obtained by fast Fourier transform to obtain power spectral density): transforming blood glucose time series signals from the time dimension to the frequency dimension to reveal the periodic patterns of blood glucose fluctuations (such as low-frequency fluctuations related to eating and high-frequency fluctuations related to physiological rhythms).
[0036] Nonlinear characteristics of metabolic stability (e.g., calculated through sample entropy): Blood glucose changes are not a simple linear process. Nonlinear dynamic characteristics such as sample entropy can quantify the complexity and unpredictability of blood glucose sequences. The higher the value, the more unstable the metabolism and the more chaotic the fluctuations.
[0037] By fusing these three types of features to construct a high-dimensional feature vector, the model is provided with a comprehensive and in-depth input view, enabling it to understand blood glucose behavior from three levels: macro trends, periodic patterns, and micro complexities.
[0038] Step S104: Input the high-dimensional feature vector into the pre-trained blood glucose prediction model and output the blood glucose prediction value sequence for the specified future time period. This step typically relies on a deep learning model with strong temporal modeling capabilities that has been pre-trained on a large amount of historical data, such as a hybrid model of long short-term memory network and attention mechanism (LSTM-Attention).
[0039] Specifically, the gating mechanisms within the LSTM network (input gate, forget gate, output gate) enable it to effectively learn and remember long-term blood glucose dependencies (such as the impact of yesterday's insulin sensitivity on today's blood glucose), overcoming the vanishing gradient problem of ordinary recurrent neural networks. The attention mechanism dynamically weights the importance of different time points in the input sequence, allowing the model to focus more on recent fluctuations most critical to the current prediction (such as recent eating or exercise events). By learning the complex nonlinear mapping between high-dimensional feature vectors and future blood glucose values, the model ultimately outputs a sequence of predicted blood glucose values for a specified future time period. This not only provides point-by-point predictions of blood glucose but, more importantly, reveals its trajectory, creating conditions for proactive intervention.
[0040] Step S105: Obtain current blood glucose level, real-time carbohydrate intake and exercise intensity data, combine with blood glucose prediction value sequence, and generate insulin dose adjustment instructions and dietary advice instructions through proximal strategy optimization algorithm to obtain a personalized blood glucose control plan; In this embodiment, the core of this step is reinforcement learning, particularly the Proximal Policy Optimization (PPO) algorithm. Within this framework, the AI model is shaped into an agent that observes environmental states including current blood glucose levels, predicted blood glucose sequences, real-time carbohydrate intake, and exercise intensity. The agent's required actions are to generate insulin dosage adjustment instructions and dietary recommendations.
[0041] Specifically, the PPO algorithm learns decision-making strategies by optimizing a carefully designed reward function that comprehensively considers multiple clinical goals: for example, a positive reward is given for achieving target blood glucose levels, while a large negative reward is given for predicting hypoglycemia or hyperglycemia. Simultaneously, to avoid inconvenience to patients, significant adjustments to the treatment plan may also result in a small negative reward. PPO ensures the stability of the learning process and avoids drastic policy fluctuations by limiting the step size of each policy update. In this way, the system can autonomously learn a dynamic strategy that effectively controls blood glucose while maximizing safety and quality of life through millions of trials in a simulated environment, achieving true personalization.
[0042] Step S106: Call the preset clinical rule base to perform safety rule verification on the personalized blood sugar control plan and generate a verified safe blood sugar control plan; While AI models are powerful in decision-making, their direct application to humans carries unacceptable risks. Therefore, this step introduces a knowledge-based, deterministic safety layer to provide a final review of the data-driven model decisions. A pre-defined clinical rule base incorporates medical consensus and safety boundaries, such as the maximum permissible range for a single insulin dose adjustment, contraindicated drugs under different physical conditions, and absolutely prohibited dose combinations. When the personalized plan generated by the PPO algorithm conflicts with these hard rules (e.g., the suggested dose adjustment exceeds the safety threshold set for a patient with renal insufficiency), the system will forcibly correct the plan to the safe range allowed by the rules.
[0043] Step S107: Distribute the safe blood sugar control plan to user terminals and doctor monitoring platforms; The safe blood sugar control plan is distributed to both patients and doctors, but with different focuses: the plan distributed to user terminals (such as mobile apps) is usually presented in a concise and easy-to-understand form of guidance (such as "Please consume 10g of carbohydrates within 10 minutes"), and may incorporate gamification elements to improve compliance; while the plan distributed to the doctor's monitoring platform includes more comprehensive data background and decision-making basis, allowing doctors to remotely monitor, review, or manually adjust as needed. This two-way distribution mechanism ensures both the timeliness and convenience of patients' self-management and empowers professional medical staff with ultimate supervision and control, achieving a balance between efficiency and safety.
[0044] Step S108: Collect time-series blood glucose data after the user implements the safe blood glucose control plan, and update the weight matrix of the blood glucose prediction model through online transfer learning.
[0045] When a user implements a safe blood sugar control plan, the newly collected time-series blood glucose data serves as the most direct feedback signal. By comparing predicted and actual values, the system can calculate the error (such as mean absolute error). Online transfer learning technology enables the system to fine-tune the pre-trained global model (base model) using this new, small-batch real-time data, specifically by updating the parameters in the model's weight matrix. This allows the model to quickly adapt to the unique physiological responses of individual patients and their metabolic changes over time (such as changes in insulin sensitivity). The longer the system is used, the deeper its understanding of a specific user becomes, and the more accurate its predictions and decisions become, truly realizing the evolution from a generalized model to a personalized health model.
[0046] The above implementation transforms traditional passive-response blood glucose management into a proactive, highly personalized, and continuously optimized precision medical intervention. This technological solution not only improves the rate of achieving target blood glucose control and reduces the risk of emergencies, but also alleviates the burden on both doctors and patients through human-machine collaboration. Ultimately, while ensuring the highest level of safety, it achieves intelligent and automated diabetes management, possessing significant clinical value and practical significance.
[0047] Reference Figure 2 As one implementation of step S103, the step of extracting time-domain statistical features, frequency-domain transform features, and metabolic stability nonlinear features from multi-source datasets to construct a high-dimensional feature vector includes: Step S201: Perform sliding window segmentation on the time-aligned multi-source dataset to generate a set of equal-length physiological parameter time series segments; Physiological signals, especially blood glucose changes, are typical non-stationary time series, and their statistical characteristics evolve over time. Treating all data as a whole will obscure key short-term dynamic patterns (such as the rapid rise in blood glucose one hour after a meal).
[0048] In this embodiment, the sliding window segmentation technique defines a fixed-length window (e.g., 2 hours) and slides it along the time axis in steps (e.g., 5 minutes) to divide the original sequence into a series of overlapping, equal-length time series segments. This method ensures that each segment captures a relatively complete physiological event cycle (e.g., a complete food metabolism process) while maintaining the continuity between events through overlap, providing standard data units that reflect local features and preserve temporal correlations for subsequent analysis.
[0049] Step S202: Perform time-domain statistical processing on each time series segment, calculate the mean, variance, range and autocorrelation coefficient, and generate a subset of time-domain statistical features; Time-domain statistical processing provides the most intuitive numerical representation of the signal: the mean reflects the average blood glucose level within the window period; variance or standard deviation quantifies the degree of fluctuation in blood glucose around the mean, serving as a direct indicator of stability; the range (the difference between the maximum and minimum values) describes the absolute range of blood glucose changes within that period, helping to identify abrupt fluctuations. The autocorrelation coefficient measures the correlation of the sequence itself at different time points. For example, a high lag first-order autocorrelation coefficient indicates that the current blood glucose value is highly correlated with its previous value, suggesting a smooth sequence with high inertia; while a low coefficient may indicate abrupt changes or noise.
[0050] These features together constitute a subset of time-domain statistical features, providing the model with a quantitative description of the short-term static profile of blood glucose from four dimensions: central tendency, dispersion, range of variation, and time dependence.
[0051] Step S203: Perform frequency domain transformation processing on each time series segment to extract frequency domain energy distribution features and the amplitude of the main frequency component, and generate a frequency domain transformation feature subset; Since time-domain analysis alone cannot reveal the inherent periodicity of a signal, this step uses frequency-domain transformation (such as Fast Fourier Transform, FFT) to convert the signal from the time-amplitude domain to the frequency-energy domain. From this perspective, complex blood glucose fluctuations can be decomposed into a superposition of several simple harmonic waves (sine / cosine waves) of different frequencies.
[0052] Specifically, the frequency domain energy distribution characteristics reveal how the energy of blood glucose fluctuations is allocated across different frequency bands. For example, low-frequency energy may correspond to the slow cyclical changes caused by three meals a day, while high-frequency energy may correspond to more subtle physiological rhythms or noise. The amplitude of the dominant frequency component refers to the intensity of the frequency (or a few frequencies) with the most concentrated energy among all frequency components, indicating the strength of the dominant cyclical factor driving blood glucose changes.
[0053] Step S204: Perform nonlinear dynamic analysis on each time series segment to quantify the degree of metabolic homeostasis fluctuation and generate a subset of nonlinear features of metabolic stability; Blood glucose regulation is a complex nonlinear physiological system involving the combined effects of multiple hormones, organs, and external inputs. Its dynamic characteristics cannot be fully captured by linear time-domain and frequency-domain analyses. This step introduces nonlinear dynamic analysis to quantify the inherent complexity and unpredictability of the system, i.e., the degree of fluctuation in metabolic homeostasis.
[0054] In the embodiments of this application, a commonly used metric is sample entropy, which measures the complexity of a signal by calculating the conditional probability of generating new patterns in a sequence. A blood glucose sequence that is very regular and predictable (e.g., in a stationary state) has a low sample entropy value; conversely, if the sequence fluctuates wildly and is chaotic (e.g., in a decompensated state), its sample entropy value is high. Therefore, nonlinear features such as sample entropy can serve as sensitive indicators of metabolic stability. The resulting subset of nonlinear features of metabolic stability can effectively distinguish blood glucose fluctuations that appear to have similar variances but have drastically different intrinsic dynamic patterns, providing the model with in-depth information about the underlying stability and health of the glucose metabolism system.
[0055] Step S205: Concatenate the time-domain statistical feature subset, frequency-domain transform feature subset, and metabolic stability nonlinear feature subset of the same time segment into vectors to generate a single-window feature vector; This process involves analyzing the same time series segment from three different mathematical perspectives (time domain, frequency domain, and nonlinearity) to generate three complementary feature subsets. The logic of this step is to perform feature-level fusion, that is, to combine these three subsets into a unified, high-information-density single-window feature vector through vector concatenation. This multi-perspective fusion greatly enriches the model's input information, enabling it to integrate all key patterns within a local time window, laying a solid foundation for accurate judgments.
[0056] Step S206: Aggregate the single-window feature vectors of all time segments to construct a high-dimensional feature vector.
[0057] In this step, the feature vector of a single window can only reflect the physiological state at a local time point. This step aggregates all the single-window feature vectors generated in chronological order through time-series aggregation (usually by stacking or arranging them in sequence) to finally construct a high-dimensional feature vector representing the entire analysis time span.
[0058] The above implementation fundamentally improves the understanding depth and pattern recognition ability of subsequent blood glucose prediction models for complex physiological signals, enabling the models to not only capture explicit statistical regularities, but also to discern implicit periodic rhythms and intrinsic dynamic stability. This is the core technological foundation for achieving high-precision, forward-looking, and personalized blood glucose management, and significantly enhances the intelligence level and clinical applicability of the entire system.
[0059] Reference Figure 3 As one implementation of step S104, the step of inputting a high-dimensional feature vector into a pre-trained blood glucose prediction model and outputting a sequence of predicted blood glucose values for a specified future time period includes: Step S301: Slice the input high-dimensional feature vector in the time dimension to generate a feature segment sequence synchronized with the physiological cycle and input it into the pre-trained blood glucose prediction model. The time-dimension slicing operation involves dividing long feature sequences into a series of feature segments based on known physiological cycles (e.g., a 24-hour diurnal cycle or a typical meal interval). For example, data can be segmented into multiple consecutive segments such as "after breakfast to before lunch" or "after lunch to before dinner." This not only reduces the computational complexity of the model when processing long sequences but also allows the model to more clearly learn specific patterns of blood glucose changes during specific physiological phases (such as the postprandial metabolically active period), thus laying a structured foundation for subsequent precise time-series analysis.
[0060] Step S302: The feature segment sequence is parsed layer by layer by the temporal feature extraction module to capture the long-term dependency of blood glucose changes and generate hidden state temporal codes. In the embodiments of this application, the temporal feature extraction module is typically composed of a recurrent neural network similar to a Long Short-Term Memory (LSTM) network or a Gated Recurrent Unit (GRU). The core of such networks lies in their internal gating mechanisms (such as input gates, forget gates, and output gates), which can selectively remember important long-term information and forget irrelevant details.
[0061] Specifically, when each feature segment in the sequence is sequentially input into the blood glucose prediction model, it first enters the temporal feature extraction module. The recurrent neural network then parses the sequence layer by layer (deep network) or step by step (time step). Its internal hidden states are updated over time, and this state vector encapsulates all historical information from the beginning of the sequence to the current moment. In this way, the module can effectively capture long-term dependencies, such as understanding the potential impact of "yesterday's exercise before dinner" on "this morning's fasting blood glucose." Finally, for the entire input sequence, the module outputs a hidden state temporal code containing complete sequence information. This code is a highly abstract feature representation that encapsulates the dynamic trajectory information of blood glucose changes.
[0062] Step S303: Perform attention weighting operation on the hidden state temporal encoding to highlight the influence weight of key time nodes on the prediction target and generate weighted feature representation; While models like LSTM can handle long sequences, their hidden state encoding traditionally treats information from all time steps equally. However, in blood glucose prediction, the importance of different time points varies drastically. For example, a recent eating event has a far greater impact on the current prediction than exercise 24 hours prior. The introduction of attention mechanisms aims to address this crucial issue.
[0063] Specifically, the importance score of the hidden state encoding at each time point in the sequence to the current prediction target is dynamically calculated, i.e., the attention weight. Then, the hidden state encodings of all time steps are weighted and summed according to their respective weights to generate a weighted feature representation. This means that the model automatically focuses more attention on those moments most indicative of future blood glucose prediction (such as recent meal times, insulin injection points, or periods of strenuous exercise), while weakening the influence of irrelevant or interfering periods. This step greatly improves the model's feature selection ability and interpretability, making its decision-making more focused on key physiological events.
[0064] Step S304: Input the weighted feature representation into the fully connected regression layer to calculate the predicted blood glucose values for multiple consecutive time points in the future; After obtaining the weighted feature representation optimized by the attention mechanism and condensing key temporal information, the goal of this step is to map it into specific, future blood glucose value predictions. Each neuron in the fully connected regression layer is connected to all outputs of the previous layer. Taking the high-dimensional weighted feature representation as input, and through one or more layers of matrix operations and activation functions, each neuron in the final output layer corresponds to a predicted blood glucose value at a specific future time point (e.g., 30 minutes, 60 minutes, or 120 minutes later). This design allows the model to simultaneously calculate blood glucose levels at multiple consecutive future time points, rather than predicting only a single point, thus providing a complete future blood glucose change curve and providing a sufficient time window for prospective intervention.
[0065] Step S305: Aggregate the predicted blood glucose values of multiple consecutive time points in chronological order to generate a sequence of predicted blood glucose values for a specified future time period.
[0066] This process aggregates multiple potentially discrete predicted values from the fully connected regression layer (e.g., four points representing t+30, t+60, t+90, and t+120 minutes) in chronological order to form a continuous, smooth sequence of predicted blood glucose values. This sequence clearly shows the expected trajectory of blood glucose levels over a specified time period (e.g., 2 hours) starting from the current moment. It not only provides specific numerical points but, more importantly, reveals the trend of change (whether it continues to rise, peaks and then declines, or remains stable). This contains richer information than predictions at a single time point and is crucial for clinical decision support (e.g., determining the timing and magnitude of blood glucose peaks).
[0067] In the above implementation, not only can deep dynamic patterns related to blood glucose changes be extracted from complex multimodal time-series data, but it can also intelligently focus on the impact of key physiological events and has the ability to self-optimize in response to individual differences and metabolic state drift, thereby transforming blood glucose management from passive responsive monitoring to proactive, personalized, and precise intervention.
[0068] Reference Figure 4 As one implementation of step S105, the steps of obtaining current blood glucose levels, real-time carbohydrate intake, and exercise intensity data, combining them with a blood glucose prediction sequence, and generating insulin dose adjustment instructions and dietary recommendations through a proximal strategy optimization algorithm to obtain a personalized blood glucose control plan include: Step S401: Obtain current blood glucose level, real-time carbohydrate intake, and exercise intensity data; Step S402: Superimpose the current blood glucose value onto the starting time point of the blood glucose prediction value sequence to construct a complete blood glucose time series trajectory; Among them, the current blood glucose value is the most accurate and immediate measurement value from the sensor. The current blood glucose value is used as a known and absolutely accurate initial condition and connected end to end with the predicted future sequence on the time axis, thereby constructing a continuous and complete blood glucose time series trajectory that extends from the current instant to a specified future time period.
[0069] Step S403: Integrate blood glucose time-series trajectory, real-time carbohydrate intake and exercise intensity data to generate a current metabolic state feature vector; Real-time carbohydrate intake is the core input variable affecting blood glucose rise; exercise intensity data is a key process variable reflecting energy expenditure and affecting blood glucose decline. By encoding blood glucose trajectory (system output), carbohydrates (primary input), and exercise intensity (primary expenditure) together into a unified current metabolic state feature vector, this vector constitutes a comprehensive digital snapshot of the patient's metabolic status at this moment and in the near future. It clearly answers the three key questions: "How is blood glucose changing?", "What is causing its change?", and "What factors might soon affect its change?", providing the agent with all the contextual information needed to make informed decisions.
[0070] Step S404: Based on pre-stored user vital sign data, calculate metabolic equivalent parameters and insulin sensitivity coefficients to generate personalized physiological regulatory factors; Different patients exhibit drastically different glycemic responses to the same diet and exercise, fundamentally due to individual physiological differences. User vital signs (such as weight, height, BMI, body fat percentage, and age) are relatively stable but crucial individual characteristics. Based on this data, an insulin sensitivity coefficient can be calculated, which quantitatively describes the strength of the patient's body's response to insulin, i.e., how much blood glucose level is reduced by a unit of insulin. Simultaneously, metabolic equivalent parameters can be estimated to more accurately measure energy expenditure levels during exercise.
[0071] Understandably, the metabolic equivalent parameter and the insulin sensitivity coefficient together constitute individualized physiological regulatory factors, enabling subsequent algorithm models to understand and adapt to the unique metabolic characteristics of specific patients (for example, the insulin dose required by an insulin-resistant obese patient and an insulin-sensitive lean patient after consuming the same amount of carbohydrates is vastly different), thereby ensuring that the generated plan is truly personalized.
[0072] Step S405: Input the current metabolic state feature vector and individualized physiological regulatory factors into the pre-trained proximal strategy optimization algorithm model, and output the insulin dose adjustment and carbohydrate supplementation amount in the constrained action space. This logic relies on the Proximal Policy Optimization (PPO) algorithm within a reinforcement learning framework. The pre-trained PPO model acts as an experienced agent, observing a state that integrates input information combining real-time context and individual characteristics (current metabolic state feature vector and individualized physiological regulators). The agent's actions involve providing intervention suggestions, namely, adjusting insulin dosage (pharmacological intervention) and carbohydrate supplementation (behavioral intervention).
[0073] In some embodiments, the algorithm's action space is strictly constrained to ensure absolute safety. For example, the action space may be constrained to the point that a single insulin dose adjustment must not exceed a certain percentage of the patient's total daily dose, or that carbohydrate supplementation must be within the minimum effective dose range required to prevent hypoglycemia.
[0074] Specifically, the PPO algorithm, through learning in a simulated environment, has mastered a complex strategy: how to choose an action (i.e., adjustment amount) under a given state to maximize long-term cumulative rewards. This reward function is designed to simultaneously optimize multiple objectives, such as improving blood glucose target achievement rate (positive reward), avoiding hypoglycemia (significant negative reward), and reducing drastic fluctuations in the treatment plan (slight negative reward). Therefore, the model's output is the optimal intervention amount calculated within the safety boundary to achieve the best long-term blood glucose control effect.
[0075] Step S406: Convert the insulin dose adjustment amount and carbohydrate supplementation amount into insulin dose adjustment instructions and dietary recommendations. The adjustment amount calculated by the algorithm is a pure numerical value and cannot be directly executed. The logic of this step is to perform an operational conversion of the instruction, that is, to transform the data into clinical action language. For example, "insulin dose adjustment amount = -1.5" is transformed into "insulin dose adjustment instruction: reduce by 1.5 units"; "carbohydrate supplementation amount = 15" is transformed into "dietary recommendation instruction: recommend intake of 15 grams of rapidly absorbed carbohydrates". This conversion not only includes numerical values, but also clarifies the direction of action (increase / decrease) and units, and can be supplemented with details (such as carbohydrate type) based on clinical knowledge, so that the output instruction is clear and unambiguous, which patients can easily understand and execute, or that devices (such as insulin pumps) can directly interpret.
[0076] Step S407: Combine insulin dose adjustment instructions and dietary recommendations to construct a personalized blood sugar control plan and mark the generated timestamp.
[0077] The combined approach integrates pharmacological and non-pharmacological interventions into a synergistic, personalized blood sugar control plan, embodying the concept of comprehensive management. The timestamp records the exact moment the plan was generated, defining its effectiveness and timeliness, as metabolic states are dynamic and outdated plans may become ineffective or even harmful. Furthermore, it provides a crucial index for subsequent feedback learning; the system can correlate blood sugar changes after this time point with the specific plan to assess its effectiveness, while also meeting the traceability requirements of medical records, facilitating auditing and review.
[0078] In the above implementation, the complex clinical decision-making problem under multi-objective constraints is transformed into a computable, data-driven optimization process. This not only ensures the foresight and scientific nature of the intervention measures, but also, through strict individualized calibration and safety constraints, makes them both accurate and safe, thus achieving a deep integration of precision medicine and digital health technology.
[0079] Reference Figure 5 As one implementation of step S106, the step of calling a preset clinical rule base to perform safety rule verification on the personalized blood sugar control plan and generating a verified safe blood sugar control plan includes: Step S501: Analyze the insulin dose adjustment instructions and dietary advice instructions in the personalized blood sugar control plan, and extract the blood sugar control parameters to be executed; The personalized blood sugar control plan is a structured object containing operational intentions, but its specific content (such as "add 2 units of insulin" or "supplement with 15 grams of carbohydrates") needs to be parsed to extract the pure numerical values and their operational directions. For example, extracting "insulin adjustment = +2 units" and "carbohydrate supplementation = 15 grams" from the instructions.
[0080] Step S502: Obtain the user's current physiological state data and match the corresponding safety threshold rule set from the preset clinical rule base; The safety threshold rule set includes blood glucose fluctuation range thresholds, upper limits for single insulin doses, and extreme values for carbohydrate intake. In some embodiments, a pre-defined clinical rule base stores safety rules based on numerous clinical guidelines (such as ADA standards) and expert experience. However, the specific numerical thresholds for these rules need to be dynamically selected based on the patient's current physiological status data (such as the presence of renal insufficiency, pregnancy, and whether the current blood glucose trend is rapidly rising or falling). For example, for a patient with a history of hypoglycemic coma, the lower limit of their "blood glucose fluctuation range threshold" might be set to a higher 4.4 mmol / L, rather than the universal 3.9 mmol / L; for obese patients, their "upper limit for a single insulin dose" might be more stringent. The matching process involves retrieving and activating the set of safety threshold rules best suited to the current situation from the rule base. This ensures that the standards used for safety verification are highly individualized and matched to the patient's real-time risk, rather than rigid universal values, thus ensuring both safety and the flexibility and effectiveness of the protocol.
[0081] Step S503: Dynamically compare the blood sugar control parameters to be executed with the set of safe threshold rules to detect whether there is a risk of parameters going out of bounds; if yes, proceed to step S504; if no, directly use the blood sugar control parameters to be executed as the safe blood sugar control scheme. The dynamic comparison process is a precise calculation that compares the extracted parameter values one by one with their corresponding safety thresholds. For example, it determines whether the recommended insulin increase exceeds the upper limit of a single insulin dose set for the patient's current condition; or whether the recommended carbohydrate supplementation exceeds the reasonable carbohydrate intake limit (especially for patients requiring weight management). This process detects any potential risks of parameter exceeding limits. This risk detection is not just a simple numerical comparison but may involve more complex logic. For instance, if a predicted blood glucose trend is about to decline rapidly, even if the current insulin dose is within the static upper limit, the system may still determine that there is a risk of delayed hypoglycemia.
[0082] Step S504: Based on the predefined constraint optimization strategy, modify the sugar control parameters to be executed to generate the modified sugar control parameters; Specifically, when a risk of exceeding limits is detected, the system does not simply reject the instruction, but instead initiates an intelligent constraint optimization and correction process. The predefined constraint optimization strategy is a set of priority rules, the core principle of which is usually to get as close as possible to the original solution's sugar control objective while satisfying the most critical safety constraints.
[0083] In some embodiments, for example, the strategy may specify that "absolutely avoiding the risk of hypoglycemia" has the highest priority. If the original regimen triggers the risk of hypoglycemia due to excessive insulin dosage, the modified strategy may prioritize reducing the insulin dosage to within the safe upper limit, rather than first increasing carbohydrate intake. This process involves the algorithm automatically correcting out-of-bounds parameters to generate corrected blood sugar control parameters. The goal of the correction is to find an alternative that is within the safe threshold range and is medically reasonable. This reflects the system's intelligent balancing ability to maintain the effectiveness of the treatment plan while adhering to the bottom line of safety.
[0084] Step S505: Reconstruct insulin dose adjustment instructions and dietary recommendations based on the corrected blood sugar control parameters; The system takes the verified and corrected, purely data-driven blood sugar control parameters and reconstructs them into complete, natural language or standardized insulin dosage adjustment instructions and dietary recommendations according to a preset instruction template. For example, the corrected parameter "insulin adjustment amount = +1 unit" is regenerated as "insulin dosage adjustment instruction: increase by 1 unit". This step ensures that the final output is no longer an abstract number, but a clear, explicit, and actionable guideline that can be directly executed by patients, doctors, or automated devices (such as insulin pumps).
[0085] Step S506: Combine the reconstructed instructions and bind the verification timestamp to generate a safe sugar control scheme.
[0086] The combined operation packages the reconstructed insulin and dietary instructions into a coordinated whole and binds it to a verification timestamp. This timestamp records the exact moment the safety verification was completed, clarifying the start time of its effectiveness, because the patient's physiological state is dynamic. It also provides a key index for subsequent effect evaluation and feedback learning, allowing the system to accurately correlate blood glucose changes after this time point with this specific plan.
[0087] The above implementation ensures that each blood sugar control plan not only theoretically pursues optimal blood sugar control but also absolutely meets the individualized safety constraints of patients in practice. By transforming the safety knowledge and experience of clinical experts into automatically executable computer algorithms, the system achieves full automation, real-time monitoring, and precision in safety supervision, providing core technological support for the safe and reliable deployment of this system in critical medical scenarios.
[0088] Reference Figure 6 As one implementation of step S108, the step of collecting time-series blood glucose data after the user implements the safe blood glucose control plan and updating the weight matrix of the blood glucose prediction model through online transfer learning includes: Step S601: Receive the execution feedback data stream uploaded by the user terminal, which includes continuous blood glucose monitoring values, real-time physiological parameters and environmental indicators after the user executes the safe blood sugar control plan; When a user executes a safe blood sugar control plan (such as adjusting insulin dosage or recommending a diet), its effects will be reflected in the user's changing physiological state. The execution feedback data stream includes newly generated continuous blood glucose monitoring values after the plan is executed, real-time physiological parameters reflecting the body's stress and metabolic state (such as heart rate and activity level), and environmental indicators that may modulate physiological responses (such as temperature). Receiving this data means that the system can continuously observe the actual consequences of its decisions on real individuals, thus laying the foundation for evaluating decision quality and obtaining learning samples.
[0089] Step S602: Align the execution feedback data stream with the execution time interval of the corresponding safe sugar control scheme to generate a labeled incremental training dataset; The original data stream is continuous in time, but it must be precisely correlated with specific intervention actions in order for the model to learn the mapping relationship between "cause" (a certain plan) and "effect" (subsequent physiological changes). The correlation alignment operation extracts data from the continuous data stream within a certain period after the plan is executed, based on the execution timestamps attached to the plan, and uses the actual blood glucose values within that period as labels to match them with features such as previous plan instructions and physiological states, thereby generating a labeled incremental training dataset.
[0090] Step S603: Initialize the online learner based on the current weight matrix of the blood glucose prediction model and load the feature distribution benchmark of historical training data; The system first initializes a dedicated online learner based on the model's current weight matrix (i.e., all the knowledge the model already possesses). Simultaneously, it loads a baseline of feature distribution from historical training data (such as the mean and variance of each feature dimension) to standardize new data during subsequent learning, ensuring it maintains a consistent scale with the older data and avoiding learning bias caused by data distribution drift.
[0091] Step S604: Use the incremental training dataset to perform forward inference on the online learner and calculate the error loss function between the predicted blood glucose value and the actual blood glucose monitoring value. Specifically, the newly generated incremental training dataset is input into the online learner for forward inference, whereby the learner makes a blood glucose prediction for each sample based on its current parameters. Subsequently, the learner's predictions are compared point-by-point with the actual blood glucose values labeled in the dataset. An error loss function (such as Mean Absolute Error, MAE) is used to calculate the overall degree of these prediction biases. This loss value is a key scalar metric that quantitatively reflects the degree to which the current model (parameterized by the weight matrix) is ill-suited to or inaccurate in predicting the latest physiological response data. A larger loss value indicates a worse predictive ability of the model for the user's current state, and a greater degree of parameter adjustment is required.
[0092] Step S605: Update the weight parameters of the online learner using the gradient backpropagation algorithm, and constrain the parameter update magnitude using a dynamic learning rate decay strategy; The gradient backpropagation algorithm calculates the gradient (i.e., derivative) of the loss function with respect to each weight parameter of the model. This indicates the direction and magnitude in which each parameter should be adjusted to reduce the loss. The system then fine-tunes these weight parameters according to the direction indicated by the gradient. To ensure learning stability and prevent excessively large, oscillating parameter changes due to a single batch of new data, the system employs a dynamic learning rate decay strategy. The learning rate controls the step size of parameter updates, and decay means that this step size gradually decreases as the learning process progresses (or over time). In incremental learning scenarios, this typically manifests as using a smaller learning rate for the initial few batches of new data, thereby constraining the magnitude of parameter updates, preventing new knowledge from abruptly overwriting old knowledge, and achieving smooth knowledge fusion.
[0093] Step S606: The updated weight parameters are fused into the weight matrix of the blood glucose prediction model, overriding the original model parameters to complete online transfer learning.
[0094] The updated weight parameters are then integrated back into the main model by overwriting the original weight moments to achieve online transfer learning. This overwriting operation means that the main model has been updated in real time, and its predictive behavior will be more in line with the user's latest metabolic characteristics from the next moment onwards.
[0095] The above implementation ensures that, after deployment, the model is no longer a static tool that gradually becomes detached from the user's physiological changes, but rather an intelligent entity capable of learning from each intervention, dynamically tracking the user's metabolic state drift, and continuously self-calibrating. This capability enables the system's predictions and decisions to become increasingly accurate and personalized over time, thereby maximizing long-term clinical efficacy while ensuring safety and reliability.
[0096] Reference Figure 7As a further implementation of the dynamic blood glucose prediction and management method, after the step of collecting time-series blood glucose data after the user implements the safe blood glucose control plan, it also includes: Step S701: Calculate the difference between the newly collected time-series blood glucose data and the blood glucose prediction value sequence, and generate a residual vector; In this system, after the blood sugar control plan is implemented, the newly collected time-series blood glucose data represents the actual physiological response, while the previously output blood glucose prediction sequence represents the expectation based on historical knowledge. Calculating the difference between the two, i.e., generating the residual vector, is essentially a real-time, online verification of the model's prediction accuracy.
[0097] Specifically, the residual vector includes positive and negative residuals. Positive residuals (actual value > predicted value) may reveal unforeseen events that cause elevated blood glucose, such as unrecorded dietary intake or stress response; while negative residuals (actual value < predicted value) may indicate a potential risk of hypoglycemia, such as an unexpected increase in insulin sensitivity due to unplanned exercise.
[0098] Understandably, the shape of the residual vector (e.g., it may be random, fluctuating slightly, or continuous and unidirectionally amplified) can effectively distinguish between transient measurement noise and a systematic shift in the model that is no longer suitable for the current metabolic state of the patient. This can serve as the most critical original basis for subsequent deep pattern analysis and for determining whether a model update is needed.
[0099] Step S702: Input the residual vector into the pre-constructed variational autoencoder network to generate the latent space feature distribution; The key difference between variational autoencoders (VAEs) and traditional autoencoders lies in the fact that the encoder outputs parameters of a probability distribution (typically the mean μ and variance σ), rather than a deterministic encoded vector. This means that for the input residual vector, the VAE does not map it to a point, but rather to a Gaussian distribution in the latent space. The generation of this latent space feature distribution can capture the uncertainty in the residual data and distinguish superficially similar residual patterns (such as all exhibiting small positive deviations) in the latent space, revealing their different underlying causes (e.g., some may originate from measurement noise, while others may indicate slow metabolic trend changes).
[0100] In this embodiment, the variational autoencoder (VAE) introduces regularization to force the latent space to become continuous, smooth, and regular, resulting in similar residual patterns having similar distributions in the latent space. Furthermore, the VAE can better decouple different variation factors in the data; for example, one latent variable dimension might be specifically responsible for encoding "bias caused by inaccurate eating timing," while another dimension encodes "bias caused by changes in insulin sensitivity." In this way, the latent space feature distribution generated by the VAE can profoundly characterize the potential sources and characteristics of current prediction bias in a structured and probabilistic manner.
[0101] Step S703: Obtain the pre-stored historical normal metabolic state feature distribution; Here, "historical normal metabolic state" refers to data accumulated over a period when the patient's physiological condition is stable and blood glucose is well controlled (e.g., the past month under conditions of no acute events and regular lifestyle). Processing this historical data through the same VAE encoder yields a series of latent space feature distributions corresponding to the normal state. These distributions can be aggregated (e.g., by calculating the average of their mean and variance) to form a comprehensive, pre-stored historical feature distribution that represents the patient's individual baseline metabolic characteristics.
[0102] Understandably, this baseline distribution is crucial because it defines a personalized standard for "what predictive residual patterns fall within the normal range of fluctuation for this patient," rather than using a universal threshold applicable to everyone. This allows the system to detect subtle but clinically significant changes in metabolic patterns specific to a particular individual.
[0103] Step S704: Calculate the KL divergence value between the latent space feature distribution and the historical normal metabolic state feature distribution; KL divergence is a classic method in information theory used to measure the difference between two probability distributions. It calculates the amount of information lost when a baseline distribution is used to approximate the current distribution.
[0104] In this embodiment, calculating the KL divergence value precisely measures the degree to which the current metabolic state, as reflected by prediction bias, deviates from the individual's historical normal state. If the two distributions are perfectly identical, the KL divergence is zero; the greater the difference, the larger the KL divergence value. The advantage of this measure is that it is a probabilistic overall comparison, comprehensively considering changes in the distribution center (mean) and the distribution shape (variance). For example, a systematic shift in the mean may indicate a long-term change in insulin sensitivity; while an increase in variance may mean a decrease in metabolic stability.
[0105] In step S705, if the KL divergence value is greater than the dynamic adjustment threshold, the online transfer learning update of the blood glucose prediction model is triggered.
[0106] Among them, the dynamic adjustment threshold is a threshold value that can be individually set based on the patient's risk level (such as whether there is a history of severe hypoglycemia) or clinical goals.
[0107] In this embodiment of the application, when the calculated KL divergence value is continuously greater than this threshold, it means that the current prediction model can no longer accurately capture the patient's latest and significantly changed metabolic characteristics, and the pattern of its prediction bias has exceeded the normal fluctuation range of the individual. At this time, the system will automatically trigger online transfer learning update.
[0108] Understandably, this triggering mechanism based on KL divergence monitoring ensures that model updates are based on evidence. It avoids unnecessary updates when model performance is still acceptable in order to save computational resources, and it can make timely adjustments when there are truly clinically significant metabolic changes, thus maintaining the accuracy and personalization of predictions.
[0109] In the above implementation, the decision to update the model is elevated from a passive response based on a fixed time interval or a simple error threshold to an active perception and intelligent decision-making level based on probability distribution difference analysis. This not only enables more sensitive detection of clinically significant metabolic pattern changes, but also improves the utilization efficiency of computing resources through the on-demand update strategy.
[0110] This application also discloses a dynamic blood glucose prediction and management system.
[0111] A dynamic blood glucose prediction and management system, specifically comprising: The multi-source data receiving module is used to receive raw user data streams through an IoT gateway; the raw user data streams include time-series blood glucose data, physiological parameter data, environmental indicator data, as well as dietary logs and medication dosage data from the user terminal. The data processing module is used to perform data cleaning operations and timestamp alignment on the user's raw data stream to generate time-series aligned multi-source datasets; The multidimensional feature extraction module is used to extract time-domain statistical features, frequency-domain transformation features, and metabolic stability nonlinear features from multi-source datasets to construct high-dimensional feature vectors. The blood glucose time series prediction module is used to input high-dimensional feature vectors into a pre-trained blood glucose prediction model and output a sequence of predicted blood glucose values for a specified future time period. The blood sugar control plan decision module is used to obtain current blood glucose value, real-time carbohydrate intake and exercise intensity data, and combine them with blood glucose prediction value sequence to generate insulin dose adjustment instructions and dietary advice instructions through proximal strategy optimization algorithm to obtain a personalized blood sugar control plan. The clinical safety rule verification module is used to call the preset clinical rule base to perform safety rule verification on the personalized blood sugar control plan and generate a verified safe blood sugar control plan. The plan distribution module is used to distribute safe blood sugar control plans to user terminals and doctor monitoring platforms; The model adaptive update module is used to collect time-series blood glucose data after the user implements the safe blood glucose control plan, and update the weight matrix of the blood glucose prediction model through online transfer learning.
[0112] The dynamic blood glucose prediction and management system of this application embodiment can implement any of the above methods, and the specific working process of each module in the system can refer to the corresponding process in the above method embodiment.
[0113] In the several embodiments provided in this application, it should be understood that the provided methods and systems can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for example, the division of a certain module is merely a logical functional division, and in actual implementation there may be other division methods, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed.
[0114] This application also discloses a computer device.
[0115] A computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a dynamic blood glucose prediction and management method as described above.
[0116] This application also discloses a computer-readable storage medium.
[0117] A computer-readable storage medium storing a computer program that can be loaded by a processor and executed as described above in any of the methods of dynamic blood glucose prediction and management.
[0118] The computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device; the program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0119] The above are all preferred embodiments of this application and are not intended to limit the scope of protection of this application. Any feature disclosed in this specification (including the abstract and drawings) may be replaced by other equivalent or similar features unless specifically stated otherwise. That is, unless specifically stated otherwise, each feature is only one example of a series of equivalent or similar features.
Claims
1. A method for dynamic blood glucose prediction and management, characterized in that, The method includes: The system receives raw user data streams via an IoT gateway; these raw user data streams include time-series blood glucose data, physiological parameter data, environmental indicator data, and dietary logs and medication dosage data from the user's terminal. Perform data cleaning and timestamp alignment on the user's raw data stream to generate a time-aligned multi-source dataset; Time-domain statistical features, frequency-domain transformation features, and metabolic stability nonlinear features are extracted from the multi-source dataset to construct a high-dimensional feature vector. The high-dimensional feature vector is input into a pre-trained blood glucose prediction model, which outputs a sequence of predicted blood glucose values for a specified future time period. The system acquires current blood glucose levels, real-time carbohydrate intake, and exercise intensity data. Combined with the blood glucose prediction sequence, it generates insulin dose adjustment instructions and dietary recommendations through a proximal strategy optimization algorithm to obtain a personalized blood glucose control plan. The personalized blood sugar control plan is validated by calling a preset clinical rule base, and a validated safe blood sugar control plan is generated. The safe blood sugar control plan is distributed to the user terminal and the doctor monitoring platform; Collect time-series blood glucose data after the user implements the safe blood glucose control plan, and update the weight matrix of the blood glucose prediction model through online transfer learning.
2. The method for dynamic blood glucose prediction and management according to claim 1, characterized in that, The steps for extracting time-domain statistical features, frequency-domain transform features, and metabolic stability nonlinear features from the multi-source dataset and constructing a high-dimensional feature vector include: The time-aligned multi-source dataset is segmented using a sliding window to generate a set of equal-length time series segments of physiological parameters. Perform time-domain statistical processing on each time series segment, calculate the mean, variance, range and autocorrelation coefficient, and generate a subset of time-domain statistical features; Perform frequency domain transformation on each time series segment to extract frequency domain energy distribution features and the amplitude of the dominant frequency component, and generate a subset of frequency domain transformation features. Nonlinear dynamic analysis is performed on each time series segment to quantify the degree of metabolic homeostasis fluctuation and generate a subset of nonlinear features of metabolic stability. The time-domain statistical feature subset, frequency-domain transform feature subset, and metabolic stability nonlinear feature subset of the same time segment are concatenated into vectors to generate a single-window feature vector; The high-dimensional feature vector is constructed by aggregating the single-window feature vectors of all time segments.
3. The method for dynamic blood glucose prediction and management according to claim 2, characterized in that, The steps of inputting the high-dimensional feature vector into a pre-trained blood glucose prediction model and outputting a sequence of predicted blood glucose values for a specified future time period include: The high-dimensional feature vector input is sliced in the time dimension to generate a sequence of feature segments synchronized with the physiological cycle, which is then input into a pre-trained blood glucose prediction model. The feature segment sequence is analyzed layer by layer by the temporal feature extraction module to capture the long-term dependency of blood glucose changes and generate hidden state temporal codes. An attention-weighted operation is performed on the hidden state temporal encoding to highlight the influence weight of key time nodes on the prediction target, and a weighted feature representation is generated. The weighted feature representation is input into a fully connected regression layer to calculate the predicted blood glucose values for multiple consecutive time points in the future. The predicted blood glucose values at multiple consecutive time points are aggregated in chronological order to generate a sequence of predicted blood glucose values for the specified future time period.
4. The method for dynamic blood glucose prediction and management according to claim 1, characterized in that, The steps involved in obtaining current blood glucose levels, real-time carbohydrate intake, and exercise intensity data, combined with the predicted blood glucose value sequence, and generating insulin dose adjustment instructions and dietary recommendations using a proximal strategy optimization algorithm to obtain a personalized blood glucose control plan include: Obtain current blood glucose levels, real-time carbohydrate intake, and exercise intensity data; The current blood glucose value is superimposed onto the starting time point of the predicted blood glucose value sequence to construct a complete blood glucose time series trajectory; Integrate the blood glucose time-series trajectory, real-time carbohydrate intake, and exercise intensity data to generate a current metabolic state feature vector; Based on pre-stored user vital signs data, metabolic equivalent parameters and insulin sensitivity coefficients are calculated to generate individualized physiological regulatory factors; The current metabolic state feature vector and individualized physiological regulatory factors are input into a pre-trained proximal strategy optimization algorithm model, which outputs the insulin dose adjustment and carbohydrate supplementation amount in a constrained action space. The insulin dose adjustment and carbohydrate supplementation amounts are converted into insulin dose adjustment instructions and dietary recommendation instructions; The personalized blood sugar control plan is constructed by combining the insulin dose adjustment instructions and dietary advice instructions and then marked with a timestamp.
5. The method for dynamic blood glucose prediction and management according to claim 4, characterized in that, The steps of performing safety rule verification on the personalized blood sugar control plan by calling a preset clinical rule base and generating a verified safe blood sugar control plan include: Analyze the insulin dose adjustment instructions and dietary recommendation instructions in the personalized blood sugar control plan, and extract the blood sugar control parameters to be executed; Obtain the user's current physiological state data and match the corresponding safety threshold rule set from the preset clinical rule base; The sugar control parameters to be executed are dynamically compared with the safety threshold rule set to detect whether there is a risk of parameters going out of bounds; If a risk of parameter out-of-bounds is detected, the sugar control parameters to be executed are corrected based on a predefined constraint optimization strategy to generate corrected sugar control parameters. Reconstruct insulin dosage adjustment instructions and dietary recommendations based on the revised blood sugar control parameters; The reconstructed instructions are combined and bound with a verification timestamp to generate the safe sugar control scheme.
6. The method for dynamic blood glucose prediction and management according to claim 5, characterized in that, The steps of collecting time-series blood glucose data after the user implements the safe blood glucose control plan and updating the weight matrix of the blood glucose prediction model through online transfer learning include: Receive execution feedback data stream uploaded by the user terminal, including continuous blood glucose monitoring values, real-time physiological parameters and environmental indicators after the user executes the safe blood sugar control plan; The execution feedback data stream is correlated and aligned with the execution time interval of the corresponding safe sugar control scheme to generate a labeled incremental training dataset; The online learner is initialized based on the current weight matrix of the blood glucose prediction model, and the feature distribution benchmark of the historical training data is loaded. The online learner is used to perform forward inference on the incremental training dataset to calculate the error loss function between the predicted blood glucose value and the actual blood glucose monitoring value. The weight parameters of the online learner are updated using the gradient backpropagation algorithm, and the parameter update magnitude is constrained by a dynamic learning rate decay strategy. The updated weight parameters are integrated into the weight matrix of the blood glucose prediction model, overriding the original model parameters to complete online transfer learning.
7. A method for dynamic blood glucose prediction and management according to any one of claims 1 to 6, characterized in that, Following the step of collecting time-series blood glucose data after the user executes the safe blood glucose control plan, the method further includes: Calculate the difference between the newly collected time-series blood glucose data and the blood glucose prediction value sequence to generate a residual vector; The residual vector is input into a pre-constructed variational autoencoder network to generate a latent space feature distribution; Obtain the pre-stored historical normal metabolic state feature distribution; Calculate the KL divergence between the latent space feature distribution and the historical normal metabolic state feature distribution; If the KL divergence value is greater than the dynamic adjustment threshold, the online transfer learning update of the blood glucose prediction model is triggered.
8. A dynamic blood glucose prediction and management system, characterized in that, The system includes: A multi-source data receiving module is used to receive raw user data streams through an IoT gateway; wherein, the raw user data streams include time-series blood glucose data, physiological parameter data, environmental indicator data, and dietary logs and medication dosage data from the user terminal; The data processing module is used to perform data cleaning operations and timestamp alignment on the user's raw data stream to generate a time-aligned multi-source dataset. The multidimensional feature extraction module is used to extract time-domain statistical features, frequency-domain transformation features, and metabolic stability nonlinear features from the multi-source dataset to construct a high-dimensional feature vector. The blood glucose time series prediction module is used to input the high-dimensional feature vector into a pre-trained blood glucose prediction model and output a sequence of predicted blood glucose values for a specified future time period. The blood sugar control plan decision module is used to obtain current blood glucose value, real-time carbohydrate intake and exercise intensity data, and combine them with the blood glucose prediction value sequence to generate insulin dose adjustment instructions and dietary advice instructions through the proximal strategy optimization algorithm, so as to obtain a personalized blood sugar control plan. The clinical safety rule verification module is used to call a preset clinical rule base to perform safety rule verification on the personalized blood sugar control plan and generate a verified safe blood sugar control plan. The solution distribution module is used to distribute the safe blood sugar control solution to the user terminal and the doctor monitoring platform; The model adaptive update module is used to collect time-series blood glucose data after the user implements the safe blood glucose control plan, and update the weight matrix of the blood glucose prediction model through online transfer learning.
9. A computer device, characterized in that: The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer program is stored that can be loaded by a processor and executed as described in any one of claims 1 to 7.