Method, system, device, medium and program product for optimizing a drug demand prediction model
By using federated learning technology to perform local data preprocessing and model training at pharmacy nodes, a global drug demand forecasting model is generated, which solves the problems of data fragmentation and static early warning in the drug management system, and achieves efficient turnover of drug inventory and reduces management costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- FIRST AFFILIATED HOSPITAL OF XINJIANG MEDICAL UNIVERSITY
- Filing Date
- 2026-04-29
- Publication Date
- 2026-07-24
AI Technical Summary
Existing drug management systems suffer from fragmented data, static early warning models, and an inability to dynamically respond to fluctuations in drug demand and policy impacts, resulting in low drug inventory turnover and high management costs.
By employing federated learning technology, local data preprocessing and model training are performed at each pharmacy node to generate model update parameters. These parameters are then aggregated into a global model using a federated averaging algorithm, forming a global drug demand prediction model. This enables cross-institutional knowledge sharing and data privacy protection.
It improved the accuracy of drug demand forecasting, increased drug inventory turnover, reduced management costs, and enhanced the precision of drug supply and emergency response capabilities.
Smart Images

Figure CN122455403A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, system, device, medium, and program product for optimizing a drug demand forecasting model. Background Technology
[0002] Currently, hospital drug management is undergoing a transformation from extensive to intensive methods. Existing technologies mainly rely on electronic prescription systems, radio frequency identification (RFID) traceability systems, and predictive tools based on traditional time series models (such as ARIMA and LSTM). These systems have achieved certain results in specific areas, such as medication error prevention or inventory traceability. For example, computerized prescription entry systems (CPOE) can significantly reduce serious medication errors, and RFID technology can effectively improve inventory turnover efficiency.
[0003] However, existing technologies have a series of inherent shortcomings. First, most existing systems are siloed, lacking collaborative management of the entire drug supply chain from procurement and warehousing to clinical use. This leads to data fragmentation at each stage, creating information silos and hindering global optimization. According to monitoring data from 2022, only 28% of tertiary hospitals achieved interconnectivity of drug data across the entire process. Second, existing early warning models mostly use static thresholds, failing to dynamically respond to fluctuations in drug demand, seasonal changes in disease patterns, and the complex impacts of national centralized drug procurement policies. This results in significant issues with procurement reporting deviations and fluctuations in clinical usage. Third, the quality control focus of existing systems is primarily on economic indicators (such as inventory turnover rate and loss rate), insufficiently responding to the dynamic monitoring requirements for rational drug use emphasized in the "Standards for the Evaluation of Tertiary Hospitals (2022 Edition)," leading to a bottleneck in improving prescription compliance rates. Finally, existing technologies lack effective adaptation mechanisms for special management scenarios such as long drug delivery radii in special regions, diverse demands for ethnic minority drugs, and high requirements for emergency reserves, resulting in insufficient drug accessibility and increased management costs.
[0004] Therefore, there is an urgent need to invent a comprehensive solution that can break down data barriers, provide intelligent and dynamic early warnings, and adapt to complex policies and regional characteristics, in order to solve the problems of low drug inventory turnover and high management costs caused by the low accuracy of existing drug demand forecasts. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a method, system, device, medium, and program product for optimizing a drug demand forecasting model, which at least partially solves the problems existing in the prior art.
[0006] Other features and advantages of the invention will become apparent from the following detailed description, or may be learned in part by practice of the invention.
[0007] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0008] According to a first aspect of the present invention, a method for optimizing a drug demand forecasting model is provided, the method comprising:
[0009] For each pharmacy node, local drug time-series data of the pharmacy node is obtained, and the local drug time-series data is preprocessed to obtain drug time-series feature data.
[0010] The initialized global drug demand prediction model is trained using the drug time-series feature data to obtain the model update parameters corresponding to the pharmacy node.
[0011] The federated averaging algorithm is used to aggregate the model update parameters corresponding to each pharmacy node into global model update parameters;
[0012] The updated global model parameters are applied to the current global drug demand forecasting model to obtain the updated global drug demand forecasting model.
[0013] Furthermore, the local drug time-series data is preprocessed to obtain drug time-series feature data, including:
[0014] The local drug time-series data is cleaned and missing values are handled.
[0015] Based on the cleaned local drug time-series data, feature construction is performed to obtain a drug time-series feature set, which includes date features, statistical features, and business features.
[0016] Furthermore, the initialized global drug demand prediction model is trained using the drug time-series feature data to obtain the model update parameters corresponding to the pharmacy node, including:
[0017] The initialized global drug demand forecasting model is distributed from the central pharmacy hub to each pharmacy node.
[0018] For each pharmacy node, the time-series drug feature data is used to train the initialized global drug demand prediction model to obtain the model update parameters corresponding to the pharmacy node.
[0019] The encrypted model update parameters are uploaded to the central hub of the drug depot via a secure communication channel.
[0020] Furthermore, using the federated averaging algorithm, the model update parameters corresponding to each pharmacy node are aggregated into global model update parameters, including:
[0021] At the central pharmacy hub, the federated averaging algorithm is used to average and weight the model update parameters corresponding to each pharmacy node. The node weight is determined based on the amount of data in each pharmacy node, thus obtaining the global model update parameters.
[0022] Furthermore, the model update parameters include model weights and / or model weight gradients.
[0023] Furthermore, the method also includes:
[0024] The updated global drug demand forecasting model is then redistributed to each pharmacy node.
[0025] Each pharmacy node uses the updated global drug demand prediction model to train its local model for the next round, iterating the global drug demand prediction model until it meets the preset convergence condition.
[0026] According to a second aspect of the present invention, a drug demand forecasting model optimization system is provided, the system comprising:
[0027] The data acquisition and preprocessing module is used to acquire local drug time-series data of each pharmacy node, and preprocess the local drug time-series data to obtain drug time-series feature data.
[0028] The node model training module is used to train the initialized global drug demand prediction model using the drug time-series feature data to obtain the model update parameters corresponding to the pharmacy node.
[0029] The global model update module is used to aggregate the model update parameters corresponding to each pharmacy node into global model update parameters using the federated averaging algorithm, and then apply the global model update parameters to the current global drug demand forecasting model to obtain the updated global drug demand forecasting model.
[0030] According to a third aspect of the present invention, a drug demand forecasting model optimization device is provided, the device comprising: a processor and a memory;
[0031] The memory is used to store one or more program instructions;
[0032] The processor is configured to run one or more program instructions to perform the steps of a drug demand forecasting model optimization method as described in any of the preceding claims.
[0033] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, wherein when executed by a processor, the computer program implements the steps of the drug demand forecasting model optimization method as described in any of the preceding claims.
[0034] According to a fifth aspect of the present invention, a computer program product is provided, the computer program product comprising a computing program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions that, when executed by a computer, cause the computer to implement the steps of a drug demand forecasting model optimization method as described in any of the preceding claims.
[0035] This invention provides a method, system, device, medium, and program product for optimizing a drug demand forecasting model. The method includes: acquiring local drug time-series data for each pharmacy node, preprocessing the local drug time-series data to obtain drug time-series feature data; training an initialized global drug demand forecasting model using the drug time-series feature data to obtain model update parameters corresponding to each pharmacy node; aggregating the model update parameters corresponding to each pharmacy node into global model update parameters using a federated averaging algorithm; and finally applying the global model update parameters to the current global drug demand forecasting model to obtain an updated global drug demand forecasting model. This invention effectively improves the accuracy of drug demand forecasting, thereby increasing drug inventory turnover and reducing drug management costs. Attached Figure Description
[0036] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.
[0037] Figure 1 A flowchart illustrating a method for optimizing a drug demand forecasting model provided in an embodiment of the present invention;
[0038] Figure 2 This is a schematic diagram of the structure of a drug demand forecasting model optimization system provided in an embodiment of the present invention. Detailed Implementation
[0039] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0040] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0041] Figure 1 A flowchart of a drug demand forecasting model optimization method according to an embodiment of the present invention is shown.
[0042] like Figure 1 As shown, the drug demand forecasting model optimization method according to an embodiment of the present invention may include steps S100, S200, S300 and S400.
[0043] In step S100, for each pharmacy node, the local drug time-series data of the pharmacy node is obtained, and the local drug time-series data is preprocessed to obtain drug time-series feature data.
[0044] Specifically, the above steps include:
[0045] For each pharmacy node, connect to the relevant HIS, SPD and other systems of the pharmacy to obtain local drug time-series data of the pharmacy node. The aforementioned local drug time-series data includes drug entry and exit records, inventory levels, outpatient / inpatient prescription volume and other time-series data.
[0046] Subsequently, the local drug time-series data is cleaned and missing values are handled (e.g., using multiple imputation). Based on the cleaned local drug time-series data, features are constructed. Date features are generated according to weekdays, months, and holidays. Sliding window statistical features are generated according to the average sales of the past 7 days and the year-on-year comparison. Business features are generated according to clinical department scheduling, etc.
[0047] It should be noted that each pharmacy node completes the above steps independently to ensure that the original data is retained locally.
[0048] Next, in step S200, the initialized global drug demand prediction model is trained using drug time-series feature data to obtain the model update parameters corresponding to the pharmacy node.
[0049] Specifically, the above steps include:
[0050] The pharmacy central hub distributes the initialized global drug demand prediction model (such as an LSTM network with random weights) to all pharmacy nodes participating in federated learning.
[0051] For each pharmacy node, the initialized global drug demand prediction model is trained using locally preprocessed drug time-series feature data to obtain the model update parameters corresponding to the pharmacy node. Taking the LSTM model as an example, the pharmacy node uses local data to perform forward propagation to calculate the loss and uses the backpropagation algorithm to calculate the gradient of the model weights (i.e., the direction and magnitude of how the model should be adjusted).
[0052] After training is completed, the pharmacy node does not upload any local raw data. Instead, it uploads the encrypted (TLS / SSL encrypted) model update parameters to the pharmacy central hub through a secure communication channel. The model update parameters include model weights and / or model weight gradients.
[0053] In step S300, the model update parameters corresponding to each pharmacy node are aggregated into global model update parameters using the federated averaging algorithm.
[0054] Specifically, the above steps include:
[0055] At the pharmacy central hub, the Federated Averaging (FedAvg) algorithm is used to average and weight the model update parameters corresponding to each pharmacy node. The node weight is determined based on the amount of data in each pharmacy node, thus obtaining the global model update parameters.
[0056] Finally, in step S400, the global model update parameters are applied to the current global drug demand forecasting model to obtain the updated global drug demand forecasting model.
[0057] Preferably, the drug demand forecasting model optimization method provided in this embodiment of the invention further includes:
[0058] The updated global drug demand forecasting model is redistributed to each pharmacy node, replacing its old model. Each pharmacy node then uses the updated global drug demand forecasting model for the next round of local model training, iterating the global drug demand forecasting model repeatedly until its prediction accuracy converges on the validation set or reaches a preset standard.
[0059] After the drug demand forecasting model has matured through training, it will enter the forecasting application stage:
[0060] On the one hand, each pharmacy node can use the final version of the global drug demand forecasting model to independently forecast future drug demand using the latest local data, obtaining forecasting results that combine a global perspective with local characteristics.
[0061] On the other hand, the central pharmacy hub can also run this global drug demand forecasting model, combining anonymized macroeconomic indicators synchronized from each node (such as total inventory level and total outbound volume) to forecast total demand and formulate procurement strategies at the hospital level.
[0062] In this embodiment of the invention, the model distribution, parameter uploading, and result synchronization throughout the entire process are implemented through a microservice architecture based on message queues such as Apache Pulsar, ensuring low-latency, high-concurrency real-time data interaction capabilities between nodes within the system.
[0063] This embodiment uses Federated Learning as its core technical framework. Federated Learning is a distributed machine learning paradigm whose core idea is "the data remains stationary while the model moves".
[0064] Specifically, this invention does not centrally store sensitive drug circulation data from each pharmacy in the pharmacy warehouse. Instead, it distributes the initial prediction model (including the parameterized state space form of the ARIMA model and the initial weights of the LSTM network) to each pharmacy node. Each pharmacy uses its local historical sales, inventory, and prescription data to train and update the model locally, generating parameter updates (such as gradients or weight increments). Then, each pharmacy only uploads the encrypted model parameter updates to the pharmacy warehouse central hub. After receiving parameter updates from all or some nodes, the pharmacy warehouse central hub merges these updates using a secure aggregation algorithm (FedAvg algorithm) to form a new, more comprehensive, global model. This global model is then redistributed to each pharmacy node for the next round of local training and aggregation. This iterative process ultimately forms a robust prediction model that incorporates data patterns from all nodes across the hospital while strictly protecting the data privacy of each pharmacy.
[0065] In addition, embodiments of the present invention also provide a drug demand forecasting model optimization system. Figure 2 This diagram illustrates the structure of a drug demand forecasting model optimization system, which specifically includes:
[0066] The cache record retrieval module is used to retrieve the cache record of the model to be loaded from the browser database based on the unique identifier of the model to be loaded;
[0067] The node queue generation module is used to generate an octree-structured tile node queue based on cache records and a preset maximum cache level. Each level of the tile node queue corresponds to the tile data of each level of the model to be loaded.
[0068] The tile asynchronous request module is used to asynchronously request tile data corresponding to the backend nodes based on the tile node queue, level by level.
[0069] In addition, embodiments of the present invention also provide a drug demand forecasting model optimization device, the device comprising: a processor and a memory; the memory for storing one or more program instructions; the processor for running one or more program instructions to execute the steps of a drug demand forecasting model optimization method as described above.
[0070] In addition, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the drug demand forecasting model optimization method described above.
[0071] In addition, embodiments of the present invention also provide a computer program product, which includes computer program instructions that, when executed by a processor, implement the steps of a drug demand forecasting model optimization method as described above.
[0072] The drug demand forecasting model optimization method, system, equipment, media, and program products provided in this invention realize deep integration and real-time interaction of data across the entire drug procurement, pharmacy distribution, and clinical use chain; achieve cross-institutional knowledge sharing while protecting data privacy through federated learning technology, and construct an intelligent early warning core using dynamic optimization algorithms; dynamically adapt to national centralized procurement and other pharmaceutical policies, transforming their requirements into calculable parameters for integration into management decisions; and, specifically targeting the needs of special regions, improve the accuracy of drug supply, emergency response capabilities, and the rationality of clinical drug use, ultimately achieving the core objectives of increasing inventory turnover, reducing management costs, and ensuring patient medication safety.
[0073] Compared with the prior art, the present invention has the following advantages:
[0074] In terms of management efficiency, this invention, through full-chain data-driven and intelligent algorithm optimization, increases the drug inventory turnover rate of pilot hospitals by more than 30% and shortens the response time for drug shortage warnings to 4.2 hours, significantly reducing management costs caused by inventory backlog and shortages.
[0075] In terms of medical quality and safety, this invention can be extended to include an embedded clinical rational drug use monitoring module, which can realize pre-prescription review and individualized dosage warning. The goal is to increase the clinical prescription qualification rate from the current 89.3% to over 95%, directly ensuring patient medication safety.
[0076] In terms of policy implementation, this invention can intelligently respond to policy requirements through a policy adaptation engine, improve the accuracy of the completion of the agreed procurement volume of centralized procurement varieties, reduce the deviation between reported volume and actual use, and effectively improve the accessibility of special medicines and the ability to respond quickly to public health emergencies.
[0077] In this embodiment of the invention, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in this embodiment of the invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in this embodiment of the invention can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The processor reads information from the storage medium and, in conjunction with its hardware, completes the steps of the above methods. The storage medium can be memory, for example, volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM).The storage media described in the embodiments of this invention are intended to include, but are not limited to, these and any other suitable types of memory. Those skilled in the art will recognize that the functions described in the above examples can be implemented using a combination of hardware and software. When applied software, the corresponding functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transmission of computer programs from one place to another. Storage media can be any available medium accessible to general-purpose or special-purpose computers. Although the invention has been described in detail above with general description and specific embodiments, modifications or improvements can be made to it, which will be apparent to those skilled in the art. Therefore, such modifications or improvements made without departing from the spirit of the invention are all within the scope of protection claimed by the invention.
[0078] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Any simple modifications, equivalent changes, or alterations made by those skilled in the art using the disclosed technical content shall fall within the protection scope of the present invention.
Claims
1. A method for optimizing a drug demand forecasting model, characterized in that, The method includes: For each pharmacy node, local drug time-series data of the pharmacy node is obtained, and the local drug time-series data is preprocessed to obtain drug time-series feature data. The initialized global drug demand prediction model is trained using the drug time-series feature data to obtain the model update parameters corresponding to the pharmacy node. The federated averaging algorithm is used to aggregate the model update parameters corresponding to each pharmacy node into global model update parameters; The updated global model parameters are applied to the current global drug demand forecasting model to obtain the updated global drug demand forecasting model.
2. The method for optimizing a drug demand forecasting model according to claim 1, characterized in that, The local drug time-series data is preprocessed to obtain drug time-series feature data, including: The local drug time-series data is cleaned and missing values are handled. Based on the cleaned local drug time-series data, feature construction is performed to obtain a drug time-series feature set, which includes date features, statistical features, and business features.
3. The method for optimizing a drug demand forecasting model according to claim 1, characterized in that, The initialized global drug demand prediction model is trained using the aforementioned drug time-series feature data to obtain model update parameters corresponding to the pharmacy node, including: The initialized global drug demand forecasting model is distributed from the central pharmacy hub to each pharmacy node. For each pharmacy node, the time-series drug feature data is used to train the initialized global drug demand prediction model to obtain the model update parameters corresponding to the pharmacy node. The encrypted model update parameters are uploaded to the central hub of the drug depot via a secure communication channel.
4. The method for optimizing a drug demand forecasting model according to claim 1, characterized in that, Using the federated averaging algorithm, the model update parameters corresponding to each pharmacy node are aggregated into global model update parameters, including: At the central pharmacy hub, the federated averaging algorithm is used to average and weight the model update parameters corresponding to each pharmacy node. The node weight is determined based on the amount of data in each pharmacy node, thus obtaining the global model update parameters.
5. The method for optimizing a drug demand forecasting model according to claim 1, characterized in that, The model update parameters include model weights and / or model weight gradients.
6. The method for optimizing a drug demand forecasting model according to claim 1, characterized in that, The method further includes: The updated global drug demand forecasting model is then redistributed to each pharmacy node. Each pharmacy node uses the updated global drug demand prediction model to train its local model for the next round, iterating the global drug demand prediction model until it meets the preset convergence condition.
7. A drug demand forecasting model optimization system, characterized in that, The system includes: The data acquisition and preprocessing module is used to acquire local drug time-series data of each pharmacy node, and preprocess the local drug time-series data to obtain drug time-series feature data. The node model training module is used to train the initialized global drug demand prediction model using the drug time-series feature data to obtain the model update parameters corresponding to the pharmacy node. The global model update module is used to aggregate the model update parameters corresponding to each pharmacy node into global model update parameters using the federated averaging algorithm, and then apply the global model update parameters to the current global drug demand forecasting model to obtain the updated global drug demand forecasting model.
8. A device for optimizing a drug demand forecasting model, characterized in that, The device includes: a processor and a memory; The memory is used to store one or more program instructions; The processor is configured to run one or more program instructions to perform the steps of the drug demand forecasting model optimization method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the drug demand forecasting model optimization method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, The computer program product includes computer program instructions that, when executed by a processor, implement the steps of the drug demand forecasting model optimization method as described in any one of claims 1 to 6.