A method and system for generating a guidance text based on a diabetes management strategy recommendation
By constructing a knowledge graph and aggregating entities and relationships using multiple attention layers, personalized diabetes management guidance texts are generated, solving the problems of lack of real-time, personalization and intelligence in existing methods, and achieving more accurate and efficient management guidance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CENT SOUTH UNIV
- Filing Date
- 2025-06-17
- Publication Date
- 2026-07-07
AI Technical Summary
Existing diabetes management methods lack real-time, personalization, and intelligence. Traditional guidance lacks real-time and personalization, home monitoring devices lack intelligent decision support, and rule-based systems lack flexibility and adaptability, failing to fully consider individual differences and dynamic changes in patients.
By acquiring text datasets of patient information, medical records, and lifestyle habits, entity recognition and relation extraction are performed to construct a knowledge graph. Multi-layer attention layers are used to aggregate entities and relations, generate embedded representations, align and fuse them, determine candidate vectors for management strategies, and finally generate personalized diabetes management guidance text.
It improves the real-time, personalized, and intelligent nature of diabetes management, enabling the provision of individualized management guidance based on the patient's specific situation, thereby enhancing the accuracy and efficiency of the guidance.
Smart Images

Figure CN120809290B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data recommendation technology, and in particular to a method and system for generating guidance text based on diabetes management strategy recommendations. Background Technology
[0002] Currently, diabetes management primarily relies on traditional medical guidance, home monitoring, and medication. Traditionally, diabetic patients depend on regular follow-ups and face-to-face educational guidance from doctors. This guidance typically includes dietary recommendations, exercise plans, blood glucose monitoring methods, and insulin usage instructions. However, this approach lacks real-time and personalization; patients often only seek medical help after symptoms appear, and the guidance is generally generic and difficult to tailor to individual circumstances. With technological advancements, home blood glucose monitors and insulin pumps have become increasingly common. These devices can monitor patients' blood glucose levels in real time and adjust insulin dosages as needed. While this method improves monitoring convenience, it lacks intelligent decision support; patients still need to interpret the data and make decisions themselves, which may lead to mismanagement or complications. Some existing diabetes management systems now employ rule-based methods, providing management recommendations based on preset thresholds and algorithms. For example, when blood glucose levels exceed a certain range, the system may prompt patients to adjust their diet or increase exercise. However, this rule-based approach lacks flexibility and adaptability, failing to fully consider individual patient differences and dynamic changes.
[0003] In summary, traditional medical guidance lacks real-time and personalization; while home monitoring devices improve the convenience of monitoring, they lack intelligent decision support; and rule-based management systems lack flexibility and adaptability. Therefore, existing diabetes management methods are insufficient in terms of real-time performance, personalization, and intelligence. Summary of the Invention
[0004] This application aims to propose a method and system for generating guidance text based on diabetes management strategy recommendations, which can improve the real-time, personalized and intelligent nature of diabetes management.
[0005] In a first aspect, embodiments of this application provide a method for generating guidance text based on diabetes management strategy recommendations, the method comprising:
[0006] Obtain a text dataset containing patient information, medical records, and lifestyle habits;
[0007] Entity recognition is performed on each text in the text dataset to obtain multiple entities, and the relationships between the entities are extracted from each text;
[0008] Construct a knowledge graph based on the multiple entities and the relationships between them;
[0009] The entities and relations in the knowledge graph are aggregated using multiple attention layers to obtain a first embedding representation;
[0010] Text embeddings are generated for entities and relations in the knowledge graph, and the text embeddings are aggregated into a second embedding representation using the multi-layer attention layer;
[0011] The first embedding representation and the second embedding representation are aligned and merged to obtain the target embedding representation;
[0012] Based on the target embedding representation and the target problem, multiple candidate vectors for management strategies are determined;
[0013] Select a target management strategy from the multiple candidate management strategy vectors, and generate diabetes management guidance text based on the target management strategy.
[0014] Compared with the prior art, the first aspect of this application has the following beneficial effects:
[0015] This method acquires a text dataset containing patient information, medical records, and lifestyle habits; performs entity recognition on each text in the dataset to obtain multiple entities, and extracts relationships between entities from each text; constructs a knowledge graph based on the multiple entities and their relationships; aggregates the entities and relationships in the knowledge graph using multiple attention layers to obtain a first embedding representation; generates text embeddings for the entities and relationships in the knowledge graph, and aggregates these text embeddings into a second embedding representation using multiple attention layers; aligns and fuses the first and second embedding representations to obtain a target embedding representation; determines multiple management strategy candidate vectors based on the target embedding representation and the target question; selects a target management strategy from the multiple management strategy candidate vectors, and generates diabetes management guidance text based on the target management strategy. In this way, entity and relationship information in the knowledge graph is propagated and aggregated through three attention layers, enabling accurate learning of relevant user features and avoiding the propagation of irrelevant noise. Furthermore, the aggregation of text embeddings into a second embedding representation through three attention layers incorporates the topological information of the knowledge graph into the embedding representation, which helps improve the quality of the embedding representation. By fusing high-quality first and second embedding representations, a high-quality target embedding representation is obtained. Based on this high-quality target embedding representation, a more personalized management strategy that better matches the patient's input target question can be selected, thereby generating more accurate diabetes management guidance text for diabetes management guidance. Furthermore, this method only requires the patient to input the question and patient-related text data to directly obtain diabetes management guidance text, demonstrating high efficiency, real-time performance, and intelligence. Therefore, this method can improve the real-time performance, personalization, and intelligence of diabetes management.
[0016] In some implementations, the aggregation of entities and relations in the knowledge graph using multiple attention layers to obtain a first embedding representation includes:
[0017] The first attention score between the patient entity and each relation in the corresponding layer of the patient entity is calculated using the first attention layer.
[0018] Based on the first attention score, all relations corresponding to the layer of the patient entity are aggregated to obtain the relation representation of the current layer;
[0019] The head entity representation and relation representation in the current layer are concatenated to obtain a concatenated feature representation. The concatenated feature representation is then input into the multilayer perceptron in the second attention layer to obtain a second attention score.
[0020] Based on the first attention score and the second attention score, all neighbor entities connected to the patient entity are aggregated to calculate the embedding representation of the current layer;
[0021] The third attention layer is used to aggregate the relational representations of all layers and the embedding representations of all layers to obtain the first embedding representation.
[0022] In some implementations, the step of aggregating all neighboring entities connected to the patient entity relationship based on the first attention score and the second attention score to calculate the embedding representation of the current layer includes:
[0023]
[0024] Among them, E (l) Let I represent the embedding representation of the current layer, and β represent the number of triples in the l-th layer. user_i β represents the first attention score. entity_i This represents the second attention score. This represents the i-th neighboring entity in the l-th layer.
[0025] In some implementations, the aggregation of the relational representations of all layers and the embedding representations of all layers using a third attention layer to obtain a first embedding representation includes:
[0026]
[0027] β l =(E (0) ||R (0) )·(E (l) ||R (l) ) T
[0028] Among them, E oThis represents the first embedding representation, o represents a placeholder, agg(·) represents an aggregate function, and E (l) R represents the embedding representation of the l-th layer. (l) This represents the relation representation of the l-th layer, β. l Let L represent the attention score of the l-th layer, and T represent the transpose.
[0029] In some implementations, aligning and fusing the first embedding representation and the second embedding representation to obtain the target embedding representation includes:
[0030] The first embedding representation and the second embedding representation are mapped to the same space using a mapping matrix, and the first embedding representation and the second embedding representation are aligned by maximizing cosine similarity to obtain the aligned first embedding representation and the aligned second embedding representation;
[0031] The aligned first embedding representation and the aligned second embedding representation are weighted and fused to obtain the target embedding representation.
[0032] In some implementations, determining multiple candidate vectors for management strategies based on the target embedding representation and the target problem includes:
[0033] The target problem is transformed into a problem vector representation;
[0034] The query vector is obtained by fusing the question vector representation and the target embedding representation;
[0035] Based on the query vector, select multiple candidate vectors for management strategies from the management strategy library.
[0036] In some implementations, the step of selecting a target management strategy from the plurality of management strategy candidate vectors and generating diabetes management guidance text based on the target management strategy includes:
[0037] If the target problem is the same as one of the multiple historical problems, then obtain the historical management strategy corresponding to the historical problem that is the same as the target problem;
[0038] The historical management strategy is removed from the multiple management strategy candidate vectors to obtain the remaining management strategy candidate vectors;
[0039] Select the target management strategy most relevant to the target problem from the remaining candidate management strategies;
[0040] Based on the stated target management strategy, generate diabetes management guidance text.
[0041] Secondly, embodiments of this application also provide a guidance text generation system based on diabetes management strategy recommendations, the system comprising:
[0042] The text data acquisition unit is used to acquire text datasets containing patient information, medical records, and lifestyle habits.
[0043] A text data processing unit is used to perform entity recognition on each text in the text dataset to obtain multiple entities, and to extract the relationships between the entities from each text;
[0044] A knowledge graph construction unit is used to construct a knowledge graph based on the multiple entities and the relationships between the entities;
[0045] The first data aggregation unit is used to aggregate entities and relations in the knowledge graph using multiple attention layers to obtain a first embedded representation;
[0046] The second data aggregation unit is used to generate text embeddings for entities and relationships in the knowledge graph, and to aggregate the text embeddings into a second embedding representation using the multi-layer attention layer;
[0047] The data alignment and fusion unit is used to align and fuse the first embedding representation and the second embedding representation to obtain the target embedding representation;
[0048] The management strategy determination unit is used to determine multiple management strategy candidate vectors based on the target embedding representation and the target problem;
[0049] The guidance text generation unit is used to generate diabetes management guidance text based on the multiple management strategy candidate vectors.
[0050] Thirdly, embodiments of this application also provide an electronic device, including at least one control processor and a memory for communicatively connecting to the at least one control processor; the memory stores instructions executable by the at least one control processor, the instructions being executed by the at least one control processor to enable the at least one control processor to perform a guidance text generation method based on diabetes management strategy recommendations as described above.
[0051] Fourthly, embodiments of this application also provide a computer-readable storage medium storing computer-executable instructions for causing a computer to execute a guidance text generation method based on diabetes management strategy recommendations as described above.
[0052] It is understood that the beneficial effects of the second to fourth aspects compared with the related technologies are the same as the beneficial effects of the first aspect compared with the related technologies. Please refer to the relevant description in the first aspect above, which will not be repeated here. Attached Figure Description
[0053] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:
[0054] Figure 1 This is a flowchart illustrating an embodiment of the guidance text generation method based on diabetes management strategy recommendations provided in this application;
[0055] Figure 2 This is a schematic diagram of the structure of an embodiment of the guidance text generation system based on diabetes management strategy recommendations provided in this application;
[0056] Figure 3 This is a schematic diagram of the structure of an embodiment of the electronic device provided in this application. Detailed Implementation
[0057] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0058] In the description of this application, the use of terms such as "first," "second," etc., is for the purpose of distinguishing technical features only and should not be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated or the order of the technical features indicated.
[0059] In the description of this application, it should be understood that the orientation descriptions, such as up, down, etc., are based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application.
[0060] In the description of this application, it should be noted that, unless otherwise explicitly defined, terms such as "setup," "installation," and "connection" should be interpreted broadly, and those skilled in the art can reasonably determine the specific meaning of the above terms in this application in conjunction with the specific content of the technical solution.
[0061] Currently, diabetes management primarily relies on traditional medical guidance, home monitoring, and medication. Traditionally, diabetic patients depend on regular follow-ups and face-to-face educational guidance from doctors. This guidance typically includes dietary recommendations, exercise plans, blood glucose monitoring methods, and insulin usage instructions. However, this approach lacks real-time and personalization; patients often only seek medical help after symptoms appear, and the guidance is generally generic and difficult to tailor to individual circumstances. With technological advancements, home blood glucose monitors and insulin pumps have become increasingly common. These devices can monitor patients' blood glucose levels in real time and adjust insulin dosages as needed. While this method improves monitoring convenience, it lacks intelligent decision support; patients still need to interpret the data and make decisions themselves, which may lead to mismanagement or complications. Some existing diabetes management systems now employ rule-based methods, providing management recommendations based on preset thresholds and algorithms. For example, when blood glucose levels exceed a certain range, the system may prompt patients to adjust their diet or increase exercise. However, this rule-based approach lacks flexibility and adaptability, failing to fully consider individual patient differences and dynamic changes.
[0062] In summary, traditional medical guidance lacks real-time and personalization; while home monitoring devices improve the convenience of monitoring, they lack intelligent decision support; and rule-based management systems lack flexibility and adaptability.
[0063] To address the shortcomings of existing diabetes management methods in terms of real-time performance, personalization, and intelligence, this application proposes a method and system for generating guidance text based on diabetes management strategy recommendations.
[0064] Reference Figure 1 This application provides a flowchart illustrating a method for generating guidance text based on diabetes management strategy recommendations. This method is applied to an electronic device, which may be a server or a mobile terminal, etc. Figure 1 As shown, the method for generating guidance text based on diabetes management strategy recommendations may include the following steps:
[0065] Step S100: Obtain a text dataset containing patient information, medical records, and lifestyle habits;
[0066] Step S200: Perform entity recognition on each text in the text dataset to obtain multiple entities, and extract the relationships between entities from each text;
[0067] Step S300: Construct a knowledge graph based on multiple entities and the relationships between them;
[0068] Step S400: Aggregate entities and relations in the knowledge graph using multiple attention layers to obtain the first embedding representation;
[0069] Step S500: Generate text embeddings for entities and relations in the knowledge graph, and aggregate the text embeddings into a second embedding representation using a multi-layer attention layer;
[0070] Step S600: Align and fuse the first embedding representation and the second embedding representation to obtain the target embedding representation;
[0071] Step S700: Based on the target embedding representation and the target problem, determine multiple candidate vectors for management strategies;
[0072] Step S800: Select a target management strategy from multiple management strategy candidate vectors, and generate diabetes management guidance text based on the target management strategy.
[0073] In this embodiment, a text dataset containing patient information, medical records, and lifestyle habits is acquired. Entity recognition is performed on each text in the dataset to obtain multiple entities, and relationships between entities are extracted from each text. A knowledge graph is constructed based on the multiple entities and their relationships. Multiple attention layers are used to aggregate the entities and relationships in the knowledge graph to obtain a first embedding representation. Text embeddings are generated for the entities and relationships in the knowledge graph, and multiple attention layers are used to aggregate these text embeddings into a second embedding representation. The first and second embedding representations are aligned and fused to obtain a target embedding representation. Multiple management strategy candidate vectors are determined based on the target embedding representation and the target question. A target management strategy is selected from the multiple management strategy candidate vectors, and diabetes management guidance text is generated based on the target management strategy. Thus, entity and relationship information in the knowledge graph is propagated and aggregated through three attention layers, enabling accurate learning of relevant user features and avoiding the propagation of irrelevant noise. Furthermore, the aggregation of text embeddings into a second embedding representation through three attention layers incorporates the topological information of the knowledge graph into the embedding representation, which helps enhance the quality of the embedding representation. By fusing high-quality first and second embedding representations, a high-quality target embedding representation is obtained. Based on this high-quality target embedding representation, a more personalized management strategy that better matches the patient's input target question can be selected, thereby generating more accurate diabetes management guidance text for diabetes management guidance. Furthermore, this method only requires the patient to input the question and patient-related text data to directly obtain diabetes management guidance text, demonstrating high efficiency, real-time performance, and intelligence. Therefore, this method can improve the real-time performance, personalization, and intelligence of diabetes management.
[0074] The aforementioned patient information may include the patient's (i.e., the user's) age, gender, duration of illness, and daily blood glucose fluctuation range.
[0075] The aforementioned medical records may include information such as past treatment plans, medications, and any complications.
[0076] The aforementioned lifestyle habits can include information such as dietary preferences (preferring sweet, salty, or other flavors, and approximate intake per meal), exercise (textual descriptions of exercise frequency and intensity), and daily routines (textual information such as daily sleep and wake-up times).
[0077] The entity recognition process described above for each text in the text dataset can be performed using a Named Entity Recognition (NER) model. For example, a BERT-based NER model.
[0078] The extraction of relationships between entities from each text can be achieved using a relation extraction model. For example, a relation extraction network based on deep learning.
[0079] In some implementations, multiple attention layers are used to aggregate entities and relations in the knowledge graph to obtain a first embedding representation, including:
[0080] The first attention score between the patient entity and each relation in the corresponding layer of the patient entity is calculated using the first attention layer.
[0081] Based on the first attention score, all relations corresponding to the patient entity in the corresponding layer are aggregated to obtain the relation representation of the current layer;
[0082] The head entity representation and relation representation in the current layer are concatenated to obtain a concatenated feature representation. The concatenated feature representation is then input into the multilayer perceptron in the second attention layer to obtain the second attention score.
[0083] Based on the first attention score and the second attention score, all neighbor entities connected to the patient entity are aggregated to calculate the embedding representation of the current layer;
[0084] The third attention layer is used to aggregate the relational representations of all layers and the embedding representations of all layers to obtain the first embedding representation.
[0085] In this embodiment, a first attention score is calculated between the patient entity and each relation in the corresponding layer using a first attention layer. Based on the first attention score, all relations in the corresponding layer of the patient entity are aggregated to obtain the relation representation of the current layer. The head entity representation and relation representation in the current layer are concatenated to obtain a concatenated feature representation, which is then input into a multilayer perceptron in the second attention layer to obtain a second attention score. Based on the first and second attention scores, all neighboring entities connected to the patient entity's relation are aggregated to calculate the embedding representation of the current layer. A third attention layer is used to aggregate the relation representations and embedding representations of all layers to obtain a first embedding representation. Thus, by employing multilayer attention to propagate and aggregate entities and relations in the knowledge graph, the relevant features of the patient user can be accurately learned, avoiding the propagation of irrelevant noise. The first attention layer is used to calculate the attention score, which can be used to control the relevance between patient users (i.e., patient entities) and their neighboring entities and relations in the knowledge graph. A higher attention score (i.e., higher relevance) indicates that the patient user has a higher interest in neighboring entities connected to that relation, thus giving higher weights to those neighboring entities and relations. This avoids introducing irrelevant information from multiple users. The second attention layer is used to measure the reliability of a triple (i.e., the overall relevance between the neighboring entity and (head entity, relation, user)), avoiding learning unreliable triples and introducing information with low relevance to users, and assigning higher weights to reliable triples. The third attention layer is used to measure the similarity between the embedding representations of different propagation layers and the embedding representation of layer 0 during knowledge graph propagation, addressing the oversmoothing problem and avoiding the introduction of excessive noise.
[0086] The third attention layer mentioned above is a propagation layer, which can be obtained by aggregating the relational representations of all propagation layers and the embedding representations of all propagation layers to obtain the first embedding representation.
[0087] In some implementations, based on a first attention score and a second attention score, all neighboring entities connected to the patient entity are aggregated to calculate the embedding representation of the current layer, including:
[0088]
[0089] Among them, E (l) Let I represent the embedding representation of the current layer, and β represent the number of triples in the l-th layer. user_i β represents the first attention score. entity_i This represents the second attention score. This represents the i-th neighboring entity in the l-th layer.
[0090] In this embodiment, by aggregating all neighboring entities connected to the patient entity based on the first attention score and the second attention score, the embedding representation of the current layer is calculated. This can measure the reliability of a triple (i.e., the comprehensive relevance between the neighboring entities and (the head entity, the relationship, and the user)), avoid learning unreliable triples and introducing information with low relevance to the user, and assign higher weights to reliable triples as much as possible.
[0091] In some implementations, a third attention layer is used to aggregate the relational representations of all layers and the embedding representations of all layers to obtain a first embedding representation, including:
[0092]
[0093] β l =(E (0) ||R (0) )·(E (l) ||R (l) ) T
[0094] Among them, E o This represents the first embedding representation, o represents a placeholder, agg(·) represents an aggregate function, and E (l) R represents the embedding representation of the l-th layer. (l) This represents the relation representation of the l-th layer, β. l Let L represent the attention score of the l-th layer, and T represent the transpose.
[0095] In this embodiment, by using a third attention layer to aggregate the relation representations of all layers and the embedding representations of all layers to obtain a first embedding representation, the similarity between the embedding representations of different propagation layers and the embedding representation of layer 0 during the propagation of the knowledge graph can be measured, thus solving the oversmoothing problem and avoiding the introduction of too much noise.
[0096] It should be noted that the learning process of the second embedding representation is similar to that of the first embedding representation. The difference is that the initial entity representation and relation representation of the first embedding representation are randomly initialized, while the initial entity representation and relation representation of the second embedding representation are their text representations.
[0097] In some implementations, the first embedding representation and the second embedding representation are aligned and fused to obtain the target embedding representation, including:
[0098] A mapping matrix is used to map the first and second embedding representations to the same space, and the first and second embedding representations are aligned by maximizing cosine similarity to obtain aligned first and second embedding representations.
[0099] The aligned first embedding representation and the aligned second embedding representation are weighted and fused to obtain the target embedding representation.
[0100] In this embodiment, a mapping matrix is used to map the first and second embedding representations to the same space, and the first and second embedding representations are aligned by maximizing cosine similarity to obtain aligned first and second embedding representations. The aligned first and second embedding representations are then weighted and fused to obtain the target embedding representation. Thus, by employing a weighted fusion method, the two aligned embedding representations are combined into the final embedding representation for the patient user (i.e., the target embedding representation). This final embedding representation retains both the structured information of the knowledge graph and incorporates textual semantic information, providing a more comprehensive and accurate feature foundation for subsequent recommendation management strategies and the generation of diabetes management guidance text.
[0101] In some implementations, multiple candidate vectors for management strategies are determined based on the target embedding representation and the target problem, including:
[0102] Transform the target problem into a problem vector representation;
[0103] The query vector is obtained by fusing the question vector representation and the target embedding representation.
[0104] Based on the query vector, select multiple candidate vectors for management strategies from the management strategy library.
[0105] In this embodiment, the target question is transformed into a question vector representation; the question vector representation and the target embedding representation are fused to obtain a query vector; based on the query vector, multiple management strategy candidate vectors are selected from the management strategy library. Thus, by selecting multiple management strategy candidate vectors from the management strategy library based on both the question vector representation and the target embedding representation, a management strategy that is more tailored to the patient's specific individual needs can be chosen.
[0106] In some implementations, a target management strategy is selected from multiple candidate management strategy vectors, and based on the target management strategy, diabetes management guidance text is generated, including:
[0107] If the target problem is the same as one of the multiple historical problems, then obtain the historical management strategy corresponding to the historical problem that is the same as the target problem;
[0108] The historical management strategies are removed from the multiple management strategy candidate vectors to obtain the remaining management strategy candidate vectors;
[0109] Select the target management strategy that is most relevant to the target problem from the remaining candidate management strategy vectors;
[0110] Based on the goal management strategy, generate diabetes management guidance text.
[0111] In this embodiment, if the target question is the same as one of multiple historical questions, the historical management strategy corresponding to the historical question that is the same as the target question is obtained; the historical management strategy is deleted from the multiple management strategy candidate vectors to obtain the remaining management strategy candidate vectors; the target management strategy most relevant to the target question is selected from the remaining management strategy candidate vectors; and diabetes management guidance text is generated based on the target management strategy. Thus, by selecting the target management strategy most relevant to the target question from the remaining management strategy candidate vectors, the diversity of management strategy support can be improved, and the same answer cannot be given repeatedly for the same question.
[0112] The aforementioned method for obtaining historical management strategies corresponding to historical questions identical to the target question can be achieved by calculating the similarity between the target question and historical questions. Questions with a similarity greater than a preset value are considered identical, and then the historical management strategies corresponding to the historical questions identical to the target question are obtained. It should be noted that the text statements corresponding to the target question and historical questions in this embodiment do not need to be completely identical.
[0113] To enable those skilled in the art to better understand the technical solutions of this application, a set of preferred embodiments are provided below:
[0114] Currently, diabetes management primarily relies on traditional medical guidance, home monitoring, and medication. Traditionally, diabetic patients depend on regular follow-ups and face-to-face educational guidance from doctors. This guidance typically includes dietary recommendations, exercise plans, blood glucose monitoring methods, and insulin usage instructions. However, this approach lacks real-time and personalization; patients often only seek medical help after symptoms appear, and the guidance is generally generic and difficult to tailor to individual circumstances. With technological advancements, home blood glucose monitors and insulin pumps have become increasingly common. These devices can monitor patients' blood glucose levels in real time and adjust insulin dosages as needed. While this method improves monitoring convenience, it lacks intelligent decision support; patients still need to interpret the data and make decisions themselves, which may lead to mismanagement or complications. Some existing diabetes management systems now employ rule-based methods, providing management recommendations based on preset thresholds and algorithms. For example, when blood glucose levels exceed a certain range, the system may prompt patients to adjust their diet or increase exercise. However, this rule-based approach lacks flexibility and adaptability, failing to fully consider individual patient differences and dynamic changes.
[0115] In summary, traditional medical guidance lacks real-time and personalization; while home monitoring devices improve the convenience of monitoring, they lack intelligent decision support; and rule-based management systems lack flexibility and adaptability.
[0116] Given the limitations of existing technologies, this embodiment proposes a real-time self-management support method for children and adolescents with type 1 diabetes based on a large language model. This method utilizes advanced large language model technology to provide patients with personalized self-management guidance and suggestions, aiming to improve the self-management ability and quality of life of children and adolescents with type 1 diabetes.
[0117] Self-management refers to an individual's proactive measures in daily life to manage their health, including diet control, exercise, blood glucose monitoring, and medication. For children and adolescents with type 1 diabetes, self-management is crucial for controlling the condition and preventing complications.
[0118] A real-time support system can refer to a system that can provide information, advice, or guidance in real time. In this embodiment, the real-time support method is built based on a large language model, which can provide personalized self-management guidance and support according to the specific circumstances and needs of children and adolescents with type 1 diabetes.
[0119] This embodiment leverages the powerful text generation and understanding capabilities of large language models to provide personalized self-management guidance and support for children and adolescents with type 1 diabetes. The specific technical solution of this embodiment includes the following:
[0120] 1. Data collection phase.
[0121] First, collect text data from various sources, such as:
[0122] (1) Basic patient information text, such as age, gender, duration of illness and daily blood glucose fluctuation range, etc. Key parameters will be extracted from this text information for analysis.
[0123] (2) Medical record text: past treatment plans, medication, and whether there are any complications, etc. Extract key numerical information such as specific drug dosage and insulin usage frequency from it (this step may involve simple text parsing, extracting corresponding values through set keyword matching rules, such as finding the specific numerical content after "insulin dosage is").
[0124] (3) Lifestyle text: dietary preferences (e.g., preference for sweet or salty flavors, approximate intake per meal), exercise (e.g., exercise frequency, exercise intensity), and daily routine (e.g., daily sleep and wake-up times).
[0125] 2. Text preprocessing stage.
[0126] (1) Cleaning and standardization: Clean the text collected in step 1, remove irrelevant punctuation, extra spaces and incorrect words, and standardize some content with multiple expressions, such as unifying "every day" and "daily" into one expression, which is convenient for subsequent processing.
[0127] (2) Classification and labeling: Classify and label the text content according to its nature, such as basic information, medical-related, and lifestyle habits, so that the model can distinguish and call different sections of content.
[0128] 3. Construct a patient knowledge graph.
[0129] Entity recognition: Identifying entities such as patient, age, gender, duration of illness, blood glucose fluctuation range, and related dietary and management recommendations from preprocessed text. Named Entity Recognition (NER) models, such as BERT-based NER models, can be used.
[0130] Relation extraction: Determining relationships between entities, such as "patient-age-17" or "patient-has-disease". Relation extraction models can be used, such as deep learning-based relation extraction networks.
[0131] Knowledge graph construction: The identified entities and relationships are combined into a knowledge graph and stored in the form of triples.
[0132] 4. Multimodal recommendation algorithm embedding learning stage.
[0133] First, an ID-based embedding method is used to learn relevant feature representations of users and embedding representations of relevant management strategies (items). Specifically, this includes:
[0134] This embodiment proposes a recommendation framework based on multi-layer attention. In this framework, entity and relation information from the knowledge graph is propagated and aggregated through the three attention layers proposed in this embodiment to accurately learn relevant user features and avoid the propagation of irrelevant noise. In this layer, the embedding of all IDs is randomly initialized, and then meaningful ID representations are obtained through learning.
[0135] Most existing knowledge-aware methods typically perform recursive embedding propagation by enumerating all neighbors in each layer. However, as the number of propagation layers increases, the number of neighbors of a node grows exponentially, leading to indistinguishable learned node representations. To alleviate this problem, this embodiment proposes a three-layer attention layer combined with information propagation to control the propagation of neighbor entity information and relationship information at each layer, preventing learned node representations from becoming too similar. These three attention layers include a user layer (i.e., the first attention layer), an entity layer (i.e., the second attention layer), and a propagation layer (i.e., the third attention layer). Specifically:
[0136] (1) The user-layer attention score is used to control the relevance between neighbor entities in the knowledge graph and users, avoiding the introduction of irrelevant information from multiple users. This layer's attention score β user By calculating the i-th relation r between the user (i.e., the patient entity) and the current layer (let's say the l-th layer). i (l) The inner product is obtained by considering the similarity between two vectors, and the inner product measures the similarity or strength of association between them. The core idea is that a high inner product score indicates a strong connection between the user and neighboring entities connected to that relationship. There is a high level of interest. β user One of the weights that can be used for weighted aggregation of neighbor entity information, while β user It can also be used as the weight of the relation (i.e., the first attention score). A weighted aggregation of all relation representations at level l yields a total relation representation at level l: Where I represents the number of triples in the l-th layer.
[0137] (2) The entity layer attention score is used to control the correlation between neighboring entities, the head entity, and relations. A feature representation is obtained by concatenating the head entity representation and the relation representation. This feature representation is then input into a three-layer multilayer perceptron (MLP) to obtain the entity layer attention score β. ebtity (That is, the second attention score) is obtained by adding the user-layer attention score and the entity-layer attention score to obtain the final attention score of the neighboring entity. This attention score measures the comprehensive relevance between the neighboring entity and (the head entity, relations, and user), avoiding the learning of unreliable triples and the introduction of information with little relevance to the user. The current-layer embedding representation of the entity can be obtained through this attention score.
[0138] (3) The third attention layer measures the contribution of different layers' embedding representations to the final embedding representation. Since higher-order information is relatively far from both the user and the central entity, increasing the number of layers not only leads to oversmoothing by aggregating the representations of each layer, but also introduces noise, resulting in suboptimal recommendation results. Therefore, this embodiment designs attention scores for the entity and relation representations of each layer to avoid introducing excessive noise. The user or item representation learned by the ID-based method can be represented as:
[0139]
[0140] Here, agg(·) represents an aggregate function, and o represents a placeholder, which can represent a user or a project. β l =(E (0) ||R (0) )·(E(l) ||R (l) ) T The attention score for layer l needs to be learned.
[0141] This embodiment effectively filters noise and improves the quality of user and item representations by incorporating multi-layered attention. Furthermore, this embodiment not only transmits entity information during information dissemination but also propagates and aggregates relational information, further utilizing the auxiliary information of the knowledge graph to improve recommendation accuracy.
[0142] Natural language processing methods such as BERT are used to learn the text embeddings of each entity and relation in the knowledge graph. Then, attention-based aggregation is used to combine these text embeddings into user representations and item representations. (i.e., the second embedding representation). This step employs an aggregation process similar to that of the ID-based embedding method. However, unlike the ID-based method which randomly initializes embeddings, this step uses a text-based method with user and knowledge graph text embeddings as initial embeddings. Then, the topological information of the knowledge graph is incorporated into the embedding representation through a recommendation framework based on three attention layers, which helps to enhance the quality of the embedding representation.
[0143] Then align and combine the ID-based patient representations E o and text-based patient representation The final embedded representation of the patient is obtained. To fully leverage the advantages of both methods, this embodiment will use the patient representation E based on id. o Compared with text-based patient representation Alignment and union are performed. The differences between the two representations in the semantic space are eliminated through a mapping based on cosine similarity; that is, a mapping matrix is used to combine E... o and Mapping to the same space yields and W id and W t It is E o and The corresponding mapping matrix is then used to align the two representations by maximizing cosine similarity, where the mapping matrix can be known. A weighted fusion method is then employed to combine the two aligned embedding representations into the patient's final embedding representation. This representation retains both the structured information of the knowledge graph and incorporates textual semantic information, providing a more comprehensive and accurate feature foundation for subsequent applications. The formula for its final embedding representation (i.e., the target embedding representation) is defined as follows:
[0144]
[0145] 5. Large language model intervention stage.
[0146] Embedding technology transforms the user-input question (i.e., the target question) into a vector representation (i.e., the question vector representation). It embeds user-specific features into the user's representation. The query vector is obtained by combining the query vector with the question vector representation. Then, the inner product is used to calculate the query vector and the candidate strategy vectors in the management strategy library (which can be a database manually constructed based on historical data or experience). The similarity between the two vectors is used to recall the top-k management strategies as candidate vectors for the large language model (i.e., multiple candidate vectors for management strategies). Inner product similarity is a method for measuring the similarity between two vectors. It reflects the degree of similarity between them by calculating the inner product of the two vectors. Inner product similarity is particularly effective in high-dimensional spaces because the importance of a particular dimension is relatively low in high-dimensional spaces.
[0147] The large language model further analyzes the question and then selects the strategy most relevant to the question from the top-k candidate vectors. It then combines this most relevant strategy to organize the answer, resulting in self-management guidance text (i.e., diabetes management guidance text). This step includes:
[0148] Feature extraction and parameter generation: The preprocessed text is input into the large language model. The model uses its natural language understanding capabilities to identify key features in the text. For example, it can analyze the approximate daily carbohydrate intake from text describing dietary preferences and daily intake (this may be done by combining the text about the types and portions of staple foods mentioned with common food nutrition tables to calculate the specific grams and other parameters, which involves simple calculations of corresponding nutrient values). It can also analyze the exercise situation from text combined with standard exercise intensity to determine the metabolic equivalent value corresponding to the exercise intensity (by matching and generating the corresponding parameters based on a common table of correspondence between exercise intensity and metabolic equivalent).
[0149] Historical Question Retrieval: This function retrieves whether a user has asked this question previously. If so, it displays all relevant management strategies from previous answers, marks each strategy in the candidate strategy library, and then the large model selects the most relevant, unanswered strategy from the top-k management strategies to provide the answer, thus improving the diversity of supported management strategies. If the user has not asked this question before, it only needs to select the most relevant strategy from the top-k management strategies to provide the answer.
[0150] Personalized strategy generation: Based on these extracted feature parameters and candidate diabetes self-management strategies (such as rules and knowledge of reasonable dietary structures and exercise duration suggestions corresponding to different age groups and blood glucose ranges, which can be embedded in the model training in text form or used as a reference when calling), the large language model generates personalized self-management guidance text. For example, for a 12-year-old patient who loves sports but has large fluctuations in blood glucose, the model generates guidance text containing specific suggestions and corresponding parameter ranges, such as "Given that you exercise at a high intensity for about 1 hour every day, it is recommended to increase your carbohydrate intake by 10-15 grams before exercise to prevent hypoglycemia. Monitor blood glucose after exercise. If blood glucose is higher than 10 mmol / L, you can replenish water as needed and rest for 15 minutes before measuring again."
[0151] 6. Feedback and optimization phase.
[0152] Patients or medical staff can provide feedback on the management strategies obtained during the intervention phase of the big language model. These feedback texts will also be collected and analyzed. The big language model will continuously adjust the management strategies generated based on the feedback, and optimize the accuracy of feature extraction and guidance generation when providing services to other patients. This process may involve simple mathematical statistical methods such as statistical analysis of the proportion of positive and negative evaluation keywords in the feedback text to measure the generation effect and make targeted improvements.
[0153] Overall, the system primarily utilizes text parsing, feature extraction and matching, simple nutritional and exercise-related numerical conversions, and text generation logic. It combines the capabilities of knowledge graphs and large language models to create personalized self-management support services for children and adolescents with type 1 diabetes. During the process, it incorporates some basic mathematical calculations based on specific professional knowledge to generate practical parameter-assisted guidance text output.
[0154] 7. Dynamic information knowledge base updates and retrieval.
[0155] The information knowledge base not only contains comprehensive information on type 1 diabetes in children and adolescents, but it is also dynamically updated to ensure that the textual data information users receive is the most up-to-date and accurate. This is especially important for technology in the medical field, as medical knowledge and best practices are constantly evolving.
[0156] 8. Intent recognition driven by dialogue history.
[0157] This embodiment's method identifies user intent by storing and analyzing the user's conversation history, thereby providing more relevant and timely responses. This context-based conversation management improves user experience and satisfaction.
[0158] 9. Multimodal information output.
[0159] The method described in this embodiment can convey information and suggestions to users in various ways (such as graphical interface, voice, and SMS), improving the efficiency and flexibility of information transmission.
[0160] 10. Modular design.
[0161] The system constructed by the method in this embodiment adopts a modular design, including user information configuration, knowledge base retrieval, dialogue record and intent recommendation module units, which makes the system easy to expand and maintain.
[0162] 11. Real-time feedback and interaction.
[0163] The method described in this embodiment can provide real-time feedback and interaction, which is especially important for medical management scenarios that require rapid response, enabling timely responses to user needs and changes.
[0164] 12. Increased user engagement.
[0165] By leveraging the interactivity and engaging nature of large language models, we can increase children's participation and interest in self-management education, thereby improving the effectiveness of self-management.
[0166] Compared with the prior art, the method of this embodiment has the following advantages:
[0167] 1. Personalized and precise user information configuration.
[0168] This embodiment collects detailed information such as the user's medical history, treatment status, dietary habits, and exercise preferences to provide more personalized and precise self-management suggestions. This configuration not only improves the relevance of the suggestions but also allows for adjustments to management strategies based on the user's specific situation, thereby enhancing the effectiveness of self-management.
[0169] 2. Comprehensive and up-to-date information knowledge base retrieval.
[0170] The information knowledge base compiles comprehensive information on type 1 diabetes in children and adolescents, including textual information such as disease details, treatment plans, frequently asked questions, and medication recommendations. This comprehensiveness ensures that users have access to the latest and most accurate medical information, contributing to improved scientific rigor and effectiveness of treatment.
[0171] 3. Efficient dialogue records and history matching.
[0172] This embodiment stores all dialogue history between the user and the large model system, and can match the 30 most recent dialogue records before the current user. This efficient dialogue record and history matching function allows users to quickly review previous exchanges, helping to maintain the coherence and contextual consistency of the conversation, while also enabling the system to better understand the user's needs and preferences.
[0173] 4. Flexible intent recommendation module.
[0174] The recommendation algorithm (i.e., multimodal recommendation algorithm) in the intent recommendation module of this embodiment can not only recall relevant management strategies based on the user's personalized characteristics and different user dialogue needs, and use different prompt words to further drive the large model to select appropriate management strategies for responses, but also avoid giving the same answer to the same question based on historical dialogues, increasing the likelihood that users will be exposed to diverse management strategies. This flexibility enables the system to quickly adapt to various user needs, providing more accurate and timely responses, thereby improving user experience and satisfaction.
[0175] 5. Real-time and interactive features.
[0176] Real-time support systems based on large language models can provide real-time information, suggestions, or guidance—a real-time and interactive feature unmatched by existing technologies. Users can receive immediate feedback, which is particularly important for healthcare management scenarios requiring rapid responses.
[0177] 6. Improve self-management skills and quality of life.
[0178] Based on the advantages mentioned above, the technical solution of this embodiment can significantly improve the self-management ability of children and adolescents with type 1 diabetes, help them better control their condition, prevent complications, and thus improve their quality of life.
[0179] Reference Figure 2 This application also provides a guidance text generation system based on diabetes management strategy recommendations. This system may include a text data acquisition unit 100, a text data processing unit 200, a knowledge graph construction unit 300, a first data aggregation unit 400, a second data aggregation unit 500, a data alignment and fusion unit 600, a management strategy determination unit 700, and a guidance text generation unit 800, wherein:
[0180] The text data acquisition unit 100 is used to acquire a text dataset containing patient information, medical records, and lifestyle habits.
[0181] The text data processing unit 200 is used to perform entity recognition on each text in the text dataset, obtain multiple entities, and extract the relationships between entities from each text;
[0182] Knowledge graph construction unit 300 is used to construct a knowledge graph based on multiple entities and the relationships between them;
[0183] The first data aggregation unit 400 is used to aggregate entities and relations in the knowledge graph using multiple attention layers to obtain the first embedded representation;
[0184] The second data aggregation unit 500 is used to generate text embeddings for entities and relations in the knowledge graph, and to aggregate the text embeddings into a second embedding representation using multiple attention layers;
[0185] The data alignment and fusion unit 600 is used to align and fuse the first embedding representation and the second embedding representation to obtain the target embedding representation;
[0186] The management strategy determination unit 700 is used to determine multiple management strategy candidate vectors based on the target embedding representation and the target problem;
[0187] The guidance text generation unit 800 is used to generate diabetes management guidance text based on multiple management strategy candidate vectors.
[0188] It should be noted that since the guidance text generation system based on diabetes management strategy recommendation in this embodiment is based on the same inventive concept as the guidance text generation method based on diabetes management strategy recommendation described above, the corresponding content in the method embodiment is also applicable to this system embodiment, and will not be described in detail here.
[0189] Reference Figure 3 This application also provides an electronic device, which includes:
[0190] At least one memory;
[0191] At least one processor;
[0192] At least one program;
[0193] The program is stored in memory, and the processor executes at least one program to implement the above-described method for generating guidance text based on diabetes management strategy recommendations.
[0194] This electronic device can be any smart terminal, including mobile phones, tablets, personal digital assistants (PDAs), and in-vehicle computers.
[0195] The electronic devices according to embodiments of this application will now be described in detail.
[0196] The processor 1600 can be implemented using a general-purpose central processing unit (CPU), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this disclosure.
[0197] The memory 1700 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 1700 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1700 and is called and executed by the processor 1600 to execute the guidance text generation method based on diabetes management strategy recommendations of the embodiments of this disclosure.
[0198] The input / output interface 1800 is used to implement information input and output.
[0199] The communication interface 1900 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0200] Bus 2000 transmits information between various components of the device (e.g., processor 1600, memory 1700, input / output interface 1800, and communication interface 1900);
[0201] The processor 1600, memory 1700, input / output interface 1800 and communication interface 1900 are connected to each other within the device via bus 2000.
[0202] This disclosure also provides a storage medium, which is a computer-readable storage medium storing computer-executable instructions for causing a computer to perform the above-described method for generating guidance text based on diabetes management strategy recommendations.
[0203] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0204] The embodiments described in this disclosure are for the purpose of more clearly illustrating the technical solutions of this disclosure and do not constitute a limitation on the technical solutions provided by this disclosure. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by this disclosure are also applicable to similar technical problems.
[0205] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this disclosure, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0206] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0207] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0208] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0209] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0210] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0211] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0212] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0213] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks. The embodiments of this application have been described in detail above with reference to the accompanying drawings, but this application is not limited to the above embodiments. Various changes can be made within the scope of knowledge possessed by those skilled in the art without departing from the spirit of this application.
[0214] The embodiments of this application have been described in detail above with reference to the accompanying drawings. However, this application is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of this application.
Claims
1. A method for generating guidance text based on diabetes management strategy recommendations, characterized in that, The method includes: Obtain a text dataset containing patient information, medical records, and lifestyle habits; Entity recognition is performed on each text in the text dataset to obtain multiple entities, and the relationships between the entities are extracted from each text; Construct a knowledge graph based on the multiple entities and the relationships between them; The entities and relations in the knowledge graph are aggregated using multiple attention layers to obtain a first embedding representation, including: The first attention score between the patient entity and each relation in the corresponding layer of the patient entity is calculated using the first attention layer. Based on the first attention score, all relations corresponding to the layer of the patient entity are aggregated to obtain the relation representation of the current layer; The head entity representation and relation representation in the current layer are concatenated to obtain a concatenated feature representation. The concatenated feature representation is then input into the multilayer perceptron in the second attention layer to obtain a second attention score. Based on the first attention score and the second attention score, all neighboring entities connected to the patient entity are aggregated, and the embedding representation of the current layer is calculated, including: in, This represents the embedding representation of the current layer. Indicates the first The number of layer triples, This represents the first attention score. This represents the second attention score. Indicates the first The first in the layer One neighboring entity; A third attention layer is used to aggregate the relational representations and embedding representations of all layers to obtain the first embedding representation, which includes: in, This represents the first embedding representation. Indicates a placeholder. Represents aggregate functions, Indicates the first Layer embedding representation, Indicates the first Layer relationship representation, Indicates the first Attention score of layer Indicates the total number of floors. Indicates transpose; Text embeddings are generated for entities and relations in the knowledge graph, and the text embeddings are aggregated into a second embedding representation using the multi-layer attention layer; The first embedding representation and the second embedding representation are aligned and merged to obtain the target embedding representation; Based on the target embedding representation and the target problem, multiple candidate vectors for management strategies are determined; Select a target management strategy from the multiple candidate management strategy vectors, and generate diabetes management guidance text based on the target management strategy.
2. The method for generating guidance text based on diabetes management strategy recommendations according to claim 1, characterized in that, The step of aligning and fusing the first embedding representation and the second embedding representation to obtain the target embedding representation includes: The first embedding representation and the second embedding representation are mapped to the same space using a mapping matrix, and the first embedding representation and the second embedding representation are aligned by maximizing cosine similarity to obtain the aligned first embedding representation and the aligned second embedding representation; The aligned first embedding representation and the aligned second embedding representation are weighted and fused to obtain the target embedding representation.
3. The method for generating guidance text based on diabetes management strategy recommendations according to claim 1, characterized in that, The step of determining multiple candidate vectors for management strategies based on the target embedding representation and the target problem includes: The target problem is transformed into a problem vector representation; The query vector is obtained by fusing the question vector representation and the target embedding representation; Based on the query vector, select multiple candidate vectors for management strategies from the management strategy library.
4. The method for generating guidance text based on diabetes management strategy recommendations according to claim 1, characterized in that, The step of selecting a target management strategy from the multiple candidate management strategy vectors and generating diabetes management guidance text based on the target management strategy includes: If the target problem is the same as one of the multiple historical problems, then obtain the historical management strategy corresponding to the historical problem that is the same as the target problem; The historical management strategy is removed from the multiple management strategy candidate vectors to obtain the remaining management strategy candidate vectors; Select the target management strategy most relevant to the target problem from the remaining candidate management strategies; Based on the stated target management strategy, generate diabetes management guidance text.
5. A guidance text generation system based on diabetes management strategy recommendations, characterized in that, The system includes: The text data acquisition unit is used to acquire text datasets containing patient information, medical records, and lifestyle habits. A text data processing unit is used to perform entity recognition on each text in the text dataset to obtain multiple entities, and to extract the relationships between the entities from each text; A knowledge graph construction unit is used to construct a knowledge graph based on the multiple entities and the relationships between the entities; The first data aggregation unit is used to aggregate entities and relations in the knowledge graph using multiple attention layers to obtain a first embedding representation, including: The first attention score between the patient entity and each relation in the corresponding layer of the patient entity is calculated using the first attention layer. Based on the first attention score, all relations corresponding to the layer of the patient entity are aggregated to obtain the relation representation of the current layer; The head entity representation and relation representation in the current layer are concatenated to obtain a concatenated feature representation. The concatenated feature representation is then input into the multilayer perceptron in the second attention layer to obtain a second attention score. Based on the first attention score and the second attention score, all neighboring entities connected to the patient entity are aggregated, and the embedding representation of the current layer is calculated, including: in, This represents the embedding representation of the current layer. Indicates the first The number of layer triples, This represents the first attention score. This represents the second attention score. Indicates the first The first in the layer One neighboring entity; A third attention layer is used to aggregate the relational representations and embedding representations of all layers to obtain the first embedding representation, which includes: in, This represents the first embedding representation. Indicates a placeholder. Represents aggregate functions, Indicates the first Layer embedding representation, Indicates the first Layer relationship representation, Indicates the first Attention score of layer Indicates the total number of floors. Indicates transpose; The second data aggregation unit is used to generate text embeddings for entities and relationships in the knowledge graph, and to aggregate the text embeddings into a second embedding representation using the multi-layer attention layer; The data alignment and fusion unit is used to align and fuse the first embedding representation and the second embedding representation to obtain the target embedding representation; The management strategy determination unit is used to determine multiple management strategy candidate vectors based on the target embedding representation and the target problem; The guidance text generation unit is used to generate diabetes management guidance text based on the multiple management strategy candidate vectors.
6. An electronic device, characterized in that, It includes at least one control processor and a memory for communicatively connecting to the at least one control processor; the memory stores instructions executable by the at least one control processor to enable the at least one control processor to perform the guidance text generation method based on diabetes management strategy recommendations as described in any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform the guidance text generation method based on diabetes management strategy recommendations as described in any one of claims 1 to 4.