Method and system for analyzing drug inventory needs based on sales data

By constructing a multi-dimensional temporal feature vector and a gated recurrent unit network to predict drug inventory demand, and combining effective inventory levels and business rules to generate replenishment suggestions, the problem of the separation between prediction and inventory management in existing technologies is solved, and precise and adaptive replenishment decisions are achieved.

CN122288601APending Publication Date: 2026-06-26JILIN MUFENG PHARMACEUTICAL CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610710651.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-22
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively integrate time-series sales characteristics with real-time inventory status, cannot effectively couple external influencing factors with business rule constraints, lack the ability to model the substitution and complementarity effects among multiple drugs, and there is a disconnect between prediction results and replenishment decisions.

Method used

By extracting trend, periodic and sudden features from historical sales data to construct a multi-dimensional time-series feature vector, inputting it into a gated recurrent unit network for dynamic prediction, and correcting the prediction results based on the effective inventory level, a mixed integer linear programming model is constructed by integrating business rule parameters to generate replenishment suggestions.

Benefits of technology

It has achieved full-process automation and linkage of drug inventory demand analysis, improved forecasting accuracy and real-time response capability, ensured that replenishment recommendations conform to demand patterns and business constraints, and has adaptive and self-optimizing capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122288601A_ABST
    Figure CN122288601A_ABST
Patent Text Reader

Abstract

This invention relates to the field of pharmaceutical data management technology, and discloses a method and system for analyzing pharmaceutical inventory demand based on sales data. The method includes extracting pharmaceutical sales time-series characteristics, integrating external influencing factors to construct a gated cyclic unit prediction model, correcting demand forecasts based on real-time inventory status, integrating business rule parameters, establishing a mixed-integer linear programming model with the objective of minimizing total cost to generate replenishment suggestions, and simultaneously outputting an analysis report containing key decision factors. This application enables accurate, interpretable, and rule-constrained intelligent pharmaceutical replenishment decisions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of pharmaceutical data management technology, and more specifically, to a method and system for analyzing pharmaceutical inventory demand based on sales data. Background Technology

[0002] With the rapid development of the modern pharmaceutical distribution system, especially in areas such as digital transformation, supply chain optimization, and intelligent management, the need for accurate prediction of drug sales demand, real-time monitoring of transaction anomalies, and end-to-end traceability is becoming increasingly urgent. While traditional drug inventory management methods have made some progress in basic data collection, inventory management, and sales statistics, there is still room for improvement in effectively transforming sales data into dynamic control strategies. The balance between prediction accuracy, real-time response capability, and system operability needs to be strengthened, and there are structural deficiencies in building an end-to-end closed loop of sales, forecasting, and inventory strategies.

[0003] Therefore, how to integrate time-series sales characteristics with inventory status feedback, deeply explore the relationship between business rules and demand changes, accurately capture the characteristics of drug market fluctuations, and develop a highly adaptive drug inventory demand analysis method has become an urgent technical problem to be solved. Summary of the Invention

[0004] This invention provides a method and system for analyzing drug inventory demand based on sales data, which solves the technical problems in the prior art, such as difficulty in integrating time-series sales characteristics with real-time inventory status, inability to effectively couple external influencing factors with business rule constraints, lack of modeling ability for substitution and complementarity effects among multiple drugs, and disconnect between prediction results and replenishment decisions.

[0005] This invention provides a method and system for analyzing drug inventory demand based on sales data, including: The first aspect involves analytical methods for drug inventory demand based on sales data, including: Obtain historical sales data of the target drug and extract time-series features from the historical sales data, including trend features, periodic features, and sudden features; The multidimensional time-series feature vector and external influencing factors including holidays, weather and epidemiological indicators are sequentially input into the gated recurrent unit network according to time steps to construct a dynamic demand prediction model and output the prediction results of the initial drug demand. Obtain the current available inventory, in-transit inventory, and allocated inventory of the target drug, and calculate the effective inventory; correct the effective inventory based on the difference between the effective inventory and the forecast result to obtain the corrected demand forecast result; The demand forecast results are integrated with preset business rule parameters to obtain an integrated dataset that includes supplier delivery dates, order quantities, regional distribution strategies, and warehouse capacity. Based on the integrated dataset, a mixed-integer linear programming model is constructed with the objective function of minimizing the total cost, including procurement, holding, and stockout costs. The model is then solved under the constraints of order quantity and warehouse capacity to generate replenishment recommendations. Simultaneously, an analysis report is generated, which includes key decision factors and inventory weight information that affect the replenishment recommendations.

[0006] Furthermore, historical sales data of the target drug are obtained, and time-series features are extracted from the historical sales data, including: Retrieve the sales records of the target drug within a preset time window from the drug sales database; The sales records are filled with missing values ​​and outliers are removed to form a cleaned sales data sequence; The sales data sequence is segmented using a sliding window method; each segment corresponds to a time window. Extract the trend characteristics, periodic characteristics, and sudden characteristics of the sales data sequence within each time window; The trend characteristics are quantified by first-order difference sequences and weighted least squares linear regression with weights decaying exponentially over time. The periodicity is identified by using Fourier transform to identify the dominant frequency components whose spectral energy percentage is greater than a preset threshold. The suddenness feature is identified by the ratio of the number of local mutation points to the mean of the moving standard deviation. The trend features, periodic features, and sudden features are vectorized and concatenated to form a multidimensional time series feature vector.

[0007] Further, the timing features are input into a gated recurrent unit network, including: A gated recurrent unit structure with 2 to 4 hidden layers is constructed, the number of neurons in each layer is set to 64 to 256, and a dropout mechanism is introduced to prevent overfitting; The input, forget, and output gates control the inflow, retention, and state output of information. At the last time step, a fully connected layer outputs two values, which are used as the mean and logarithm of the normal distribution, respectively, to generate the probability distribution of daily demand. The output dimension of the fully connected layer is 2. We use a weighted combination of mean squared error and quantile loss as the loss function, and dynamically adjust the learning rate using adaptive moment estimation and cosine annealing strategies to train and update the network parameters.

[0008] Further, the current inventory status data of the target drug is obtained, and the prediction result is corrected based on the current inventory status data, including: The system reads the current available inventory, in-transit inventory, and allocated inventory of the target drug in real time, and calculates the effective inventory based on the inventory data. The effective inventory is equal to the current available inventory plus the in-transit inventory minus the allocated inventory. The prediction results are corrected using a soft constraint mechanism to obtain the corrected results; Wherein, when the effective inventory is less than the forecast result, the correction result is set as the difference between the original demand forecast result and the effective inventory. During the soft constraint mechanism correction process, when the current available inventory is lower than the preset inventory safety ratio threshold, a forced replenishment signal is triggered, and the correction result is adjusted based on the inventory gap and the predicted total quantity limit. When the total predicted result exceeds the effective inventory, the predicted result is scaled proportionally for a preset time period based on the soft constraint mechanism to ensure that the correction result is not lower than the inventory replenishment amount. A smoothing factor that is adaptively adjusted based on historical volatility is introduced to buffer abnormal fluctuations in the correction results, thereby completing multi-level correction of the prediction results.

[0009] Furthermore, the demand forecast results are integrated with preset business rule parameters, including: Extract the supplier delivery date corresponding to the target drug from the supplier master data; the supplier delivery date represents the number of days required from order placement to delivery. Read the order quantity of the target drug from the procurement strategy configuration table; the order quantity represents the procurement batch unit allowed by the supplier; Obtain the delivery strategy for the target drug's delivery area from the regional logistics rule base; the delivery strategy includes delivery frequency, transportation cost, and delivery route information; Obtain the remaining available capacity of the warehouse where the target drug is located from the warehouse management system, and calculate the quantity that can be put into storage based on the volume of a single drug item; The demand forecast results, supplier delivery dates, order quantities, delivery strategy parameters, and available inventory quantities are correlated to construct a multi-dimensional integrated dataset.

[0010] Furthermore, based on the integrated dataset, an inventory planning optimization model is constructed, and the inventory planning optimization model is solved to generate replenishment suggestions that meet business constraints, including: Define the order quantity for the next procurement cycle as the decision variable; An objective function is constructed for the decision variables to minimize the sum of procurement, transportation, stockout, holding, and ordering costs, and different weight coefficients are assigned to each cost item. The decision variables are subject to a set of constraints including order quantity constraints, maximum inbound quantity constraints, delivery window constraints, warehouse receiving capacity constraints, and demand coverage requirements. A mixed-integer linear programming solver is used to solve the inventory planning optimization model consisting of the objective function and the set of constraints within a preset time limit, so as to obtain the optimal order quantity, order date and delivery route as replenishment suggestions.

[0011] Furthermore, an analysis report is generated simultaneously, including: The attention weights of the gated recurrent unit network in the prediction process are extracted, and the importance of the input features is ranked based on the gradient-weighted class activation mapping method. Based on the importance ranking results, key factors driving replenishment decisions are identified, including sudden increases in sales, inventory warnings, delivery time constraints, or batch economics. The attention weights, key factors, cost composition ratios, and business rule constraints are converted into structured data. An analysis report is generated based on the structured data, including the demand background, current inventory status, rule constraints, basis for recommendations, and implementation suggestions.

[0012] Furthermore, it also includes the detection of abnormal sales events: Real-time monitoring of drug sales over a preset time period; when the sales deviation exceeds a preset standard deviation multiple, it is marked as a suspected abnormal event. The suspected abnormal events are associated with external data sources to verify their causes. These external data sources include hospital centralized procurement announcement databases, public health early warning information databases, and promotional activity filing databases. By matching timestamps and filtering geographic locations, related records that overlap with the time window and match the geographic location of the suspected abnormal event are filtered from the external data source. Calculate the correlation score between the associated record and the suspected abnormal event. When the correlation score exceeds a preset threshold, confirm the cause type of the suspected abnormal event and mark the cause type as centralized procurement-driven, public health event-driven, or promotional activity-driven. The confidence level of the prediction model is dynamically adjusted based on the confirmation result of the cause type, and the characteristics of the suspected abnormal event and the cause type are synchronously input into the gated recurrent unit network.

[0013] Furthermore, it also includes multi-drug synergistic analysis: A drug relationship diagram is constructed based on an expert knowledge base and historical sales correlation, and the drug relationship diagram includes substitution relationships and complementary effects. In this graph, drug nodes represent different drugs, the edges represent the relationships between drugs, and the edge weights are the weighted average of the clinical substitution strength score and the Pearson correlation coefficient. A graph neural network is used to perform multi-layer graph convolution operations on the drug relationship graph. The graph convolution operation includes 2 to 4 graph convolution layers. Each graph convolution layer performs linear transformation and non-linear activation on the historical sales features of the current drug node and its neighboring drug nodes. During the forward propagation of the graph convolution operation, the historical sales features of the current drug node are passed along the edges of the drug relationship graph to adjacent drug nodes, and feature aggregation is performed in each graph convolution layer to capture the demand transmission effect between drug sets. Based on the output results of each layer of the graph convolution operation, an attention mechanism is introduced to perform weighted aggregation of the sales change information of adjacent drugs in the drug relationship graph. The attention mechanism dynamically allocates the contribution of each neighboring drug to the demand prediction of the target drug by calculating the attention weight between the target drug node and each neighboring drug node. The attention weights are weighted and summed with the sales change information of the corresponding adjacent drugs to obtain the aggregated features that reflect the correlation effect between drugs. The aggregated features are introduced as additional input features into the dynamic demand prediction model, and together with the original time-series features, they participate in the forward demand prediction step to obtain multi-drug joint demand results that take into account the substitution and complementarity effects between drugs.

[0014] Secondly, a drug inventory demand analysis system based on sales data includes: Feature extraction module: used to acquire historical sales data of the target drug and extract time-series features from the historical sales data, including trend features, periodic features and sudden features; Demand forecasting module: used to input the multidimensional time-series feature vector and external influencing factors including holidays, weather and epidemiological indicators into the gated recurrent unit network in time steps to construct a dynamic demand forecasting model and output the forecast results of initial drug demand; Status correction module: used to obtain the current available inventory, in-transit inventory and allocated inventory of the target drug, calculate the effective inventory; and correct the difference between the effective inventory and the prediction result to obtain the corrected demand prediction result. Data integration module: used to integrate the demand forecast results with preset business rule parameters to obtain an integrated dataset including supplier delivery time, order quantity, regional distribution strategy and warehouse capacity; Report generation module: Based on the integrated dataset, it constructs a mixed-integer linear programming model with the objective function of minimizing the total cost, including procurement, holding, and stockout costs, and solves the model under the constraints of order quantity and warehouse capacity to generate replenishment recommendations; and simultaneously generates an analysis report containing key decision factors and inventory weight information that affect the replenishment recommendations.

[0015] The beneficial effects of this invention are as follows: This invention constructs a multi-dimensional time-series feature vector by extracting trend features, periodic features and sudden features from historical sales data, and inputs it and external influencing factors into a gated recurrent unit network for dynamic prediction according to time steps. Then, the prediction results are corrected based on the effective inventory, and then the business rule parameters are integrated to construct a mixed integer linear programming model to generate replenishment suggestions, forming a complete transformation link from data collection, feature extraction, demand prediction, inventory correction and optimization decision-making. This method uses gated recurrent unit networks to capture temporal dependencies and integrates multidimensional external influencing factors to improve prediction accuracy. It achieves real-time response to inventory status by reading and calculating effective inventory levels in real time. It generates directly executable replenishment suggestions by constructing a mixed integer linear programming model with the goal of minimizing total cost and solving it under constraints to ensure system operability. The three are organically integrated through a unified data flow and optimization framework, which ensures both prediction accuracy and real-time performance. This method establishes a complete closed loop, from acquiring sales data and extracting time-series features, outputting forecast results through dynamic demand forecasting, obtaining corrected demand based on inventory status, integrating business rule parameters to form an integrated dataset, generating replenishment suggestions through model optimization, and simultaneously generating an analysis report containing key decision factors and inventory weight information. It realizes the fully automated linkage of sales monitoring, demand forecasting, inventory assessment, and replenishment decision-making. The analysis report makes the decision basis transparent and supports continuous optimization. This method comprehensively extracts trend features, periodic features, and sudden features in the demand forecasting stage to characterize the temporal patterns of sales data. In the inventory correction stage, it calculates the effective inventory level and corrects it based on the difference between the effective inventory level and the forecast results to achieve dynamic linkage between the forecast results and the inventory status. The temporal features reflect the demand patterns and future trends, while the inventory status feedback reflects the current resource constraints and the urgency of replenishment. The deep integration of the two makes the replenishment recommendations not only in line with the demand forecasting patterns but also meet the requirements of inventory management, avoiding the decision-making bias caused by the separation of forecasting and inventory management in traditional methods. This method integrates the corrected demand forecast results with business rule parameters, including supplier delivery dates, order quantities, regional distribution strategies, and warehouse capacity, to construct an integrated dataset. In a mixed-integer linear programming model, these business rule parameters are directly used as constraints in the optimization process. By balancing demand changes and business rules within a unified optimization framework, the optimal balance between demand satisfaction and rule compliance is achieved. This ensures that replenishment recommendations respond to demand changes while adhering to actual business constraints. Compared to traditional methods that simply overlay rules, this method delves deeper into the relationship between demand changes and business rules through optimization modeling. Furthermore, this method identifies abnormal fluctuations and abrupt changes in sales data by extracting sudden features, captures market fluctuations caused by public health events and seasonal diseases by fusing external influencing factors such as epidemiological indicators, learns and predicts patterns of different types of fluctuations through the memory mechanism of gated recurrent unit networks, and dynamically adjusts replenishment strategies during market fluctuations by adjusting demand based on effective inventory levels. Compared to traditional methods that rely on human experience to judge market fluctuations, this method achieves automated and accurate capture of pharmaceutical market fluctuation characteristics through multi-dimensional feature extraction, external factor fusion, and deep learning modeling, improving prediction accuracy and decision robustness in volatile market environments. This method employs a gated recurrent unit network (GRNN) to automatically learn the temporal patterns of sales data through training on historical data, eliminating the need for manually specified forecasting rules. During the demand correction phase, it dynamically adjusts forecast results based on real-time inventory status data, enabling replenishment recommendations to adapt to changes in current inventory levels. In the optimization phase, it dynamically constructs constraints based on business rule parameters in the integrated dataset, allowing decisions to adapt to changes in the business environment. Synchronously generated analysis reports feed back key decision factors and inventory weight information to the system and decision-makers, supporting continuous optimization of model parameters and business rules. This forms a self-learning, self-adjusting, and self-optimizing adaptive mechanism. Compared to the fixed rules and static parameters of traditional methods, this method continuously improves performance with data accumulation and environmental changes, exhibiting strong adaptability. In summary, this invention, through a systematic technical solution design, provides an intelligent, automated, and precise solution for pharmaceutical inventory demand analysis, demonstrating significant technological advancement and practical value. Attached Figure Description

[0016] Figure 1 This is a schematic diagram of the drug inventory demand analysis method based on sales data provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of a drug inventory demand analysis system module based on sales data provided in an embodiment of the present invention. Detailed Implementation

[0017] The subject matter described herein will now be discussed with reference to exemplary embodiments. It should be understood that these embodiments are discussed only to enable those skilled in the art to better understand and implement the subject matter described herein, and changes may be made to the function and arrangement of the elements discussed without departing from the scope of this specification. Various processes or components may be omitted, substituted, or added as needed in the examples. Furthermore, some features described in the examples may be combined in other examples.

[0018] At least one embodiment of the present invention discloses a method and system for analyzing drug inventory demand based on sales data, including: like Figure 1 As shown, the method for analyzing drug inventory demand based on sales data includes the following steps: Step 1: Obtain historical sales data of the target drug and extract time-series features from the historical sales data, including trend features, periodic features, and sudden features; Step 2: Input the multidimensional time-series feature vector and external influencing factors including holidays, weather and epidemiological indicators into the gated recurrent unit network in sequence according to time steps to construct a dynamic demand prediction model and output the prediction results of the initial drug demand. Step 3: Obtain the current available inventory, in-transit inventory, and allocated inventory of the target drug, and calculate the effective inventory; correct the difference between the effective inventory and the forecast result to obtain the corrected demand forecast result; Step 4: Integrate the demand forecast results with the preset business rule parameters to obtain an integrated dataset that includes supplier delivery time, order quantity, regional distribution strategy and warehouse capacity; Step 5: Based on the integrated dataset, construct a mixed-integer linear programming model with the objective function of minimizing the total cost, including procurement, holding, and stockout costs. Solve the model under the constraints of order quantity and warehouse capacity to generate replenishment recommendations. Simultaneously generate an analysis report containing key decision factors and inventory weight information that affect the replenishment recommendations.

[0019] In this embodiment, a regional chain pharmacy group is used as the application scenario. This group has over 300 stores nationwide, manages more than 5,000 drug SKUs, and generates approximately 100,000 sales records daily. The system is deployed in the enterprise's local data center, adopts a microservice architecture, and the various functional modules communicate through RESTful APIs and achieve asynchronous data processing through message queues. Although no figures are provided in the accompanying drawings, based on the system's logical structure, the entire process can be divided into five core components: a feature extraction module, a demand prediction module, a state correction module, a data integration module, and a report generation module. These modules exchange data and synchronize their states through standardized data interfaces.

[0020] First, in the feature extraction module, the system retrieves the daily sales records of the target drug (e.g., amoxicillin capsules, 0.25g x 24 capsules) from the drug sales database over the past 365 days. The raw data includes fields such as timestamp, sales quantity, store ID, and batch number. The system first performs linear interpolation to fill missing values ​​and uses a three-standard-deviation-based elimination strategy for outliers: if the sales volume of a certain day exceeds the historical mean ± 3σ, it is judged as an outlier and replaced with the moving average of the previous and next 7 days. The cleaned sales data sequence is segmented using the sliding window method, with a window length of 30 days and a step size of 1 day, generating a total of 336 time windows. For each window, the system extracts trend, periodic, and sudden features. The trend feature is obtained by calculating the sign change rate of the first-order difference sequence and fitting the slope of a straight line using a weighted least squares method with weights decaying exponentially over time (decay factor λ = 0.95). This slope reflects the strength and direction of the recent sales trend. Periodicity features are analyzed using Fast Fourier Transform (FFT) to perform spectral analysis on the sequence within the window, identifying dominant frequency components with an energy share exceeding 5%, such as 7-day (weekly) and 30-day (monthly) periods, and recording their frequency and amplitude. Suddenness features are quantified by calculating the ratio of the number of local abrupt change points within the window (detected using the Pelt algorithm) to the mean of the moving standard deviation (7-day window width). A higher ratio indicates more drastic sales fluctuations. These three types of features are normalized and concatenated into a 128-dimensional vector, serving as a multidimensional time-series feature representation for this time window.

[0021] Subsequently, this multidimensional time-series feature vector, along with external influencing factors, is input into the demand prediction module. External influencing factors include whether the day is a statutory holiday (Boolean value), the highest temperature (degrees Celsius), and the number of reported influenza-like illnesses (from the National Center for Disease Control and Prevention API), which are aligned by time steps to form an external factor vector. The system constructs a 3-layer gated recurrent unit network, with 128 neurons per layer and 128 hidden state dimensions. A dropout rate of 0.3 is introduced between layers to prevent overfitting. The activation functions for the input gate, forget gate, and output gate are all sigmoid functions (logistic functions), and the state update uses the tanh function (hyperbolic tangent function). In the last time step, two scalars, z1 and z2, are output through a fully connected layer, where z1 is the mean of a normal distribution. As the standard deviation, this generates a daily demand that follows a normal distribution. The probability prediction is given by μ, where μ represents the expected value of the predicted demand (in boxes). Z represents the variance of the predicted demand (reflecting the uncertainty of the prediction), and Z1 and Z2 are the original output values ​​of the fully connected layer, respectively. An exponential function is used to ensure a positive standard deviation. During training, the loss function employs a weighted combination of mean squared error, 0.1 quantile loss, and 0.9 quantile loss, with weights of 0.6, 0.2, and 0.2 respectively, to balance point prediction accuracy and prediction interval coverage. The optimizer uses Adam with an initial learning rate of 0.001, dynamically adjusted over 100 epochs using a cosine annealing strategy. After training, the model performs rolling forecasts of demand for the next 30 days, outputting the mean daily demand and a 90% confidence interval.

[0022] In the status correction module, the system reads the current available inventory (i.e., the quantity in the warehouse that can be immediately dispatched), the in-transit inventory (the quantity ordered but not yet delivered), and the allocated inventory (the quantity promised to stores but not yet shipped) of the target medicine from the warehouse management system in real time. The effective inventory calculation formula is: Effective inventory = Current available inventory + In-transit inventory - Allocated inventory. Assuming the current effective inventory is 800 boxes, and the model predicts a total demand of 1200 boxes for the next 7 days, the initial correction result is 1200 - 800 = 400 boxes. However, the correction process is not a simple subtraction, but uses a soft constraint mechanism: when the effective inventory is less than the predicted total demand for the next H days, a net demand gap is calculated. ,in This indicates the effective inventory level (unit: boxes), and H indicates the preset replenishment cycle length (e.g., 7 days). This represents the projected total demand (in boxes) for the next H days. This indicates the inventory gap that needs to be replenished (unit: boxes); if the current available inventory is below the safety stock threshold. (For example, if set to 3 times the average daily sales, i.e., 150 boxes), then the mandatory replenishment quantity is... Ensure that inventory levels are not lower than safe levels, including Indicates the safety stock threshold (unit: boxes). This indicates taking the maximum of the two; otherwise, scaling the projected demand for the next H days proportionally to the sum. That is, the demand on day t after correction is ,in, This represents the corrected demand on day t (unit: boxes). This represents the original forecast demand for day t (unit: boxes). To avoid drastic fluctuations in replenishment recommendations due to abnormal daily fluctuations, the system introduces a smoothing factor α, whose value is adaptively adjusted based on the standard deviation of historical 30-day sales: the larger the standard deviation, the smaller α (minimum is 0.7). The correction result is exponentially smoothed, i.e., corrected demand = α × original corrected result + (1-α) × previous day's corrected result.

[0023] The corrected demand forecast results are then passed to the data integration module. This module extracts rule parameters from multiple business systems: it obtains the supplier delivery time (e.g., 5 working days) for the target drug from the supplier master data; it reads the order quantity (e.g., minimum order quantity of 100 boxes, and must be an integer multiple of 50 boxes) from the procurement strategy configuration table; it obtains the delivery strategy for the corresponding delivery region (e.g., East China) from the regional logistics rule base, including delivery on Tuesdays and Fridays, a single transportation cost of 200 yuan, and a maximum delivery radius of 300 kilometers; and it obtains the remaining available capacity of the target warehouse (e.g., 50 cubic meters) from the warehouse management database, and, combined with the volume of a single drug (0.002 cubic meters / box), calculates the maximum number of boxes that can be stored, which is 25,000 boxes. These parameters are then time-aligned and logically correlated with the corrected demand forecast results to construct an integrated dataset. For example, if it is predicted that 400 boxes need to be replenished on the 6th day, then the delivery time of 5 days needs to be considered, and the actual order date should be the 1st day; at the same time, 400 boxes must meet the constraint of being an integer multiple of 50 boxes, and not exceed the warehouse limit of 25,000 boxes.

[0024] Finally, in the report generation module, the system constructs a mixed-integer linear programming model based on the integrated dataset. Decision variables are defined. s represents the quantity ordered on day t (in boxes, a non-negative integer). t ≥0 indicates the inventory quantity at the end of day t (unit: boxes), b t ≥0 represents the stockout quantity on day t (unit: boxes); the objective function is: Where T represents the planning time range (e.g., 30 days), c p c represents the unit purchase cost (unit: yuan / box). h c represents the unit holding cost (unit: yuan / box / day).b c represents the unit cost of stockout (unit: yuan / box). o This represents the fixed ordering cost (unit: yuan / order). For indicator functions (when x t The value is 1 when the value is greater than 0, otherwise it is 0 (used for calculating fixed ordering costs). Constraints include: s t-1 +x t-L -d t =s t -b t (Inventory balance constraint, where L represents the supplier's lead time in days, d) t (This represents the actual demand on day t). (Order quantity constraint, Q represents the minimum order quantity unit,) x represents t (must be an integer multiple of Q), s t ≤S max (Storage capacity constraint, S) max (This refers to the maximum inventory capacity, etc.) The system calls the Gurobi solver to solve a mixed-integer linear programming model within a 30-second time limit, outputting the optimal order quantity, order date, and recommended delivery route (e.g., from the Shanghai warehouse to six stores in Hangzhou, Nanjing, etc.). Simultaneously, the system analyzes the attention weights of the gated recurrent unit network during the prediction process using a gradient-weighted activation mapping method, identifying that the surge in sales on day 15 was mainly driven by an increase in reported influenza cases, a factor accounting for 35% of the decision-making weight. Combining cost structure (transportation costs account for 40%, holding costs account for 30%) and business rules (batch economy saved 120 yuan), the system generates a structured analysis report containing five parts: demand background, inventory status, rule constraints, basis for recommendations, and implementation suggestions.

[0025] In addition, the system includes an abnormal sales event detection submodule. When the daily sales volume exceeds the historical average by ±2.5σ, it is marked as a suspected abnormal event. The system automatically connects to external data sources: it queries the hospital centralized procurement announcement database and finds that a tertiary hospital issued a winning bid announcement for amoxicillin centralized procurement on that day; it matches the public health early warning information database and confirms that the local area is in the peak influenza season; it searches the promotional activity filing database and finds no relevant records. Through timestamp matching (3 days before and after the event) and geographic location filtering (same city), two related records are selected. The relevance score (based on text similarity and time overlap) is calculated, with scores of 0.82 and 0.76 respectively, both exceeding the threshold of 0.7, thus confirming that the cause type is centralized procurement driven and public health event driven. Based on this, the system lowers the confidence of the prediction model by 10% and embeds event features (such as keywords in the centralized procurement announcement and influenza index) as additional input into the next training cycle of the gated recurrent unit network.

[0026] In multi-drug collaborative analysis, the system constructs a drug relationship graph based on an expert knowledge base (500 drug substitution relationships labeled by 10 clinical pharmacists) and historical sales Pearson correlation coefficients (past 180 days). Nodes in the graph represent drugs, and edge weights are a weighted average of clinical substitution strength scores (0-1) and correlation coefficients (-1 to 1) (weights 0.6:0.4). For example, amoxicillin and cefixime have a substitution relationship with a weight of 0.75. The system employs a 3-layer graph convolutional network (GCN), with each layer performing a linear transformation (weight matrix W∈R^128×128) and ReLU activation on the features of adjacent nodes. During forward propagation, the sales features of the amoxicillin node are propagated along the edges to adjacent nodes such as cefixime, and aggregated at each layer. Subsequently, an attention mechanism is introduced to calculate the attention weights of amoxicillin and each adjacent drug (normalized by softmax through the dot product of the learnable vector a and the concatenated features), dynamically allocating contributions. The final aggregated feature (weighted changes in sales of adjacent drugs) is used as an additional input, concatenated with the original time-series features, and then input into the gated recurrent unit network so that the prediction results reflect the substitution effect (e.g., when cefixime is in short supply, the demand for amoxicillin may increase).

[0027] Specifically, the Clinical Substitution Strength Score is a numerical indicator (usually normalized to 0-1 or 0-5) designed to objectively quantify the degree to which two drugs are substitutable in a treatment setting. A Clinical Substitution Strength Score comparison table is established, where the score for each pair of drugs (i,j) is... The calculation is based on the following rules: If the primary indications of drugs i and j completely overlap, the base score is 0.8; if they both belong to ATC Level 4, add 0.1; if they are listed as equivalent recommendations in the "National Essential Medicines Clinical Application Guidelines," add 0.1; final score... ,in, This table represents the clinical substitution strength score between drug i and drug j (range 0-1). `min()` indicates the minimum value to ensure the score does not exceed 1.0. The base score is determined by the degree of overlap in the primary indications, while the supplementary score is accumulated from factors such as ATC classification and clinical guideline recommendations. This table is pre-stored in the system database. Its quantification is primarily based on structured medical knowledge, specifically including but not limited to the following sources: Matching degree between official drug instructions and indications: By comparing the official instructions of two drugs (such as Chinese drug instructions), if their primary therapeutic indications highly overlap (e.g., both drugs are approved for first-line glucose lowering in type 2 diabetes), a higher base substitution score (e.g., 0.8) can be assigned. If the indications only partially overlap, the score is based on the proportion of the overlap.

[0028] Authoritative clinical treatment guidelines and pathways: Refer to national or industry-issued clinical treatment guidelines (such as the "National Essential Medicines Clinical Application Guidelines" and disease prevention and treatment guidelines for various specialties). If the guidelines explicitly list two drugs as interchangeable options or equivalent recommendations in a specific treatment pathway or regimen, a high score (e.g., 0.9-1.0) can be assigned based on the level and strength of the evidence for the recommendation (e.g., Class I recommendation, Level A evidence).

[0029] Pharmacological mechanism of action and drug classification system: Based on the anatomical, therapeutic and chemical classification codes of drugs, namely ATC codes. If two drugs have the same or very similar ATC Level 4 (therapeutic subgroup) or Level 5 (chemical substance subgroup) codes, it indicates that their mechanisms of action and therapeutic uses are highly similar, and a higher baseline score (e.g., 0.7-0.9) can be set accordingly.

[0030] Expert consensus and prescription sets: Based on the prescription sets or principles of drug substitution formulated by the hospital's pharmacy department or clinical expert committee. For drugs that are clearly identified as routine in-hospital substitutes, a pre-defined substitution intensity score can be directly assigned.

[0031] Structured Drug Knowledge Base: Extracts structured field information such as therapeutic equivalence and alternative drugs from professional pharmaceutical databases (such as UpToDate, Micromedex, or domestic professional rational drug use knowledge bases) and maps it to numerical scores.

[0032] In practice, information can be obtained from multiple sources mentioned above and integrated using rule engines or weighted voting. For example: Direct match: If it is explicitly the preferred alternative in the guidelines, the score is 1.0.

[0033] Weighted calculation: The final score is calculated by combining the matching degree of the instruction manual (weight 40%), the strength of the guide recommendation (weight 40%), and the similarity of the ATC code (weight 20%).

[0034] Expert calibration: The preliminary calculated scores are reviewed and fine-tuned by a pharmaceutical expert review panel to form the final clinical substitution strength score comparison table.

[0035] The weighted average of this score and the Pearson correlation coefficient (reflecting the statistical correlation of sales volume) calculated based on pure sales data constitutes the final weight of the edges in the drug relationship graph. This approach incorporates prior knowledge of clinical medical logic while retaining objective data-driven findings, enabling the constructed drug relationship graph to more scientifically reflect the true relationships (substitution and complementarity) between drugs. This, in turn, allows subsequent graph neural network models to more accurately capture the demand transmission effects between drug sets.

[0036] The aforementioned modules interact through a unified data bus. The multi-dimensional time-series feature vector output by the feature extraction module serves as input to the demand forecasting module. The initial forecast result output by the demand forecasting module is then compared with the effective inventory quantity output by the state correction module. The corrected result enters the data integration module, and the integrated dataset drives the optimization model solution in the report generation module. All data streams are encapsulated in JSON format, including fields such as timestamp, drug ID, value, and unit, ensuring semantic consistency between modules. The system automatically executes a full-scale analysis process at 2:00 AM daily, generating replenishment suggestions for the day and pushing them to the purchasing manager's terminal via WeChat.

[0037] To enable those skilled in the art to fully understand and implement this invention, the specific implementation principles of this invention are further supplemented below with a specific application scenario.

[0038] In the actual operation environment of a regional chain pharmacy group, the system first retrieves the daily granular sales records of the target drug, amoxicillin capsules, from the drug sales database over the past 365 days. These records contain structured fields such as timestamps, sales quantities, store IDs, and batch numbers. The system performs missing value processing on the raw data, using linear interpolation to fill in missing data points caused by system failures or transmission interruptions. For outlier identification, the system calculates the mean μ and standard deviation σ of the historical sales sequence. If the sales volume of a certain day exceeds the interval [μ−3σ,μ+3σ], it is judged as an outlier, and the data is replaced with the moving average within a 14-day window consisting of 7 days before and after that day, thus ensuring the continuity and stability of the input data. After cleaning, the time-series data is divided into sliding windows with a length of 30 days and a step size of 1 day, generating a total of 336 overlapping windows. Each window serves as an independent sample for feature construction.

[0039] For each window, the system extracts three types of features: trend features are obtained by calculating the sign change rate of the first-order difference sequence and performing a weighted least squares fit on the most recent 30 days' data using an exponentially decaying weight (decay factor λ=0.95), with the resulting slope serving as a trend strength indicator; periodic features are obtained by performing a Fast Fourier Transform (FFT) on the sequence within the window to extract the dominant frequency components with an energy share exceeding 5% in the spectrum, such as the frequencies and amplitudes corresponding to the 7-day (corresponding to the cycle) and 30-day (corresponding to the monthly cycle); and suddenness features are obtained by using the Pelt change point detection algorithm to identify the number of sales abrupt changes within the window and calculating the mean of the 7-day moving standard deviation, with the ratio of the number of abrupt changes to the mean of the moving standard deviation serving as a quantitative indicator of the volatility. These three types of features are then Z-score standardized and concatenated into a 128-dimensional vector, forming a multidimensional time-series feature representation for that window.

[0040] The multidimensional time-series feature vector and the external influencing factor vector are input into the demand forecasting module. External influencing factors include whether the day is a statutory holiday (coded as 0 or 1), the maximum temperature value released by the meteorological department, and the number of influenza-like illness reports returned by the National Center for Disease Control and Prevention API. All external variables are aligned by date and concatenated with the feature vector along the time dimension. The system constructs a three-layer gated recurrent unit network, with each layer containing 128 neurons and a hidden state dimension of 128. A dropout rate of 0.3 is set between layers to suppress overfitting. At the last time step, the network outputs two scalars, which, after softplus activation, serve as the mean μ and standard deviation σ of a normal distribution, thereby generating the probability distribution of future daily demand. During the training phase, a composite loss function is used, which is a weighted combination of mean squared error (MSE) and 0.1 quantile loss and 0.9 quantile loss in a ratio of 0.6:0.2:0.2. The optimizer is Adam, the initial learning rate is set to 0.001, and a cosine annealing strategy is used to dynamically adjust the learning rate within 100 training cycles. Finally, the model outputs the point estimate of daily demand for the next 30 days and its 90% confidence interval.

[0041] The status correction module connects in real-time to the warehouse management system (WMS) to obtain the current available inventory, in-transit inventory, and allocated inventory of the target drug. Based on the formula: Effective Inventory = Current Available Inventory + In-Transit Inventory - Allocated Inventory, the current schedulable inventory is calculated. If the predicted total demand for the next 7 days is 1200 boxes, and the effective inventory is 800 boxes, the initial replenishment gap is 400 boxes. However, the correction process incorporates a soft constraint mechanism: when the current available inventory is below the safety stock threshold (set at 3 times the average daily sales, i.e., 150 boxes), regardless of the predicted demand, the system forcibly triggers a replenishment command to ensure that the inventory does not fall below the safety level; if the predicted total demand exceeds the effective inventory, the system scales the predicted values ​​for each day proportionally, so that the corrected total demand equals the replenishment gap. To further suppress the sharp fluctuations in replenishment recommendations caused by a sudden increase in daily sales, the system introduces an adaptive smoothing factor α, whose value is determined by the standard deviation of historical 30-day sales: the larger the standard deviation, the smaller α (the lower limit is 0.7). The corrected demand is smoothed by the exponential smoothing formula: corrected demand = α × original corrected result + (1 − α) × previous day's corrected result.

[0042] The data integration module extracts rule parameters from multiple business systems: it reads a delivery time of 5 working days from the supplier master data table; it obtains the constraint that the minimum order quantity is 100 boxes and must be an integer multiple of 50 boxes from the procurement strategy configuration table; it retrieves the East China delivery strategy from the regional logistics rule base, including fixed delivery days on Tuesdays and Fridays, a single transportation cost of 200 yuan, and a maximum delivery radius of 300 kilometers; and it obtains the remaining capacity of the target warehouse of 50 cubic meters from the warehouse management database. Combined with the volume of 0.002 cubic meters per box, the maximum inbound quantity is calculated to be 25,000 boxes. The above parameters are aligned with the corrected demand forecast results on the timeline. For example, if there is a replenishment demand of 400 boxes on the 6th day, the actual order date is calculated as the 1st day based on the 5-day delivery time, and it is verified whether the 400 boxes meet the constraints of being an integer multiple of 50 boxes and the upper limit of 25,000 boxes. If not, it is rounded up to the nearest compliant value.

[0043] The report generation module constructs a mixed-integer linear programming model based on the integrated dataset. The decision variables are the order quantities (integers) for each potential ordering day within the next 30 days. The objective function is to minimize total cost, including procurement cost (unit price × quantity), transportation cost (fixed 200 yuan / transaction + 0.5 yuan / box), holding cost (0.02 yuan / box / day × average daily inventory), stockout cost (5 yuan / box × stockout quantity), and ordering cost (50 yuan / transaction). Constraints include: order quantity must be an integer multiple of 50; single inbound quantity cannot exceed 25,000 boxes; ordering date must meet delivery requirements (i.e., delivery on the 5th day after ordering, and the delivery date covers the predicted stockout day); the warehouse's daily receiving capacity is capped at 5,000 boxes; stockout quantity within any consecutive 7 days cannot exceed 5% of the total demand for that period. The system calls the Gurobi solver to solve the optimization problem within 30 seconds, outputting the optimal ordering plan and delivery route. Meanwhile, by analyzing the attention weight of the gated recurrent unit network in predicting high demand on day 15 using the gradient-weighted class activation mapping method, the number of influenza reports was identified as a key driving factor, contributing 35% to the feature channel. This information was used to generate the recommendation basis section of the structured report.

[0044] In terms of anomaly detection, when daily sales exceed the historical average by ±2.5σ, the system automatically triggers an event correlation analysis process. It sequentially queries the hospital centralized procurement announcement database, the public health early warning information database, and the promotional activity registration database. Candidate records are filtered using timestamp matching (within 3 days before and after the event) and geographic location filtering (same city). A correlation score is calculated based on text similarity and time overlap. If the score exceeds a threshold of 0.7, the event type is confirmed, and the model confidence is adjusted. In multi-drug collaborative analysis, the system constructs a drug relationship graph based on substitution relationships labeled by clinical pharmacists and historical sales Pearson correlation coefficients. A three-layer graph convolutional network (GCN) aggregates the sales features of adjacent drugs, and an attention mechanism dynamically weights the contribution of each adjacent node. Finally, the aggregated features are concatenated to the original temporal features and input into a gated recurrent unit network, ensuring that the prediction results reflect the substitution effect between drugs.

[0045] The above modules interact through a unified data bus. All data streams are encapsulated in JSON format, including fields such as timestamp, drug ID, numerical value, and unit, ensuring semantic consistency. The system automatically executes a full-scale analysis process at 2:00 AM daily, generating replenishment suggestions for the day and pushing them to the purchasing manager's terminal via WeChat, achieving end-to-end closed-loop operation from data collection, feature construction, demand forecasting, inventory adjustment, rule integration to optimization decision-making.

[0046] like Figure 2 As shown, the drug inventory demand analysis system based on sales data includes: Feature extraction module: used to acquire historical sales data of the target drug and extract time-series features from the historical sales data, including trend features, periodic features and sudden features; Demand forecasting module: used to input the multidimensional time-series feature vector and external influencing factors including holidays, weather and epidemiological indicators into the gated recurrent unit network in time steps to construct a dynamic demand forecasting model and output the forecast results of initial drug demand; Status correction module: used to obtain the current available inventory, in-transit inventory and allocated inventory of the target drug, calculate the effective inventory; and correct the difference between the effective inventory and the prediction result to obtain the corrected demand prediction result. Data integration module: used to integrate the demand forecast results with preset business rule parameters to obtain an integrated dataset including supplier delivery time, order quantity, regional distribution strategy and warehouse capacity; Report generation module: Based on the integrated dataset, it constructs a mixed-integer linear programming model with the objective function of minimizing the total cost, including procurement, holding, and stockout costs, and solves the model under the constraints of order quantity and warehouse capacity to generate replenishment recommendations; and simultaneously generates an analysis report containing key decision factors and inventory weight information that affect the replenishment recommendations.

[0047] The embodiments of the present invention have been described above. However, the embodiments are not limited to the specific implementation methods described above. The specific implementation methods described above are merely illustrative and not restrictive. Those skilled in the art can make more equivalent embodiments under the guidance of the present embodiments, and all of them are within the protection scope of the present embodiments.

Claims

1. A method for analyzing the demand of a drug inventory based on sales data, characterized by, include: Obtain historical sales data of the target drug and extract time-series features from the historical sales data, including trend features, periodic features, and sudden features; The time-series features and external influencing factors, including holidays, weather, and epidemiological indicators, are sequentially input into a gated recurrent unit network according to time steps to construct a dynamic demand forecasting model, so as to output the forecast results of initial drug demand. Obtain the current available inventory, in-transit inventory, and allocated inventory of the target drug, and calculate the effective inventory; correct the effective inventory based on the difference between the effective inventory and the forecast result to obtain the corrected demand forecast result; The demand forecast results are integrated with preset business rule parameters to obtain an integrated dataset that includes supplier delivery dates, order quantities, regional distribution strategies, and warehouse capacity. Based on the integrated dataset, a mixed-integer linear programming model is constructed with the objective function of minimizing the total cost, including procurement, holding, and stockout costs. The model is then solved under the constraints of order quantity and storage capacity to generate replenishment suggestions. An analysis report is generated simultaneously, which includes key decision-making factors and inventory weight information that affect replenishment recommendations.

2. The method of claim 1, wherein the sales data is obtained from a plurality of pharmacies. Obtain historical sales data for the target drug and extract time-series features from the historical sales data, including: Retrieve the sales records of the target drug within a preset time window from the drug sales database; The sales records are filled with missing values ​​and outliers are removed to form a cleaned sales data sequence; The sales data sequence is segmented using a sliding window method; each segment corresponds to a time window. Extract the trend characteristics, periodic characteristics, and sudden characteristics of the sales data sequence within each time window; The trend characteristics are quantified by first-order difference sequences and weighted least squares linear regression with weights decaying exponentially over time. The periodicity is identified by using Fourier transform to identify the dominant frequency components whose spectral energy percentage is greater than a preset threshold. The suddenness feature is identified by the ratio of the number of local mutation points to the mean of the moving standard deviation. The trend features, periodic features, and sudden features are vectorized and concatenated to form a multidimensional time series feature vector.

3. The method of claim 1, wherein the sales data is obtained from a plurality of pharmacies. The temporal features are input into a gated recurrent unit network, including: A gated recurrent unit structure with 2 to 4 hidden layers is constructed, the number of neurons in each layer is set to 64 to 256, and a dropout mechanism is introduced to prevent overfitting; The input, forget, and output gates control the inflow, retention, and state output of information. At the last time step, a fully connected layer outputs two values, which are used as the mean and logarithm of the normal distribution, respectively, to generate the probability distribution of daily demand. The output dimension of the fully connected layer is 2. We use a weighted combination of mean squared error and quantile loss as the loss function, and dynamically adjust the learning rate using adaptive moment estimation and cosine annealing strategies to train and update the network parameters.

4. The method of claim 1, wherein the sales data is obtained from a pharmacy information system. Obtain the current inventory status data of the target drug, and correct the prediction result based on the current inventory status data, including: The system reads the current available inventory, in-transit inventory, and allocated inventory of the target drug in real time, and calculates the effective inventory based on the inventory data. The effective inventory is equal to the current available inventory plus the in-transit inventory minus the allocated inventory. The prediction results are corrected using a soft constraint mechanism to obtain the corrected results; Wherein, when the effective inventory is less than the forecast result, the correction result is set as the difference between the original demand forecast result and the effective inventory. During the soft constraint mechanism correction process, when the current available inventory is lower than the preset inventory safety ratio threshold, a forced replenishment signal is triggered, and the correction result is adjusted based on the inventory gap and the predicted total quantity limit. When the total predicted result exceeds the effective inventory, the predicted result is scaled proportionally for a preset time period based on the soft constraint mechanism to ensure that the correction result is not lower than the inventory replenishment amount. A smoothing factor that is adaptively adjusted based on historical volatility is introduced to buffer abnormal fluctuations in the correction results, thereby completing multi-level correction of the prediction results.

5. The method of claim 1, wherein the sales data is obtained from a pharmacy information system. Integrating the demand forecast results with preset business rule parameters includes: Extract the supplier delivery date corresponding to the target drug from the supplier master data; the supplier delivery date represents the number of days required from order placement to delivery. Read the order quantity of the target drug from the procurement strategy configuration table; the order quantity represents the procurement batch unit allowed by the supplier; Obtain the delivery strategy for the target drug's delivery area from the regional logistics rule base; the delivery strategy includes delivery frequency, transportation cost, and delivery route information; Obtain the remaining available capacity of the warehouse where the target drug is located from the warehouse management system, and calculate the quantity that can be put into storage based on the volume of a single drug item; The demand forecast results, supplier delivery dates, order quantities, delivery strategy parameters, and available inventory quantities are correlated to construct a multi-dimensional integrated dataset.

6. The method of claim 1, wherein the sales data is obtained from a pharmacy information system. Based on the integrated dataset, an inventory planning optimization model is constructed, and the model is solved to generate replenishment suggestions that meet business constraints, including: Define the order quantity for the next procurement cycle as the decision variable; An objective function is constructed for the decision variables to minimize the sum of procurement, transportation, stockout, holding, and ordering costs, and different weight coefficients are assigned to each cost item. The decision variables are subject to a set of constraints including order quantity constraints, maximum inbound quantity constraints, delivery window constraints, warehouse receiving capacity constraints, and demand coverage requirements. A mixed-integer linear programming solver is used to solve the inventory planning optimization model consisting of the objective function and the set of constraints within a preset time limit, so as to obtain the optimal order quantity, order date and delivery route as replenishment suggestions.

7. The method of claim 1, wherein the sales data is obtained from a pharmacy information system. Simultaneously generate analysis reports, including: The attention weights of the gated recurrent unit network in the prediction process are extracted, and the importance of the input features is ranked based on the gradient-weighted class activation mapping method. Based on the importance ranking results, key factors driving replenishment decisions are identified, including sudden increases in sales, inventory warnings, delivery time constraints, or batch economics. The attention weights, key factors, cost composition ratios, and business rule constraints are converted into structured data. An analysis report is generated based on the structured data, including the demand background, current inventory status, rule constraints, basis for recommendations, and implementation suggestions.

8. The method for analyzing drug inventory demand based on sales data according to claim 1, characterized in that, It also includes the detection of abnormal sales events: Real-time monitoring of drug sales over a preset time period; when the sales deviation exceeds a preset standard deviation multiple, it is marked as a suspected abnormal event. The suspected abnormal events are associated with external data sources to verify their causes. These external data sources include hospital centralized procurement announcement databases, public health early warning information databases, and promotional activity filing databases. By matching timestamps and filtering geographic locations, related records that overlap with the time window and match the geographic location of the suspected abnormal event are filtered from the external data source. Calculate the correlation score between the associated record and the suspected abnormal event. When the correlation score exceeds a preset threshold, confirm the cause type of the suspected abnormal event and mark the cause type as centralized procurement-driven, public health event-driven, or promotional activity-driven. The confidence level of the prediction model is dynamically adjusted based on the confirmation result of the cause type, and the characteristics of the suspected abnormal event and the cause type are synchronously input into the gated recurrent unit network.

9. The method for analyzing drug inventory demand based on sales data according to claim 1, characterized in that, It also includes multi-drug synergistic analysis: A drug relationship diagram is constructed based on an expert knowledge base and historical sales correlation, and the drug relationship diagram includes substitution relationships and complementary effects. In this graph, drug nodes represent different drugs, the edges represent the relationships between drugs, and the edge weights are the weighted average of the clinical substitution strength score and the Pearson correlation coefficient. A graph neural network is used to perform multi-layer graph convolution operations on the drug relationship graph. The graph convolution operation includes 2 to 4 graph convolution layers. Each graph convolution layer performs linear transformation and non-linear activation on the historical sales features of the current drug node and its neighboring drug nodes. During the forward propagation of the graph convolution operation, the historical sales features of the current drug node are passed along the edges of the drug relationship graph to adjacent drug nodes, and feature aggregation is performed in each graph convolution layer to capture the demand transmission effect between drug sets. Based on the output results of each layer of the graph convolution operation, an attention mechanism is introduced to perform weighted aggregation of the sales change information of adjacent drugs in the drug relationship graph. The attention mechanism dynamically allocates the contribution of each neighboring drug to the demand prediction of the target drug by calculating the attention weight between the target drug node and each neighboring drug node. The attention weights are weighted and summed with the sales change information of the corresponding adjacent drugs to obtain the aggregated features that reflect the correlation effect between drugs. The aggregated features are introduced as additional input features into the dynamic demand prediction model, and together with the original time-series features, they participate in the forward demand prediction step to obtain multi-drug joint demand results that take into account the substitution and complementarity effects between drugs.

10. A drug inventory demand analysis system based on sales data, used to execute the drug inventory demand analysis method based on sales data as described in any one of claims 1-9, characterized in that, include: Feature extraction module: used to acquire historical sales data of the target drug and extract time-series features from the historical sales data, including trend features, periodic features and sudden features; Demand forecasting module: used to input the multidimensional time-series feature vector and external influencing factors including holidays, weather and epidemiological indicators into the gated recurrent unit network in time steps to construct a dynamic demand forecasting model and output the forecast results of initial drug demand; Status correction module: used to obtain the current available inventory, in-transit inventory and allocated inventory of the target drug, calculate the effective inventory; and correct the difference between the effective inventory and the prediction result to obtain the corrected demand prediction result. Data integration module: used to integrate the demand forecast results with preset business rule parameters to obtain an integrated dataset including supplier delivery time, order quantity, regional distribution strategy and warehouse capacity; Report generation module: Based on the integrated dataset, it constructs a mixed-integer linear programming model with the objective function of minimizing the total cost, including procurement, holding, and stockout costs, and solves the model under the constraints of order quantity and warehouse capacity to generate replenishment suggestions. An analysis report is generated simultaneously, which includes key decision-making factors and inventory weight information that affect replenishment recommendations.