Drug inventory demand analysis method and system based on sales data
By constructing a policy simulation sandbox and a BERT-TCN-ConvLSTM hybrid model, the problem of delayed response to the coupling effect of policy and public opinion in drug inventory forecasting was solved, and accurate quantification of drug demand and intelligent inventory management were achieved.
Patent Information
- Application Number
- CN202510922256.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-04
- Publication Date
- 2025-10-31
AI Technical Summary
Existing drug inventory forecasting technologies struggle to capture the coupling effect of policy and public opinion in a timely manner, leading to significantly increased forecasting bias during policy adjustments and public health emergencies.
A policy simulation sandbox is constructed, and entity recognition and sentiment intensity analysis in the medical field are performed through the BERT architecture to generate a public opinion pressure index. The TCN-ConvLSTM hybrid model is used to extract multi-source time series features and dynamically assign weights to generate a demand tension vector. Finally, inventory strategy decisions are made through fluctuation entropy analysis.
It enables precise quantification and visual prediction of the impact of medical insurance policies on drug demand, enhances the ability of medical institutions to respond to policy adjustments and public health emergencies, and avoids inventory backlog or shortages.
Smart Images

Figure CN120875749A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of pharmaceutical supply technology, and in particular to a method and system for analyzing drug inventory demand based on sales data. Background Technology
[0002] In the field of pharmaceutical supply chain management, traditional methods for forecasting drug inventory demand mainly rely on time-series analysis models of historical sales data, such as the ARIMA algorithm. These methods generate inventory replenishment recommendations by analyzing the time-series characteristics of drug sales and incorporating seasonal adjustment factors. Existing technology proposes a drug demand forecasting system based on deep neural networks. This system uses LSTM to capture the nonlinear characteristics of sales data and introduces external weather factors as auxiliary variables, thereby improving forecast accuracy. This technology represents the mainstream development direction of intelligent drug inventory management.
[0003] Existing technologies have limitations in addressing the impact of sudden policy adjustments and regional public opinion shifts on drug demand. When significant changes occur in medical insurance policies or public opinion fluctuations are triggered by public health emergencies, traditional models struggle to capture the coupling effect of policy and public opinion on drug demand in a timely manner. This is because existing technologies lack the ability to structurally analyze policy texts and have not established a dynamic correlation model between policy factors and public opinion factors, leading to significantly increased prediction bias during policy windows or the early stages of an outbreak. Summary of the Invention
[0004] In view of the aforementioned existing problems, the present invention is proposed.
[0005] Therefore, this invention provides a method for analyzing drug inventory demand based on sales data to address the problem of delayed response to policy-public opinion coupling effects in drug inventory forecasting technology.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0007] In a first aspect, the present invention provides a method for analyzing drug inventory demand based on sales data, which includes: real-time collection of multimodal data of the pharmaceutical supply chain and preprocessing it; constructing a policy simulation sandbox to analyze the impact of medical insurance policies; and generating a policy-demand coupling matrix.
[0008] Using the BERT architecture, entity recognition and sentiment intensity analysis are performed on preprocessed multimodal data of the pharmaceutical supply chain in the medical field, outputting a public opinion pressure index. Spatial coordinate transformation is performed through a geographic entity association mapping method to generate a geographic public opinion pressure index.
[0009] By integrating the policy-demand coupling matrix and the public opinion geographic pressure index, a demand tension vector is generated through multi-source time-series feature extraction and dynamic weight allocation using a TCN-ConvLSTM hybrid model.
[0010] By analyzing the fluctuation entropy value, inventory strategy decisions are made based on the demand tension vector to obtain a drug procurement plan, and multi-dimensional demand decomposition is performed to generate drug inventory demand.
[0011] As a preferred embodiment of the drug inventory demand analysis method based on sales data described in this invention, the multimodal data of the pharmaceutical supply chain includes pharmacy sales data, medical text data, medical insurance policy change data, and social media sentiment data;
[0012] The preprocessing includes time alignment, anomaly detection, normalization transformation, and feature enhancement.
[0013] As a preferred embodiment of the drug inventory demand analysis method based on sales data described in this invention, the specific steps for constructing a policy simulation sandbox to analyze the impact of medical insurance policies and generate a policy-demand coupling matrix are as follows:
[0014] Based on preprocessed multimodal data of the pharmaceutical supply chain, a policy simulation sandbox is constructed by configuring the time window, regional labeling and reimbursement gradient of medical insurance policies through a parameterized engine.
[0015] Multiple rounds of impact tests on medical insurance policy changes were conducted in a policy simulation sandbox to calculate the elasticity coefficient of medical insurance policy change data to pharmacy sales data and generate a policy-drug demand response surface.
[0016] The nonlinear mapping relationship between policy and drug demand response surface changes is fitted to generate a policy-demand correlation strength matrix and conduct stability tests to generate a policy-demand coupling matrix.
[0017] As a preferred embodiment of the drug inventory demand analysis method based on sales data described in this invention, the method employs a BERT architecture to perform medical entity recognition and sentiment intensity analysis on preprocessed multimodal data of the pharmaceutical supply chain, outputting a public opinion pressure index. The specific steps are as follows:
[0018] The BERT architecture is trained for domain adaptation based on preprocessed multimodal data of the pharmaceutical supply chain to obtain the BERT-Medical model;
[0019] Using the BERT-Medical model, we performed medical entity recognition on the preprocessed multimodal data of the pharmaceutical supply chain, extracted drug names, disease names, and treatment plans to obtain medical entities, and conducted sentiment intensity analysis to obtain the sentiment intensity value of drug accessibility anxiety.
[0020] By calculating the regional semantic relevance of entities and emotional intensity values in the medical field and integrating multi-dimensional features, a public opinion pressure index is generated.
[0021] As a preferred embodiment of the drug inventory demand analysis method based on sales data described in this invention, the step of generating a geographic public opinion pressure index through spatial coordinate transformation using a geographic entity association mapping method is as follows:
[0022] Extract the regional names and medical service point information of the public opinion pressure index to generate geographic entity data;
[0023] Geographic entity data is matched with a geocoding library and spatially mapped to generate a geographic public opinion pressure index.
[0024] As a preferred embodiment of the drug inventory demand analysis method based on sales data described in this invention, the method integrates the policy-demand coupling matrix and the public opinion geographic pressure index, and uses a TCN-ConvLSTM hybrid model to extract multi-source time-series features and dynamically assign weights to generate a demand tension vector. The specific steps are as follows:
[0025] The policy-demand coupling matrix and the geographic public opinion pressure index are synchronized with timestamps and matched with spatial grids to generate a policy-public opinion alignment matrix;
[0026] By combining the dilated causal convolutional layer of TCN with the three-dimensional gated recurrent mechanism of ConvLSTM, feature interaction and hierarchical fusion are performed to obtain a spatiotemporal feature joint extraction architecture.
[0027] Based on the historical policy-public opinion alignment matrix, the TCN-ConvLSTM hybrid model is obtained by end-to-end joint training of the spatiotemporal feature joint extraction architecture through an adaptive moment estimation optimizer.
[0028] The policy-public opinion alignment matrix is input into the TCN-ConvLSTM hybrid model to extract the long-term trend features of policy impact and capture the spatiotemporal correlation features of public opinion dissemination.
[0029] Based on long-term trend characteristics and spatiotemporal correlation characteristics, the dynamic contribution weights of policies and public opinion are calculated and weighted to generate a demand tension vector.
[0030] As a preferred embodiment of the drug inventory demand analysis method based on sales data described in this invention, the steps of analyzing fluctuation entropy values to make inventory strategy decisions based on the demand tension vector, obtaining a drug procurement plan, and performing multi-dimensional demand decomposition to generate drug inventory demand are as follows:
[0031] Based on the demand tension vector, the fluctuation intensity of each drug demand sequence is calculated using the Shannon entropy variant algorithm, and the entropy value is used to label the demand vector. Then, a three-order decision tree is used to match the inventory management strategy and output the drug procurement plan.
[0032] The drug procurement plan is decomposed into two dimensions: treatment area and turnover rate, to generate drug inventory demand.
[0033] Secondly, the present invention provides a drug inventory demand analysis system based on sales data, including a data acquisition module for real-time acquisition of multimodal data of the pharmaceutical supply chain, preprocessing, constructing a policy simulation sandbox for medical insurance policy impact analysis, and generating a policy-demand coupling matrix.
[0034] The analysis module uses the BERT architecture to perform entity recognition and sentiment intensity analysis on pre-processed multimodal data of the pharmaceutical supply chain, outputs a public opinion pressure index, and generates a geographic public opinion pressure index by performing spatial coordinate transformation through a geographic entity association mapping method.
[0035] The prediction module is used to integrate the policy-demand coupling matrix and the public opinion geographic pressure index. It uses a TCN-ConvLSTM hybrid model to extract multi-source time-series features and dynamically assign weights to generate a demand tension vector.
[0036] The decision-making module is used to make inventory strategy decisions based on the demand tension vector through fluctuation entropy analysis, obtain drug procurement plans, and perform multi-dimensional demand decomposition to generate drug inventory demand.
[0037] Thirdly, the present invention provides a computer device including a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, it implements any step of the method for analyzing drug inventory demand based on sales data as described in the first aspect of the present invention.
[0038] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the method for analyzing drug inventory demand based on sales data as described in the first aspect of the present invention.
[0039] The beneficial effects of this invention are as follows: By constructing a policy simulation sandbox, the impact of medical insurance policies on drug demand is accurately quantified and visualized for prediction, enabling medical institutions to anticipate demand changes brought about by policy adjustments and effectively avoid inventory backlog or shortages. Simultaneously, through a hybrid analysis model integrating policy and public opinion data, key influencing factors in different scenarios are intelligently identified, and inventory decision-making schemes are dynamically optimized. Ultimately, this achieves an intelligent upgrade of drug supply chain management, significantly improving the response capabilities and inventory management efficiency of medical institutions in dealing with policy adjustments and public health emergencies, and providing reliable guarantees for patient access to medication. Attached Figure Description
[0040] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 This is a flowchart illustrating a method for analyzing drug inventory demand based on sales data.
[0042] Figure 2 This is a schematic diagram of a drug inventory demand analysis system based on sales data.
[0043] Figure 3 A flowchart for generating the public opinion pressure index.
[0044] Figure 4 A flowchart for generating the demand tension vector. Detailed Implementation
[0045] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0046] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0047] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0048] Reference Figures 1-4This is one embodiment of the present invention, which provides a method for analyzing drug inventory demand based on sales data, including the following steps:
[0049] S1. Collect multimodal data from the pharmaceutical supply chain in real time and perform preprocessing.
[0050] S1.1, Multimodal data in the pharmaceutical supply chain includes pharmacy sales data, medical text data, medical insurance policy change data, and social media sentiment data.
[0051] S1.2 Preprocessing includes time alignment, anomaly detection, normalization transformation, and feature enhancement.
[0052] Specifically, time alignment: pharmacy sales data, medical text data, medical insurance policy change data and social media sentiment data in the multimodal data of the pharmaceutical supply chain are matched according to a unified time benchmark. A sliding window mechanism is used to align data with different collection frequencies to the same time granularity. An example time window is set to 1 day, and missing data is filled with linear interpolation.
[0053] Anomaly detection: Based on the historical distribution characteristics of pharmacy sales data and medical text data, the 3σ criterion is used to identify abnormal values in pharmacy sales data and medical text data. The version number is used to verify the logical consistency of medical insurance policy change data. Social media sentiment data is used to detect abnormal text through sentiment polarity mutation. After anomaly data is marked, it is replaced with the average of adjacent time periods.
[0054] Standardization transformation: Pharmacy sales data and medical text data are Min-Max normalized to the [0,1] range according to drug and medical text categories; reimbursement ratios in medical insurance policy change data are converted to percentage values; and the sentiment intensity values of social media sentiment data are mapped to a 5-level Likert scale, with an example rating of 1 (extremely negative) to 5 (extremely positive).
[0055] Feature enhancement: Trend features are generated by overlaying pharmacy sales data and medical text data with a 7-day moving average. The time difference between the effective date of medical insurance policy changes is extracted as a timeliness feature from medical insurance policy change data. Keyword density features are generated by weighting social media sentiment data with TF-IDF. The trend features, timeliness features and keyword density features are merged into enhanced data according to timestamps.
[0056] S2. Construct a policy simulation sandbox to analyze the impact of medical insurance policies and generate a policy-demand coupling matrix.
[0057] S2.1 Based on preprocessed multimodal data of the pharmaceutical supply chain, a policy simulation sandbox is constructed by configuring the time window, regional labeling and reimbursement gradient of medical insurance policies through a parameterized engine.
[0058] Specifically, the preprocessed multimodal data of the pharmaceutical supply chain is input into the parameterization engine. The medical insurance policy time window is formed by parsing the medical insurance policy effective date field in the medical insurance policy change data, extracting the date value, and setting the start date of the medical insurance policy to 30 days before the effective date of the example value, and the end date of the medical insurance policy to 30 days after the effective date of the example value, forming a fixed time window of 61 days for the example calculation value. The regional labeling process calls the geocoding library to convert the latitude and longitude fields in the pharmacy sales data into 6-character codes of the example encoding length. Each 6-character code corresponds to an example geographic grid size of approximately 1.2 kilometers by 1.2 kilometers.
[0059] The reimbursement gradient processing reads the reimbursement ratio field from the medical insurance policy change data, sets the first tier to the lower limit of the exemplary interval (0% to the upper limit of the exemplary interval, 30% to the upper limit of the exemplary interval), the second tier to the median of the exemplary interval (30.01% to the upper limit of the exemplary interval, 70% to the upper limit of the exemplary interval), and the third tier to the lower limit of the exemplary interval (70.01% to the upper limit of the exemplary interval, 100% to the upper limit of the exemplary interval), and uses the greater than and less than or equal to operators to determine the intervals. A composite index table containing three dimensions—medical insurance policy time window, regional marker, and reimbursement gradient—is created in the in-memory database. The composite index table is then mapped to these three dimensions to complete the construction of the policy simulation sandbox.
[0060] S2.2 Conduct multiple rounds of impact tests on medical insurance policy changes in the policy simulation sandbox, calculate the elasticity coefficient of medical insurance policy change data on pharmacy sales data, and generate a policy-drug demand response surface.
[0061] Specifically, multiple rounds of impact tests on medical insurance policy changes are conducted in a policy simulation sandbox. For each impact test, the effective date of the medical insurance policy or the reimbursement ratio level is modified, while other dimensions remain unchanged. The change in drug sales volume in pharmacy sales data during the test period is obtained, and the percentage change in sales volume is calculated. The ratio of the reimbursement ratio adjustment in the medical insurance policy change data to the percentage change in drug sales volume is calculated to obtain the elasticity coefficient. This exemplary test is repeated 10 times, with different combinations of medical insurance policy parameters randomly selected for each test. The elasticity coefficients obtained from each round of testing and the corresponding policy parameter combinations are stored in the result set.
[0062] In the policy simulation sandbox, the elasticity coefficient values obtained from multiple rounds of testing are used as spatial data points. Spatial interpolation is performed based on these discrete data points. Intermediate values are filled at fixed intervals in the time dimension, transitional filling is performed based on the values of adjacent grid points in the geographical dimension, and intermediate level data is supplemented according to the proportional change trend in the reimbursement gradient dimension. By smoothly connecting the interpolation points in each dimension, a continuous surface is formed, and finally, a policy-drug demand response surface is generated.
[0063] It should be noted that the expression for the elasticity coefficient is obtained by calculating the ratio of the reimbursement ratio adjustment in the medical insurance policy change data to the percentage change in drug sales:
[0064]
[0065] Where E is the elasticity coefficient, with an example value of (1.25), (Q1-Q0) is the change in drug sales, Q1 is the drug sales before the adjustment of the medical insurance policy, Q0 is the drug sales after the adjustment of the medical insurance policy, (P1-P0) is the change in the reimbursement ratio, P1 is the reimbursement ratio before the adjustment of the medical insurance policy, and P0 is the reimbursement ratio after the adjustment of the medical insurance policy.
[0066] S2.3 Fit the nonlinear mapping relationship of the policy-drug demand response surface change, generate the policy-demand correlation strength matrix and conduct stability tests to generate the policy-demand coupling matrix.
[0067] Specifically, extreme points and inflection points are extracted from the policy-drug demand response surface as key feature points; for each key feature point, the medical insurance policy time window, regional label, and reimbursement gradient parameter combination and corresponding elasticity coefficient value are collected in the surrounding area; the least squares method is used to perform polynomial fitting on the data points in each feature point area, and iterative adjustment is performed until the sum of squared residuals is less than the example of 0.01, so as to obtain the set of polynomial regression coefficients for each feature point area.
[0068] The set of polynomial regression coefficients is normalized to its maximum and minimum values, transforming it to the interval between 0 and 1 to form the association strength value. The association strength value is arranged according to three dimensions: the exemplary 30-day interval of the medical insurance policy time window, the exemplary 6-digit geocode of the regional label, and the exemplary 5% interval of the reimbursement gradient. The arranged three-dimensional data is subjected to 10 exemplary bootstrap resampling operations, and the association strength is recalculated by randomly retaining 80% of the three-dimensional data each time. The fluctuation range of the association strength value at each location is recorded. Relatively stable locations with a fluctuation range of less than the exemplary 15% are selected and the association strength values of these locations are retained. The association strength values of the stable locations are reorganized and arranged according to the original three-dimensional coordinates to form the final policy-demand coupling matrix.
[0069] S3. Using the BERT architecture, it performs entity recognition and sentiment intensity analysis on preprocessed multimodal data of the pharmaceutical supply chain in the medical field, and outputs a public opinion pressure index.
[0070] S3.1. Based on the preprocessed multimodal data of the pharmaceutical supply chain, the BERT architecture is trained for domain adaptation to obtain the BERT-Medical model.
[0071] Specifically, medical text data from the preprocessed multimodal data of the pharmaceutical supply chain is extracted as training corpus. The medical text data is divided into training and validation sets according to an exemplary ratio of 8:2, and the basic pre-trained weights of the BERT architecture are loaded, including 12 layers of Transformer encoders and 768-dimensional hidden layers. After the word sequences of the medical text data are input into the BERT architecture, they are processed by the 12-layer Transformer encoder to obtain the context-dependent representation of each word. With an exemplary batch size of 32, the BERT architecture processes 32 text samples simultaneously, with each sample truncated or padded to an exemplary length of 128 words.
[0072] The cross-entropy loss between the BERT architecture output and the medical entity annotation data is calculated, and the parameters are updated using the Adam optimizer with an exemplary learning rate of 5e-5. The BERT architecture parameters are continuously adjusted within the exemplary 3 training cycles, and the intermediate BERT architecture is saved after every exemplary 1000 training steps. The medical entity recognition accuracy of the intermediate BERT architecture is evaluated on the validation set, and the optimal BERT architecture parameters with an exemplary F1 score of 0.85 or higher are retained. Finally, a BERT-Medical model that can recognize medical entities such as drug names, disease names, and treatment plans is obtained.
[0073] It should be noted that the expression for calculating the cross-entropy loss between the BERT architecture output and the entity annotation data in the medical field is as follows:
[0074]
[0075] Where L is the cross-entropy loss, N is the number of samples in the batch, i is the index variable for the number of samples, C is the total number of entity categories (including drug name, disease name, and treatment plan), c is the index variable for the entity category, and y is the index variable for the entity category. i,c It is the true label of the i-th sample in the c-th class, (p i,c ) is the probability that the BERT architecture predicts the i-th sample belongs to the c-th class.
[0076] S3.2. Using the BERT-Medical model, identify entities in the medical field from the preprocessed multimodal data of the pharmaceutical supply chain, extract drug names, disease names and treatment plans to obtain entities in the medical field, and perform sentiment intensity analysis to obtain the sentiment intensity value of drug accessibility anxiety.
[0077] Specifically, the preprocessed multimodal data of the pharmaceutical supply chain is input into the BERT-Medical model. The medical text data is converted into 768-dimensional word vectors after word segmentation. The 768-dimensional word vector sequence is processed by a 12-layer Transformer encoder to output the context representation of each word. In the entity recognition task, a fully connected layer and a softmax classifier are applied to the output representation of each word to predict the probability distribution of belonging to drug name, disease name, or treatment plan. The prediction results with a probability greater than the example of 0.7 are taken as entities in the medical field. In the sentiment analysis task, the [CLS]-tagged representation vector is extracted from sentences containing drug names. The sentiment classifier outputs the sentiment polarity score. The sentiment polarity score range of -1 (negative) to +1 (positive) is mapped to the drug accessibility anxiety index. The example score is less than -0.5, which corresponds to a high anxiety level; -0.5 to 0 corresponds to a medium anxiety level; and greater than 0 corresponds to a low anxiety level. The sentiment intensity value of drug accessibility anxiety is obtained.
[0078] S3.3 Calculate the regional semantic relevance of entities and emotional intensity values in the medical field and integrate multi-dimensional features to generate a public opinion pressure index.
[0079] Specifically, the medical entities and sentiment intensity values are grouped and aggregated according to administrative divisions. The frequency of drug names appearing in each administrative region is normalized and converted into a popularity value in the range of 0-1. The sentiment intensity values in the administrative region are weighted and summed with exemplary weights of 0.6 (negative sentiment) and 0.4 (positive sentiment) to obtain the administrative region sentiment index. The co-occurrence frequency of disease names and drug names in the medical entities is calculated, and the semantic relevance is measured using the exemplary Jaccard similarity coefficient. The three dimensions of administrative region drug popularity value, regional sentiment index and semantic relevance are integrated and weighted in the exemplary ratio of 4:3:3. The weighted combination result is subjected to exemplary Min-Max standardization and mapped to the range of 0-100 to form a public opinion pressure index, where an exemplary value above 60 is defined as a high-risk public opinion pressure area, 30-60 as a medium-risk area, and below 30 as a low-risk area.
[0080] It should be noted that the expression for calculating the co-occurrence frequency of disease names and drug names in medical entities is as follows:
[0081]
[0082] Among them, F d,m This represents the co-occurrence frequency of disease name d and drug name m in the medical field, where a is the total number of analyzed texts, v is the index variable of the analyzed texts, d is the disease name, m is the drug name, and D... v M is the set of disease names appearing in the vth text. vLet I be the set of drug names appearing in the vth text, and let I be an exponential function.
[0083] S4. Spatial coordinate transformation is performed through the geographic entity association mapping method to generate the geographic public opinion pressure index.
[0084] S4.1 Extract the regional names and medical service point information of the public opinion pressure index to generate geographic entity data.
[0085] Specifically, the process involves extracting administrative division names from the public opinion pressure index data, and simultaneously extracting the medical institution name, latitude and longitude coordinates, and institution type fields from the medical service point information; matching and verifying the administrative division names against the national standard administrative division code library to ensure standardized and consistent names; performing an exemplary 6-decimal-place precision check on the latitude and longitude coordinates of the medical service points to remove data points with abnormal latitude and longitude formats; associating and matching the verified administrative division names with the medical service point information according to the regional code to form structured records; each record contains exemplary fields: full name of administrative division, regional code, medical institution name, latitude and longitude coordinates, institution type, and corresponding public opinion pressure index value; and finally outputting a geographic entity dataset that conforms to geographic data standards.
[0086] S4.2 Match and spatially map geographic entity data with geocoding databases to generate a geographic public opinion pressure index.
[0087] Specifically, the administrative division names in the geographic entity data are precisely matched with the standard names in the geocoding library. The Levenshtein distance algorithm, an exemplary string similarity algorithm, is used to assist in handling name differences. Records with a similarity of 0.9 or higher are considered successful matches. The latitude and longitude coordinates of medical service points are compared with the spatial index in the geocoding library to determine the point-area inclusion relationship, identifying the exemplary 1.2-kilometer grid area to which each medical service point belongs. The successfully matched administrative division records and medical service point records are associated, and the corresponding exemplary 6-digit administrative division code and exemplary 9-digit grid code are extracted from the geocoding library. The public opinion pressure index values are aggregated according to the administrative division code and grid code, and the index values within each administrative region are weighted and averaged. The density weight of medical service points is set to the reciprocal of the number of medical service points. Finally, a geographic public opinion pressure index containing the standard administrative division code, grid code, and regional public opinion pressure index is output.
[0088] S5. The policy-demand coupling matrix and the public opinion geographic pressure index are integrated, and multi-source time series feature extraction and dynamic weight allocation are performed through the TCN-ConvLSTM hybrid model to generate a demand tension vector.
[0089] S5.1. Perform timestamp synchronization and spatial grid matching on the policy-demand coupling matrix and the geographic public opinion pressure index to generate a policy-public opinion alignment matrix.
[0090] Specifically, the policy-demand coupling matrix and the geographic public opinion pressure index are aligned by time dimension, and records within the same date range are extracted; the exemplary 30-day time window in the policy-demand coupling matrix is matched with the exemplary daily granularity timestamp in the geographic public opinion pressure index, and the geographic public opinion pressure index is subjected to exemplary linear interpolation processing based on the time window of the policy-demand coupling matrix.
[0091] In the spatial dimension, the exemplary 6-bit geocode in the policy-demand coupling matrix and the exemplary 9-bit grid code in the geographic public opinion pressure index are used to determine the hierarchical inclusion relationship, ensuring that each policy-demand coupling matrix region contains a complete number of geographic public opinion pressure index grids; for successfully matched spatiotemporal data units, the association strength value in the policy-demand coupling matrix is concatenated with the geographic public opinion pressure index value to form a complete record containing time window identifier, geocode, policy association strength, and public opinion pressure value; finally, a policy-public opinion alignment matrix with a unified spatiotemporal benchmark is output.
[0092] S5.2. The dilated causal convolutional layer of TCN and the three-dimensional gated recurrent mechanism of ConvLSTM are combined to perform feature interaction and hierarchical fusion to obtain a spatiotemporal feature joint extraction architecture.
[0093] Specifically, the TCN's dilated causal convolutional layers process the input sequence with an exemplary dilation factor of 2, and each layer uses an exemplary 64 3×3 convolutional kernels to extract temporal features, downsampling with an exemplary stride of 2; the ConvLSTM's three-dimensional gated recurrent mechanism processes the spatiotemporal input with an exemplary 32 5×5×5 convolutional kernels, and the forget gate uses an exemplary sigmoid activation function to control the information flow; the output feature map of the last layer of the TCN is recombined into a three-dimensional tensor by time step, aligned with the input dimension of the ConvLSTM; in the feature interaction stage, the temporal feature map of the TCN is adjusted for the number of channels by an exemplary 1×1 transposed convolution and then added element-wise with the hidden state of the ConvLSTM; during layer fusion, the exemplary 4 layers of dilated convolutional output of the TCN are concatenated with the gated output of the corresponding depth of the ConvLSTM, and then fused with an exemplary 3×3 convolutional kernel before being passed to the next layer; finally, a spatiotemporal feature joint extraction architecture is output.
[0094] S5.3 Based on the historical policy-public opinion alignment matrix, the TCN-ConvLSTM hybrid model is obtained by end-to-end joint training of the spatiotemporal feature joint extraction architecture through an adaptive moment estimation optimizer.
[0095] Specifically, the historical policy-public opinion alignment matrix is divided into training and validation sets according to time order. The training set samples are grouped according to an exemplary batch size of 32, and each batch contains policy-public opinion data within a continuous time window. In the spatiotemporal feature joint extraction architecture, the TCN part is configured with an exemplary 4-layer dilated causal convolution, with the dilation coefficient increasing in increments of [1, 2, 4, 8], and each layer uses an exemplary 64 3×3 convolution kernels; the ConvLSTM part is set with an exemplary 32 5×5×5 three-dimensional convolution kernels, and the time step is set to an exemplary 2. The adaptive moment estimation optimizer parameters are fixed with an exemplary initial learning rate of 0.001, momentum parameters beta1 of 0.9, and beta2 of 0.999.
[0096] Each training batch inputs a spatiotemporal feature joint extraction architecture. The TCN dilated causal convolutional layer extracts long-term trend features of policy impact layer by layer, while the ConvLSTM 3D gated recurrent mechanism captures the spatiotemporal correlation features of public opinion dissemination. After forward propagation, the difference between the predicted demand tension vector and the true value is calculated using an exemplary mean squared error function. During backpropagation, the maximum norm of the gradient is limited to an exemplary 5.0. After every exemplary 1000 training steps, the performance of the TCN-ConvLSTM hybrid model is evaluated on an independent validation set, and the validation loss and weight parameters are recorded.
[0097] During training, the validation loss is continuously monitored. If no decrease is observed in 10 consecutive exemplary evaluations, an early stopping mechanism is triggered to terminate training. Finally, the parameter combination with the minimum validation set loss is selected from all saved intermediate TCN-ConvLSTM hybrid models as the TCN-ConvLSTM hybrid model.
[0098] S5.4 Input the policy-public opinion alignment matrix into the TCN-ConvLSTM hybrid model to extract the long-term trend features of policy impact and capture the spatiotemporal correlation features of public opinion dissemination.
[0099] Specifically, after the policy-public opinion alignment matrix is input into the TCN-ConvLSTM hybrid model, the dilated causal convolutional layer of the TCN part processes the time series data layer by layer according to the exemplary dilation coefficient sequence [1,2,4,8]. Each layer uses an exemplary 64 3×3 convolutional kernels for feature extraction. The receptive field is gradually expanded through the exemplary 4-layer network structure, and finally the long-term trend features of the policy impact are output.
[0100] The ConvLSTM part scans the spatial dimension with 32 5×5×5 three-dimensional convolutional kernels as an example, with a fixed time step of 2 as an example. The information flow is controlled by the sigmoid activation function of the forget gate and the input gate. The cell state is continuously updated within 8 time steps as an example, and the spatiotemporal correlation features of public opinion propagation are output.
[0101] S5.5 Based on long-term trend characteristics and spatiotemporal correlation characteristics, calculate the dynamic contribution weights of policies and public opinion and perform weighted fusion to generate a demand tension vector.
[0102] Specifically, long-term trend features and spatiotemporal correlation features are input into a 128-dimensional fully connected layer, and the ReLU activation function is used to compress the 256-dimensional features to 128 dimensions. Both fully connected layers use the same initialization parameters, and the output dimension is uniformly 128-dimensional feature vectors. An attention mechanism is used to obtain the dynamic weights of the long-term trend features and spatiotemporal correlation features, where the query vector comes from the long-term trend features and the key-value vector comes from the spatiotemporal correlation features. The attention score is normalized to the dynamic weights of the long-term trend features and spatiotemporal correlation features in the range of 0 to 1 using the softmax function, and an exemplary temperature parameter of 1.0 is set to control the smoothness of the weight distribution. An exemplary initial base weight of 0.6 is assigned to the long-term trend features, and an exemplary initial base weight of 0.4 is assigned to the spatiotemporal correlation features, and these are weighted and harmonicized with the attention weights. The weighted feature vectors are concatenated according to an exemplary ratio and then fused through a fully connected layer. Finally, a demand tension vector is generated.
[0103] S6. Through fluctuation entropy analysis, inventory strategy decisions are made based on the demand tension vector to obtain a drug procurement plan, and multi-dimensional demand decomposition is performed to generate drug inventory demand.
[0104] S6.1 Based on the demand tension vector, the fluctuation intensity of each drug demand sequence is calculated using the Shannon entropy variant algorithm to generate an entropy value-labeled demand vector. Then, a three-order decision tree is used to match the inventory management strategy and output the drug procurement plan.
[0105] Specifically, the demand tension vector is grouped by drug category, and the demand change sequence for each drug category within an exemplary 7-day time window is extracted. For each drug demand sequence, the Shannon entropy value is calculated, and the uncertainty of the probability distribution is calculated using the exemplary logarithmic base 2. When the demand fluctuation within the window exceeds the exemplary 15%, the entropy weight is increased. The entropy results are normalized to the 0-1 interval, generating an entropy-labeled demand vector containing the drug code and corresponding entropy value. A three-order decision tree is preset with exemplary split points of entropy values 0.3 and 0.7, classifying drugs into three categories: low volatility, medium volatility, and high volatility. Low volatility drugs adopt an exemplary fixed-cycle replenishment strategy with an exemplary replenishment cycle of 30 days. Medium volatility drugs adopt an exemplary (s,S) strategy with a safety stock of 1.5 times the exemplary weekly average sales. High volatility drugs adopt an exemplary dynamic adjustment strategy, monitoring inventory daily and setting an exemplary replenishment trigger line of 3 days' estimated sales. Finally, a drug procurement plan containing drug codes, classification results, and corresponding replenishment strategies is output.
[0106] It should be noted that the expression for calculating the Shannon entropy variant value for each drug demand sequence is as follows:
[0107]
[0108] Where H is the Shannon entropy variant value, T is the time window length (7 days for example), t is the index variable of the time window length, and x t λ is the drug demand on day t, λ is the adjustment parameter (example value is 0.5), and s is the mean of the demand sequence.
[0109] S6.2 Decompose the drug procurement plan into two dimensions: treatment area and turnover rate, to generate drug inventory demand.
[0110] Specifically, the drug procurement plan is divided into 12 exemplary therapeutic areas, with each category of drugs classified according to their pharmacological characteristics. Drug turnover is simultaneously tracked, and the turnover level is determined by the ratio of exemplary 30-day sales records to the average inventory, categorized into three levels: high turnover (exemplary 2.0 or higher), medium turnover (1.0 to 2.0), and low turnover (below 1.0). A two-dimensional classification matrix is formed by crossing therapeutic areas and turnover levels. High-turnover drugs are configured with an exemplary 7-day usage as the baseline inventory, medium-turnover drugs maintain an exemplary 10-day usage, and low-turnover drugs retain an exemplary 14-day usage. Core therapeutic drugs use an exemplary 15-day replenishment frequency, while non-core drugs extend to an exemplary 30-day replenishment frequency. The output includes drug inventory requirements with elements such as drug identification, therapeutic category, turnover level, baseline inventory quantity, and replenishment frequency.
[0111] This embodiment also provides a drug inventory demand analysis system based on sales data, including:
[0112] The data acquisition module is used to collect multimodal data from the pharmaceutical supply chain in real time, perform preprocessing, build a policy simulation sandbox to analyze the impact of medical insurance policies, and generate a policy-demand coupling matrix.
[0113] The analysis module uses the BERT architecture to perform entity recognition and sentiment intensity analysis on pre-processed multimodal data of the pharmaceutical supply chain, outputs a public opinion pressure index, and generates a geographic public opinion pressure index by performing spatial coordinate transformation through a geographic entity association mapping method.
[0114] The prediction module is used to integrate the policy-demand coupling matrix and the public opinion geographic pressure index. It uses a TCN-ConvLSTM hybrid model to extract multi-source time-series features and dynamically assign weights to generate a demand tension vector.
[0115] The decision-making module is used to make inventory strategy decisions based on the demand tension vector through fluctuation entropy analysis, obtain drug procurement plans, and perform multi-dimensional demand decomposition to generate drug inventory demand.
[0116] This embodiment also provides a computer device applicable to the analysis method of drug inventory demand based on sales data, including: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the analysis method of drug inventory demand based on sales data as proposed in the above embodiment.
[0117] The computer device can be a terminal, comprising a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.
[0118] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements the method for analyzing drug inventory demand based on sales data as proposed in the above embodiments. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0119] In summary, this invention achieves precise quantification and visual prediction of the impact of medical insurance policies on drug demand by constructing a policy simulation sandbox, enabling medical institutions to anticipate demand changes brought about by policy adjustments and effectively avoid inventory backlogs or shortages. Simultaneously, through a hybrid analysis model integrating policy and public opinion data, it intelligently identifies key influencing factors in different scenarios and dynamically optimizes inventory decision-making schemes, ultimately realizing an intelligent upgrade of drug supply chain management. This significantly improves medical institutions' response capabilities to policy adjustments and public health emergencies, enhances their inventory management efficiency, and provides reliable guarantees for patient access to medication.
[0120] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for analyzing drug inventory demand based on sales data, characterized in that: include, Real-time collection of multimodal data from the pharmaceutical supply chain, preprocessing, construction of a policy simulation sandbox for medical insurance policy impact analysis, and generation of a policy-demand coupling matrix; Using the BERT architecture, entity recognition and sentiment intensity analysis are performed on preprocessed multimodal data of the pharmaceutical supply chain in the medical field, outputting a public opinion pressure index. Spatial coordinate transformation is performed through a geographic entity association mapping method to generate a geographic public opinion pressure index. By integrating the policy-demand coupling matrix and the public opinion geographic pressure index, a demand tension vector is generated through multi-source time-series feature extraction and dynamic weight allocation using a TCN-ConvLSTM hybrid model. By analyzing the fluctuation entropy value, inventory strategy decisions are made based on the demand tension vector to obtain a drug procurement plan, and multi-dimensional demand decomposition is performed to generate drug inventory demand.
2. The method for analyzing drug inventory demand based on sales data as described in claim 1, characterized in that: The multimodal data of the pharmaceutical supply chain includes pharmacy sales data, medical text data, medical insurance policy change data, and social media sentiment data; The preprocessing includes time alignment, anomaly detection, normalization transformation, and feature enhancement.
3. The method for analyzing drug inventory demand based on sales data as described in claim 2, characterized in that: The process of constructing a policy simulation sandbox to analyze the impact of medical insurance policies and generate a policy-demand coupling matrix involves the following steps: Based on preprocessed multimodal data of the pharmaceutical supply chain, a policy simulation sandbox is constructed by configuring the time window, regional labeling and reimbursement gradient of medical insurance policies through a parameterized engine. Multiple rounds of impact tests on medical insurance policy changes were conducted in a policy simulation sandbox to calculate the elasticity coefficient of medical insurance policy change data to pharmacy sales data and generate a policy-drug demand response surface. The nonlinear mapping relationship between policy and drug demand response surface changes is fitted to generate a policy-demand correlation strength matrix and conduct stability tests to generate a policy-demand coupling matrix.
4. The method for analyzing drug inventory demand based on sales data as described in claim 1, characterized in that: The method employs the BERT architecture to perform entity recognition and sentiment intensity analysis on preprocessed multimodal data from the pharmaceutical supply chain, outputting a public opinion pressure index. The specific steps are as follows: The BERT architecture is trained for domain adaptation based on preprocessed multimodal data of the pharmaceutical supply chain to obtain the BERT-Medical model; Using the BERT-Medical model, we performed medical entity recognition on the preprocessed multimodal data of the pharmaceutical supply chain, extracted drug names, disease names, and treatment plans to obtain medical entities, and conducted sentiment intensity analysis to obtain the sentiment intensity value of drug accessibility anxiety. By calculating the regional semantic relevance of entities and emotional intensity values in the medical field and integrating multi-dimensional features, a public opinion pressure index is generated.
5. The method for analyzing drug inventory demand based on sales data as described in claim 4, characterized in that: The process of generating a geographic public opinion pressure index through spatial coordinate transformation using a geographic entity association mapping method is described in the following steps. Extract the regional names and medical service point information of the public opinion pressure index to generate geographic entity data; Geographic entity data is matched with a geocoding library and spatially mapped to generate a geographic public opinion pressure index.
6. The method for analyzing drug inventory demand based on sales data as described in claim 1, characterized in that: The fusion of the policy-demand coupling matrix and the public opinion geographic pressure index is used to extract multi-source time-series features and dynamically assign weights through a TCN-ConvLSTM hybrid model to generate a demand tension vector. The specific steps are as follows: The policy-demand coupling matrix and the geographic public opinion pressure index are synchronized with timestamps and matched with spatial grids to generate a policy-public opinion alignment matrix; By combining the dilated causal convolutional layer of TCN with the three-dimensional gated recurrent mechanism of ConvLSTM, feature interaction and hierarchical fusion are performed to obtain a spatiotemporal feature joint extraction architecture. Based on the historical policy-public opinion alignment matrix, the TCN-ConvLSTM hybrid model is obtained by end-to-end joint training of the spatiotemporal feature joint extraction architecture through an adaptive moment estimation optimizer. The policy-public opinion alignment matrix is input into the TCN-ConvLSTM hybrid model to extract the long-term trend features of policy impact and capture the spatiotemporal correlation features of public opinion dissemination. Based on long-term trend characteristics and spatiotemporal correlation characteristics, the dynamic contribution weights of policies and public opinion are calculated and weighted and fused to generate a demand tension vector.
7. The method for analyzing drug inventory demand based on sales data as described in claim 6, characterized in that: The process involves analyzing fluctuation entropy values to determine inventory strategy decisions based on demand tension vectors, resulting in a drug procurement plan. Furthermore, multi-dimensional demand decomposition is performed to generate drug inventory demand. The specific steps are as follows: Based on the demand tension vector, the fluctuation intensity of each drug demand sequence is calculated using the Shannon entropy variant algorithm, and the entropy value is used to label the demand vector. Then, a three-order decision tree is used to match the inventory management strategy and output the drug procurement plan. The drug procurement plan is decomposed into two dimensions: treatment area and turnover rate, to generate drug inventory demand.
8. A drug inventory demand analysis system based on sales data, based on the drug inventory demand analysis method based on sales data according to any one of claims 1 to 7, characterized in that: include, The data acquisition module is used to collect multimodal data from the pharmaceutical supply chain in real time, perform preprocessing, build a policy simulation sandbox to analyze the impact of medical insurance policies, and generate a policy-demand coupling matrix. The analysis module uses the BERT architecture to perform entity recognition and sentiment intensity analysis on pre-processed multimodal data of the pharmaceutical supply chain, outputs a public opinion pressure index, and generates a geographic public opinion pressure index by performing spatial coordinate transformation through a geographic entity association mapping method. The prediction module is used to integrate the policy-demand coupling matrix and the public opinion geographic pressure index. It uses a TCN-ConvLSTM hybrid model to extract multi-source time-series features and dynamically assign weights to generate a demand tension vector. The decision-making module is used to make inventory strategy decisions based on the demand tension vector through fluctuation entropy analysis, obtain drug procurement plans, and perform multi-dimensional demand decomposition to generate drug inventory demand.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the method for analyzing drug inventory demand based on sales data as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the method for analyzing drug inventory demand based on sales data as described in any one of claims 1 to 7.
Citation Information
Cited By
Intelligent analysis system and method for medicine supply chain based on cloud platform
CN122000093A