A method and system for processing data related to traditional Chinese medicine prescription events
By decomposing prescription changes into atomic events and generating counterfactual prescriptions that satisfy prescription rules, the problems of quantification and rule feasibility of prescription changes in existing technologies are solved. This achieves contribution quantification and statistical credibility assessment at the individual level, and reduces inconsistencies and evaluation drift in the calculation process.
Patent Information
- Application Number
- CN202611287536.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-24
- Publication Date
- 2026-11-17
AI Technical Summary
Existing technologies lack the ability to break down prescription changes into atomic events at the individual level and quantify their contribution on an event-by-event basis. The counterfactual prescription generation process is not constrained by prescription rules, which makes it impossible to guarantee the feasibility of the rules. There is a lack of unified event-based benchmarks and model version constraints between factual and counterfactual scenarios.
Prescription changes are decomposed into atomic events with separate encoding of event type and operation range. Rule-feasible counterfactual prescriptions that satisfy prescription rules are generated by solving the target locking bit and rule projection. The prescriptions are evaluated by re-eventization with the same benchmark and solidified response model to ensure that factual and counterfactual prescriptions are processed consistently under the same previous prescription, the same event feature dictionary and fixed input dimensions.
It achieves the quantification of the contribution of a single prescription event, reduces state-event inconsistency and benchmark drift in the counterfactual construction process, improves computational efficiency, and provides a statistical credibility assessment of the contribution.
Smart Images

Figure CN123120211A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of traditional Chinese medicine data processing technology, and relates to a method and system for processing data contribution from traditional Chinese medicine prescription events. Background Technology
[0002] Traditional Chinese medicine prescription event contribution data processing aims to determine the contribution of a specific prescription change to the outcome response from a sequence of existing prescriptions, providing a basis for prescription optimization and efficacy evaluation. Currently, the data processing methods available for this task mainly fall into three categories.
[0003] The first category is population-based statistical methods for evaluating prescription efficacy. These methods assess the overall efficacy and safety of drugs or prescription regimens at the population level by performing statistical processing such as propensity score scoring and covariate correction on real-world clinical data. Their conclusions reflect average-level associations or effects, and the analytical granularity remains at the overall prescription regimen level. When clinicians need to answer questions about the impact of adding or removing a particular drug or adjusting a single dose on the outcome of a specific patient, these methods lack the ability to break down the event at the event level.
[0004] The second category is treatment protocol comparison methods based on sequence analysis. These methods model the treatment process as a sequence structure, analyzing differences between different treatment stages or protocols through sequence alignment and similarity calculations. They are suitable for protocol classification and stage division. Their analysis focuses on the similarity and differences at the overall protocol level. The impact of individual events in the prescription sequence is intertwined with changes in the overall protocol; therefore, these methods cannot isolate and quantify the impact of a single prescription event.
[0005] The third category is counterfactual analysis methods based on causal inference. These methods construct counterfactual scenarios using causal inference tools such as structural causal graphs and time-varying confounding corrections, thereby estimating the causal effects of interventions. Theoretically, they possess the potential for individualized attribution. However, directly applying them to traditional Chinese medicine (TCM) prescription scenarios has two limitations. First, the generation process of counterfactual prescriptions does not consider prescription feasibility constraints such as TCM compatibility rules, dosage constraints, and processing requirements. The generated counterfactual prescriptions may not meet the pre-set prescription rule constraints, and the contribution estimates obtained based on such prescriptions may be distorted. Second, the construction benchmarks of factual and counterfactual scenarios are not consistent in event encoding and exposure calculation, resulting in benchmark drift. Furthermore, the response model may undergo version or parameter updates between two predictions, and the difference results, in addition to the influence of the target event, are also mixed with biases caused by the aforementioned factors. Moreover, existing methods lack statistical credibility assessment methods for contribution estimation results.
[0006] As can be seen from the above three methods, existing technologies lack the data processing capability to decompose prescription changes into atomic events at the individual level and quantify their contributions on an event-by-event basis. The generation process of counterfactual prescriptions is not constrained by prescription rules, leading to unreliable rule feasibility. Furthermore, there is a lack of unified event-based benchmarks and model version constraints between factual and counterfactual scenarios. Therefore, there is an urgent need in this field for a data processing method capable of performing event-level structured processing on continuous follow-up prescription changes, and maintaining consistency between factual and counterfactual paths in event-based benchmarks, feature input structures, and model evaluation criteria while ensuring that counterfactual prescriptions meet prescription rules. This would allow for the acquisition of outcome response contribution data and statistical support judgment results corresponding to a single prescription event. Summary of the Invention
[0007] The technical problem to be solved by this application is: how to perform consistent eventification and constrained counterfactual processing on prescription status data generated from continuous follow-up visits, so that, under the condition that the target event is strictly canceled and the counterfactual prescription meets the preset prescription rules, the factual prescription and the counterfactual prescription form a comparable model input based on the same previous prescription, the same event feature dictionary and fixed input dimensions, thereby reducing the state-event inconsistency, evaluation benchmark drift and model evaluation caliber changes in the counterfactual construction process, and thereby obtaining the outcome response contribution data and its statistical support judgment results corresponding to the target prescription event.
[0008] To address the aforementioned technical problems, this invention provides a method and system for processing data related to traditional Chinese medicine prescription events.
[0009] This invention provides a method for processing data on contributions from traditional Chinese medicine prescription events, comprising the following steps: S1, the change of the current prescription of the object to be analyzed relative to the previous prescription is decomposed into atomic events. Each atomic event is encoded with event type and operation magnitude separately. The event type represents the category of prescription change, and the operation magnitude is a non-negative value.
[0010] S2, determine the target event from the atomic events, restore the prescription state before the target event changes, generate the original counterfactual prescription after canceling the target event, and set a target lock bit. The target lock bit is used to lock the target variable corresponding to the target event during the counterfactual processing and prohibit the editing of the target variable.
[0011] S3, under the hard constraint of the target locking position, only the non-target variables are edited, and the rule projection is solved with the minimum editing distance as the objective, so as to obtain the rule-feasible counterfactual prescription that satisfies the prescription rule.
[0012] S4, the factual prescription, the original counterfactual prescription, and the rule-feasible counterfactual prescription are all reconstructed relative to the same previous prescription event set, completing the same baseline re-eventization.
[0013] S5, input the feature snapshots corresponding to the fact prescription, the original counterfactual prescription, and the rule-feasible counterfactual prescription after being re-eventified with the same benchmark into the same solidified response model. The solidified response model is a response model with version frozen and parameters frozen, to obtain the fact response, the original counterfactual response, and the rule-feasible counterfactual response. The target cancellation difference is calculated by subtracting the original counterfactual response from the fact response. The rule repair difference is calculated by subtracting the rule-feasible counterfactual response from the original counterfactual response. The total feasible counterfactual difference is calculated by subtracting the rule-feasible counterfactual response from the fact response. The sum of the target cancellation difference and the rule repair difference is equal to the total feasible counterfactual difference.
[0014] S6, perform counterfactual statistical support determination on the feasible counterfactual prescriptions of the rules, determine the contribution of the target event to the outcome response based on the total difference of feasible counterfactual facts, and output the counterfactual statistical support determination result corresponding to the contribution.
[0015] The counterfactual statistical support determination does not use the target cancellation difference, rule repair difference, or total feasible counterfactual difference as the basis for determination; it can be performed separately from the model response difference of the solidified response model. In specific execution, the counterfactual statistical support determination can be performed after the rule-feasible counterfactual prescription is generated and before the model response difference, to conduct a preliminary statistical support determination of the rule-feasible counterfactual prescription; the counterfactual statistical support determination result is output in association with the corresponding contribution during the contribution output stage.
[0016] This invention also provides a data processing system for traditional Chinese medicine prescription event contributions, including an atomic event encoding module, a target counterfactual generation and locking module, a rule projection module, a re-eventization module, a model difference module, a statistical support and judgment module, and a result output module. Each module is used to implement the corresponding data processing and result output in S1 to S6 above.
[0017] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for processing data contributing to traditional Chinese medicine prescription events.
[0018] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention decomposes prescription changes into atomic events with separate encoding of event type and operation range, and quantifies the contribution of each event at the individual level. This overcomes the shortcomings of existing group statistical methods that cannot perform individualized attribution for a specific prescription adjustment of a single patient, and realizes the quantification of the contribution of a single prescription event.
[0019] This invention solves the problem by locking the target location and projecting the rule. Under the hard constraint of locking the target variable, it only edits the non-target variables and generates a rule-feasible counterfactual prescription that meets the rules of traditional Chinese medicine compatibility, dosage constraints and processing requirements with the goal of minimizing the edit distance. This ensures that the counterfactual prescription meets the preset prescription rule constraints and reduces the risk of contribution estimation distortion caused by the counterfactual prescription violating the preset rules.
[0020] This invention re-eventizes the factual prescription, the original counterfactual prescription, and the rule-feasible counterfactual prescription by using the same previous prescription as the comparison benchmark to regenerate the event set, and reconstructs the feature snapshot according to the same fixed feature dictionary and fixed input dimensions. At the same time, by fixing the response model, the three evaluation paths keep the model version and model parameters consistent, thereby reducing the state-event inconsistency and evaluation benchmark drift caused by using the factual event set, changing the feature coordinate structure, or updating the model, and making the target cancellation difference, rule repair difference, and total feasible counterfactual difference have a unified data processing caliber.
[0021] This invention uses counterfactual statistical support determination based on the number of neighborhood support for historical independent objects, the nearest training distance, and the out-of-bounds conditional probability to provide a statistical credibility assessment for contribution estimation, making the contribution conclusion verifiable and interpretable.
[0022] This invention improves computational efficiency in large-scale data processing scenarios by incrementally recalculating based on the projection editing list and variable lineage, recalculating only the response corresponding to the affected variable when there is a local change in the prescription, avoiding a full recalculation.
[0023] Other advantages, objectives, and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination, or may be learned from practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description
[0024] To make the objectives, technical solutions, and advantages of the present invention clearer, the preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, wherein: Figure 1 The overall flowchart of the data processing method for traditional Chinese medicine prescription events in this invention; Figure 2 This is a schematic diagram illustrating the temporal relationship between adjacent diagnoses, actual exposure intervals, and outcome response windows in this invention. Figure 3 This is a schematic diagram of the target event locking, rule projection, counterfactual statistical support judgment, same-bench re-eventization, and solidified response model differential process of the present invention. Figure 4This is a schematic diagram of the counterfactual generation and contribution calculation process for prescription status persistence events in this invention. Detailed Implementation
[0025] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0026] Unless otherwise specified, the dictionary, threshold, response kernel, variable classification, candidate set, rules, model, solver parameters, and random seed in the following embodiments are all fixed before training or target analysis, and the factual path and counterfactual path use the same compatible version. "Rule feasible" only indicates that the data state meets the preset rules and does not indicate a clinical prescription recommendation.
[0027] Example 1 This embodiment illustrates the complete calculation process of the method of the present invention, and provides a general basis for data processing, variable lineage, effective exposure calculation, constraint solving, statistical support and recalculation for subsequent embodiments for various diseases.
[0028] The process is executed by an electronic device containing a processor and memory. The processed objects are structured consultation records, drug status, event records, time intervals, model features, and rule constraints. The electronic device receives data through a database interface, file interface, or manual input interface, and writes intermediate states, version information, and final analysis results into the structured database.
[0029] Figure 1 The overall process shown includes: Step S101, acquiring continuous follow-up visit data; Step S102, data standardization and record status coding; Step S103, constructing adjacent visit pairs and prescription events; Step S104, constructing outcome response vectors; Step S105, constructing effective exposure overlap maps and calculating effective exposures; Step S106, variable lineage and confounding correction; Step S107, constrained counterfactual generation and counterfactual statistical support determination; Step S108, re-eventization with the same baseline, feature snapshot reconstruction, and solidified response model differencing; Step S109, determination of uncertainty, credibility, and output threshold; Step S110, output of contribution results, hard labels, and evidence chains.
[0030] The above steps are supported by the data foundation and traceability information that runs through S101 to S110. The processing objects, configuration versions and intermediate states of each step are all written into a structured database for storage.
[0031] I. Terminology and Data Objects The term "outcome indicator" as used in this manual refers to an observational variable that can be quantified or recorded in a structured manner during consecutive follow-up visits, and whose improvement direction and outcome response window can be pre-configured. This includes symptom- or scale-based outcomes, patient-reported outcomes, and objective continuous or discrete indicators obtained from medical devices, examinations, or standardized measurements. Examples include sleep symptom scores such as difficulty falling asleep and nighttime awakenings in the insomnia example, and systolic blood pressure (SBP), diastolic blood pressure (DBP), or home blood pressure mean in the hypertension example. "Symptom" is a subtype of the outcome indicator. Unless specifically specified in the insomnia example, the index 's' in the formulas of this manual is used as a general outcome indicator index.
[0032] In this embodiment, the "prescription operation state support function" represents a non-negative function that continuously holds true within the actual execution interval of the subsequent prescription. The drug reduction or dosage reduction event supports the "non-existent state" or "lower dose state" rather than drug intake. "Target event locking" means that after restoring the target variable to the state before the target event occurred, the restored state is set to an uneditable state, preventing subsequent rule projection from causing the target event to recur. "Target lock bit" is a field that stores this immutable state. "Same baseline re-eventization" means comparing the fact prescription, the original counterfactual prescription, and the rule-feasible counterfactual prescription with the same previous prescription and generating a complete event set. The "target sensitive variable" changes with the cancellation of the target event and does not enter the corresponding target event exposure model. "Counterfactual statistical support judgment" and "rule feasibility judgment" are implemented separately. "Rule-feasible counterfactual prescription" is the prescription data state that simultaneously satisfies the target lock bit and the applicable preset prescription rule.
[0033] The term "fixed response model" as used in this specification refers to an evaluation model, evaluation function, or corresponding model set that has been fixed before the target analysis and is used for unified model response evaluation of fact prescriptions, original counterfactual prescriptions, and rule-feasible counterfactual prescriptions. In one implementation, it includes an evaluation function formed by an outcome baseline model and a contribution estimation model, and calls a pre-fixed family of event exposure models to construct residual event features; other implementations may consist of one or more functionally equivalent models. For the same target event and the same outcome indicator, the three evaluation paths use the same version, the same parameters, the same feature dictionary, and the same fixed-dimensional input definition of the fixed response model, without retraining, parameter tuning, or model replacement due to different prescription states.
[0034] II. Input Data and Unified Record Structure The data receiving and standardization module reads data from electronic medical records, prescription systems, follow-up scales, medication logs, and co-intervention records, and labels them as training data or target analysis data. Raw records retain their source, time, raw values, and structured values, and remain read-only. Standardization results are written to a derived table. Training objects, calibration objects, and target analysis objects are coded separately and isolated from each other.
[0035] Table 1. Main data tables and fields for continuous follow-up visit data
[0036] Dosage is uniformly converted to grams per dose or a preset standard dosage unit. If different processed forms exist for the same drug name, the drug name code retains the common base name, and the processing status is set as a separate field. For Chinese medicine granules, decoction pieces, or pills, powders, ointments, and elixirs, dosage form conversion factors can be configured separately; when the conversion basis is insufficient, the original unit is retained and an incomparable mark is set.
[0037] The status of outcome indicators should at least retain the original record status, standardized values, and quality status. For symptom- or scale-based outcomes, it is preferable to further distinguish between presence, explicit denial, not asked, asked but not recorded, and uncertain; 0 to 10 scales can be normalized to 0 to 1, and mild, moderate, and severe grades can be converted to a unified dimension according to a preset mapping. For objective continuous indicators such as SBP and DBP, the original values, units, measurement sources, number of measurements, and measurement quality should be retained, and directional standardization should be performed according to the disease-specific outcome configuration; missing or unmeasured values should not be treated as normal values or 0.
[0038] III. Construction of Adjacent Visit Pairs and Prescription Atomic Events, and Persistent Prescription Status Events For each subject, sort them in ascending order by consultation time. For the i-th consultation where i is greater than or equal to 2, the adjacent (i-1)-th and i-th consultations constitute a prescription change consultation pair. And using the i-th consultation as the reason The effective number of visits for the generated prescription event; when there is an (i+1)th outcome observation, the outcome response after the event is evaluated based on the interval between the (i)th and (i+1)th visits. If the adjacent interval is less than the preset minimum interval or greater than the preset maximum interval, the corresponding record can be retained and a time anomaly marker can be set, or it can be excluded in specific disease implementation examples.
[0039] (1) In equation (1), The standard dose of the drug for the i-th treatment is h. The standard dose for the previous treatment.
[0040] when and When a dosing event is generated; and A dose reduction event is generated; when both doses are greater than zero and the absolute value of the dose difference exceeds a preset absolute threshold, or the relative change exceeds a preset relative threshold, a dose reduction event is generated based on... The symbols generate dose increase events (hereinafter referred to as increment events) or dose decrease events (hereinafter referred to as reduction events), respectively. Changes in preparation method or administration method generate independent events.
[0041] Each atomic event e also stores the event type. , the state before the change , changed state Non-negative operating amplitude and support functions . Determine the semantics of the operation. Only the magnitude of the change should be indicated; the two should not be combined using positive and negative signs. (Regarding events involving dosage increases and decreases...) The preferred method is to divide the dosage increase or decrease by the pre-established upper limit of comparable dosages; for increase and decrease events, the absolute value of the dosage difference is divided by the comparable dosage range; when no reliable dosage range exists, the event existence amplitude of 1 is used and a dosage incomparability marker is set; changes in processing and administration methods are represented by the pre-established non-negative state distance. The direction of the event's response to the outcome is determined by the difference between the fact and counterfactual values in the established response model.
[0042] Table 2. Direction, amplitude, support status, and target cancellation rules of atomic events
[0043] Changes in prescriptions and the number of visits The system calculates the similarity of drug sets. Dosage structure similarity Similarity to prescription module The similarity is maintained by forming prescriptions with fixed non-negative weights. The event dictionary index and event-level fixed encoding are as follows: (2) In equation (2), For standard drug codes, For event type, Analysis levels are categorized by herbal flavor, herbal pair, efficacy category, or prescription module. Using fixed coordinate keys as the event feature dictionary, the addition, reduction, increase, and decrease of the same drug are mapped to different coordinates. (Previous state) and the changed state Instead of being used directly as dictionary coordinate keys, it is used as an event state attribute and processed by equation (3). Encoding; Event group identifiers are only stored as metadata for event groups and evidence chains within the same consultation session and do not participate in fixed coordinate generation. Prescription status persistence events are replaced by maintenance object codes. It also saves the state summary before and after training, similarity components, and target deviation types fixed before training.
[0044] (3) In equation (3), The drug code, event type, and analysis level together determine a fixed event coordinate. The state encoding mapping is fixed during the training phase. The non-negative operation magnitude of the event. For event-level encoding indexed by fixed event keys, the fixed-dimensional inputs of the model described later are in the same... Constructed on a coordinate system, factual and counterfactual inputs use the same event feature dictionary and the same dimensional order fixed during the training phase. When a drug-level event not seen during the training phase appears in the target analysis, the system rolls up to the coordinates of the drug pair, efficacy category, or prescription module according to a preset mapping; if there are no supported roll-up coordinates, the system outputs an unseen event and an unpredictable marker, without temporarily expanding the model input dimensions.
[0045] (4) In equation (4), , , The weights are non-negative and the sum of the three is 1. The Jaccard similarity between the (i-1)th prescription drug set and the i-th core drug set can be used. ; This represents the coverage similarity of treatment methods, efficacy categories, or preset prescription modules. Each similarity score is truncated to 0 to 1, and the weights, comparison drug ranges, and module dictionaries are fixed before training begins.
[0046] (5) When the maintenance threshold corresponding to analysis level l is satisfied and At that time, a prescription status persistence event will be generated and will (i) as the magnitude of a non-negative event between 0 and 1; due to The normalized denominator of equation (5) is always positive, and hour , The coordinates of the persistent event are not generated at this time. At the whole prescription level, all comparable drugs are compared. At the core prescription level, only the core drug set and main dosage structure determined before the event occurs are compared. At the prescription module level, the target module is covered. In the same consultation, drug-level addition and subtraction events and higher-level prescription status persistent events can coexist, but each unchanged drug must not be encoded as a prescription status persistent event.
[0047] IV. Outcome Response Vector and Recording Quality (6) In equation (6), The outcome burden value of the i-th diagnosis outcome indicator s is standardized after disease-specific outcome configuration, and it is uniformly agreed that the higher the value, the worse the condition; The post-event outcome response observed from the i-th to the (i+1)-th visit, compared with the response to changes in prescription frequency. The event pairing that takes effect for the i-th time. These are the upper and lower limits of the standardized range of the outcome indicator, which are fixed before the target analysis in the disease outcome configuration, and are not taken from the observation extreme values of the current target analysis object; the direction of the original indicator is fixed in advance by the configuration, and the direction is converted first if necessary. ε in equation (6) is a very small positive number to prevent the denominator from being zero; unless otherwise specified, ε in all equations in the text represents a very small positive number that matches the dimension of the denominator and is fixed before the analysis, and ε in different formulas does not need to take the same value. Indicates improvement. This indicates a worsening of the condition; new or absent symptoms, interval severity, continuous measurements such as SBP or DBP, and other discrete outcomes are calculated according to the standardized rules configured for the corresponding outcomes.
[0048] (7) In equation (7), The quality factors for the recording or measurement of outcome indicator s, prescription dosage information quality, actual exposure information quality, co-intervention information quality, and visit interval or time information quality are all between 0 and 1. This refers to the overall data quality weighting for outcome indicator s for each diagnosis. The aforementioned quality factors are used to reflect the reliability or completeness of the relevant information, not its effective exposure. Or observe coverage using the response window. The outcome indicator is replaced by its own value. If a certain outcome indicator is not recorded or measured, it is not assigned a value of 0 or a normal value, but is excluded from the corresponding outcome equation or weighted by the missing value model.
[0049] V. Outcome Response Window and Effective Exposure Overlap Map Each outcome indicator s is configured with a minimum onset lag. Peak time and maximum support time .
[0050] Figure 2 This shows the temporal relationship between visit frequency, prescription exposure, co-intervention, and response window. (Lag kernel) (u) can be set in the following segmentation manner; the parameters are configured according to the disease type version, outcome indicator code and disease stage index when necessary, and different outcome indicators within the same disease type can use different response windows.
[0051] , ; , ; , The rest are (8) In equation (8), The exponential decay rate after the peak time is given, and it is required that... The above parameters are all determined during the training or configuration solidification phase. For changes in prescription frequency... A nonnegative support function is defined for the atomic event e that is generated and takes effect in the i-th diagnosis. ,in, Determine according to Table 2. (t) indicates whether the corresponding changed operation state is valid within the actual execution time of the i-th prescription; compliance function Take 0 to 1 individually, avoiding combinations with... Repeated events are counted. The observation interval after the event is defined. The actual execution interval of the i-th prescription The final response support range For prescription status persistence events, , Supports the continuous state of target units, core units, or modules.
[0052] (9) Equation (9) calculates only the intersection of the observation interval, the actual execution interval, and the complete outcome response support interval in the numerator. The denominator is fixed as the hysteresis kernel quality within the complete outcome response support interval and does not shorten with the actual observation length. Therefore, insufficient actual execution, missed doses, or premature termination of the observation period will not result in an artificially high support level close to 1 due to the simultaneous shortening of the numerator and denominator. O(i,e,s) is truncated to 0 to 1, and the same integration caliber is used for joint interventions. When the actual start time cannot be determined, the prescription time can be used plus a solidification delay and the time quality factor can be reduced. The start time should not be deduced from the results of subsequent outcomes.
[0053] And the target operation state is established. (10) , (11) In equations (10) and (11), and Determined by medication dispensing records, medication logs, and missed dose dates. Addition or increment events support the existence of a state or a higher dose state after an addition; reduction or decrease events support the absence of a state or a lower dose state. For multiple discontinuous dosing intervals, (t) Take the union of each actual execution sub-interval. When there is insufficient basis for drug conversion, dose merging is not mandatory; incomparable labels are used, and the prescription dose quality factor and counterfactual statistical support are reduced.
[0054] (12) Equation (12) is the response window observation coverage, used to distinguish between "not actually executed" and "response window has not been fully observed". Without changing the direction of event operations, the coverage metrics and confidence factors are saved as an independent response window; when When the result is below the solidification threshold, the system may retain the result but mark it as insufficient response window coverage, or directly output that it is unpredictable.
[0055] Effective exposure map In the middle, node Including atomic events, joint intervention, and outcome response, edge Connect nodes that have time-supported relationships, edge weights The overlapping weights are calculated using equation (9). Edge weights below a preset threshold can be deleted to reduce model dimensionality. Nodes It may also include prescription status continuous event nodes; the edge weights between them and the outcome response nodes are also calculated according to equation (9).
[0056] VI. Confounding Variables and Object-Based Cross-Fitting For each target event e, the system establishes variable lineage based on field origin and counterfactual change tests. Definition ,in For variables that have been determined before the event occurs, For simultaneous joint intervention, For prescription context variables that remain unchanged between the fact prescription and the original counterfactual prescription after the target event is cancelled, and which are not post-event mediations; define another... The target sensitive variables, which vary with the prescription status P to be evaluated, include the total number of medicinal ingredients affected by the target event, total dosage, target module coverage, and structural summary. For a fixed target event e, the outcome baseline model and the event exposure model family only receive the same... ; It must not be used as a fixed confounding variable or exposed model input, but must be recalculated separately in the factual and counterfactual evaluation paths of the fixed response model.
[0057] Table 3. Variable Categories, Model Purpose, and Rules for Handling Facts and Counterfacts
[0058] ; (13) ; (14) In equations (13) and (14), for a fixed target event e, the coordinates r of all events entering the current contribution estimation model are at the same level. Conditional residuals are defined as follows: when r equals e, it represents the target event exposure residual. The outcome baseline model and event exposure model family must not accept valid exposures, event magnitudes, post-change states, target-sensitive variables, or post-event mediations for the target event e. Whether a variable belongs to... Determined by the counterfactual change test: This variable is calculated from both the factual prescription and the original counterfactual prescription, and any changes in its value are attributed to... Only data whose values remain unchanged and for which there is no subsequent event source can be included. When the set of events to be cancelled is J, the original counterfactual prescription is generated from the union of all target lock bits. Directly outputting the joint counterfactual prescription is not feasible when lock bits conflict. Training objects are divided into K folds, and all diagnoses of the same object must not cross folds.
[0059] In one implementation, the hyphen is... (object identifier, Generated by mod K, K-values, normalization dictionaries, and feature dictionaries are fixed before training begins. All diagnosis pairs, missing model samples, and Bootstrap sampling units for the same object are kept within the same object group; target analysis objects must not participate in outcome baseline models, event exposure model families, contribution estimation models, hyperparameter selection, or confidence calibration.
[0060] For event e and outcome metric s, let the support weights be... The effective sample size is defined as follows: (15) Response window observation coverage Instead of multiplying again in the aforementioned support weights, the confidence and hard labels are incorporated into the confidence calculation later using an independent coverage factor and a preset coverage threshold, to avoid observing insufficient coverage. In addition, it is repeatedly reduced. When If the number of occurrences of independent objects is lower than the preset lower limit, or the external conditional probability of the target event does not meet the preset overlap interval, the contribution of high confidence level of medicinal flavor will not be output; if the system can roll up the analysis level and it is still insufficient, the output will be insufficient support and cannot be estimated.
[0061] VII. Contribution Estimation Model After obtaining the residuals, contribution estimation models are established for each fixed target event e and outcome index s to avoid mixing the baseline residuals corresponding to different target events. The fixed dimension input in the following formula is constructed according to equation (19), and the training phase is based on fact prescriptions. Corresponding input fitting: (16) Equation (16) is weighted using the number of visits and the outcome quality weight q(i,s). In the linear implementation, To perform joint regularized linear mapping of L1 and L2 on all fixed coordinates in equation (19), the interaction coordinates are generated only for the set of allowed interaction event pairs fixed before training, and the regularization parameters are selected by inner-layer cross-validation based on the object; in the preset nonlinear implementation, A gradient boosting model with a predefined structure and hyperparameter range is used.
[0062] Regardless of the implementation method, the same input coordinate definition is used in both the training and target analysis phases; once the model is selected, the outcome baseline model, event exposure model family, contribution estimation model, input fields, feature dimensions, interaction set, and parameter version remain consistent in the factual and counterfactual paths.
[0063] (17) (18) In equations (17) and (18), P represents the prescription state corresponding to the factual prescription, the original counterfactual prescription, or the rule-feasible counterfactual prescription; for a fixed target event e, Remaining unchanged across the three evaluation paths, Each prescription status is recalculated independently; The event encoding and Equation (9) are re-executed according to the prescription state P. When r equals e, Equation (18) gives the exposure residual of the target event under the prescription state P. All trained models, feature dictionaries, coordinate order, and interaction sets are fixed during target analysis.
[0064] (19) Equation (19) gives the fixed-dimensional input construction method. Wherein, The nonnegative operational magnitude of event r under prescription state P, and the time support function. Distinguish between phases; A value of 0 or 1 indicates the presence of the event mask; The set of allowed interactive event pairs is fixed before training; ⊕ indicates vector block concatenation; Fixed coordinate mapping for the target sensitive variable.
[0065] When an event does not exist, the corresponding mask, amplitude, and effective exposure are set to zero; when a record is missing, an independent missing mask is used, and it is not treated as if it did not occur. The coordinates and transformation methods of each mapping are fixed before training. Factual and counterfactual events are recalculated separately, but the dimensions must not be changed. If no event is seen during the training phase, the fixed mapping is used for roll-up only, and coordinates must not be added temporarily during target analysis. Roll-up analysis only changes the analysis unit level, and multiple drug flavor level contributions are not added afterward as group level contributions; for drug pairs, efficacy categories, or prescription module level analysis units, the member set, state encoding, event amplitude, and target cancellation rules are fixed in advance during the training phase. During target analysis, the state before the change at that level is restored and locked, and rule projection, counterfactual statistical support judgment, and re-eventization with the baseline are continued.
[0066] By default, the joint intervention node enters the joint intervention coordinate in the concurrent joint intervention variable or fixed input, and is only used to correct the contribution of traditional Chinese medicine events; the joint intervention contribution is only output according to formula (33) when the system is pre-configured with the state before the joint intervention change, the dosage or intensity range and its coding rules. If the corresponding counterfactual rules are not configured, the contribution value of the joint intervention node is not output.
[0067] 8. Constrained Counterfactual Prescription Generation like Figure 3 As shown, for the target atomic event e, the original counterfactual prescription is first generated. When a dosing event is cancelled, the target drug will be restored to its previous state (if it did not exist). When a dosing reduction event is cancelled, the previous drug and dosage will be restored. When an increase or decrease event is cancelled, the dosage before the change will be restored. When a change in processing or administration method is cancelled, the previous state will be restored. The above conditions will be written into the target lock bit. ; The objective events and joint interventions between China and Africa should be kept in fact. Any subsequent standardization, candidate replacement, rule repair, and equivalent state merging should first verify the target lock position, and candidates that fail to be verified should be directly eliminated.
[0068] Counterfactual prescriptions must simultaneously satisfy the following constraints: the target event is unconstrained; all doses are non-negative; doses are within the upper and lower limits given by the rule base (if a rule is missing, a pre-defined quantile range from the training data can be used); no combination in the prohibited compatibility set may exist simultaneously; when the base prescription label can be determined, the coverage rate of the core drugs in the base prescription is not lower than a preset lower limit; when the treatment method or efficacy label can be determined, the coverage rate of each relevant efficacy category is not lower than a preset lower limit; the total number of medicinal ingredients is within a preset range; and the processing state and administration method state are within a preset allowed set. The set of non-target variables that allow projection adjustment. Predetermined by the rule base and historical feasible prescription status, projections must not alter common interventions, outcome indicator records, compliance, pre-event fixed variables, or the status corresponding to the target event. If the base prescription or treatment label cannot be determined, the corresponding coverage constraint is disabled and a missing label is output; subsequent outcomes or contribution results are not used to supplement the label.
[0069] (20) In equation (20), Ω is the set of feasible rules, and the target event cancellation constraint ensures that the target event is strictly cancelled both before and after projection; Edit(P, () represents the set of variables that have actually changed relative to the original counterfactual prescription, and constrains them. This indicates that only the predefined set of non-target variables is allowed. The variables in the formula are modified by the rule projection; D is the prescription edit distance.
[0070] If the original counterfactual prescription satisfies all rules, it is directly used as a rule-feasible counterfactual prescription; otherwise, mixed-integer optimization, dynamic programming, or deterministic heuristic search is used for the solution. The solution process returns at least the feasibility state, objective value, and termination reason; for solvers that can provide an optimality bound, the optimality bound is also saved. Multiple optimal solutions are unique according to the order fixed before analysis; when only feasible solutions that satisfy all hard constraints but are not proven to be optimal are obtained, a "not proven optimal feasible solution" flag is output; when the feasible set is empty, a rule-feasible counterfactual prescription is not generated, the counterfactual feasibility factor is set to 0, and the unsolvable constraint is saved.
[0071] (twenty one) (twenty two) (twenty three) (twenty four) (25) In equations (21) to (25), For drugs, there are variables. As a dose variable, and These are the lower and upper limits of dosage. To prohibit compatibility sets, This is the current core candidate set of the basic method. For the set of candidate drugs of efficacy category f, For the set of function categories covered by the current configuration requirements, This represents the minimum coverage of current core candidate drugs in the basic formulation. This represents the minimum coverage rate for efficacy category f, and both values range from 0 to 1. and The range of medicinal ingredients. and These respectively indicate the processing method and the method of administration.
[0072] Equation (25) defines D as the universal edit distance between any two prescription states P and Q; These are the editing cost weights corresponding to the drug's state of existence, dosage, processing, and administration, respectively, and are all non-negative weights fixed before analysis. This is an indicator function.
[0073] For target dosing events, the target drug is locked as not existing; for target dosing events, the target drug is locked as existing and the dosage is equal to the pre-change dosage; for target dosage increases or decreases, the target dosage is locked as equal to the pre-change dosage; for target processing or administration method changes, the corresponding state is locked as equal to the pre-change state. If the drug name standardization module finds that a candidate drug and the target drug belong to the same origin, the same standard code, or are marked as target equivalent by the rule base, then the candidate is automatically selected from the list. This excludes cases from bypassing target event locking via synonyms or equivalent codes.
[0074] The set of non-target variables that can be modified The following steps are performed to generate the following rules: Read existing disease, treatment, or basic prescription tags before the event occurred; if tags are missing, only the pre-change prescription, previous visits, and fixed mappings are used to determine the rule; filter historical rule-based feasible prescriptions that match the tags; exclude candidates that conflict with the target lock position, share the same origin as the target drug, have the same standard code, or are equivalent to the target; add confirmed rule candidates; sort by the number of historical independent objects in descending order, edit cost in ascending order, and code lexicographical order, and extract a preset number of candidates. Rule conflict priorities are as follows: target event lock, prohibited combinations, dosage legality, core coverage, and efficacy coverage. Combinations should be used with caution, and pre-fixed configurations should be used as candidate screening conditions or hard constraints. Tag sources, candidate exclusion reasons, parallel solution resolution, and conflict constraints are all written to the log.
[0075] After obtaining the rule-feasible counterfactual prescription, the computing device first performs counterfactual statistical support determination according to equations (27) and (28), and then executes the following in sequence: fix the previous prescription; compare the fact prescription, the original counterfactual prescription, and the rule-feasible counterfactual prescription with the previous prescription and generate their respective event sets; record the sources of fact retention, target cancellation, projection dosing, projection dosing reduction, and projection dosage adjustment; recalculate the affected support function, effective exposure, response window observation coverage, event exposure residual, target sensitive variable, and interaction term; and input the solidified response model after completing the feature snapshot hash. If the event set obtained by re-eventizing the rule-feasible counterfactual prescription with the same baseline is inconsistent with the coordinates of the event to be input, the system stops the calculation of the event and outputs the status, event, and feature inconsistency markers.
[0076] For events involving the persistence of the target prescription state, since the prescriptions before and after the fact are in the same maintenance state domain, restoring the state before the change is not used as a cancellation method. The system constructs a target deviation function, which is set to 1 when the candidate prescription satisfies at least one of the following conditions relative to the fact-maintaining prescription: the overall prescription similarity is below a threshold, the core drug undergoes a non-equivalent change, the main dosage structure exceeds a change threshold, or the target prescription module coverage changes; otherwise, it is set to 0.
[0077] , , , (26) In equation (26), Configure a corresponding set of feasible rules for the current disease. This set of candidate prescriptions matches the disease type, treatment method, basic prescription, or disease stage before the event occurred. The target deviation condition is applied throughout the candidate generation, standardization, and projection processes. Candidates must first have historical independent object support; when multiple candidates have the same edit distance, a unique result is determined sequentially by descending order of the number of historical independent object neighborhood supports, ascending order of the number of modified medicinal ingredients, ascending order of the total dose change, and lexicographical order of the standard code. If no rule-feasible candidate or no candidate with counterfactual statistical support exists, the sustained contribution of the high-confidence prescription state is not calculated.
[0078] IX. Counterfactual Statistical Support and Out-of-Distribution Control Rule feasibility only verifies whether the prescription status satisfies the target event locking and rule constraints. To avoid extrapolating prescription statuses outside the training distribution using a fixed response model, the system calculates counterfactual statistical support after rule feasibility is established but before model differencing. The training queue is defined as the set of rule-feasible prescription statuses with the same disease configuration and analysis level as the current case, and duplicate statuses of the same object are counted only once during support counting.
[0079] , ; (27) (28) In equations (27) and (28), the training object set is a set of independent training objects that have at least one rule-feasible prescription state in the training prescription set. Indicates the training prescription status Belonging object, therefore Each individual object is counted at most once; δ is the neighborhood distance threshold. Supporting scales for independent historical objects To analyze the hard lower bound of the neighborhood support number of previously fixed historical independent objects, For distance attenuation scale, To analyze the hard upper limit of the nearest training distance before it is fixed; To ensure that the baseline variables remain fixed in the factual and counterfactual evaluation paths, the conditional probability of the target event e reaching the preset effective exposure threshold is obtained from the out-of-bounds prediction values of the training objects. The value is between 0 and 1; when the number of neighborhood support for a historical independent object is lower than the hard lower bound or the external conditional probability of the target event does not meet the preset overlap interval, the corresponding indicator function of equation (28) directly makes It outputs labels that are feasible but lack counterfactual statistical support, and outputs out-of-distribution labels when the nearest training distance exceeds the hard upper limit. When the value is below the preset threshold, retain the counterfactual statistical support insufficient label or out-of-distribution label according to the actual triggering reason. Exploratory differences can be saved but must not be marked as high confidence. When the training prescription set is empty, output out-of-distribution directly. When the conditional probability cannot be reliably estimated, output counterfactual statistical support insufficient or unpredictable.
[0081] 10. Feasible counterfactual total difference, interaction contribution, and credibility (29) (30) (31) (32) In equations (29) to (32), CE(e,s) is the abbreviation for the total feasible counterfactual difference. For the simplified notation of the hat number in the fixed estimation function of equation (17), the fact prescription, original counterfactual prescription, and rule-feasible counterfactual prescription for the same target event all call the same... All three states are relative to the same Perform re-eventization with the baseline and recalculate the target sensitivity variables separately. If Violation of prescription rules and This is only used as a diagnostic metric for the software; the final output will be... Projection editing list and The rule fix percentage is based on... calculate, To analyze the near-zero tolerance of pre-curing; when "Rule repair is not the primary factor" in certain situations; otherwise... When the solidification threshold is exceeded, a "rule repair dominant" flag is output.
[0082] (33) Equation (33) is used for cases where a joint intervention counterfactual rule is configured: For the common intervention evaluation function pre-fixed during the training phase, To ensure that the inputs for the evaluation of the intervention are factual prescriptions of traditional Chinese medicine, other common interventions, fixed variables before the event, compliance, and observation intervals, To restore only the state, dosage, or intensity of the target co-intervention c to the corresponding input after the change; the co-intervention counterfactual does not enter the feasible domain projection of the Chinese medicine dosage, compatibility, and basic formula structure, and no output is given when there is no explicit pre-change state or fixed coding rule. (c,s).
[0083] (34) In equation (34), The nearest feasible alternative prescription that satisfies the target deviation constraint obtained from equation (26). This indicates the difference in the model response of a prescription status persistence event relative to the most recently feasible change of status, under the current observation data, disease configuration, and fixed response model conditions; it is not equivalent to the efficacy of prescription adherence determined by randomized trials, nor does it directly generate instructions to continue adherence or adjust the prescription.
[0084] ; (35) When calculating the interaction contribution in equation (35), a unified variable lineage is first established for the joint event set J={e,r}. And call the solidified evaluation function corresponding to the joint event set according to the same rule from equation (13) to equation (17). ; This indicates that under the joint context J, events in J′ are cancelled and events in J\J′ are locked as fact states. If locking results in a conflict or no common feasible solution exists, the corresponding Δ is not calculated and the interactive counterfactual infeasibility is output. Each single-event counterfactual state and joint counterfactual state execute the counterfactual statistical support determination of equations (27) and (28) respectively. For any necessary counterfactual state When the value is below a preset threshold, the corresponding interaction contribution should not be marked as high credibility.
[0085] (36) (37) , (38) , (39) When the rule projection is feasible; when the original counterfactual prescription is feasible, take When there is no feasible solution, take (40) (41) (42) , (43) In equation (36), to The factors are, in order: effective sample size factor, exposure support factor, resampling symbol stability factor, rule feasibility factor, data completeness factor, counterfactual statistical support factor, and response window observation coverage factor, with each factor limited to 0 to 1.
[0086] In equations (37) to (43), According to equation (15), its support weight is calculated as follows: No additional ride ; The contribution value to Bootstrap is greater than Less than - and absolute value not exceeding The object resampling ratio, To analyze the near-zero tolerance of pre-cured material; The prescription editing distance obtained by solving the regular projection is defined by the prescription editing distance function D according to equation (25); Calculate according to formula (28). These are the normalized scales for effective sample size, average effective exposure support, rule projection edit distance, and response window observation coverage, respectively, all of which are pre-fixed during the training or calibration phase and saved with the configuration version.
[0087] The system implements Bootstrap on an object-by-object basis, and the low confidence threshold is pre-fixed by a set of calibration objects isolated from the training objects: calibration is performed as applicable. If the calibration is deemed inapplicable, proceed according to the original method. determination. When the value is below the preset threshold, the actual triggering reason outputs a counterfactual statistical support deficiency or out-of-distribution hard flag according to equation (28). When the response window coverage falls below the preset lower limit, a hard marker indicating insufficient coverage is output. A hard marker indicating unpredictable or incalculable results is output when the counterfactual situation is not feasible or the effective sample size is insufficient. No calibration step should cover these hard markers. When the solver only obtains an unproven optimal feasible solution... The calculation is still performed using the projected feasible branch, but the "unproven optimal feasible solution" label and the optimality bound must be retained and it must not be marked as the highest confidence level.
[0088] For events where the prescription status persists, since there is no original counterfactual prescription, its Calculated based on the most recently available alternative prescription: Let When there exists a nearest alternative prescription that satisfies the target deviation constraint and the rule is feasible. When it does not exist At this time, e in equation (42) takes the value of ; , The result of equation (26) The remaining credibility factors are calculated based on the data and model output corresponding to the prescription status persistence events.
[0089] During confidence calibration, calibration objects isolated from the training objects are stratified according to their original confidence values, event types, and analysis levels. Interval coverage, contribution sign error rate, rule feasibility rate, counterfactual statistical support rate, and data completeness are calculated. Ordinal-preserving regression or a fixed monotonic piecewise function can be used to map the original confidence to the calibrated confidence, and the corresponding thresholds are fixed on the same calibration object set. The mapping function, thresholds, applicable data range, and version are all saved together and cannot be reselected or relaxed during the target analysis phase. If there are insufficient calibration objects, events exceeding the applicable range, inconsistent model versions, or out-of-distribution labels, the original confidence is retained, and an uncalibrated or inapplicable label is output; it cannot be upgraded to high confidence.
[0090] XI. Results Output and System Deployment The results output module saves the previous comparison benchmark for each consultation; for the target atomic event, it saves the fact prescription, the original counterfactual prescription, the rule-feasible counterfactual prescription, and three sets of events; for the prescription status persistence event, it saves the fact-maintaining prescription, the most recent feasible alternative prescription, and two sets of events; and saves co-intervention, outcome response, effective exposure, response window observation coverage, event exposure residual, target sensitive variable, target cancellation difference, rule repair difference, feasible counterfactual total difference, prescription status persistence contribution, interaction contribution, confidence interval, confidence level, counterfactual statistical support judgment results, out-of-distribution label, projection edit list, and version information; the aggregated results retain the indexes that trace back to the original consultation, training session, variable lineage, and counterfactual construction process.
[0091] For a single target event, the system recalculates only the affected event nodes, outcome response edges, target sensitive variables, and interaction items based on the projection editing list and variable lineage. Unchanged nodes reuse fact feature snapshots. The evidence chain at least saves the input record index, object number, prescription snapshot hash, target lock bit, candidate set version, solver status, counterfactual statistical support judgment, recalculated nodes, model version, and calibration version. Training and analysis data undergo de-identification, access control, and operation log recording.
[0092] 12. Deterministic execution and solidification of recalculated parameters In one deterministic implementation, time integration uses a fixed 1-day grid, objects are divided into 5 folds according to a fixed hash seed, and candidate sorting and bootstrap use a saved random seed; the feasibility tolerance, optimality tolerance, timeout threshold, and order of parallel solutions for mixed-integer solutions are fixed before analysis. When a timeout is reached but only a feasible solution is obtained, the optimality bound is saved and it is marked as approximately feasible; when no feasible solution is obtained, the target event lock should not be relaxed.
[0093] In this embodiment, the effective sample size lower limit, the independent object occurrence count lower limit, the neighborhood distance threshold, the distance decay scale, the historical independent object support scale, the statistical support threshold, the conditional probability overlap lower limit, the response window coverage lower limit, and the nearest training distance upper limit are all determined on a calibration object set isolated from the training objects according to a preset grid: first, the fixed constraints of a counterfactual violation rate of 0, an out-of-distribution false acceptance rate, and an interval coverage rate are satisfied, and then the final combination is determined by minimizing the contribution recovery error or the sign error rate. The candidate grid, selection criteria, and results are written into the configuration hash, and cannot be reselected or relaxed during the target analysis stage.
[0094] This embodiment uses the following listed parameters: the time integration step is 1 day, and the subjects are divided into 5 folds; in the insomnia symptom-type outcome configuration, the minimum onset lag is 1 day, the peak time is 7 days, the maximum support time is 21 days, and the decay rate is 0.08 per day; the outcome baseline model and the event exposure model family use 200 gradient boosting trees of depth 3 with a learning rate of 0.05, and the contribution estimation model uses an L1 and L2 regularized weighted linear model with 300 bootstrap iterations and a random seed of 20,260,806. Other statistical support thresholds are determined by a calibration object set isolated from the training subjects in a finite candidate grid and are saved along with the candidate grid, selection criteria, and configuration hash. The above sleep response window and model parameters are only used in the insomnia simulation embodiment described later; the hypertension embodiment must call a separate hypertension outcome configuration, response window, common intervention dictionary, prescription rules, and fixed response model, and does not directly infer the hypertension outcome using the insomnia model or parameters.
[0095] Table 4. Curing parameters, curing time points, and evidence chain records.
[0096] Example 2 This embodiment illustrates the specific implementation and data output format of core processes such as atomic event construction, effective exposure calculation, joint intervention correction, contribution estimation, interactive contribution, ablation verification, counterfactual projection, target locking, and re-eventization with the same benchmark in the scenario of continuous follow-up visits for insomnia.
[0097] All data in this embodiment are simulated data constructed based on a preset generation mechanism. They do not correspond to any real patients and are not intended as evidence of clinical efficacy or prescription recommendations. They are only used to illustrate the data structure, calculation steps, and output format of this invention.
[0098] The simulated subject is designated SIM-001, with a total of 4 visits, forming 3 pairs of adjacent visits. Symptoms are scored from 0 to 10, with higher scores indicating greater severity.
[0099] Table 5. Visit time and symptom score of simulated subject SIM-001
[0100] The prescriptions and co-interventions remained largely unchanged from V1 to V2, with minimal changes in symptoms. The V2 prescription, compared to V1, included increased dosages of Ziziphus jujuba seed extract, Polygonum multiflorum stem extract, Albizia julibrissin bark extract, and reduced dosage of Citrus reticulata peel. Concurrently, the sleep aid W1 increased from 1 unit to 2 units. A total of 13 doses of the actual Chinese medicine prescription were taken, out of a planned 16 doses, with a compliance rate of 0.8125. Prescription changes were minimal from V3 to V4.
[0101] Table 6 Simulated Prescription Status and Joint Intervention
[0102] For the prescription changes of V2 relative to V1, the atomic event building blocks are generated as follows: E1 is the increase of jujube seed from 20g to 30g, E2 is the increase of Polygonum multiflorum from 15g to 30g, E3 is the addition of Albizia julibrissin bark 12g, and E4 is the removal of tangerine peel 6g.
[0103] This embodiment sets a minimum onset lag of 1 day, a peak time of 7 days, a maximum support time of 21 days, and a decay rate of 0.08 per day for sleep-related symptoms, using a 1-day grid integration. Event effective time. The complete response support interval is defined as follows: [The actual start time of V2 prescription execution is taken as the interval]. +1 day +21 days]; The denominator of equation (9) is calculated within this complete interval. The numerator only includes the intersection of the observation interval from V2 to V3 and the actual execution date, and the missed dose days. (t)=0. Each event Calculated according to Table 2 and the solidified dose range; if the dose range is missing, the existing amplitude 1 is used and the dose quality factor is reduced. The weights listed in Table 7 are determined by the above grid, execution log, kernel parameters and amplitude configuration.
[0104] Table 7. Effective Exposure Overlap Weights for Atomic Events and Co-interventions
[0105] The simulation queue was divided into 5 folds based on the object, with SIM-001 and all its diagnoses residing in only one validation fold. The outcome baseline model and the target event exposure model used only... The changes in total dosage, total number of medicinal ingredients, or structural composition caused by increasing the dosage of Ziziphus jujuba seed, increasing the dosage of Polygonum multiflorum stem, adding Albizia julibrissin bark, and reducing the dosage of Citrus reticulata peel are all categorized under the respective events. (P), does not enter the corresponding exposure model. The outcome baseline model and the event exposure model family use 200 gradient boosting trees of depth 3 with a learning rate of 0.05. The contribution estimation model uses an L1 and L2 regularized weighted linear model with 300 bootstraps. When canceling each event, strictly restore the state before the change. Then verify the feasibility of the rule according to Equation (20), calculate the counterfactual statistical support according to Equation (28), and perform the same baseline re-eventization on the fact prescription and counterfactual prescription before inputting it into the solidified response model. The four in this embodiment All meet the prescription rules, corresponding When (e,s)=0, the system still saves the original counterfactual snapshot, target lock bit, and counterfactual event set so that it can use the same output structure as the events that need projection repair.
[0106] In this embodiment, SIM-001 is an external validation object within the training queue, used only to verify cross-fitting and contribution recovery processes by object, and is not equivalent to the target analysis object after model solidification. In the target analysis stage, an external object that did not participate in the outcome baseline model, event exposure model family, contribution estimation model, inner and outer layer parameter selection and confidence calibration is selected, and only the solidified standardized dictionary, event dictionary, hysteresis kernel, rule version and model parameters are called.
[0107] Table 8. Simulation contribution analysis results for the observation period after events V2 to V3.
[0108] The confidence levels listed in Table 8 are the minimum confidence levels Q(e,s) for each presented outcome corresponding to the same event, used as a conservative summary index at the event level. The square brackets in Table 8 represent the 95% simulated Bootstrap confidence intervals. After correcting for W1 increments, E1 contributes significantly to difficulty falling asleep, E2 to nighttime awakenings and insufficient total sleep, and E3 to daytime fatigue; E4 crosses zero and has low confidence. Without inputting the co-intervention C1, the standard model estimates the contributions of E1 and E2 to difficulty falling asleep as 0.72 and 0.55, respectively, significantly higher than the 0.44 and 0.21 in Table 8. This simulation comparison demonstrates that co-intervention correction can reduce erroneous attribution. When W1 is not configured to change the pre-state and intensity coding rules, C1 is only used as a correction variable and is not listed as a separate contribution.
[0109] Events E1 and E2 are connected in the compatibility graph and their co-occurrence frequency reaches a threshold. After jointly canceling E1 and E2, the total change in sleep difficulty is 0.79, and the sum of the individual event contributions is 0.65, therefore the interaction contribution is 0.14; the interaction contribution of nighttime awakening is 0.11. The interaction contribution is output separately to avoid double-counting the collaborative part in E1 and E2.
[0110] Combination Figure 4 The process of constructing, counterfactual generation, and contribution calculation of prescription status persistence events is illustrated using the V2 to V3 consultations in Tables 5 and 6. The prescription status of traditional Chinese medicine in V2 and V3 is consistent, with the drug set being Ziziphus jujuba seed, Polygonum multiflorum stem, Poria cocos, Polygala tenuifolia root, and Albizia julibrissin bark. The dosage of each drug also remains unchanged. Therefore, the drug set similarity, dosage structure similarity, and prescription module similarity are all 1. The prescription maintenance similarity is calculated to be 1 according to formula (4). If the core prescription level maintenance threshold is 0.90, the system generates a K1 core prescription level prescription status persistence event. K1 indicates that the core drug set, main dosage structure, and prescription module continue to be maintained in V3. No persistence event is generated for each unchanged drug. The non-negative amplitude of K1 is calculated to be 1 according to formula (5). The actual support interval adopts the actual execution interval of the V3 prescription and is adjusted by the compliance function of 19 doses / 21 doses.
[0111] When calculating the prescription status persistence contribution of K1, the system keeps the pre-event variables, co-intervention status, and other fixed variables unchanged for visits V2 to V3, where W1 is 2 units in both V2 and V3. Among the historical feasible candidates matched with the insomnia disease configuration, basic prescription label, and prescription rules, the most recent feasible alternative prescription is selected according to Equation (26) if the core prescription similarity is below 0.90, the core drug undergoes a non-equivalent change, the main dose structure exceeds the change threshold, or the target prescription module coverage changes, and this deviation condition is locked. The factual V3 prescription and the final alternative prescription are both regenerated with respect to the V2 prescription to generate event sets and exposure characteristics, and the K1 persistence contribution to each sleep symptom is calculated according to Equation (34) using the outcome response observed during V3 to V4. The above K1 results are used to evaluate the model response difference of V3 in maintaining the core prescription structure relative to the most recent feasible change state under the current observation data and fixed response model conditions, without automatically generating a continued prescription instruction.
[0112] Table 9. Main generation parameters of the simulated queue
[0113] During the generation process, the prescription adjustment probability is first determined based on baseline symptoms, past trends, and random effects of the subjects to form indication confounding; then, the symptom response for the next visit is generated based on actual exposure overlap, joint interventions, and preset contribution coefficients.
[0114] In a recomputable generation, the normalized baseline severity is denoted as... The trend of symptoms during the previous visit is recorded as follows: The random effects of the object are denoted as Let Z be the binary indicator variable indicating whether the prescription is increased or decreased in the i-th adjacent visit. i Z i =1 indicates that a dose or dosage has been added. This indicates that it has not occurred; its probability of occurrence is set to... The non-zero direct contribution coefficient is from Equal probability sampling, non-zero interaction coefficients from Equal probability sampling, observation noise follows The probability of symptom s being missing is determined by The generated data was adjusted to the missing data rate described in Table 9 using the symptom-specific intercept. The generation program saved compliance distribution parameters, baseline parameters for each symptom, event type assignment probabilities, drug codes, dose boundaries, compatibility plots, non-zero coefficient indexes, missing model intercepts, and random seeds as versioned configuration files. The training, control, and ablation methods read the same configuration and the same generated data to avoid differences in comparison criteria due to resampling.
[0115] Table 10. Validation results of the simulated queue.
[0116] Table 11 Ablation Verification Results of Core Modules
[0117] Table 12 Results of Structural Consistency Comparison Verification
[0118] In the parameter sensitivity analysis, when the lag kernel peak time was varied between 5 and 10 days, the maximum support time was varied between 14 and 28 days, and the cross-fit fold number was varied between 3 and 10, the contribution recovery MAE was between 0.068 and 0.081; when the Bootstrap was increased from 100 to 500, the interval width changed by less than 5%.
[0119] Suppose the previous prescription includes H1 10g, H2 8g, and H3 6g, and the subsequent prescription includes H1 10g, H2 12g, and H4 6g. The transition from the previous prescription to the subsequent prescription generates three factual atomic events: E1 is the increase of H2 from 8g to 12g, E2 is the decrease of H3 by 6g, and E3 is the increase of H4 by 6g. The rule base stipulates that H3 and H4 cannot exist simultaneously, and the target event is E2.
[0120] When E2 is cancelled, H3 is strictly restored to 6g, forming the original counterfactual prescription, which contains H1 10g, H2 12g, H3 6g, and H4 6g. Since H3 and H4 coexist, this prescription does not satisfy the prohibition of compatibility constraints. The system writes the presence of H3 and a dose of 6g into the target lock bit, and H3 cannot be subtracted again during the projection process. The set of non-target variables that can be modified includes subtracting H4, replacing H4 with H5 which is compatible with H3, or adjusting other auxiliary drugs within the rule-permitted range. According to the edit distance of Equation (25), if the cost of subtracting H4 is the lowest, the rule-feasible counterfactual prescription is obtained as H1 10g, H2 12g, and H3 6g, which satisfies the constraints of target lock, dose, prohibition of compatibility, core coverage, and number of drug ingredients.
[0121] Instead of constructing the model input by simply deleting the E2 coordinate from the fact event set, the system re-compares the fact prescription and the rule-feasible counterfactual prescription with the same previous prescription. The fact event set consists of E1, E2, and E3, and the counterfactual event set is E1. E2 is marked as target cancellation, E3 as projection elimination, and E1 as fact retention. If the E3 event node is retained, the model input still represents H4 medication, which contradicts the prescription state where H4 does not exist in the rule-feasible counterfactual prescription; this inconsistency is eliminated by re-eventization with the baseline.
[0122] Suppose a prescription consists of core drugs H1, H2, and H3, and auxiliary drugs H4 and H5. The core candidate set of the rule base is H1, H2, H3, and H6, and the target event is medication addition H3. If this event is cancelled, the core coverage rate falls below a threshold. The structural constraints are not met; the projection writes "H3 does not exist" to the target lock bit, and can only be performed from... Select non-target candidates compatible with this locking position. In the prescription editing distance, the cost of adding or subtracting a core drug is set to 3, for auxiliary drugs to 1, the cost of changing the dosage by one standard unit is 0.2, and the cost of changing the processing or administration method is 0.5; Using H6 as the distance benchmark, the edit distance with one standard dose unit added is 3.2, which is less than 4.1 and 5.0 for other candidate states that meet the hard constraints. Therefore, it is determined that... This is for a state where a low dose of H6 is added and H3 is absent. Further calculations are then required. , and If the H6 state lacks historical independent object support, then although the rule is feasible, the output will still show insufficient counterfactual statistical support. The system records "H3 drug administration event cancellation" and "applying H6 rule projection" and their edit distances respectively; when there are no candidates that satisfy all hard constraints, the output will show counterfactual infeasibility and will not calculate high confidence contribution.
[0123] Let's take the target event, E1, where the amount of jujube seed increases from 20g to 30g, as the objective event. The total dose of the subsequent prescription is 90g; if E1 is removed and E2 through E4 are retained, the original total counterfactual dose is 80g. Therefore, the total dose changes between the objective and the target counterfactual events, which falls under the category of... The E1 target event exposure model must not be entered. In the solidification response model, the calculations are repeated using 90g and 80g respectively. Baseline symptoms, past trends, contemporaneous W1 increments, and the context of non-targeted prescriptions that remained unchanged before and after E1 removal can be accessed. .
[0124] After obtaining the rule-feasible counterfactual prescription for E1, the system calculates the number of historical independent object neighborhood support numbers from the same training prescription as the insomnia configuration and the drug-level event dictionary, deduplicating each object. and closest distance And read the out-of-bounds conditional probability that E1 reaches the preset effective exposure threshold under the baseline conditions before the event. If any condition does not meet the threshold of equation (28), the system can still save factual and counterfactual snapshots and exploratory model differences, but will output "insufficient counterfactual statistical support" or "out of distribution" according to the triggering reason. If the result is below the threshold, it will not be included in the high-confidence event ranking.
[0125] Example 3 This embodiment illustrates the computer implementation of the system, the incremental recalculation performance based on the projection-edited list, and various modified implementation methods.
[0126] The system includes a data receiving and standardization module, an event construction module, an outcome response module, an effective exposure map module, a counterfactual generation module, a re-eventization module, a contribution calculation module, and a result output module, each executing the corresponding steps described in Embodiment 1. Variable lineage and confounding correction are performed by a pre-processing subunit shared by the counterfactual generation module and the contribution calculation module according to fixed rules. The correspondence between the above-mentioned implementation modules and the functional modules described in Claim 9 is as follows: the atomic event encoding module corresponds to the event construction module; the target counterfactual generation and locking module, the rule projection module, and the statistical support judgment module correspond to the counterfactual generation module; the re-eventization module corresponds to the re-eventization module; the model differencing module corresponds to the contribution calculation module; and the result output module corresponds to the result output module.
[0127] Table 13 Comparison of computational resources between incremental recalculation and full reconstruction
[0128] Table 13 compares the two reconstruction methods under the same computing device, the same input data, the same model version, and the random seed: When performing batch counterfactual analysis on 10,000 target events, incremental recalculation based on the projection editing list only processes affected nodes, edges, target sensitive variables, and interaction items, and reuses fact snapshots, full response window denominators, and hysteresis kernel caches; compared with event-by-event full reconstruction, the total time is reduced by 70.8%, the peak memory is reduced by 50.0%, and the snapshot hash and contribution results are consistent.
[0129] Example 4 This embodiment is used to illustrate the disease configuration, event construction, and counterfactual processing process of objective continuous outcomes such as SBP and DBP in the general data processing flow of this invention.
[0130] This embodiment uses exemplary hypertension simulation data to illustrate the specific implementation of an objective continuous outcome. The data does not correspond to real patients and is only used to illustrate the data structure, event construction, effective exposure calculation, and counterfactual processing.
[0131] The hypertension scenario calls for a separate hypertension outcome configuration. Core outcomes include at least SBP and DBP; further configuration is available for home morning and evening average blood pressure measurements or standardized multiple in-office measurements. The direction of blood pressure reduction is fixed as a positive improvement direction before analysis, and the source, unit, number of measurements, and quality status of blood pressure measurements are saved as outcome quality fields.
[0132] Table 14 Main fields for hypertension disease configuration
[0133] Table 15 Simulated Input Data for Three Consecutive Visits to the Hospital for Hypertension
[0134] Taking the prescription change from V1 to V2 as an example, the event construction module generates E1 as the incremental event of H1 increasing from 12g to 18g, E2 as the H4 medication reduction event, and E3 as the H5 medication increase event; the concurrent co-intervention event C1 is the adjustment of A1 from 1 unit to 2 units. The SBP decreased from 150 mmHg to 142 mmHg and DBP decreased from 92 mmHg to 88 mmHg from V2 to V3, which is only recorded as an objective outcome change observed in adjacent visits; the system must not directly attribute all changes to any one traditional Chinese medicine event based on this.
[0135] Taking E1 as an example, three sets of snapshots are input into the same fixed response model corresponding to hypertension, and the output is... The study evaluated the target cancellation difference, rule repair difference, total feasible counterfactual difference, counterfactual statistical support, and credibility for both SBP and DBP.
[0136] Example 5 This embodiment is used to verify the feasibility, collaborative intervention processing capability, structural consistency, and reliability control effect of the present invention on real-world retrospective continuous follow-up data.
[0137] Table 16 Implementation plan for the retrospective continuous cohort study of hypertension
[0138] The main cohort included 50 hypertensive patients who visited the hospital between August 2025 and August 2026, consecutively according to the aforementioned preset criteria. Among them: Group A (n=12), who did not take any routine antihypertensive medication during the observation period; Group B (n=26), whose antihypertensive medication types and dosages remained basically stable; and Group C (n=12), whose medications were added, discontinued, increased, decreased, or changed during the observation period. The main cohort consisted of 50 patients, 182 visits, and 132 adjacent visit pairs.
[0139] Further clinical consistency evaluation was conducted on the ranking of event contributions. From the aforementioned cohort, visit pairs with complete outcome records, verifiable joint interventions, and at least two evaluable TCM prescription events within the same visit pair were selected. Two TCM physicians, unaware of the model's contribution values, ranking, and confidence results, independently selected and ranked the TCM prescription events they considered most correlated with subsequent SBP or DBP changes based on changes in symptoms and blood pressure, prescription changes, actual medication administration, and concurrent joint intervention information from adjacent visits. In cases of disagreement, a third physician reviewed the ranking to reach a consensus. The algorithm was based on the feasible counterfactual total difference. Events were ranked by absolute values, and the consistency between the model output and independent clinical judgment was evaluated using Top-1 consistency rate, Top-3 coverage rate, Spearman ranking correlation coefficient, and inter-physician weighted κ. Physician evaluations were used to verify the clinical consistency of the model output and were not considered the gold standard for the true causal contribution of events.
[0140] Table 17. Actual validation indicators and results of the real-world cohort of hypertension.
[0141] The present invention can also be implemented in the following variations: Outcome indicators can be composed of structured symptoms or scales, natural language processing results, patient-reported outcomes, and objective continuous or discrete indicators obtained from medical equipment, examinations, or standardized measurements. Information such as tongue appearance and pulse appearance can be used as baseline and disease course covariates. When the data can be quantified or structured and has a fixed response window during continuous follow-up visits, it can also be included according to the outcome configuration. The solidified response model can be selected from a regularized linear model, a gradient boosting model, or a hierarchical Bayesian model before training. After selection, its input fields, feature dimensions, parameters, and versions remain unchanged in the factual and counterfactual paths. When the data is insufficient to estimate the independent contribution of a particular drug, drug pairs, efficacy categories, prescription modules, or treatment elements can be used as atomic analysis units and their levels can be identified. When accurate medication logs are unavailable, upper and lower bounds of the exposure interval can be constructed based on the number of medications dispensed, patient self-report, and follow-up visit date, and the contribution can be output in interval form. When joint intervention information is missing, the credibility is reduced and a joint intervention missing marker is output. This invention can be used for insomnia, hypertension, chronic gastrointestinal diseases, chronic cough, skin diseases, or other diseases that form a continuous follow-up sequence. However, it only calls disease-specific configurations when the corresponding disease has an executable outcome indicator dictionary or outcome configuration, response window parameters, common intervention dictionary, prescription rules, and calibration scope. In cases of acute and critical illness, single visit, lack of evaluable outcome, completely uncertain actual exposure, or insufficient sample support, an inapplicable or insufficiently supported marker is output.
[0142] The above modifications do not change the core computational process of atomic event separation and encoding, effective exposure calculation, target sensitive variable isolation, target event locking, rule projection, counterfactual statistical support for judgment, re-eventization with the benchmark, and solidified response model difference.
[0143] In summary, this invention eliminates confusion between event direction and amplitude through atomic event non-negative amplitude encoding; locks the target variable throughout the rule projection process using target locking positions, ensuring the counterfactual prescription after rule projection meets preset prescription rule constraints; eliminates the difference in event encoding benchmarks between factual and counterfactual paths through benchmark re-eventization; and eliminates the differential error introduced by model updates through version freezing of the solidified response model. These four links are orderly coupled, achieving the quantification and statistical credibility assessment of the contribution of traditional Chinese medicine prescription events. This invention is applicable to continuous follow-up visits for various chronic diseases such as insomnia and hypertension. The output results can be used for individualized prescription attribution analysis, empirical pattern collation, and research hypothesis generation, but do not automatically generate disease diagnoses or prescription adjustment instructions.
[0144] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A Chinese medicine prescription event contribution data processing method performed by an electronic device, the method comprising: receiving a Chinese medicine prescription event contribution data; and processing the Chinese medicine prescription event contribution data. Includes the following steps: The change of the current prescription of the object to be analyzed relative to the previous prescription is decomposed into atomic events. The current prescription is taken as the fact prescription. Each atomic event is encoded with event type and operation magnitude separately. The event type represents the category of prescription change, and the operation magnitude is a non-negative value. The target event is determined from the atomic events. The target variable corresponding to the target event in the fact prescription is restored to the state before the target event occurred. The original counterfactual prescription after canceling the target event is generated. A target lock bit is set. The target lock bit is used to lock the restored state of the target variable and prevent subsequent rule projections from changing the restored state of the target variable. Under the hard constraint of the target locking position, the original counterfactual prescription is used as the projection reference. Only the non-target prescription variables that are allowed to be edited are edited. The rule projection solution is performed with the goal of minimizing the prescription editing distance relative to the original counterfactual prescription, so as to obtain a rule-feasible counterfactual prescription that satisfies the preset prescription rules. The factual prescription, the original counterfactual prescription, and the rule-feasible counterfactual prescription are each regenerated with respect to the same previous prescription to generate their own complete event sets. Based on the same feature dictionary and fixed input dimension fixed during the training phase, the corresponding feature snapshots are reconstructed according to the regenerated complete event sets to complete the same baseline re-eventization. The feature snapshots corresponding to the factual prescription, the original counterfactual prescription, and the rule-feasible counterfactual prescription are input into the same fixed response model to obtain the factual response, the original counterfactual response, and the rule-feasible counterfactual response. Based on the factual response, the original counterfactual response, and the rule-feasible counterfactual response, the target cancellation difference, the rule repair difference, and the total feasible counterfactual difference are calculated. The target cancellation difference is the difference obtained by subtracting the original counterfactual response from the factual response. The rule repair difference is the difference obtained by subtracting the rule-feasible counterfactual response from the original counterfactual response. The total feasible counterfactual difference is the difference obtained by subtracting the rule-feasible counterfactual response from the factual response. The sum of the target cancellation difference and the rule repair difference is equal to the total feasible counterfactual difference. The evaluation path of the factual prescription, the original counterfactual prescription, and the rule-feasible counterfactual prescription adopts the same fixed response model. The fixed response model maintains the same model version, model parameters, feature dictionary, and fixed input dimension during the evaluation of the three prescription states. Perform counterfactual statistical support determination on the feasible counterfactual prescriptions of the rules, determine the contribution of the target event to the outcome response based on the total difference of feasible counterfactual facts, and output the counterfactual statistical support determination result corresponding to the contribution.
2. The traditional Chinese medicine prescription event contribution data processing method according to claim 1, characterized in that, The event types include at least one of the following: drug addition event, drug reduction event, dosage increase event, dosage decrease event, processing change event, and administration method change event; The event type is used to determine the operational semantics of prescription changes, and the operational magnitude is independent of the operational semantics and is represented by a non-negative numerical value.
3. The traditional Chinese medicine prescription event contribution data processing method according to claim 1, characterized in that, It also includes calculating the effective exposure of the atomic event, which includes: performing a weighted integral on the intersection of the post-event observation interval, the actual execution interval, and the complete outcome response support interval based on the actual execution interval of the atomic event, the prescription operation state support function, the compliance function, and the outcome response lag kernel, and normalizing it with the outcome response lag kernel quality within the complete outcome response support interval to obtain the effective exposure of the atomic event relative to the corresponding outcome response.
4. The traditional Chinese medicine prescription event contribution data processing method according to claim 1, characterized in that, The preset prescription rules include at least one of the following: upper and lower limit of dosage, prohibited compatibility, basic prescription core drug coverage, efficacy category coverage, number of medicinal ingredients, processing state, and administration method. The rule-feasible counterfactual prescription is a prescription data state that simultaneously satisfies the target locking position and the applicable preset prescription rule.
5. The traditional Chinese medicine prescription event contribution data processing method according to claim 1, characterized in that, The same-baseline re-eventization includes: Using the previous prescription as a common benchmark, the factual prescription, the original counterfactual prescription, and the rule-feasible counterfactual prescription are compared with the previous prescription to regenerate their respective complete event sets. Prescription features that change due to changes in the state of the prescription to be evaluated are identified as target sensitive variables. For each regenerated complete event set, at least one of the following is recalculated: event operation magnitude, effective exposure, the target sensitive variable, and the interaction item corresponding to the allowed interactive event. Fixed-dimensional feature snapshots are formed according to the coordinate order of the same feature dictionary solidified in the training phase.
6. The traditional Chinese medicine prescription event contribution data processing method according to claim 1, characterized in that, The evaluation process of the solidified response model calls upon the family of event exposure models solidified during the training phase; In the evaluation paths of the factual prescription, the original counterfactual prescription, and the rule-feasible counterfactual prescription, the same model version, model parameters, feature dictionary, and fixed input dimension are used. Prescription features that change due to changes in the status of the prescription to be evaluated are identified as target sensitive variables. These target sensitive variables are not used as fixed inputs to the event exposure models corresponding to the target event in the event exposure model family, and are recalculated based on the factual prescription, the original counterfactual prescription, and the rule-feasible counterfactual prescription, respectively.
7. The traditional Chinese medicine prescription event contribution data processing method according to claim 1, characterized in that, The counterfactual statistical support for the determination includes: In the set of training prescription states that match the current disease configuration and analysis level, the number of historical independent object neighborhood support for the rule-feasible counterfactual prescription is calculated according to the deduplication of training objects; Calculate the nearest training distance of the rule-feasible counterfactual prescription relative to the set of training prescription states; And to obtain the out-of-bounds conditional probability of the target event reaching a preset effective exposure threshold under preset baseline variable conditions, generated by a cross-fit model grouped by training objects; The counterfactual statistical support determination result is determined based on the comparison results of the number of neighborhood support for the historical independent object, the nearest training distance, and the out-of-place conditional probability with the corresponding preset threshold.
8. The traditional Chinese medicine prescription event contribution data processing method according to claim 1, characterized in that, Also includes: Prescription characteristics that change due to changes in the status of the prescription to be evaluated are identified as target sensitive variables; Incremental recalculation is performed based on target event cancellation change, projection editing list and variable lineage. The target event cancellation change is used to determine the target prescription variable that has changed relative to the original counterfactual prescription. The projection editing list is used to determine the non-target prescription variable that has changed relative to the original counterfactual prescription. The variable lineage is used to determine the affected features that have a dependency relationship with the target prescription variable and / or the changed non-target prescription variable. For the affected features, the corresponding event nodes, outcome response edges, target sensitive variables and / or interaction items are recalculated, and the feature snapshots corresponding to the fact prescriptions are reused for the unaffected features.
9. A traditional Chinese medicine prescription event contribution data processing system, characterized in that, include: The atomic event encoding module is used to decompose the change of the current prescription relative to the previous prescription into atomic events encoded by separating the event type and the non-negative operation magnitude, and to treat the current prescription as the fact prescription; The target counterfact generation and locking module is used to determine the target event, restore the target variable corresponding to the target event to the state before the target event occurred, generate the original counterfact prescription, and set a target lock bit to lock the restored state; The rule projection module is used to edit only the non-target prescription variables that are allowed to be edited in the preset way, with the original counterfactual prescription as the projection reference, under the hard constraint of the target locking position, and to obtain the rule-feasible counterfactual prescription with the minimum prescription editing distance as the objective; The event re-event module is used to regenerate the complete event set of the fact prescription, the original counterfactual prescription, and the rule-feasible counterfactual prescription respectively relative to the same previous prescription, and reconstruct the corresponding feature snapshot based on the same feature dictionary and fixed input dimension solidified during the training phase. The model difference module is used to input feature snapshots corresponding to the three prescription states into the same fixed response model. The fixed response model keeps the model version, model parameters, feature dictionary and fixed input dimension unchanged during the evaluation of the three prescription states, and calculates the target cancellation difference, rule repair difference and feasible counterfactual total difference. The statistical support determination module is used to perform counterfactual statistical support determination on the feasible counterfactual prescriptions of the rules; The results output module is used to determine the contribution of the target event to the outcome response based on the total feasible counterfactual difference, and to output the counterfactual statistical support judgment result corresponding to the contribution.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the method for processing data contribution of traditional Chinese medicine prescription events as described in any one of claims 1 to 8.
