A method, apparatus, device, and readable storage medium for generating a health management program.
By combining feature decoupling and chain-like forward propagation with state machine analysis, the problem of lack of cross-domain constraints in health management solutions is solved, and automatic verification and format standardization of cross-dimensional content are achieved, thereby improving the security and efficiency of health management solutions.
Patent Information
- Application Number
- CN202611282344.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-21
- Publication Date
- 2026-11-17
AI Technical Summary
In existing technologies, each intelligent agent operates independently and in isolation during the health management plan generation process, lacking a unified cross-domain clinical constraint mechanism. This leads to conflicts between exercise prescriptions and user disease contraindications, as well as contradictions between nutritional diets and medication rules, posing potential medical safety risks and failing to ensure the clinical safety and reliability of health management plans.
By decoupling features, health data is split into common feature data and incremental feature data. Multi-task composite generation of control instructions is used to propagate in a chain-like forward manner within the same attention space. Combined with a predefined state machine for streaming parsing, automatic verification of cross-dimensional content conflicts and format standardization are achieved.
It reduces the probability of content conflicts and contradictions, achieves linkage and alignment between health goals, clinical treatment plans, exercise prescriptions and nutritional diet plans, improves the response efficiency and clinical compliance of health management for people with multiple coexisting diseases, and enhances the clinical reliability and output efficiency of health management plans.
Smart Images

Figure CN123120185A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of health management technology, and specifically relates to a method, apparatus, electronic device and readable storage medium for generating a health management plan. Background Technology
[0002] With the large-scale deployment of big data models in health management scenarios, using models to customize and generate health management solutions has become the mainstream implementation path in the industry.
[0003] In related technologies, health management solutions are often generated using siloed, independent agent architectures or multi-model concatenation systems. Multiple independent agents are deployed for different business lines, and each agent generates a corresponding management sub-solution based on specific prompts and a local RAG knowledge base. These sub-solutions are then simply pieced together to form a complete health plan. However, because each agent operates independently, it can only perform reasoning within its own business domain, lacking a unified cross-domain clinical constraint mechanism. This leads to problems such as conflicts between exercise prescriptions and user disease contraindications, and contradictions between nutritional diets and medication rules, posing clear medical safety risks and failing to ensure the clinical safety and reliability of the health management solution. Summary of the Invention
[0004] To overcome the problems existing in related technologies, the present invention provides a method, apparatus, electronic device and readable storage medium for generating health management solutions.
[0005] In a first aspect, embodiments of this application provide a method for generating a health management plan, the method comprising: The health data to be processed is decoupled by features, and the data is split to obtain common feature data and incremental feature data corresponding to at least two management dimensions. These are then assembled to form structured user feature data. Based on preset multi-task composite generation control instructions, the target model is driven to perform a single forward propagation in the same attention space according to the user feature data and chain-like conditional generation rules. For any management dimension, the output data of the management dimension is injected as a constraint into the generation chain of subsequent management dimensions to continuously output the output data of each management dimension, thus obtaining a hybrid semantic sequence. The chain-like conditional generation rules define the generation order of each management dimension. The mixed semantic sequence is stream-parsed based on a predefined state machine to obtain structured health scheme data.
[0006] Secondly, embodiments of this application provide a health management plan generation apparatus, the apparatus comprising: The first processing module is used to perform feature decoupling processing on the health data to be processed, splitting it into common feature data and incremental feature data corresponding to at least two management dimensions, and assembling them into structured user feature data. The first generation module is used to drive the target model to perform a single forward propagation in the same attention space based on the user feature data according to the chain-like conditional generation rules, based on the preset multi-task composite generation control instructions. For any management dimension, the output data of the management dimension is injected as a constraint into the generation chain of the subsequent management dimensions to continuously output the output data of each management dimension and obtain a hybrid semantic sequence. The chain-like conditional generation rules define the generation order of each management dimension. The first acquisition module is used to perform streaming parsing on the hybrid semantic sequence based on a predefined state machine to obtain structured health scheme data.
[0007] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0009] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.
[0010] In this embodiment, by decoupling and splitting features and unifying structured input, the problems of repetitive feature extraction and inconsistent definitions in traditional multi-agent architectures are avoided from the source. Simultaneously, relying on a single forward propagation chain generation of content within the same attention space of the target model, the output data of the preceding management dimension becomes the generation constraint for the subsequent management dimension. This eliminates the need for multiple rounds of calls across agents, automatically completing the verification of cross-dimensional content conflicts within the semantic space. This blocks the generation path of conflicting solutions from the source of solution generation, reducing the probability of content conflicts to a certain extent. Therefore, in health management scenarios for people with multiple coexisting diseases, it can achieve the linkage and alignment of health goals, clinical treatment plans, exercise prescriptions, and nutritional diet plans, resolving the problem of conflicting intervention rules for multiple diseases in such scenarios, and improving the response efficiency and clinical compliance of medical and elderly care services for people with multiple diseases. Furthermore, streaming parsing through a predefined state machine further standardizes the format and compliance, eliminating redundant verification steps of hard-coded rules, achieving clinical-level flexibility and security, and thus improving the clinical reliability and output efficiency of health management solutions. Attached Figure Description
[0011] Figure 1 This is a flowchart illustrating the steps of a method for generating a health management plan according to an embodiment of the present invention; Figure 2 This is a flowchart illustrating the specific steps of a method for generating a health management plan according to an embodiment of the present invention; Figure 3 This is a structural diagram of a health management solution generation device provided in an embodiment of the present invention; Figure 4 This is a structural diagram of an electronic device provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0012] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0013] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0014] The method for generating a health management solution provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0015] Figure 1 This is a flowchart illustrating the steps of a health management scheme generation method provided in this embodiment of the invention. It is applied to a composite multi-task reasoning system built on a large language model. This system may include a data pre-fusion module, a cross-domain multi-objective constraint collaborative reasoning layer (objective model), and a post-typed state transition layer (post-FSM interception gateway). The data pre-fusion layer can intercept input, call a unified interface for cleaning, and decouple long texts into "common feature data" and "incremental feature data," eliminating redundant tokens and solving the model's "lost in the middle" problem.
[0016] The cross-domain multi-objective constraint collaborative reasoning layer can be used to inherit the fusion context of the front-end layer, inject the reconstructed "four-in-one" system prompt words, and drive the target model to perform chain dependency reasoning in a unified semantic space to resolve conflicts.
[0017] The post-typed state transition layer is used to utilize code-level Pydantic Schema as the output of the state machine constraint model, physically intercept illegal tokens, ensure the structural integrity of the output results, and divert the parsed sub-JSON content to the external system.
[0018] like Figure 1 As shown, the method may include: Step 101: Perform feature decoupling on the health data to be processed, splitting it to obtain common feature data and incremental feature data corresponding to at least two management dimensions, and assembling them to form structured user feature data.
[0019] In this embodiment of the invention, unstructured health data to be processed is collected from multi-source health terminals, medical systems, and user health records, including user vital signs, past medical history, medication records, exercise preferences, dietary habits, and other health information related to the user to be evaluated.
[0020] In one possible implementation, the user to be evaluated can be a customer seeking health management consultation at a medical institution, a resident living in a nursing home and undergoing long-term chronic disease management, a home-based elderly care customer undergoing chronic disease management through telemedicine and smart devices, or a customer experiencing chronic disease management in a physical setting such as a nursing home or medical institution, or a customer experiencing remote chronic disease management through mobile devices (such as mobile apps, large TV screens, smart speakers, etc.).
[0021] The collected health data to be processed is divided into common feature data that is universal across dimensions and incremental feature data for at least two management dimensions, through feature extraction and classification functions. Common feature data can be shared features that are universal across all management dimensions and do not require repeated extraction, such as basic profile information applicable across the entire chain, including user age, underlying disease classification, and allergy history. Incremental feature data can be differentiated features for different users to be evaluated, such as user dietary preferences under the nutrition management dimension and user's past exercise records under the exercise management dimension—information specific to a single management dimension.
[0022] Common feature data and incremental feature data are assembled into structured user feature data with complete fields and uniform format by performing field alignment and type normalization according to a predefined unified schema format.
[0023] Step 102: Based on the preset multi-task composite generation control instructions, drive the target model to perform a single forward propagation in the same attention space according to the user feature data and the chain-like conditional generation rules. For any management dimension, inject the output data of the management dimension as a constraint into the generation chain of the subsequent management dimensions to continuously output the output data of each management dimension and obtain a hybrid semantic sequence. The chain-like conditional generation rules define the generation order of each management dimension.
[0024] In this embodiment of the invention, structured user feature data and multi-task composite generation control instructions are input into the target model. The multi-task composite generation control instructions are pre-constructed system prompts, which contain built-in data generation rules for each management dimension, generation order constraints for each management dimension, output data structure, disease contraindication mapping table, and a preset recipe library. The system prompts drive the target model to simultaneously complete multi-task outputs in a single inference iteration. Management dimensions may include management goal dimensions, health management dimensions, nutrition management dimensions, and exercise management dimensions.
[0025] For example, the multi-task composite generation control command can be a pre-built four-in-one integrated system prompt word. This prompt word is not a splicing of scattered multi-task commands, but rather a structured semantic framework that deeply integrates four types of core constraints into a unified reasoning guidance system: the first part contains built-in exclusive data generation rules for each management dimension. For example, the health management dimension needs to follow clinical diagnosis and treatment guidelines to output risk classification conclusions, the nutrition management dimension needs to match the residents' dietary nutrient reference intake to formulate an intake plan, and the exercise management dimension needs to meet the exercise safety thresholds of different age groups to generate appropriate prescriptions. All rules are embedded with strong instruction semantics that can be directly recognized by the target model.
[0026] The second part incorporates the generation order constraints corresponding to each management dimension. By locking the fixed chain generation logic of "health management goals, health management plans, exercise management plans, and nutrition management plans", it prohibits the target model from disrupting the generation order and ensures that the generation action of subsequent dimensions always takes the complete output of previous dimensions as a prerequisite constraint.
[0027] The third part incorporates a unified output data structure across all dimensions. It defines the type, value range, and required attributes of all output fields through a nested, strongly typed schema. This guides the target model's output token sequence to meet structured format requirements from the prompt word level, reducing the parsing and verification pressure on the subsequent state machine.
[0028] The fourth part includes a built-in disease contraindication mapping table and a preset recipe library. The disease contraindication mapping table covers the semantic associations of absolute clinical contraindications for common chronic diseases, while the preset recipe library pre-classifies dietary plans for different calorie levels and dietary restrictions. The disease contraindication mapping table and the preset recipe library can be embedded into the feature space of prompt words in a semantically associated binding manner, allowing for direct matching and verification in a single inference without calling an external RAG retrieval interface.
[0029] During the initial inference phase of the target model, the constraint knowledge in the system prompts is loaded into the semantic feature space of the target model, constructing a chained conditional probability graph under a multi-task joint distribution. Subsequently, the target model can initiate a single forward propagation within the same attention space according to predefined chained conditional generation rules. First, it generates health management goals corresponding to the management goal dimension based on user feature data, and writes the key-value vector of the health management goal into the key-value cache in real time, injecting it as a mandatory constraint into subsequent links. Based on the constraints of the health management dimension, it generates the first output data for the health management dimension, and writes the key-value vector of this output data into the key-value cache in real time, injecting it as a mandatory constraint into the generation links of the nutrition management and exercise management dimensions. After generating the second output data for the nutrition management dimension, this output data is appended to the key-value cache, injecting it as a mandatory constraint into the generation link of the exercise management dimension. All generation actions are completed continuously in a single forward propagation, and the output contains a mixed semantic sequence that simultaneously includes inference content and multi-dimensional output content.
[0030] Chained conditional generation rules refer to predefined multi-task generation sequence logic, requiring the target model to generate data in a fixed order of health management goals, health management dimensions, exercise management dimensions, and nutrition management dimensions. The output of the preceding dimension must serve as a pre-constraint for the generation of the subsequent dimension. Single forward propagation within the same attention space means that all multi-task generation processes are completed entirely within a single inference forward propagation of the target model, without triggering multiple rounds of external calls. Compared to traditional multi-model concatenation and multi-agent multi-round calls architectures, all cross-dimensional constraints are automatically linked within the same attention space. The generation process of the subsequent dimension can refer to the output of the preceding dimension and the thought chain, reducing the security risk of cross-domain mutually exclusive solutions.
[0031] Hybrid semantic sequences can be continuous token streams that are output by the target model during the chain generation process, and simultaneously contain implicit thought chain reasoning (CoT) content and structured output content from various management dimensions.
[0032] In one possible implementation, to achieve knowledge representation and conflict resolution between different management dimensions, a conflict filtering mechanism based on heterogeneous medical and elderly care hypergraph neural networks can be adopted. This scheme abstracts various heterogeneous health characteristics of users (such as disease tags, current medications), exercise contraindications (such as heart rate thresholds), and nutritional components (such as purines and sodium) as nodes and hyperedges in a hypergraph, respectively. For example, a user's specific health characteristic (such as "stage 3 hypertension") can be abstracted as a node in the hypergraph; a clinical pathway that can simultaneously connect three heterogeneous elements—disease, exercise, and diet—(such as `[hypertension, limiting moderate-to-high intensity resistance, recommended low-salt diet]`) can be abstracted as a hyperedge. A hyperedge can contain any number of nodes, thus representing cross-domain multivariate nonlinear associations.
[0033] Before feeding data into the target model, features with medical conflicts are pre-emptively physically broken and decoupled through multi-hop logical reasoning and association rule mining in the hypergraph. For example, a topological conflict detection algorithm can be pre-run in the hypergraph network. When user health data is input, the hypergraph performs multi-hop neighbor walks in the graph vector space. When it is found that two hyperedges, "diabetes → recommended high protein" and "gout → restricted high protein," share the same protein node and have excessively high conflict weights, the hypergraph network uses association rule mining to perform "physical breaking," dynamically disconnecting one of the lower-priority hyperedges. This cross-domain feature resolution is completed before the data is input into the target model's prompts.
[0034] In another possible implementation, to resolve conflicts between different management dimensions, a streaming workflow using distributed multi-agent asynchronous generation and a central reinforcement learning arbitration gateway (Central Critic Net) can be employed. Specifically, the four tasks—health, medical, exercise, and nutrition—can be asynchronously generated by four independent agents using their own dedicated fine-tuning models. The generated initial local solutions are then uniformly submitted to a subsequent "general practitioner arbitration agent (Critic Agent)." The arbitration agent, based on a deep reinforcement learning (RLHF) reward model or compliance verification schema, performs multiple rounds of dynamic rejection and fine-tuning iterations (Reflection Mechanism) on conflicting tokens or fields until the conflicts are completely resolved. For example, the Central Critic Net first intercepts four drafts and inputs them into a reward model fine-tuned based on deep reinforcement learning and interdisciplinary expert consultation data for compliance scoring. The arbitration agent's evaluation finds that the exercise agent recommends weighted squats (which violates the osteoporosis and fall risk restrictions raised by the medical agent, thus lowering the token sequence score). Subsequently, the arbitration agent triggers a "multi-turn reflection flow," generating a rejection prompt along with the reason for the conflict, which is then resent to the motion agent to restrict rewriting. The entire process is asynchronous and iterative until all scores in the reward model pass or the conflict-free criteria of the validation schema are met, at which point the central gateway merges and outputs the results.
[0035] Step 103: Perform streaming parsing on the hybrid semantic sequence based on a predefined state machine to obtain structured health scheme data.
[0036] In this embodiment of the invention, in order to prevent the target model from collapsing under long text throughput, after the target model outputs a mixed semantic sequence, the mixed semantic sequence can be streamed and parsed based on a predefined state machine to further standardize the data format.
[0037] For example, a predefined nested Pydantic class (UnifiedHealthOutput) that integrates four workflow output structures can be used as the control state machine. When the state machine recognizes implicit thought chain reasoning content in the sequence, it automatically switches to soft state mode, releases the token interception mask, performs unconstrained pass-through of the reasoning content, and retains the reasoning logic of the target model. When it recognizes the boundary marker indicating the completion of the thought chain content output, the state machine switches to hard constraint verification mode, performs token-by-token validity verification on all subsequently generated structured business fields, and intercepts all illegal tokens that do not conform to strong type definitions or cross-domain clinical constraints. Finally, it automatically filters unstructured reasoning content, extracts all compliant structured business fields, and outputs structured health solution data for clinical-grade health management that is 100% compliant with strong type definitions and has no cross-domain conflicts.
[0038] In summary, this invention, through feature decoupling and unification of structured input, avoids the problems of repetitive feature extraction and inconsistent definitions inherent in traditional multi-agent architectures. Simultaneously, relying on a single forward propagation chain generation of content within the same attention space of the target model, the output data of the preceding management dimension becomes the generation constraint for the subsequent management dimension. This eliminates the need for multiple rounds of calls across agents, automatically verifying cross-dimensional content conflicts within the semantic space. This blocks the generation path of conflicting solutions from the source of solution generation, reducing the probability of content conflicts to some extent. Furthermore, in health management scenarios involving individuals with multiple coexisting diseases, it enables the linkage and alignment of health goals, clinical treatment plans, exercise prescriptions, and nutritional plans, resolving conflicts between intervention rules for multiple diseases and improving the response efficiency and clinical compliance of medical and elderly care services for these groups. Finally, streaming parsing using a predefined state machine further standardizes format and compliance, eliminating redundant verification steps that require hard-coded rules. This achieves clinical-grade flexibility and security, thereby improving the clinical reliability and output efficiency of health management solutions.
[0039] Furthermore, this solution utilizes a combined data processing approach—including health data feature decoupling, single-attention space chain-based conditional generation of hybrid semantic sequences, and state machine streaming parsing—to eliminate, to some extent, defects such as data translation errors, constraint transmission gaps, and format parsing failures throughout the entire data chain from data input and model inference to structured data output. In medical and elderly care scenarios with multiple coexisting diseases, no additional post-conflict resolution and format correction steps are required, enabling the rapid output of health management solutions that combine safety and clinical reliability.
[0040] Optionally, embodiments of the present invention may further include the following steps: Step 201: For each basic generation unit generated, the key-value vector corresponding to the basic generation unit is written into the key-value cache; the key-value cache is used to expand the perception coverage of the target model.
[0041] In this embodiment of the invention, in the entire chain-like condition generation process of the target model, after each basic generation unit's output action is completed, the Key vector and Value vector corresponding to that basic generation unit are immediately extracted and appended to the contiguous storage block of the key-value cache, without the need for secondary calculation or repeated loading of historical vectors.
[0042] The hybrid semantic sequence can include basic generation units (Tokens). A basic generation unit can be the smallest semantic carrier of a single output in the autoregressive generation chain of the target model. For example, the Token vector in the Transformer architecture is the smallest execution unit for the target model to complete the semantic output.
[0043] The key-value cache stores the key and value vectors corresponding to the basic generation units generated in the past. The vectors in this cache can be repeatedly accessed throughout the entire generation cycle of a single forward propagation.
[0044] Step 202: When the key-value vector corresponding to the basic generation unit belongs to the clinical taboo class vector, the attention weight of the clinical taboo class vector is set to the maximum value, and the attention weight is written into the metadata field of the corresponding vector in the key-value cache; the attention weight is used to indicate that the clinical taboo class vector obtains the highest semantic awareness priority in all subsequent self-attention calculations, so as to reduce the generation probability of conflicting basic generation units.
[0045] In this embodiment of the invention, after the output of each basic generation unit is completed, the key-value vector corresponding to the basic generation unit can be labeled. If it is determined that the key-value vector corresponding to the basic generation unit belongs to the clinical contraindication class vector, the attention weight of the clinical contraindication class vector can be set to the maximum value, and then the weight value is written into the metadata field of the corresponding Key vector in the key-value cache.
[0046] Among them, clinical contraindication vectors can be pre-annotated semantic vectors carrying clear clinical absolute contraindication markers, such as semantic vectors corresponding to high-risk clinical conclusions like "grade 3 hypertension, very high risk," "severe fall risk," and "penicillin allergy." Attention weights refer to configurable weight parameters in the self-attention mechanism used to characterize the semantic perception priority of different vectors. The higher the weight value, the higher the priority of the vector being activated and perceived by the model in all subsequent self-attention calculations.
[0047] The clinically contraindicated vectors with their attention weights set to the maximum value will be prioritized for activation by the model in the self-attention calculation process of all downstream management dimensions such as nutrition management and exercise management. They will not be covered by the semantic signals of other ordinary vectors. This provides a non-negligible clinical constraint benchmark for all subsequent generation steps from a semantic perspective, and can provide an anchor point for the probability suppression of conflicting candidate units without the need for external hard-coded rules.
[0048] In this embodiment of the invention, by continuously and dynamically expanding the key-value cache during the generation process, the semantic features of all previous historical tokens can be recalculated without repeatedly calculating them. This allows the semantic awareness coverage of the target model to expand from the current local generation fragment, providing complete global historical semantic feature support for subsequent cross-dimensional clinical constraint linkage verification and eliminating constraint omissions caused by cross-module information asynchrony. Furthermore, by marking the attention weights of clinical contraindication class vectors, the absolute clinical contraindication semantic vector is not ignored during subsequent generation processes, thus determining the clinical constraint benchmark for all subsequent generation steps from a semantic perspective.
[0049] Optionally, embodiments of the present invention may further include the following steps: Step 301: If the semantic correlation between any candidate basic generation unit and the clinical contraindication class vector in the key-value cache is greater than or equal to a preset correlation threshold, then the generation probability of the candidate basic generation unit is directly reduced to the specified generation probability.
[0050] Step 302: Determine the basic generation unit based on the generation probability of each candidate basic generation unit.
[0051] In this embodiment of the invention, when the target model is preparing to generate the current basic generation unit, the target model will select all candidate tokens from the health domain vocabulary. Each candidate basic generation unit corresponds to an initial generation probability Logits value.
[0052] The system retrieves the initial generation probabilities corresponding to all current candidate basic generation units. Then, it reads the clinical contraindication class vectors marked with the highest priority in the metadata field of the key-value cache. It calculates the semantic correlation between the query vector of each candidate basic generation unit and the key vector of that clinical contraindication class. If the semantic correlation of a candidate unit is greater than or equal to a preset correlation threshold, it indicates that the candidate basic unit is a high-conflict candidate unit. The generation probability of this candidate unit is then directly and forcibly adjusted to the specified generation probability, thus suppressing the probability of high-conflict candidate units.
[0053] Semantic relevance is used to characterize the semantic match between the Query vector of a candidate basic generation unit and the Key vector of the clinical contraindication class marked with the highest priority in the metadata field of the key-value cache. The higher the semantic relevance, the greater the conflict between the candidate unit and the clinical contraindication. The specified generation probability can be a pre-set fixed value or a random value less than or equal to a preset generation probability threshold.
[0054] Based on the generation probabilities of all adjusted candidate basic generation units, the candidate unit with the highest generation probability is selected as the basic generation unit of the final output.
[0055] In this embodiment of the invention, there is no need to pre-write hard-coded keyword deletion and replacement rules. Conflict resolution is completed dynamically within the semantic feature space of the target model. That is, cross-dimensional clinical conflict resolution can be completed adaptively at the moment the token is generated. This not only preserves the flexibility of the target model in generating health plans, but also blocks the output path of high-conflict medical content from the source of generation, thereby improving the clinical safety and reliability of health management plans.
[0056] Optionally, step 101 may include the following steps: Step 401: Extract features from the health data to be processed using a feature extraction function. Determine the user full-dimensional profile data and continuous intervention plan data in the user feature data as shared feature data. Determine the vital signs data and contraindication rules related to the exercise management dimension, and the preference data and recommendation data related to the nutrition management dimension as incremental feature data.
[0057] In this embodiment of the invention, the context of the health data to be processed is read by calling the unified interface `get_customer_prompts`. A feature extraction function is then called to retrieve structured profile data such as the user's age, gender, and underlying disease identifiers from the health data. In the second stage, unstructured long-text follow-up records and physical examination reports are input into the lightweight model summarization module. Prompt words are used to limit the model's output to include the core chief complaint and a list of diagnosed disease labels, ultimately outputting a matrix of major health problems. The feature extraction function can be a pre-built chronic disease feature extraction function, `get_primary_health_problems`.
[0058] Based on this, a feature decoupling algorithm is executed. According to the division rules of business reusability and restriction level, features that are common across business lines, such as user full-dimensional profile data and continuous intervention plan data, are uniformly classified as shared feature data. Vital signs data and sports RAG contraindication rules specific to the sports dimension are classified as incremental feature data of the sports management dimension. Dietary preference data and food RAG recommendation data specific to the nutrition dimension are classified as incremental feature data of the nutrition management dimension.
[0059] Step 402: Determine the user feature data based on the shared feature data and the incremental feature data.
[0060] In this embodiment of the invention, a pre-written independent cleaning pipeline is used to merge and assemble all shared feature data into a single base context (Base_Context) through regular expression matching and structured key-value recognition logic, forming a common feature base applicable to all business lines. Subsequently, an external RAG retrieval tool is triggered to distribute specific knowledge slices of the corresponding incremental feature data to the motion management dimension route and the nutrition management dimension route, respectively. These two types of incremental feature data are then attached as external modules to the corresponding extended fields of the common feature base, ultimately completing the merging and reorganization of all features to obtain structured user feature data.
[0061] For example, an example of the assembly topology of user feature data can be: <Global_Base_Profile> [Patient Profile and Chief Medication Complaints]< / Global_Base_Profile> <Domain_Specific_Constraints> <Sport_RAG_Context> [Exercise contraindications and physical examination data]< / Sport_RAG_Context> <Nutrition_RAG_Context> [Food Preferences and Calorie Baseline Data] < / Nutrition_RAG_Context> < / Domain_Specific_Constraints> This reorganization can leverage the target model's sensitivity to structured tags to explicitly guide the self-attention mechanism to establish cross-domain semantic connections.
[0062] In this embodiment of the invention, by extracting shared feature data and incremental feature data, unstructured long text can be transformed into structured feature extraction, avoiding the interference of redundant information caused by full model extraction. At the same time, by assembling shared feature data and incremental feature data into user feature data, the defects of independent feature extraction and inconsistent feature caliber of each agent under the traditional siloed agent architecture are avoided. This ensures the global consistency of shared features across business dimensions while preserving the exclusive independence of incremental features in each vertical business dimension.
[0063] Optionally, step 103 may include the following steps: Step 501: Invoke the predefined state machine to route the thought chain reasoning content in the hybrid semantic sequence to an independent soft state field.
[0064] In this embodiment of the invention, the predefined state machine can be a finite state automaton (FSM) syntax tree generated by converting a pre-declared UnifiedHealthOutputPydantic strongly typed class. At the top level of the Pydantic topology tree, an independent global_co_thinking_process (implicit thought chain) field is explicitly defined as an independent soft state field. The independent soft state field is a physically isolated region in the state machine's open, high-degree-of-freedom semantic space, completely physically isolated from all subsequent structured business fields at the data structure level. The topology tree can be generated by recursively decomposing the type constraints, nesting levels, enumeration rules, and mandatory field validation logic of all fields, starting from a predefined nested Pydantic class.
[0065] As the model begins outputting the mixed semantic sequence token by token, a predefined finite state automaton is simultaneously launched in the subsequent strongly typed state transition layer. Based on the physical state of the currently generated text, the state automaton generates a Boolean mask matrix of the corresponding vocabulary size at each token inference step t, retaining all valid tokens pointing to the start identifier of the global_co_thinking_process field as outputtable states. When the state automaton recognizes the starting semantic marker of the thought chain reasoning content in the mixed semantic sequence, it automatically routes all subsequent reasoning tokens to this independent soft state field, temporarily removing the Boolean mask restrictions within this field and relaxing the syntactic constraints at the Logits level. This allows the target model to maintain a high-entropy state of natural language within this physically isolated area, completing the clinical conflict resolution and chain reasoning across multiple dimensions of "health goals - health management - exercise management - nutrition management".
[0066] Step 502: After the reasoning content of the thought chain is output, switch the state machine to hard constraint verification mode.
[0067] In this embodiment of the invention, the state machine continuously monitors the output state of the independent soft state field. When the closed semantic marker of the global_co_thinking_process field is detected, the internal state transition logic is triggered to switch from the soft state high degree of freedom mode to the hard constraint verification mode, and at the same time, the constraint capability of the full Boolean mask matrix is reactivated.
[0068] This state transition action can match the semantic output rhythm of the target model's chained generation without the need for external manual intervention. Relying on the cascading binding characteristics of the nested Pydantic topology tree, it forcibly locks the generation boundaries of all subsequent structured business fields at the physical layer, ensuring that cross-domain business data naturally maintains atomicity in a single inference, and to a certain extent avoids the data misalignment problem under the traditional multi-interface splicing architecture from the bottom layer.
[0069] Step 503: Based on the state machine in hard constraint validation mode, perform legality validation on the generated structured business fields and output structured health scheme data that conforms to the strong type definition.
[0070] In this embodiment of the invention, after entering the hard constraint verification mode, the state machine, based on the physical state of the currently generated text, predicts the probability distribution (Logits) of the next token across the entire vocabulary at each token inference step t. The state machine, based on the currently generated text state (e.g., having just output `{"management_goals":`, the next physical state can only output `[` or `{`), reversely generates a Boolean mask matrix of the corresponding vocabulary size. The boolean value corresponding to a valid token is marked as 1, and the boolean value corresponding to all tokens that do not conform to the JSON syntax and the Pydantic field declaration is marked as 0. The probability of generating such illegal tokens is directly eliminated to negative infinity through Logits calculation. From a probabilistic perspective, all possible token outputs that do not conform to the data topology structure are completely eliminated, ensuring that every character output by the target model is 100% consistent with the topology tree rules and avoiding format collapse issues.
[0071] For example, the state machine can be implemented with respect to the generation probability of Token v using the following formula:
[0072] For example, a data structure that incorporates nested Pydantic strongly typed classes can be as follows: from pydantic import BaseModel, Field from typing import List, Dict class GoalSchema(BaseModel): quantified_targets: List[str] = Field(description="Quantified health target indicators") class PlanSchema(BaseModel): nursing_tasks: List[str] = Field(description="List of nursing tasks") medication_guidance: str = Field(description="Precision medication guidance and suggestions") class ExerciseSchema(BaseModel): fitt_frequency: str = Field(description="motion frequency(F)") fitt_intensity: str = Field(description="Motion intensity(I)") absolute_contraindications: List[str] = Field(description="Absolute contraindications for exercise") class NutritionSchema(BaseModel): total_calories_kcal: float = Field(description="Daily total calorie requirement") banned_foods: List[str] = Field(description="Foods that are banned based on disease labels and medicinal effects") dietary_recipes: Dict[str, List[str]] = Field(description="Standardized energy level recipe proportions for three meals") class UnifiedHealthOutput(BaseModel): global_co_thinking_process: str = Field(description="A global thinking process that integrates the logic of resolving conflicts between medicine, health, and diet") management_goals: GoalSchema = Field(description="Health Management Goals Section") health_plan: PlanSchema = Field(description="Health Management Plan Section") exercise_advice: ExerciseSchema = Field(description="Exercise plan section") comprehensive_nutrition: NutritionSchema = Field(description="Nutrition Plan Section") It is understood that the above-mentioned data structure of merging and nesting Pydantic strongly typed classes is only an example of a data structure implementation, and this solution does not limit the specific content of the data structure of merging and nesting Pydantic strongly typed classes.
[0073] In related technologies, a hard FSM interception is often applied directly to all token flows. Because the model semantic space is locked throughout, the cross-dimensional clinical conflict resolution steps of the long inference chain will be forcibly interrupted, and the target model will be forced to abandon deep thinking and only adapt to the format, resulting in a decline in the quality of the solution.
[0074] This solution explicitly defines an independent soft-state field, namely the implicit thought chain field `global_co_thinking_process`. First, all inference content from the mixed semantic sequence is routed to this independent soft-state field. Within this region, the FSM mask constraint is completely lifted, preserving the model's high-entropy semantic space and ensuring that long-chain clinical inference remains undisturbed throughout. After the inference content is fully output, the solution switches to hard constraint validation mode, performing full strong type validation on subsequent structured business fields, eliminating the probability of generating all illegal tokens at the Logits level. This alternating soft and hard constraint mechanism achieves compliant output format without sacrificing the depth of clinical solution inference, thus ensuring the dual technical effects of "long-chain deep inference" and "100% strong type parsing on the backend."
[0075] Furthermore, in related technologies, the backend often needs to write a large number of regular expressions or fixed string truncation logic to clean the data, but this approach is prone to system crashes. This solution, due to the rigid contract between the front-end FSM and the nested Pydantic topology, allows validated business fields to be directly accessed via object properties to achieve second-level traffic splitting and downstream routing. The back-end module also avoids the dependence on a large number of regular expressions for cleaning in traditional solutions, eliminating the vulnerability of string cleaning logic to crashes at the architectural level. The final output is a cross-domain health management structured health solution data that fully conforms to strongly typed definitions.
[0076] Optionally, step 102 may include the following steps: Step 601: Based on the shared feature data and the generation rules corresponding to the health management dimension in the system prompt words, generate the first output data corresponding to the health management dimension.
[0077] In this embodiment of the invention, the target model loads shared feature data and, in conjunction with the exclusive generation rules for the management target dimension in the system prompts, determines the absolute contraindications of the highest clinical risk factors, outputting hierarchical and periodic standardized health management goals. Simultaneously, the clinical contraindication class vectors corresponding to the absolute contraindications are stored in a key-value cache, and their attention weights are set to the maximum value.
[0078] For example, when the model activates a token vector such as "Grade 3 Hypertension (Very High Risk)" in its self-attention mechanism, the attention weights of semantic vectors strongly associated with it, such as "Absolute Taboo: No Breath Holding, No Medium-to-High Intensity Resistance Training," will increase. These will then be extracted as the highest-priority control boundaries during the target generation stage. This allows for defining a unified intervention direction for all subsequent business dimensions from the generation source.
[0079] Step 602: Based on the health management goal, the shared feature data, and the generation rules corresponding to the health management dimension in the system prompt, generate the first output data corresponding to the health management dimension.
[0080] In this embodiment of the invention, the target model uses the generated health management goal as the highest priority constraint, combines it with globally shared feature data, obtains the generation rules corresponding to the health management dimension in the system prompt words, completes the chain-like reasoning generation of the clinical dimension, and outputs the first output data that is completely aligned with the top-level management goal. The first output data can be a health management sub-plan generated for the health management dimension, which may include clinical content such as confirmed disease classification, individualized medication plans, and daily medical care details.
[0081] Step 603: Determine the health management goal, the first output data, the shared feature data, and the incremental feature data corresponding to the nutrition management dimension as the first constraint condition corresponding to the nutrition management dimension.
[0082] In this embodiment of the invention, health management goals, first output data, shared feature data, and incremental feature data of the exercise management dimension are structurally merged and assembled to form the first constraint condition before the generation of the exercise management dimension. The first constraint condition is used to structurally bind the top-level anchor point, clinical output, and exercise-specific features in advance, constraining the output content of the second output data of the exercise management dimension. This avoids the information silo limitation of the exercise dimension in traditional architectures, where it can only perceive its own features. By injecting hard constraints of top-level management goals and clinical diagnosis and treatment before the generation of the exercise dimension, compliance risks arising from subsequent exercise plans violating clinical contraindications are avoided.
[0083] Step 604: Based on the first constraint and the generation rule corresponding to the motion management dimension in the system prompt, generate the second output data corresponding to the motion management dimension.
[0084] In this embodiment of the invention, the target model loads a first constraint condition and, in conjunction with the generation rules corresponding to the exercise management dimension, explicitly retrieves the medical contraindications and restrictions output by the preceding steps, filters exercise options that do not meet clinical requirements, and generates second output data aligned with the top-level management goals and clinical treatment requirements. The second output data can be an exercise management plan generated for the exercise management dimension, and may include exercise prescription content such as exercise type, intensity, frequency, and a list of contraindicated actions suitable for the user to be evaluated.
[0085] Step 605: Determine the health management goal, the first output data, the second output data, the shared feature data, and the incremental feature data corresponding to the nutrition management dimension as the second constraint condition corresponding to the nutrition management dimension.
[0086] In this embodiment of the invention, the health management goal, the first output data, the second output data, the shared feature data, and the incremental feature data of the nutrition management dimension are structurally merged and assembled to form the second constraint condition before the generation of the nutrition management dimension.
[0087] Step 606: Based on the second constraint and the generation rule corresponding to the nutrition management dimension in the system prompt, generate the third output data corresponding to the nutrition management dimension.
[0088] In this embodiment of the invention, the target model loads a second constraint condition, and based on the generation rules corresponding to the nutrition management dimension, combined with the disease contraindication mapping table in the system prompt words and the preset recipe library, automatically calculates the calorie deficit according to the dynamic energy consumption brought about by the exercise prescription and matches the standardized recipes corresponding to the energy level, generating third output data that is fully adapted to the pre-constraints of the entire chain.
[0089] For example, during the content generation process, the internal state transitions of the target model can satisfy the joint distribution of multi-task constraints, as shown in the following conditional probability cascade decomposition formula:
[0090] In the single forward propagation generated with a single click, the target model is generated word-for-word according to an autoregressive mechanism: Using the user feature data Context, P(Target|Context) is calculated to determine the health management target Target. Using the health management target as known conditions, P(Plan|Target, Context) is calculated to determine the first output data, i.e., the health management sub-plan Plan. Using the health management target and the first output data as known conditions, P(Sport|Plan, Target, Context) is calculated to determine the second output data, i.e., the exercise management sub-plan Sport. Using the health management target, the first output data, and the second output data as known conditions, P(Nutrition|Sport, Plan, Target, Context) is calculated to determine the third output data, i.e., the nutrition management sub-plan Nutrition. In this way, "single-step composite reasoning" enables progressive constraints and adaptive conflict elimination.
[0091] Understandably, during the generation of the first, second, and third output data, the semantic correlation between the candidate basic generation units generated by the target model and the clinical contraindication class vectors in the key-value cache is calculated. The generation probability of candidate basic generation units with semantic correlation greater than or equal to the preset correlation threshold is reduced to the specified generation probability. In other words, conflict resolution and adaptive evolution are completed in one go during the generation of the final basic generation unit (token), which improves the flexibility of content generation and further reduces the possibility of generating conflicting content.
[0092] In this embodiment of the invention, a chain-like serial generation architecture is used to inject constraints layer by layer with health management goals as the top layer. This makes the output data of the preceding management dimensions the data generation boundary of the subsequent management dimensions, which to some extent avoids the goal misalignment problem of traditional multi-dimensional parallel generation. At the same time, the subsequent exercise and nutrition management dimensions can fully perceive the preceding constraints of the entire chain, automatically complete conflict resolution, and eliminate the need for a large number of post-conflict checks. Natural alignment of cross-dimensional content can be achieved within a single inference, improving the clinical compliance and generation efficiency of health management plans.
[0093] Optionally, step 606 may include the following steps: Step 701: Calculate the motion energy consumption data based on the second output data and the first output data.
[0094] In this embodiment of the invention, the target model can perform semantic parsing on the exercise prescription text in the second output data to extract quantifiable parameters such as exercise type, single exercise duration, and weekly exercise frequency. Simultaneously, by combining this data with the user's basic disease tags, exercise risk level, and weight data from the first output data, it can calculate the daily exercise energy consumption data of the user to be evaluated. The exercise energy consumption data is used to characterize the total daily energy expenditure.
[0095] Step 702: Calculate the total daily target calorie intake based on the shared feature data and the exercise energy consumption data.
[0096] In this embodiment of the invention, the target model loads the basal metabolic rate and user health management goals from the shared feature data, and combines them with exercise energy consumption data to dynamically calculate the daily total target calorie intake that is adapted to the individual status of the user to be evaluated.
[0097] Step 703: Based on the preset recipe library and disease contraindication mapping table in the system prompt words, determine the recipe data that matches the total target calorie intake, and use it as the third output data.
[0098] In this embodiment of the invention, during the nutrition management dimension generation stage, an attention mechanism is used to automatically filter standard recipe entries corresponding to the energy level based on a preset recipe library in the system prompts and the daily total target calorie intake. Simultaneously, combined with the disease-related dietary restrictions rules carried in the second constraint, high-purine and other prohibited ingredients are automatically filtered out. Finally, structured recipe data that meets calorie requirements and has no clinical conflict is generated in the `dietary_recipes` field of the JSON, serving as the third output data. This third output data can be a nutrition management sub-plan, including ingredient suggestions, ingredient intake amounts, cooking methods, prohibited foods, and recipe recommendations.
[0099] In this embodiment of the invention, by relying on the linkage effect of constraints from various management dimensions, the multi-step operations of recipe retrieval, contraindication filtering, and format structuring in the traditional solution are merged into a single model generation process. This avoids the defects of recipe data misalignment and contraindication omission caused by traditional multi-module splicing, and achieves a dual improvement in the efficiency and compliance of nutrition plan generation.
[0100] For example, using elderly people who are advanced in age, have multiple comorbidities, and are at high risk of falls as the core scenario, this demonstrates the end-to-end data processing and closed-loop flow of a full-stack integrated medical and elderly care decision-making engine, such as... Figure 2 As shown: The basic business background data of the user to be evaluated is as follows: The user is an 82-year-old male, 172cm tall, weighing 86kg, with a BMI of 29.07, classifying him as severely obese. The original health record input into the system is a multi-source unstructured long text of 35k tokens, covering outpatient medical records from a tertiary hospital over the past 5 years, follow-up records for the past six months, daily blood pressure monitoring data from the community health manager, and the latest annual physical examination report. Clinically diagnosed disease labels include type 2 diabetes, stage 3 hypertension (very high risk), acute gout attack, and primary osteoporosis. The comprehensive elderly assessment determines him to be at high risk of severe falls. He is currently taking metformin, benzbromarone, febuxostat, nifedipine controlled-release tablets, and cefixime. The system is deployed on a cloud server cluster. After the community health manager triggers a one-click command to generate a full-cycle intervention plan on the workbench, the background executes a four-stage closed-loop process: S1: Data Pre-fusion and Heterogeneous Feature Decoupling and Extraction Stage. Multi-source unstructured health record text is obtained through the `get_customer_prompts` interface. The core feature extraction function `get_primary_health_problems` is called to decouple and remove redundancy from features. Features are split into two categories: common feature data and incremental feature data corresponding to at least two management dimensions. These are then assembled into a unique `Unified_Input_Context` message, which is fed to the downstream inference layer in a single delivery. This reduces token overhead while avoiding the problem of missing key clinical features due to errors in long text.
[0101] S2: Cross-domain conflict resolution reasoning stage based on chain-dependent long thought chains. The target model loads the reconstructed four-in-one system prompts and unfolds chain-conditional probability reasoning within the same attention space according to a preset medical logic graph.
[0102] For example, the implicit thought chain content of the target model may include: 1. Risk Alignment: If a user has stage 3 hypertension and a high risk of severe falls, the exercise prescription must "absolutely halt" high-intensity resistance and weight training, prohibit breath-holding, and the exercise environment must be 100% supervised.
[0103] 2. Drug-food conflict: When taking cefixime, the nutrition and diet module must be triggered with the highest priority "strict abstinence from alcohol" (to prevent disulfiram-like reaction).
[0104] 3. Nutritional conflict: Diabetics need a high-protein, low-carbohydrate diet, but acute gout requires a strict "low-purine, limited animal protein" diet. -> Conflict resolution: Nutritional priority is adjusted to prioritize acute gout, and the main protein sources are revised to low-purine eggs and skim dairy products, while seafood and high-meat foods are removed.
[0105] 4. Target alignment: Calculate energy levels based on exercise consumption; osteoporosis requires high calcium and high vitamin D.
[0106] S3: Output control stage based on nested Pydantic structured state machines. The post-typed state transition layer performs global collaborative reasoning within independent soft-state fields, including risk alignment, drug-food conflict interception, cross-nutrition rule conflict resolution, and full-dimensional goal alignment. It completes cross-domain constraint binding within the internal semantic space, completely eliminating potential multi-domain decision-making conflicts. When a closed semantic marker is detected in the `global_co_thinking_process` field, the internal state transition logic is triggered, switching from a soft-state high-degree-of-freedom mode to a hard-constraint verification mode. By activating the Logits interception mechanism of the finite state automaton, the model output is locked within a preset topology, ensuring that the content output per token is 100% compliant with the strong-type definition, and outputting a fully compliant structured JSON message as structured health solution data.
[0107] For example, the output data interface for structured health program data can be: { "thinking_process": "User Mr. Zhang is 82 years old and suffers from multiple comorbidities. The core conflict lies in the dietary contradiction between diabetes and gout, and the contradiction between high blood pressure / high risk of falls and the safety of exercise intensity. This plan has resolved these issues through a long-term thought process: In terms of diet, during the acute phase of gout, purines take priority over the high-protein requirement of diabetes, so eggs and dairy products are used to supplement protein; in terms of exercise, the high blood pressure and fall triggering mechanism is triggered, so the training is switched to seated / monitored balance training; cephalosporin use is detected, so a strict alcohol ban is enforced." "management_goals": { "quantified_targets": [ Fasting blood glucose should be controlled between 5.0 and 7.2 mmol / L. "Systolic blood pressure stabilized at 130-139 mmHg, diastolic blood pressure at 70-79 mmHg", "Symptoms of acute gout subside within 3-5 days, and blood uric acid drops below 360 μmol / L." ] }, "health_plan": { "nursing_tasks": [ "Encrypted blood pressure monitoring frequency: Measure and upload the records once each in the morning, before bed, and before exercise." "Fall prevention improvements to the living environment: Install handrails beside the bed, lay non-slip mats in the shower room, and keep floor lights on at night." Medical advice: Have a follow-up urinalysis and kidney function test in 5 days to assess the control of the urinary tract infection. ], "medication_guidance": "Continue taking nifedipine and metformin as prescribed. Cefixime must be taken to complete the full course of treatment. Closely monitor for any skin itching or gastrointestinal discomfort during this period." }, "exercise_advice": { "fitt_frequency": "3-4 times per week, preferably 1 hour after dinner in the evening", "fitt_intensity": "Low intensity, target heart rate 90-100 beats / min, stop immediately if systolic blood pressure >160mmHg during exercise". "absolute_contraindications": [ "Absolutely prohibited: Any resistance training requiring intense breath-holding is strictly prohibited (to prevent a spike in blood pressure that could lead to stroke)." "Absolutely prohibited: Weighted squats and high-impact jumping exercises are prohibited (to prevent osteoporosis, fragility fractures, and falls)." ], "safety_warning": "Given the high risk of severe falls, all exercise must be performed within the reach of a community rehabilitation therapist or family member. We recommend 'seated resistance band training' and 'bilateral chair balance exercises.'" }, "comprehensive_nutrition": { "total_calories_kcal": 1600.0, "banned_foods": [ Strictly prohibited: Red meat (pork, beef, lamb), seafood (shrimp, crab, shellfish), animal organs, and concentrated meat broths (high-purine contraindications during acute gout attacks) Strictly contraindicated: Alcoholic beverages, beer, and any alcoholic drinks and foods (avoid fatal disulfiram-like reactions while taking cefixime) "Strictly avoid: high-GI fruits (such as lychee and longan) and refined desserts." ], "dietary_recipes": { "breakfast": ["250ml skim milk", "1 slice of whole wheat bread", "1 boiled egg"], "lunch": ["100g soft rice noodles / oatmeal", "200g stir-fried bok choy (with less salt)", "100g steamed tofu"], "dinner": ["1 bowl of millet porridge", "Stir-fried eggs with mushrooms (50g each of shiitake mushrooms and wood ear mushrooms)", "50g of steamed low-purine freshwater fish (speed and regulations limited)"] } } } It is understood that the output data content and output interface of the above structured health solution data are only examples in an example scenario, and this solution does not limit the specific content of the output data and the output interface.
[0108] S4: In the heterogeneous nested output and post-processing stage, the post-output module directly accesses object attributes to seamlessly parse structured messages, routing output data from different management dimensions in parallel to corresponding downstream business systems, such as target management systems, medical care systems, sports rehabilitation systems, and smart diet systems, or pushing them as a complete and unified JSON health management report to the user's app. The entire process, from raw long text input to multi-system output, reduces the time required for solution generation from several days of consultation by interdisciplinary experts to minutes of fully automated closed-loop generation. This eliminates multi-domain decision-making conflicts and reduces the expert manpower costs for generating health management solutions to some extent.
[0109] It should be noted that the health management plan generation method provided in this application embodiment can be executed by a health management plan generation device, or a control module in the health management plan generation device for executing the method of loading the health management plan generation. This application embodiment uses the execution of the method of loading the health management plan by a health management plan generation device as an example to illustrate the health management plan generation device provided in this application embodiment.
[0110] Figure 3 This is a structural diagram of a health management solution generation device provided in an embodiment of this application, with reference to... Figure 3 The device may include: The first processing module 801 is used to perform feature decoupling processing on the health data to be processed, splitting it into common feature data and incremental feature data corresponding to at least two management dimensions, and assembling them into structured user feature data. The first generation module 802 is used to drive the target model to perform a single forward propagation in the same attention space based on the user feature data according to the chain-like conditional generation rules, based on a preset multi-task composite generation control instruction. For any management dimension, the output data of the management dimension is injected as a constraint into the generation chain of the subsequent management dimensions to continuously output the output data of each management dimension, thereby obtaining a hybrid semantic sequence. The chain-like conditional generation rules define the generation order of each management dimension. The first acquisition module 803 is used to perform streaming parsing on the hybrid semantic sequence based on a predefined state machine to obtain structured health scheme data.
[0111] Optionally, the hybrid semantic sequence includes a basic generation unit; the apparatus further includes: The first writing module is used to write the key-value vector corresponding to each basic generation unit into the key-value cache for each basic generation unit generated; the key-value cache is used to allow the target model to expand its perceptual coverage. The second writing module is used to set the attention weight of the clinically contraindicated vector to the maximum value when the key-value vector corresponding to the basic generation unit belongs to the clinically contraindicated vector, and write the attention weight into the metadata field of the corresponding vector in the key-value cache; the attention weight is used to indicate that the clinically contraindicated vector obtains the highest semantic awareness priority in all subsequent self-attention calculations, so as to reduce the generation probability of conflicting basic generation units.
[0112] Optionally, the device further includes: The second processing module is used to directly reduce the generation probability of any candidate basic generation unit to a specified generation probability if the semantic correlation between any candidate basic generation unit and the clinical contraindication class vector in the key-value cache is greater than or equal to a preset correlation threshold. The first determining module is used to determine the basic generation unit based on the generation probability of each candidate basic generation unit.
[0113] Optionally, the multi-task composite generation control instruction is a pre-built system prompt word. The system prompt word contains built-in data generation rules for each management dimension, sequential generation constraints for each management dimension, output data structure, disease contraindication mapping table, and preset recipe library, which are used to drive the target model to synchronously complete multi-task output in a single inference.
[0114] Optionally, the first processing module 801 includes: The first extraction module is used to extract features from the health data to be processed through a feature extraction function, and to determine the user full-dimensional profile data and continuous intervention plan data in the user feature data as shared feature data, and to determine the vital sign data and contraindication rules related to the exercise management dimension, and the preference data and recommendation data related to the nutrition management dimension as incremental feature data. The second determining module is used to determine the user feature data based on the shared feature data and the incremental feature data.
[0115] Optionally, the first acquisition module 803 includes: The first routing module is used to call a predefined state machine to route the thought chain reasoning content in the hybrid semantic sequence to an independent soft state field. The first switching module is used to switch the state machine to hard constraint verification mode after the output of the thought chain reasoning content is completed. The second output module is used to perform legality verification on the generated structured business fields based on the state machine in hard constraint verification mode, and output structured health scheme data that conforms to the strong type definition.
[0116] Optionally, the management dimensions include management goal dimensions, health management dimensions, exercise management dimensions, and nutrition management dimensions; the first generation module 802 includes: The first generation submodule is used to generate a health management target corresponding to the management target dimension based on the shared feature data and the generation rules corresponding to the management target dimension in the system prompt words; The second generation submodule is used to generate the first output data corresponding to the health management dimension based on the health management goal, the shared feature data, and the generation rules corresponding to the health management dimension in the system prompt words; The first determining submodule is used to determine the health management goal, the first output data, the shared feature data, and the incremental feature data corresponding to the exercise management dimension as the first constraint condition corresponding to the exercise management dimension. The third generation submodule is used to generate the second output data corresponding to the motion management dimension based on the first constraint and the generation rule corresponding to the motion management dimension in the system prompt; The second determining submodule is used to determine the health management goal, the first output data, the second output data, the shared feature data, and the incremental feature data corresponding to the nutrition management dimension as the second constraint condition corresponding to the nutrition management dimension. The fourth generation submodule is used to generate the third output data corresponding to the nutrition management dimension based on the second constraint and the generation rule corresponding to the nutrition management dimension in the system prompt.
[0117] Optionally, the fourth generation submodule includes: The first calculation module is used to calculate the energy consumption data of exercise based on the second output data and the first output data; The second calculation module is used to calculate the total daily target calorie intake based on the shared feature data and the exercise energy consumption data. The third determining module is used to determine recipe data that matches the total target calorie intake based on the preset recipe library and disease contraindication mapping table in the system prompt words, and use it as the third output data.
[0118] The device for generating the health management solution in this application embodiment can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network-attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.
[0119] The device for generating the health management plan in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.
[0120] Optional, such as Figure 4 As shown, this application embodiment also provides an electronic device, including a processor 910, a memory 909, and a program or instructions stored in the memory 909 and executable on the processor 910. When the program or instructions are executed by the processor 910, they implement the various processes of the above-described health management scheme generation method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0121] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0122] Figure 5 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application. The electronic device 900 includes, but is not limited to, components such as: radio frequency unit 901, network module 902, audio output unit 903, input unit 904, sensor 905, display unit 906, user input unit 907, interface unit 908, memory 909, and processor 910.
[0123] Those skilled in the art will understand that the electronic device 900 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 910 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 5 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here. It should be understood that, in this embodiment, the input unit 904 may include a graphics processing unit (GPU) 9041 and a microphone 9042. The GPU 9041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 906 may include a display panel 9061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 907 includes at least one of a touch panel 9071 and other input devices 9072. The touch panel 9071 is also called a touch screen. The touch panel 9071 may include a touch detection device and a touch controller. Other input devices 9072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.
[0124] The memory 909 can be used to store software programs and various data. The memory 909 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 909 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 909 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.
[0125] Processor 910 may include one or more processing units; optionally, processor 910 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 910.
[0126] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described health management scheme generation method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0127] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0128] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described health management scheme generation method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0129] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0130] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described health management scheme generation method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0131] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0132] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0133] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A method for generating a health management plan, characterized in that, The method includes: The health data to be processed is decoupled by features, and the data is split to obtain common feature data and incremental feature data corresponding to at least two management dimensions. These are then assembled to form structured user feature data. Based on preset multi-task composite generation control instructions, the target model is driven to perform a single forward propagation in the same attention space according to the user feature data and chain-like conditional generation rules. For any management dimension, the output data of the management dimension is injected as a constraint into the generation chain of subsequent management dimensions to continuously output the output data of each management dimension, thus obtaining a hybrid semantic sequence. The chain-like conditional generation rules define the generation order of each management dimension. The mixed semantic sequence is stream-parsed based on a predefined state machine to obtain structured health scheme data.
2. The method according to claim 1, characterized in that, The hybrid semantic sequence includes a basic generation unit; the method further includes: For each basic generation unit generated, the key-value vector corresponding to the basic generation unit is written into the key-value cache; the key-value cache is used to allow the target model to expand its perceptual coverage. When the key-value vector corresponding to the basic generation unit belongs to the clinical taboo class vector, the attention weight of the clinical taboo class vector is set to the maximum value, and the attention weight is written into the metadata field of the corresponding vector in the key-value cache; the attention weight is used to indicate that the clinical taboo class vector obtains the highest semantic awareness priority in all subsequent self-attention calculations, so as to reduce the generation probability of conflicting basic generation units.
3. The method according to claim 2, characterized in that, The method further includes: If the semantic correlation between any candidate basic generation unit and the clinical contraindication class vector in the key-value cache is greater than or equal to a preset correlation threshold, then the generation probability of the candidate basic generation unit is directly reduced to the specified generation probability. The basic generation unit is determined based on the generation probability of each candidate basic generation unit.
4. The method according to claim 1, characterized in that, The multi-task composite generation control command is a pre-built system prompt word. The system prompt word contains built-in data generation rules for each management dimension, generation order constraints for each management dimension, output data structure, disease contraindication mapping table, and preset recipe library, which are used to drive the target model to synchronously complete multi-task output in a single inference.
5. The method according to claim 1, characterized in that, The process involves decoupling the health data to be processed, splitting it into common feature data and incremental feature data corresponding to at least two management dimensions, and assembling them to form structured user feature data, including: The health data to be processed is extracted using a feature extraction function. The user full-dimensional profile data and continuous intervention plan data in the user feature data are identified as shared feature data. The vital signs data and contraindication rules related to the exercise management dimension, and the preference data and recommendation data related to the nutrition management dimension are identified as incremental feature data. The user feature data is determined based on the shared feature data and the incremental feature data.
6. The method according to claim 1, characterized in that, The process of performing streaming parsing on the hybrid semantic sequence based on a predefined state machine to obtain structured health plan data includes: Invoke a predefined state machine to route the thought chain reasoning content in the hybrid semantic sequence to an independent soft state field; After the reasoning content of the thought chain is output, the state machine is switched to hard constraint verification mode; Based on the state machine in hard constraint validation mode, the generated structured business fields are validated for legality, and structured health scheme data that conforms to the strong type definition is output.
7. The method according to claim 4, characterized in that, The management dimensions include management goal dimension, health management dimension, exercise management dimension, and nutrition management dimension; for any management dimension, the output data of that management dimension is injected as a constraint into the generation chain of subsequent management dimensions to continuously output the output data of each management dimension, including: Based on the shared feature data and the generation rules corresponding to the management target dimension in the system prompt words, a health management target corresponding to the management target dimension is generated; Based on the health management goal, the shared feature data, and the generation rules corresponding to the health management dimension in the system prompt words, the first output data corresponding to the health management dimension is generated; The health management goal, the first output data, the shared feature data, and the incremental feature data corresponding to the exercise management dimension are determined as the first constraint condition corresponding to the exercise management dimension. Based on the first constraint and the generation rule corresponding to the motion management dimension in the system prompt, generate the second output data corresponding to the motion management dimension; The health management goal, the first output data, the second output data, the shared feature data, and the incremental feature data corresponding to the nutrition management dimension are determined as the second constraint condition corresponding to the nutrition management dimension. Based on the second constraint and the generation rule corresponding to the nutrition management dimension in the system prompt, the third output data corresponding to the nutrition management dimension is generated.
8. The method according to claim 7, characterized in that, The process of generating third output data corresponding to the nutrition management dimension based on the second constraint and the generation rule corresponding to the nutrition management dimension in the system prompt includes: Based on the second output data and the first output data, calculate the energy consumption data of the exercise; Based on the shared feature data and the exercise energy consumption data, the total daily target calorie intake is calculated; Based on the preset recipe library and disease contraindication mapping table in the system prompts, recipe data that matches the total target calorie intake is determined and used as the third output data.
9. A device for generating a health management plan, characterized in that, The device includes: The first processing module is used to perform feature decoupling processing on the health data to be processed, splitting it into common feature data and incremental feature data corresponding to at least two management dimensions, and assembling them into structured user feature data. The first generation module is used to drive the target model to perform a single forward propagation in the same attention space based on the user feature data according to the chain-like conditional generation rules, based on the preset multi-task composite generation control instructions. For any management dimension, the output data of the management dimension is injected as a constraint into the generation chain of the subsequent management dimensions to continuously output the output data of each management dimension and obtain a hybrid semantic sequence. The chain-like conditional generation rules define the generation order of each management dimension. The first acquisition module is used to perform streaming parsing on the hybrid semantic sequence based on a predefined state machine to obtain structured health scheme data.
10. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method for generating a health management scheme as described in any one of claims 1-8.
11. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the method for generating a health management scheme as described in any one of claims 1-8.
