An intelligent detection method for drug components based on anti-infection clinical pharmacy

CN122814531APending Publication Date: 2026-09-25AFFILIATED HOSPITAL OF JIANGNAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611162128.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-03
Publication Date
2026-09-25

AI Technical Summary

Technical Problem

[0002]近红外光谱技术已逐步应用于药品成分的快速无损检测,然而,现有光谱检测方法通常仅关注待测药品自身的标准光谱特征,忽略了患者体内抗感染药物代谢产物的光谱干扰,患者在使用抗感染药物后,其体内会生成母体药物及多种代谢产物,这些物质可能随体液或交叉污染进入待测药品样本中,在近红外光谱上与目标成分的特征峰发生重叠,导致光谱识别模型的误判,传统的背景扣除或固定波长筛选方法难以动态区分源自患者体内代谢产物的光谱干扰,因为不同药物、不同代谢阶段产生的干扰光谱特征各异,缺乏针对患者具体用药医嘱的代谢产物光谱数据库支撑,也无法实现基于代谢产物干扰程度的光谱自适应校正,因此,如何从医院信息模块获取患者当前抗感染药物使用信息,并结合药物代谢途径预先建立代谢产物光谱特征库,进而通过光谱残差分析定位代谢产物干扰区域,采用随相关系数变化的权重因子进行信号衰减,从而获得纯净的代谢干扰校正光谱用于深度学习成分识别,成为提升抗感染药品临床检测准确性与可靠性的难题,为了解决这一技术问题,于是我们提供了一种基于抗感染临床药学的药品成分智能检测方法

Benefits of technology

本发明通过采集待测药品的初始光谱数据,并结合医院信息模块获取患者当前抗感染药物医嘱,从预先构建的抗感染药物代谢产物光谱特征数据库中调取母体药物及代谢产物的标准光谱,解决了传统光谱检测忽略患者体内代谢产物光谱干扰导致成分误判的问题,进而将预处理光谱与标准光谱进行残差分析,计算相关系数并标记代谢产物干扰区域,再采用随相关系数大小调整的权重因子对这些区域进行信号衰减,获得代谢干扰校正光谱,实现了对患者用药史所致光谱干扰的自适应校正,最后将校正光谱输入深度学习成分识别模型,输出药品成分定性结果及校正前后光谱差异度提示与调配安全性评级,提升了抗感染临床药学中药品成分检测的准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122814531A_ABST
    Figure CN122814531A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of drug component detection, in particular, the present application relates to a kind of intelligent detection method of drug component based on anti-infection clinical pharmacy, the present application first collects the initial spectral data of the drug to be measured, obtains the current anti-infection drug medical order information of patient through hospital information module, retrieves the standard spectrum of parent drug and main metabolite from the pre-constructed anti-infection drug metabolite spectral feature database, after the initial spectrum is pretreated, residual error analysis is carried out with standard spectrum, the correlation coefficient of absorbance of each wavelength point and metabolite standard spectrum is calculated, the continuous wavelength interval with correlation coefficient greater than interference threshold is marked as metabolite interference region, spectral signal attenuation is carried out on the region using weight factor adjusted with correlation coefficient, and metabolite interference correction spectrum is obtained, finally input into deep learning component identification model, and output drug component qualitative result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of pharmaceutical component detection technology, and more specifically, to an intelligent detection method for pharmaceutical components based on anti-infective clinical pharmacy. Background Technology

[0002] Near-infrared spectroscopy has been increasingly applied to the rapid and non-destructive detection of drug components. However, existing spectroscopic detection methods typically focus only on the standard spectral characteristics of the drug itself, neglecting the spectral interference from the metabolites of anti-infective drugs in the patient's body. After using anti-infective drugs, the patient's body generates the parent drug and various metabolites. These substances may enter the drug sample through bodily fluids or cross-contamination, overlapping with the characteristic peaks of the target component in the near-infrared spectrum, leading to misjudgments by the spectral recognition model. Traditional background subtraction or fixed wavelength screening methods are difficult to dynamically distinguish spectral interference originating from metabolites in the patient's body because the spectral characteristics of interference generated by different drugs and different metabolic stages vary, lacking targeted solutions. Even with a database of metabolite spectra supporting specific medication orders for patients, adaptive spectral correction based on the degree of metabolite interference is still not possible. Therefore, how to obtain patients' current anti-infective drug usage information from the hospital information module, pre-establish a metabolite spectral feature library in conjunction with drug metabolism pathways, locate the metabolite interference region through spectral residual analysis, and use a weighting factor that varies with the correlation coefficient to attenuate the signal, thereby obtaining a pure metabolic interference-corrected spectrum for deep learning component identification, has become a challenge to improve the accuracy and reliability of clinical detection of anti-infective drugs. To solve this technical problem, we provide an intelligent detection method for drug components based on clinical pharmacy of anti-infective drugs. Summary of the Invention

[0003] The purpose of this invention is to provide an intelligent detection method for drug components based on anti-infective clinical pharmacy, so as to solve the problems mentioned in the background art.

[0004] To achieve the above objectives, one objective of this invention is to provide a method for intelligent detection of drug components based on anti-infective clinical pharmacy, comprising the following steps: S1. Collect the initial spectral data of the drug to be tested; S2. Obtain the medical order information of the anti-infective drugs currently being used by the patient corresponding to the drug to be tested through the hospital information module. Based on the generic name of the drug in the medical order information, retrieve the standard spectral data of the anti-infective drug and its known metabolites from the pre-constructed anti-infective drug metabolite spectral feature database. The anti-infective drug metabolite spectral feature database is based on the in vivo metabolic pathways of different anti-infective drugs and includes the characteristic spectra of the parent drug and its main metabolites under the same detection conditions. S3. Preprocess the initial spectral data to obtain the preprocessed spectrum. Perform spectral residual analysis between the preprocessed spectrum and the standard spectrum. Calculate the correlation coefficient between the absorbance at each wavelength point and the standard spectrum of metabolites. Mark the continuous wavelength range with a correlation coefficient greater than the preset interference threshold as the metabolite interference region. S4. Attenuate the spectral signal in the region of metabolite interference using a weighting factor adjusted according to the correlation coefficient, while maintaining the original signal in the unlabeled region to obtain the metabolic interference corrected spectrum. S5. Input the metabolic interference correction spectrum into the deep learning component identification model that has been pre-trained using the spectrum of anti-infective drug standards, output the component qualitative results of the drug to be tested, and generate auxiliary information including the difference in spectral density before and after correction and the formulation safety rating.

[0005] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention collects initial spectral data of the drug to be tested and combines it with the patient's current anti-infective drug prescription obtained from the hospital information module. It retrieves the standard spectra of the parent drug and its metabolites from a pre-constructed database of spectral characteristics of anti-infective drug metabolites, solving the problem of traditional spectral detection neglecting the spectral interference of metabolites in the patient's body, which leads to misjudgment of components. Then, it performs residual analysis on the preprocessed spectrum and the standard spectrum, calculates the correlation coefficient and marks the metabolite interference region. Then, it uses a weighting factor adjusted according to the magnitude of the correlation coefficient to attenuate the signal in these regions, obtaining the metabolic interference corrected spectrum. This achieves adaptive correction of spectral interference caused by the patient's medication history. Finally, the corrected spectrum is input into a deep learning component recognition model, which outputs the qualitative results of drug components, the difference between the spectra before and after correction, and the safety rating of formulation, thus improving the accuracy of drug component detection in clinical pharmacy for anti-infective drugs. Attached Figure Description

[0006] Figure 1 This is a flowchart illustrating the overall workflow of the present invention. Detailed Implementation

[0007] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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 are within the scope of protection of the present invention.

[0008] Please see Figure 1 As shown, this embodiment provides a smart detection method for drug components based on anti-infective clinical pharmacy, including the following steps: S1. Collect the initial spectral data of the drug to be tested; S2. Obtain the medical order information of the anti-infective drugs currently being used by the patient corresponding to the drug to be tested through the hospital information module. Based on the generic name of the drug in the medical order information, retrieve the standard spectral data of the anti-infective drug and its known metabolites from the pre-constructed anti-infective drug metabolite spectral feature database. The anti-infective drug metabolite spectral feature database is based on the in vivo metabolic pathways of different anti-infective drugs and includes the characteristic spectra of the parent drug and its main metabolites under the same detection conditions. S3. Preprocess the initial spectral data to obtain the preprocessed spectrum. Perform spectral residual analysis between the preprocessed spectrum and the standard spectrum. Calculate the correlation coefficient between the absorbance at each wavelength point and the standard spectrum of metabolites. Mark the continuous wavelength range with a correlation coefficient greater than the preset interference threshold as the metabolite interference region. S4. Attenuate the spectral signal in the region of metabolite interference using a weighting factor adjusted according to the correlation coefficient, while maintaining the original signal in the unlabeled region to obtain the metabolic interference corrected spectrum. S5. Input the metabolic interference correction spectrum into the deep learning component identification model that has been pre-trained using the spectrum of anti-infective drug standards, output the component qualitative results of the drug to be tested, and generate auxiliary information including the difference in spectral density before and after correction and the formulation safety rating.

[0009] First, a portable near-infrared spectrometer is used to perform spectral scanning of the drug to be tested. The portable near-infrared spectrometer is a specialized detection device that relies on the near-infrared optical sensing principle to capture the absorption and reflection signals of substances at different wavelengths of near-infrared light. Before the formal scanning, the portable near-infrared spectrometer is started to perform a self-test, sequentially checking the operating status of the optical emission path, photosensitive element, signal encoding unit, and data transmission channel. After the self-test, the device baseline calibration is completed under no-load conditions with all external light completely blocked and all samples removed. The reference light signal under no-load conditions is recorded to eliminate baseline offset problems caused by long-term use. The finished drug to be tested, prepared by the pharmacy, is placed in a standardized testing station. The relative distance and illumination angle between the spectrometer probe and the surface of the finished drug are adjusted according to the equipment operating specifications. The entire process uses a non-contact scanning mode. Non-contact scanning means that there is no physical contact between the probe and the finished drug, which avoids contamination of the drug by external impurities and prevents drug residues from adhering to the probe surface and affecting the results of subsequent multiple tests.

[0010] During the equipment parameter setting phase, the scanning wavelength range and sampling step size corresponding to the spectral characteristic database of anti-infective drug metabolites are uniformly used to ensure that the basic parameters of the detection system before and after are consistent. After the parameters are confirmed, the photosensitive element of the portable near-infrared spectrometer collects the reflected light intensity after the light passes through the drug to be tested wavelength by wavelength according to the set step size. The light intensity analog signal corresponding to different wavelengths is converted into a continuous electrical signal sequence. This electrical signal sequence is the original spectral signal obtained by scanning. After the signal acquisition is completed, the built-in transmission module of the spectrometer transmits the original spectral signal in segments to the back-end data preprocessing module through an encrypted wired link. Each segment of transmitted data is attached with a check character. After receiving each segment of signal, the data preprocessing module checks the check character to confirm that there is no packet loss or distortion problem during the transmission process. After all the original spectral signals are completely received, the noise processing stage is officially started.

[0011] The data preprocessing module first performs dark current noise subtraction. Dark current noise is the inherent electrical signal interference generated by the operation of the spectrometer's photosensitive element under the condition of no external incident light. First, it retrieves the dark current reference data obtained by taking the arithmetic mean of multiple light-shielding tests when the portable near-infrared spectrometer was manufactured. The dark current reference data is a standard noise sequence that corresponds one-to-one with the number of points in the original spectral signal. For the signal value of each sampling point in the original spectral signal, the original signal value is subtracted from the dark current reference value of the same point. The noise is canceled point by point. After all points are processed, the first-order processed signal with dark current removal is obtained.

[0012] After completing the dark current noise subtraction, the ambient light noise elimination is performed. Ambient light noise is the interference component of the light superimposed on the spectral signal at the detection site. First, an independent ambient light reference spectrum is collected under the current detection station and without the drug to be tested. This reference spectrum records the complete signal distribution corresponding to the ambient light at the site. Then, the first-order processed signal and the ambient light reference spectrum are subjected to point-by-point difference calculation. The point value of the first-order processed signal is subtracted from the value of the corresponding point of the ambient light reference spectrum to eliminate the superimposed interference caused by the external ambient light. After the calculation is completed, the second-order processed signal is obtained.

[0013] To smooth the second-order processed signal, this invention employs a moving average smoothing filter algorithm to weaken high-frequency glitches in the signal. First, a fixed sliding window containing multiple consecutive adjacent sampling points is set. Starting from the first valid point of the second-order processed signal, the signal values ​​of all points within the window are extracted. The sum of all values ​​within the window is divided by the total number of points contained in the window to obtain the arithmetic mean. This average value is used to replace the original signal value at the center of the sliding window. The sliding window is then moved one point backward according to the sampling order. The operation of obtaining the average value and replacing the value is repeated until the sliding window has traversed the entire set of second-order processed signals. After smoothing and filtering, irregular high-frequency glitches caused by instantaneous electromagnetic interference and slight optical jitter in the spectral signal are effectively filtered out, finally yielding a preliminarily denoised spectral signal.

[0014] After noise processing is complete, the wavelength calibration stage begins. Wavelength calibration establishes a unique correspondence between the sampling points of the spectral signal and the standard wavelength scale, ensuring that the wavelength system of the current spectrum is completely consistent with the detection conditions of the anti-infective drug metabolite spectral characteristic database. First, the standard wavelength sequence, adjacent wavelength intervals, and allowable wavelength offset range stored in the anti-infective drug metabolite spectral characteristic database are read. Simultaneously, the native wavelength mapping table of the portable near-infrared spectrometer is retrieved. Using the standard wavelength sequence in the database as a reference, each sampling point in the pre-denoised spectrum is compared with its corresponding original wavelength. For sampling points with slight wavelength offsets, a linear interpolation algorithm is used to correct the wavelength. The linear interpolation calculation method is as follows: By combining the difference between the two standard wavelengths on the left and right of the offset point and the offset of the current point, the corrected standard wavelength is calculated. After all points have completed wavelength matching and correction, a wavelength calibration log is automatically generated, recording the original wavelength, corrected wavelength and offset value of each point for subsequent data traceability.

[0015] Once all sampling points have completed unified wavelength calibration, the complete spectral signal, after multi-level denoising and wavelength matching, is defined as the initial spectral data of the drug to be tested. The data preprocessing module stores the standard wavelength value and the corresponding signal value of each sampling point in pairs according to a preset unified storage format. At the same time, it associates the drug number, detection time, equipment number, noise processing parameters, and wavelength calibration parameters corresponding to this test. The storage process simultaneously writes to the local main storage area and the backup area to avoid data loss due to single storage area failure. After the initial spectral data is completely stored, a data ready command is sent to the downstream process. This set of initial spectral data will be directly transferred to the subsequent process for use in conjunction with the standard spectrum retrieved from the hospital information module to carry out spectral residual analysis and metabolite interference area marking.

[0016] Establishing a database of spectral characteristics of anti-infective drug metabolites is a preliminary step in developing intelligent drug component detection methods based on clinical pharmacy for anti-infective drugs. The database integrates measured spectra of physical samples with virtual spectra from metabolic simulations, comprehensively covering the near-infrared spectral characteristics of the parent anti-infective drug, known metabolites, and intermediate metabolites that are difficult to purify physically. All data are collected and processed under conditions identical to those used in subsequent drug testing. Liquid chromatography-mass spectrometry (LC-MS) is a technique that first separates complex mixtures using LC, then uses mass spectrometry for qualitative and quantitative detection. Researchers first collect serum samples from individuals who have used the corresponding anti-infective drugs. Serum samples were fed into a liquid chromatography-mass spectrometry (LC-MS) system. The system separated different components within the serum according to a preset chromatographic separation gradient. Mass spectrometry analysis was then performed on each separated individual component to distinguish the parent anti-infective drug from clinically known metabolites based on mass spectrometric characteristic peaks. Multi-stage purification was performed on the target components to obtain high-purity anti-infective drug standards and various known metabolites. All purified samples were uniformly packaged and labeled with the generic name of the drug, product type, purification batch, and preparation time. The samples were stored in a constant temperature and light-protected environment to prevent component deterioration and thus affect subsequent spectral acquisition results.

[0017] After the pure sample preparation is completed, a repeated standard spectral acquisition operation under uniform conditions is initiated. The portable near-infrared spectrometer used for subsequent drug testing is used throughout the process. The wavelength range, sampling step size, non-contact scanning distance, ambient temperature and humidity, and ambient light of the equipment are all kept fixed to ensure the consistency of spectral data from different sources. A single type of pure sample is placed at a standardized testing station, and the equipment is started to perform non-contact scanning. The standard spectral data is a discrete data sequence formed by pairing continuous wavelength points with corresponding absorbance values. For each pure sample, at least three independent scanning actions are performed continuously according to the operating procedures. After each scan, the equipment is briefly reset before the next scan is performed to avoid the influence of signal residue from the previous scan. Finally, at least three repeated standard spectral data are obtained for each pure sample. Each set of repeated standard spectral data is stored separately and bound with the sample number, scan sequence number, and acquisition time to achieve traceability of the scan data. After acquiring multiple repeating standard spectral data, an averaging process is performed. This averaging process is used to reduce data deviations caused by random electromagnetic interference and minor environmental fluctuations during a single scan. Before processing, the multiple repeating standard spectral data corresponding to the same sample are first verified to ensure that the wavelength arrangement order and wavelength interval of all data are completely consistent. Arithmetic average calculation is performed point by point in order of wavelength from low to high. For any wavelength point, the absorbance value corresponding to that point in the three repeating spectra is extracted. The three absorbance values ​​are added together to calculate the sum. Then, the sum is divided by the number of spectra involved in the calculation to obtain the average absorbance value of that wavelength point. After traversing all wavelength points and performing the above calculations in sequence, the original multiple scattered repeating spectra are integrated into a single integrated spectral sequence that eliminates random errors.

[0018] After the integrated spectral sequence is generated, normalization processing is performed. Spectral normalization is a standardization operation that maps all absorbance values ​​within the spectrum to a fixed range. This is used to compensate for differences in overall signal amplitude caused by minor deviations in sample loading thickness and scanning distance. This invention employs a maximum-minimum normalization algorithm. First, it iterates through all absorbance values ​​within the integrated spectral sequence, selecting the maximum and minimum absorbance values ​​in the entire data set to determine the boundaries of the normalization operation interval. For the absorbance value corresponding to each wavelength point, the calculation method is as follows: The absorbance at the current point is subtracted from the minimum absorbance, and the result is divided by the difference between the maximum and minimum absorbance. After this operation, the absorbance at all wavelength points is converted to a unified range of zero to one. After the normalization operation is completed point by point, a unique standard spectral fingerprint corresponding to the current pure sample is finally generated. The standard spectral fingerprint is a standardized spectral sequence that can uniquely correspond to the optical absorption characteristics of the drug or known metabolite after noise reduction, averaging, and normalization. Each parent drug and each known metabolite will generate an independent and unique standard spectral fingerprint.

[0019] After the standard spectral fingerprints corresponding to the physical samples are prepared, the simulation of virtual characteristic spectra of intermediate metabolites begins. The pharmacokinetic simulation software is a professional simulation tool built upon the in vivo metabolic pathways, metabolic reaction rates, and metabolic capabilities of human organs for anti-infective drugs. Intermediate metabolites are transitional components temporarily generated during drug metabolism in the human body, which are difficult to purify on a large scale through experimental methods. The staff first inputs the generic name of the current drug into the software, and simultaneously inputs the corresponding patient's liver and kidney function parameters. These parameters include quantitative indicators such as liver metabolic enzyme activity and renal excretion rate. These parameters characterize the body's ability to metabolize the drug. The software, combined with the established parameters of the anti-infective drug... The simulation process first calculates the theoretical physicochemical properties and component proportions of intermediate metabolites at different metabolic stages by considering in vivo metabolic pathways, component conversion ratios, and reaction rate constants. Then, it matches the detection conditions such as wavelength range and sampling step size of the physical sample spectrum. Based on the absorption law of near-infrared light and substances, the theoretical absorbance values ​​of intermediate metabolites are simulated and calculated at each wavelength point. The theoretical values ​​of all wavelength points are combined sequentially to form a continuous data sequence, which is the virtual characteristic spectrum. For various intermediate metabolites generated by the same anti-infective drug at different metabolic stages, the above simulation process is repeated to obtain multiple sets of corresponding virtual characteristic spectra. Each set of virtual characteristic spectra is bound to the generic name of the drug, metabolic stage, and simulation parameters.

[0020] Finally, the association, classification, and database storage of the full spectral data were carried out. First, a structured data table was built as the main body of the database. The data table used the generic name of the drug as the associated index and was divided into three independent storage areas: parent drug area, known metabolite area, and intermediate metabolite area. The unique standard spectral fingerprints of the parent drug, the unique standard spectral fingerprints of the known metabolites, and the virtual characteristic spectra of various intermediate metabolites obtained from drug metabolism kinetic simulation were all collected and bound with the generic name of the drug as the associated primary key. All spectral data corresponding to the same generic name were integrated into a complete set of data. When storing the data in the data table, traceability content such as spectral acquisition parameters, data processing parameters, sample purification information, and metabolic simulation parameters were also included to ensure that the original information could be verified by reverse engineering for each spectral data. After classifying and storing all anti-infective drugs and their corresponding metabolic spectra according to this rule, the database of spectral characteristics of anti-infective drug metabolites was officially completed. This database contains both standard spectral fingerprints measured from actual samples and virtual characteristic spectra generated by simulation. The data coverage is complete, and the detection and processing conditions and the detection system of the drugs to be tested are completely unified. The standard spectral data in the database can be directly called, providing a stable and comprehensive spectral reference for the entire set of intelligent detection methods for drug components.

[0021] After completing the initial spectral data acquisition of the drug under test and the establishment of the spectral characteristic database of anti-infective drug metabolites, this step realizes the parsing of hospital prescription information, targeted database retrieval, metabolic stage assessment, and integration of multiple standard spectra. This step can accurately screen spectral data corresponding to the metabolic stage based on the patient's actual medication time, reduce the participation of invalid spectral data in subsequent analysis, and improve the efficiency and accuracy of spectral residual analysis and interference region identification. First, it connects with the hospital information module to complete the parsing of prescription information and extraction of key fields. The hospital information module is a comprehensive data management platform that integrates patient medical records, drug dispensing information, and medication orders within the hospital. After the drug under test is dispensed in the pharmacy, it is automatically bound to the corresponding patient's identity identifier. Based on this association, the hospital information module is used to retrieve the anti-infective drug prescription information currently being administered by the patient. The prescription information is transmitted in a standardized structured message format. The received message is divided into multiple independent fields, recording patient information, drug type, dosage, frequency of administration, administration time, and administering personnel. The data preprocessing unit first parses the received message format, splits the entire message according to preset field identifiers, and extracts two fields: the generic drug name and the administration time. The generic drug name is the standard official name of the anti-infective drug and serves as the unique keyword for database retrieval. The administration time is the standard timestamp of the doctor's order execution and the completion of the patient's medication, used for subsequent metabolic phase evaluation. After the fields are extracted, data validity is checked to determine whether the generic drug name string conforms to the drug naming specifications and whether the administration timestamp is in a valid time format. If a field is missing or the format is abnormal, an error message is generated and the doctor's order information retrieval request is re-initiated. If the verification passes, the generic drug name and administration time are stored in a temporary data buffer for later retrieval.

[0022] After extracting key fields, a database query request is initiated using the generic name of the drug as the primary key. The database of spectral features of anti-infective drug metabolites uses the generic name of the drug to establish a first-level index structure. All spectral data are classified and collected according to the generic name. After receiving the keyword, the retrieval module traverses the index list and locates the data partition that completely matches the current generic name of the drug. First, it retrieves the pre-stored standard spectral fingerprint of the parent drug from this partition. The parent drug is the original anti-infective drug directly taken by the patient. The standard spectral fingerprint is a standardized near-infrared spectral sequence formed after multiple repeated scans, averaging, and normalization. During the retrieval process, the integrity of the spectral file is checked simultaneously to confirm that there are no missing wavelength sequences, sampling points, and absorbance data. After the check is passed, the standard spectral fingerprint of the parent drug is stored in the temporary spectral storage area.

[0023] Next, we will carry out time interval calculation and drug metabolism stage assessment. Internally, we will uniformly convert the drug administration time and the device's local current time into integer time values ​​in milliseconds. After the timestamp conversion is completed, we will perform a subtraction operation, subtracting the integer value corresponding to the drug administration time from the integer value corresponding to the current time. The result is the total number of milliseconds between the two types of time. This value is the time interval between the drug administration time and the current time. The time interval can intuitively reflect the duration after the drug enters the human body.

[0024] For each anti-infective drug, the database pre-divides complete metabolic phase intervals based on pharmacokinetic experimental results. Different duration ranges correspond to different in vivo metabolic states. At the same time, the known major metabolites with the highest proportion and the most significant spectral interference in each metabolic phase are marked. The calculated time intervals are compared with the preset time intervals for each metabolic phase one by one. When the time interval falls into the first interval, it is determined to be the drug absorption phase; when it falls into the second interval, it is determined to be the drug distribution phase; when it falls into the third interval, it is determined to be the peak drug metabolism phase; and when it falls into the largest interval, it is determined to be the drug excretion phase. After completing the metabolic phase determination, the database re-enters the data partition corresponding to the generic name of the drug. Based on the determination result, it retrieves the standard spectral fingerprints of all known major metabolites associated with the metabolic phase. Only the spectral data corresponding to the active metabolites in the current phase are selected, rather than retrieving the full metabolite spectrum, in order to reduce the data volume. The retrieved standard spectral fingerprints of known major metabolites are also put into the temporary spectral storage area after integrity verification.

[0025] After obtaining the standard spectral fingerprints of the parent drug and the known metabolites at the current metabolic stage, we continue to search and retrieve all virtual feature spectra associated with the drug within the data partition of the same generic name. The virtual feature spectra are intermediate metabolite spectra generated by pharmacokinetic simulation software in combination with liver and kidney function parameters of different patients. These intermediate metabolites are difficult to obtain through physical purification, and the corresponding spectral data are all simulation-generated sequences. We traverse all files marked as virtual spectra within the partition, retrieve them all, and add them to the temporary spectral storage area.

[0026] Once the standard spectral fingerprints of the parent drug, the standard spectral fingerprints of the known major metabolites at the current metabolic stage, and the full set of virtual feature spectra have all been retrieved, the data merging operation is executed to construct a standard spectral data set of anti-infective drugs and known metabolites. Before merging, the basic dimensions of all spectral data are first unified, and the wavelength start and end range, adjacent wavelength intervals, and total number of sampling points of each spectrum are checked to ensure that the coordinate system of all spectra is completely consistent. For the very few spectra with point deviations, a linear interpolation algorithm is used to complete the absorbance values ​​of the corresponding wavelength points. After the dimension unification is completed, all spectral sequences are systematically integrated into the same structured dataset in the order of parent drug spectrum, known metabolite spectrum, and virtual feature spectrum. The integrated dataset is the standard spectral data set.

[0027] After the dataset is assembled, a final integrity verification is performed. The total number of spectra and the number of points per spectra are counted. Damaged or garbled invalid spectra are removed and supplemented. Once the verification is successful, the complete standard spectral data set is directly transmitted to the next processing unit for spectral residual analysis with the preprocessed spectra of the drug to be tested. This ensures that the standard spectra match the patient's actual medication status and avoids redundant data from increasing the subsequent computational load. It provides a compliant and effective reference spectral basis for the accurate labeling of metabolite interference regions.

[0028] After completing the standard spectral data set of anti-infective drugs and known metabolites in the previous step, the formal process of residual spectrum generation, mean absolute residual calculation, dynamic threshold setting, and identification of potential spectral interference regions officially begins. This step obtains residual data by point-by-point difference between the preprocessed spectrum of the drug to be tested and multiple standard spectra. Based on the full wavelength statistical results, a dynamic residual threshold adapted to a single spectrum is generated. Then, based on the threshold, continuous characteristic bands are screened, which can accurately locate the spectral range affected by the parent drug and various metabolites. This lays the data foundation for subsequent correlation coefficient calculation and metabolite interference region determination. In this invention, the preprocessed spectrum is a standard spectral sequence obtained after multi-level denoising and unified wavelength calibration of the initial spectrum of the drug to be tested. Each wavelength point in the sequence corresponds to a unique absorbance value. The standard spectral data set includes the standard spectral fingerprint of the parent drug, the standard spectral fingerprint of known metabolites, and the virtual characteristic spectrum of intermediate metabolites. The wavelength start and end range, sampling step size, and total number of points of all spectra are completely consistent with the preprocessed spectrum. This is a prerequisite for point-by-point difference operation.

[0029] First, a residual spectral sequence is generated sequentially for each standard spectrum. The residual spectrum is a new spectral sequence formed by subtracting the absorbance of two types of spectra at the same wavelength coordinates. Following the internal arrangement of the standard spectral dataset, staff extract individual spectra one by one. Each individual spectrum can be a standard spectral fingerprint generated from a physical sample or a virtual feature spectrum obtained from pharmacokinetic simulation. For the currently extracted standard spectrum, a point-by-point subtraction operation is performed starting from the first wavelength point in the sequence. The absorbance value of the preprocessed spectrum at that wavelength position is read, and simultaneously, the absorbance value of the current standard spectrum at the same wavelength position is read. The absorbance of the preprocessed spectrum is then subtracted from the absorbance of the current standard spectrum. The absorbance of the standard spectrum is calculated, and the result is the residual value at that wavelength. The above subtraction operation is repeated for all points of the entire spectrum in ascending order of wavelength. After the residual values ​​of all wavelength points have been calculated, the ordered sequence composed of continuous wavelength coordinates and corresponding residual values ​​is a residual spectrum sequence corresponding to the current standard spectrum. Each time a residual spectrum sequence is generated, the original standard spectrum number and spectrum type corresponding to the sequence are recorded and stored independently to avoid confusion between residual data from different sources. This process continues to traverse all spectra in the standard spectrum dataset until all standard spectra have completed the difference operation, generating a complete set of residual spectrum sequences.

[0030] For each independent residual spectral sequence within the group, the average absolute residual value across the entire wavelength range is calculated one by one. The absolute residual is the value obtained by removing the positive or negative sign of the residual value at a single point. First, all wavelength points of the current residual spectral sequence are traversed, and the residual value corresponding to each point is extracted one by one. The absolute value of each residual value is calculated to obtain the absolute residual of the corresponding point. Then, the absolute residuals of all points in the entire sequence are summed to obtain the total absolute residual of the entire wavelength. At the same time, the total number of effective wavelength points contained in the current residual spectral sequence is counted. The total absolute residual of the entire wavelength is divided by the total number of points to obtain the average absolute residual value of the residual spectral sequence. The average absolute residual value corresponding to each residual spectral sequence is associated and bound to the original sequence for storage, and used as a parameter for subsequent dynamic threshold calculation.

[0031] After calculating the mean absolute residual, the dynamic residual threshold is set. Unlike a fixed threshold, the dynamic residual threshold is adaptively adjusted based on the overall deviation level of a single residual spectrum. Internally, a fixed scaling factor is pre-calibrated through numerous spectral comparison experiments. This factor ranges from zero to one and remains constant throughout the process. The dynamic residual threshold is calculated by multiplying the mean absolute residual of the current residual spectrum sequence by the preset scaling factor. Each residual spectrum sequence independently calculates its own dynamic residual threshold using its corresponding mean absolute residual, preventing the sharing of the same threshold among multiple residual spectra. This approach can adapt to the spectral deviation differences caused by different drugs and metabolites, reducing misjudgment problems caused by a uniform threshold. The calculated dynamic residual threshold is also associated with and recorded with the corresponding residual spectrum sequence and mean absolute residual.

[0032] Within a single residual spectral sequence, continuous wavelength bands with residual values ​​below a dynamic residual threshold are identified. These bands represent potential spectral interference regions corresponding to the current standard spectrum. Smaller residual values ​​indicate higher overlap between the preprocessed spectrum and the standard spectrum at the corresponding wavelength, and a greater probability of interference from corresponding drugs or metabolites. Numerical comparisons are performed point-by-point starting from the first wavelength in the residual spectral sequence. Simultaneously, a continuous point counter is initialized and set to zero. When the residual value at the current wavelength is detected to be less than the dynamic residual threshold, the continuous point counter is incremented. When the residual value at the current wavelength is detected to be greater than or equal to the dynamic residual threshold, the continuous point counter is first determined. If the current value of the counter is greater than zero, it means that there was a continuous wavelength point that met the conditions. Then, the starting wavelength, ending wavelength, and total number of points contained in the continuous band are recorded. The band is officially marked as the potential spectral interference region corresponding to the current standard spectrum. Then, the continuous point counter is reset to zero, and the remaining points are traversed. If the value of the continuous point counter is zero, the traversal is directly continued without additional recording. When the traversal reaches the last wavelength point of the residual spectrum sequence, an additional end check needs to be performed. If the value of the continuous point counter is greater than zero at this time, it means that there is an unrecorded continuous band at the end of the sequence. The band information is recorded and the region is marked according to the same rules.

[0033] In a single residual spectral sequence, one or more independent continuous wavelength bands may be identified. Each band that meets the conditions will be marked as a potential spectral interference region, and supplementary data such as residuals and average residuals at each point within the band will be retained.

[0034] After all residual spectral sequences have completed band identification and region labeling, the wavelength range, corresponding standard spectral information, and residual statistical data of all potential spectral interference regions are summarized. The data is then uniformly pushed to the next processing stage to calculate the correlation coefficient between the absorbance at each wavelength point and the standard spectrum of metabolites, further screening out the true metabolite interference regions. This can effectively improve the overall accuracy of subsequent interference correction and component identification.

[0035] After completing multi-level noise processing and unified wavelength calibration of the initial spectral data of the drug to be tested and generating preprocessed spectra, the extraction of absorbance at each wavelength point was formally carried out. Absorbance is a quantitative value used in near-infrared spectroscopy to characterize the degree of absorption of the analyte by incident light at a specific wavelength. This extraction work relies on the structured storage rules of the preprocessed spectrum to take values ​​point by point, and directly completes the definition of absorbance by combining the established numerical mapping rules of this scheme.

[0036] Previously, the preprocessed spectra generated by the data preprocessing module were stored locally in a standardized structured format. The entire set of spectral data was sorted by wavelength, and all the specific wavelengths covered by the detection were arranged in ascending order of value. Each independent specific wavelength was matched with a unique point sorting number, standard wavelength identifier, and corresponding signal intensity value. The signal intensity value is a quantized electrical signal value obtained by the portable near-infrared spectrometer after capturing the reflected light signal through non-contact scanning. This value has undergone dark current noise subtraction, ambient light noise elimination, and smoothing filtering. The inherent interference of the equipment and high-frequency noise from the field environment have been eliminated, which can truly reflect the light intensity change produced after the light irradiates the drug to be tested. This is also the prerequisite for this value to directly characterize the degree of light absorption.

[0037] After the extraction process is started, the operation module first initializes the internal read pointer and the dedicated storage list. The read pointer is used to locate a single wavelength point in the preprocessed spectrum. In the initial state, the read pointer is located at the position corresponding to the first point number in the entire spectral sequence. The dedicated storage list is used to store the absorbance of each wavelength point in the corresponding order. The arrangement order of the list is completely consistent with the wavelength arrangement order of the preprocessed spectrum.

[0038] After initialization, the module begins to iterate through all specific wavelength points within the preprocessed spectrum. Within a single loop cycle, it first retrieves the standard wavelength identifier and original signal intensity value for the corresponding position based on the current read pointer. Then, it performs the first-level numerical validity check, retrieving the valid signal intensity value range calibrated and stored long-term by the device. It then determines whether the currently retrieved signal intensity value falls within this range. If the signal intensity value exceeds the valid range, it indicates a data anomaly at the current wavelength point. The standard wavelength identifier and anomaly type for that point are recorded in the anomaly point log, and the corresponding value is not added to the absorbance storage list. Afterward, the reading is directly processed. The pointer moves one position forward to the next sorting number, entering the next cycle. If the signal strength value is within the valid range, the current position data is considered normal. Combining the non-contact near-infrared scanning detection mode and unified detection conditions adopted in this solution, under the premise that the scanning distance, ambient temperature and humidity, lighting conditions, and equipment parameters are all kept fixed, the pre-processed signal strength value and the degree of light absorption by the drug to be tested form a fixed correspondence. Therefore, no additional conversion calculation is required. The signal strength value corresponding to the current wavelength position is directly defined as the absorbance of that wavelength position, and this value is written into the corresponding position in the dedicated storage list.

[0039] After assigning the absorbance value to a single point, the reading pointer is continuously moved one position backward along the point sorting number direction. The loop operation of point retrieval, value verification, and absorbance assignment is repeated, continuously traversing all remaining specific wavelength points in the preprocessed spectrum until the reading pointer moves to the last point sorting number of the entire spectral sequence. At this point, the traversal and value retrieval of all wavelength points is completed.

[0040] After the traversal is completed, the second layer of overall data review is initiated. First, the total number of valid values ​​in the absorbance storage list is counted and compared with the total number of wavelength points in the original preprocessed spectrum to check for missed readings, duplicate readings, and misaligned points. At the same time, all abnormal wavelength information in the abnormal point log is summarized. For multiple abnormal points that appear consecutively, the operation records of the previous spectral acquisition and preprocessing stages are checked in addition to locate the source of the abnormality.

[0041] Once both layers of verification are completed and the overall data compliance is confirmed, a complete dataset consisting of standard wavelength identifiers paired with corresponding absorbance values ​​is officially formed. This dataset is then pushed to the subsequent processing unit according to a preset data transmission protocol to calculate the correlation coefficient between the absorbance at each wavelength point and the standard spectrum of metabolites. This process marks the interference regions of metabolites, avoids the impact of invalid data on subsequent spectral analysis calculations, and provides basic numerical support for the data analysis stage of intelligent detection of anti-infective drug components.

[0042] Data sequence one is a one-dimensional numerical sequence formed by sorting the absorbance of all wavelength points in the preprocessed spectrum from low to high wavelength. Data sequence two is a one-dimensional numerical sequence formed by sorting the absorbance of a single metabolite standard spectral fingerprint or virtual feature spectrum extracted from the standard spectral data set according to the absorbance of the corresponding wavelength points. The sliding window method is an operation method that selects a fixed number of continuous wavelength points as independent local calculation units and traverses the complete numerical sequence segment by segment according to a fixed step size. The similarity correlation coefficient is used to quantify the linear similarity between two sets of numerical sequences of the same dimension. The preset interference threshold is a critical value calibrated through a large number of control experiments and is used to determine whether the spectral features are highly overlapping. The proportion threshold is a critical percentage value used to constrain the proportion of effective qualified points within the interval.

[0043] Before officially starting the operation, the coordinates and dimensions of the two sets of data sequences are matched. Since the wavelength range, sampling step size and total number of points were unified in all the previous spectral acquisition, preprocessing and standard spectrum preparation steps, the data sequence one and the data sequence two to be operated are matched one by one. The order of wavelength coordinates, point number and absorbance value corresponding to each position of the two sequences is checked to confirm that the total number of points of the two sequences is completely consistent and the wavelength coordinates correspond one-to-one, so as to avoid the operation deviation caused by coordinate misalignment. According to the internal arrangement order of the standard spectral data set, the standard spectral fingerprint or virtual feature spectrum of the metabolite in the set is extracted one by one. Each extracted spectrum generates an independent data sequence two. Each data sequence one and data sequence two form an independent operation pair. The operation is performed on each pair in sequence. The data between different pairs are isolated from each other to avoid data cross-contamination.

[0044] After data pairing is completed, the parameters of the sliding window are uniformly configured. Based on the distribution pattern and sampling density of the near-infrared spectral characteristic peaks of anti-infective drugs, the number of continuous wavelength points included in the sliding window is preset. The size of the window remains fixed throughout the entire process. At the same time, the sliding step size of the window is set to a single wavelength point to ensure seamless connection of local calculation units and no detection blind spots during the traversal. Locally fixed preset interference thresholds and proportional thresholds are loaded synchronously. The two types of thresholds are not dynamically changed in a single complete detection process.

[0045] After parameter configuration, the sliding window traversal and local similarity correlation coefficient calculation are performed. This invention uses the Pearson correlation coefficient as the basis for calculating the similarity correlation coefficient. Starting from the first wavelength point of the entire sequence, the local point set corresponding to the first sliding window is extracted. The absorbance values ​​of all points within the window are extracted from data sequence one and data sequence two, forming two sets of window subsequences. First, the average value of the data sequence one subsequence is calculated as follows: The absorbance values ​​within the window are summed to obtain a total. Then, the total is divided by the number of points contained in the window. The average value of the corresponding subsequence of data sequence two is calculated using the same operational logic. For each point within the window, the difference between the absorbance of a single point in data sequence one and the average value of its subsequence is calculated, as well as the difference between the absorbance of a single point in data sequence two and the average value of its own subsequence is calculated. The two sets of differences are recorded sequentially. The two sets of differences for the same point are multiplied one by one and summed to obtain a total product. At the same time, the squares of all differences corresponding to data sequence one are calculated and summed to obtain the first set of squares. The squares of all differences corresponding to data sequence two are calculated and summed to obtain the second set of squares. The first set of squares is multiplied by the second set of squares and the arithmetic square root is obtained. Finally, the total product is divided by the arithmetic square root to obtain the similarity correlation coefficient between the two sets of subsequences within the current sliding window. After calculating the correlation coefficient for each window, the coefficient is bound and stored with the start and end wavelengths of the window and the internal point number.

[0046] After the first window operation is completed, the sliding window moves backward by one wavelength point according to the preset step size, extracts a new set of local points, and repeats the complete steps of averaging, difference calculation, and similarity correlation coefficient calculation. This process continues until the last point of the sliding window reaches the last point of the entire wavelength sequence. At this point, the similarity correlation coefficients of all local windows under the current pair have been calculated.

[0047] After the window traversal is completed, the calculation results of adjacent windows are integrated by combining the wavelength coverage of each window. Each original wavelength point is assigned to all its sliding windows. The comprehensive matching results determine a unique similarity correlation coefficient for a single wavelength point, realizing the conversion from window-level coefficients to single-point coefficients, and providing point-level data support for subsequent continuous interval determination.

[0048] The entire spectrum is divided into independent continuous wavelength intervals according to wavelength arrangement rules. A continuous wavelength interval refers to a combination of points whose wavelength coordinates are connected sequentially without any discontinuity. For each continuous wavelength interval, a dual-condition verification is performed. The first layer of verification is the interval average correlation coefficient determination. First, the similarity correlation coefficient of all individual wavelength points in the interval is extracted. All coefficients are added together to obtain the interval coefficient sum. The sum is divided by the total number of points contained in the interval to obtain the average similarity correlation coefficient of the continuous wavelength interval. The average value is compared with a preset interference threshold. The second layer of verification is the qualified point ratio determination. First, the number of points in the interval whose similarity correlation coefficient of individual wavelength points is greater than the preset interference threshold is counted. The number is divided by the total number of points in the interval to obtain the qualified point ratio. The ratio value is then compared with a preset ratio threshold.

[0049] This invention sets two conditions that must be met simultaneously to complete the interference region determination. When the average similarity correlation coefficient of a continuous wavelength interval is greater than a preset interference threshold, and the proportion of qualified points within the interval is also greater than a preset proportion threshold, the continuous wavelength interval is officially marked as a metabolite interference region. If only one condition is met, or neither condition is met, the interval is determined to be a normal spectral interval caused by equipment noise or environmental fluctuations, and interference region marking is not performed. Since the standard spectral data set contains multiple standard spectral fingerprints and virtual feature spectra of metabolites, each spectrum corresponds to an independent data sequence, the entire process of sliding window calculation, point coefficient conversion, and continuous interval verification needs to be performed iteratively on all spectra in the set. After all calculations are completed, all marked metabolite interference regions are summarized, and overlapping wavelength intervals marked by different standard spectra are merged and deduplicated to form a complete and unique list of metabolite interference regions. The list synchronously records the starting wavelength, ending wavelength, average correlation coefficient of the interval, proportion of qualified points, and corresponding standard spectral source type of each interference region. The final list of metabolite interference regions will be transmitted to the next processing stage. Based on the range defined in the list, the staff will perform a spectral signal attenuation operation on the marked metabolite interference regions by adjusting the weight factor according to the correlation coefficient, while retaining the original spectral signal in the non-interference regions. This provides a precise basis for the generation of metabolic interference correction spectra and the identification of components in the deep learning model.

[0050] The attenuation weighting factor is a dimensionless value used to adjust the amplitude of the spectral signal at a single wavelength point. Its value range is fixed between zero and one. The nonlinear attenuation function is a nonlinear mathematical mapping rule that takes the similarity correlation coefficient as input and outputs the attenuation weighting factor. The original absorbance is the original light absorption quantization value of each wavelength point in the preprocessed spectrum. The metabolic interference correction spectrum is a new spectral curve formed by combining the wavelength coordinates and the corrected absorbance after weighted attenuation processing.

[0051] Before commencing the calculations, the loading of all basic data and initialization of runtime parameters are completed. A list of metabolite interference regions stored locally is retrieved, containing complete records of the start and end wavelengths of each interference region, as well as the similarity correlation coefficients for all wavelength points within the interval. Simultaneously, the raw absorbance sequence of the preprocessed spectrum is read. The two sets of data are aligned according to a wavelength sorting rule from low to high, ensuring that each wavelength coordinate matches a unique raw absorbance and similarity correlation coefficient. A built-in preset nonlinear decay function is then loaded; this function is a fixed number obtained by fitting data from numerous anti-infective drug spectral interference control experiments. The model takes the similarity correlation coefficient of a single wavelength point as input parameter and outputs the attenuation weight factor of the corresponding point. The function as a whole exhibits a negatively correlated nonlinear change law, that is, the larger the similarity correlation coefficient value, the smaller the output attenuation weight factor value. This matches the correspondence between interference intensity and signal attenuation amplitude. Unlike the linear attenuation method, the nonlinear model can better fit the changing law of near-infrared spectral interference characteristics and improve the correction effect. At the same time, a one-dimensional data storage list is initialized. This list is used to store the new absorbance values ​​of all wavelength points after correction in sequence. The number of points and the arrangement order of the list are completely consistent with the original spectrum.

[0052] After completing the preparations, activate the wavelength traversal pointer, initially positioning it at the first wavelength point of the entire spectral sequence. Begin processing point by point in a loop. First, determine whether the wavelength point currently pointed to by the pointer falls within the start and end wavelength range of any metabolite interference region. The determination method is as follows: The wavelength value of the current point is compared one by one with the wavelength boundaries of all intervals in the interference region list. If the current wavelength point is not marked as a metabolite interference region, the attenuation weight factor corresponding to the point is directly set to one, and a weighted calculation is performed. The calculation method is to multiply the original absorbance of the current point by the value of one. The result of the calculation is completely consistent with the original absorbance, which means that the spectral signal of the point does not undergo any attenuation processing. The calculation result is directly written to the corresponding position in the corrected absorbance storage list. After completing the processing of a single point, the traversal pointer moves one wavelength point forward to enter the next round of judgment and calculation process. If the current wavelength point is inside the metabolite interference region, the similarity correlation coefficient corresponding to the point is first extracted. This coefficient is used as an input parameter and substituted into the preset nonlinear attenuation function for calculation. The complete calculation process is as follows: Following the function definition, the invention sequentially performs multiple nonlinear transformations, including exponentiation, constant correction, etc., and finally outputs an initial attenuation weight factor. To avoid computational anomalies caused by extreme values, this invention adds a weight factor boundary constraint mechanism. If the initial attenuation weight factor output by the function is greater than one, the value is forcibly corrected to one; if the initial attenuation weight factor is less than zero, the value is forcibly corrected to zero, ensuring that the final attenuation weight factor is always within the legal range of zero and one.

[0053] After obtaining the compliant attenuation weighting factor, perform a signal attenuation weighted calculation for that location. The calculation method is as follows: The original absorbance at the current wavelength is multiplied by the corresponding attenuation weighting factor. The resulting value is the new absorbance value after attenuation at that wavelength. The new absorbance value is written to the corresponding position in the corrected absorbance storage list. The traversal pointer is also moved one wavelength position to the right to continue processing subsequent positions.

[0054] The logic of region judgment, weight value selection, and weighted operation is continuously looped, and the traversal pointer moves continuously along the wavelength increasing direction to process all wavelength points of the entire spectrum in turn, until the pointer reaches the last wavelength point of the spectral sequence, and the weighted operation of all points in the entire region is completed.

[0055] After all point calculations are completed, a multi-layer data verification mechanism is initiated to ensure data validity. The first layer of verification is point quantity verification, which counts the total number of valid data entries in the corrected absorbance storage list and compares this value with the total number of wavelength points in the original preprocessed spectrum to confirm that there are no omissions, duplicates, or point misalignments. The second layer of verification is weight distribution verification, which randomly selects points in multiple metabolite interference areas and checks the correspondence between the similarity correlation coefficient and the attenuation weight factor to verify whether the two conform to the preset rule of nonlinear negative correlation. The third layer of verification is numerical validity verification, which checks all new absorbance values ​​one by one to confirm that there are no unreasonable data such as negative numbers or excessively large outliers. If an abnormal point is found during the verification process, the similarity correlation coefficient, nonlinear function calculation process, and weighted calculation steps of that point will be traced back and the entire set of calculations will be re-executed until the data is compliant. If all three layers of verification pass, the spectral curve synthesis stage will begin.

[0056] Following the original order of wavelength from low to high, each wavelength coordinate is paired with the corresponding new absorbance value in the storage list. The continuous wavelength coordinate sequence and the corresponding corrected absorbance value sequence are combined to form a complete and continuous new spectral curve. This curve, after adaptive signal attenuation processing, is the metabolic interference correction spectrum.

[0057] The metabolic interference correction spectrum is stored locally in a standardized format, and the original preprocessed spectrum, list of metabolite interference regions, similarity correlation coefficients of each point, and attenuation weighting factor used for each wavelength point are also saved as full-process traceability data. Through the internal data transmission channel, the metabolic interference correction spectrum is pushed to the downstream deep learning component identification model for the qualitative analysis of the components of the drug to be tested.

[0058] The standard solution is a homogeneous liquid sample prepared by mixing pure anti-infective drugs with compliant solvents in a fixed ratio. pH is used to characterize the acid-base properties of the solution. The training spectral dataset is a collection of multiple spectral data paired with corresponding component labels. Data augmentation is a processing method that expands the number of dataset samples and enriches sample features through mathematical transformations. Convolutional neural networks are deep learning networks that extract local features by relying on convolution operations. Iterative optimization is a training process that continuously corrects the internal parameters of the network and reduces the deviation between the predicted results and the actual results through loss feedback. Component labels are standardized identifiers that mark the types and components of anti-infective drugs contained in the sample.

[0059] First, a comprehensive sample preparation process was conducted. Staff selected various types of pure anti-infective drugs commonly used in clinical pharmacies as raw materials. Following relevant drug testing standards, suitable neutral solvents were chosen. Each anti-infective drug was precisely weighed, and single-drug standard solutions were prepared according to a gradient concentration rule. Concentration ranges were divided into low, medium, and high concentration ranges, with multiple gradient nodes set in each range to simulate the spectral characteristics corresponding to different drug dosages. After preparing single-component solutions, two or more different anti-infective drug standard solutions were mixed to prepare multi-component mixed samples. Simultaneously, standardized acid-base buffer solutions were used to adjust the pH of all single-component and multi-component mixed solutions, sequentially adjusting them to acidic, neutral, and alkaline ranges. This comprehensively covered the actual working conditions that might occur during pharmacy dispensing, such as concentration differences, component mixing, and pH changes. All prepared samples were uniformly numbered and classified according to component type, concentration value, and pH value, and detailed formulation information for each sample was recorded simultaneously to provide a basis for subsequent label binding.

[0060] After sample preparation, a portable near-infrared spectrometer with standardized specifications was used. The same detection conditions were employed during the initial spectral acquisition phase of the anti-infective drug metabolite spectral characteristic database construction and the initial spectral acquisition phase of the target drug. These conditions included fixed wavelength range, fixed sampling step size, non-contact scanning distance, ambient temperature and humidity at the detection station, and ambient light intensity. Numbered samples were placed sequentially at the standardized detection station for non-contact scanning. At least three independent scans were performed on each sample to mitigate random errors from single scans. The device transmitted the raw spectral signals to the data preprocessing module, which sequentially processed dark current noise according to a predetermined procedure. After subtraction, ambient light noise elimination, smoothing filtering, and uniform wavelength calibration, multiple scanning spectra corresponding to each sample are preprocessed. The effective spectrum or the average of multiple spectra is selected as the final spectral data of the sample. The corresponding formula information is retrieved according to the sample number to generate standardized ingredient labels. The ingredient labels clearly indicate all types of anti-infective drugs contained in the sample. Each preprocessed spectrum is bound to the corresponding ingredient label. The spectral acquisition, preprocessing, and label binding of all samples are continuously completed. After all the data are summarized, an initial training spectral dataset is formed. Each data point in the dataset consists of a one-dimensional spectral sequence and a text-formatted ingredient label.

[0061] To address the issues of limited sample size in the initial dataset and the susceptibility of the model to overfitting, multi-dimensional data augmentation operations were performed on the initial training spectral dataset. Combining the data characteristics of near-infrared spectroscopy, several lossless transformation methods were employed to expand the sample size. The first method involved low-amplitude Gaussian noise superposition, where small, normally distributed random values ​​were superimposed on the absorbance values ​​at each wavelength point in the original spectrum to simulate spectral fluctuations caused by minor electromagnetic interference. The second method involved full-band amplitude scaling, proportionally amplifying or reducing the absorbance values ​​of the entire spectrum within a pre-defined reasonable range to simulate signal amplitude changes caused by minor deviations in sample loading and scanning distance. The third method involved local band micro-perturbation, selecting local wavelength ranges with concentrated drug features and slightly increasing the absorbance within these ranges. The fourth method, which enriches the representation of local features, is weighted interpolation of spectra of similar samples. Two sample spectra with similar components are selected, and weighted summation is performed point-by-point according to different weight ratios to generate new mixed spectral samples. All enhancement transformations do not change the original component labels of the samples. After the transformation, the data validity of the new samples is checked, and invalid spectra with abnormal values ​​after the transformation are removed. The original samples and the new samples generated by enhancement are integrated to obtain a training spectral dataset with a significantly expanded scale. Then, the expanded dataset is divided into training subset, validation subset and test subset according to a fixed ratio. The training subset is used for iterative updates of network parameters, the validation subset is used for real-time monitoring of the model's generalization effect during training, and the test subset is used for final performance verification after training.

[0062] After the dataset was prepared, a convolutional neural network was constructed. Taking advantage of the one-dimensional sequence nature of the spectrum, a one-dimensional convolutional neural network was built as the main structure of the deep learning component recognition model. The network, from input to output, consists of an input layer, multiple sets of convolutional pooling modules, a feature flattening layer, a fully connected layer, and an output layer. The dimension of the input layer is consistent with the total number of wavelength points in a single spectrum, used to receive the one-dimensional spectral absorbance sequence. Each set of convolutional pooling modules consists of a one-dimensional convolutional layer, a batch normalization layer, a non-linear activation function layer, and a max pooling layer. The one-dimensional convolutional layer uses a fixed number and size of convolutional kernels to extract local spectral features through convolution operations. The batch normalization layer standardizes the feature data to accelerate training convergence. The non-linear activation function introduces non-linear expressive power into the network. The max pooling layer performs a process on the feature sequence... Dimensionality reduction is used to reduce the number of network parameters and compress redundant features. Stacking multiple sets of convolutional pooling modules can extract shallow spectral texture features, mid-level component features, and deep drug semantic features layer by layer. The feature flattening layer converts the two-dimensional feature matrix output by the convolutional pooling module into a one-dimensional feature vector. The fully connected layer performs global feature fusion on the one-dimensional feature vector. The output layer at the end of the network is set with neurons matching the number of identifiable anti-infective drug types and is equipped with a Softmax activation function to output the recognition probability distribution of each type of drug. At the same time, random deactivation layers and L2 regularization constraints are added between the fully connected layers to further suppress the model overfitting problem. After the network is built, the weight parameters and bias parameters of all convolutional and fully connected layers are standardized and initialized. The weight parameters are assigned values ​​using a normal distribution, and the bias parameters are uniformly initialized to zero.

[0063] After the network structure is initialized, the iterative optimization and training phase begins. First, a complete set of training hyperparameters is configured, including the batch size of samples input to the network per cycle, the initial learning rate, the maximum number of iterations, the learning rate decay coefficient, and the number of early stopping rounds. Simultaneously, multi-class cross-entropy is selected as the loss function, which quantifies the deviation between the network's predictions and the true component labels. The calculation process is as follows: First, the text-formatted real ingredient labels are converted into one-hot encoded forms. The network outputs the predicted probability of each drug category. The single-sample loss is calculated by combining the one-hot encoded value with the logarithm of the corresponding predicted probability. The overall loss of a training batch is the arithmetic mean of the single-sample losses within the batch. The optimizer is an adaptive moment estimator, which updates parameters based on gradient information.

[0064] After formally starting training, the spectral data and corresponding labels within the training subset are read in batches. First, forward propagation is performed, with the spectral data passing through the input layer, each group of convolutional pooling modules, and the fully connected layer to finally output the predicted probability distribution. The batch average loss is calculated by combining the prediction results of all samples in the batch with the true labels. Then, backpropagation is performed, using the chain rule to calculate the gradient of all network parameters layer by layer from the output layer to the input layer. The optimizer calculates the parameter update amount based on the gradient value and the current learning rate, and corrects the network weights and bias parameters one by one. After each round of traversal of the entire training subset, the validation subset is input into the current model to calculate the validation set loss and component recognition accuracy, and to evaluate the model's generalization ability in real time. At the same time, the learning rate is reduced according to preset rules to make the parameter iteration more refined in the later stages of training. When the validation set loss no longer decreases for several consecutive rounds, the early stopping mechanism is triggered to automatically terminate the training, avoiding the model from overlearning local features of the training set.

[0065] After the entire training process is completed, a separate test subset is used to conduct a comprehensive performance test on the trained network. The overall component recognition accuracy, single-drug recognition accuracy, and false recognition rate are statistically analyzed. When all evaluation indicators meet the preset qualification standards, the optimal weight file and network structure configuration file of the network are exported. The network structure, weight parameters, and data processing rules are integrated to form a complete deep learning component recognition model. At the same time, a complete set of sample preparation records, spectral acquisition parameters, data augmentation rules, network structure parameters, and training iteration logs are compiled to form a complete model archive.

[0066] Once put into use, this deep learning component recognition model will receive metabolic interference correction spectra from the preceding steps, extract and analyze spectral features, and output qualitative results of components. It will rely on multi-condition samples to simulate actual field scenarios, enhance and expand feature dimensions with diversified data, and control the risk of overfitting with regularization and early stopping mechanisms. This ensures that the model can still identify anti-infective drug components in complex spectral interference environments, providing recognition capability support for intelligent detection of drug components.

[0067] The probability distribution vector is a one-dimensional numerical sequence output by the deep learning model after transformation by the activation function. Each value in the sequence corresponds to the probability of the presence of an identifiable anti-infective drug. The preset judgment threshold is the critical probability value for distinguishing the main effective ingredients. The preset warning threshold is the critical probability value for identifying trace interfering ingredients and suspected contaminating ingredients. The mean absolute difference is a statistical indicator of the overall deviation of the spectrum before and after quantitative correction. The difference level is the spectral interference intensity level divided according to the mean absolute difference. The rule base is a comprehensive set of judgment criteria formulated by combining anti-infective drug use specifications, drug compatibility requirements, and spectral interference risks. The drug preparation safety rating is a conclusion on the drug preparation safety level based on the ingredients and interference indicators.

[0068] First, the metabolic interference correction spectrum is input into the deep learning component recognition model to perform model inference operations. The model has fixed input dimensions, network structure and weight parameters during the training phase. Before formal inference, the input format is checked to verify whether the total number of wavelength points, data arrangement order and numerical storage format of the metabolic interference correction spectrum are completely consistent with the requirements of the model input layer. If there is a dimension deviation or format abnormality, dimension completion, point reordering and format conversion are completed according to the model standard format. After the format verification is passed, the one-dimensional absorbance sequence is completely sent into the model.

[0069] Metabolic interference correction spectral data are sequentially passed through a one-dimensional convolutional layer, a batch normalization layer, a non-linear activation layer, and a max pooling layer of the model to complete multi-dimensional local and global feature extraction. After feature flattening, the data is fed into a fully connected layer for feature fusion. Finally, the output layer, combined with the Softmax activation function, completes the probability conversion and outputs a probability distribution vector that is consistent with the model's preset dimensions of the number of drug types to be identified. Each dimension of the probability distribution vector is bound to a unique anti-infective drug name, and the values ​​in the vector range between zero and one. The magnitude of the value represents the predicted probability of the corresponding drug being detected among the drugs to be tested.

[0070] After the model outputs the probability distribution vector, it retrieves the preset judgment threshold and preset warning threshold that have been pre-calibrated and solidified locally. Both thresholds are determined through a large number of clinical sample control experiments and medication safety standards, and the value of the preset judgment threshold is always greater than the preset warning threshold.

[0071] The probability distribution vector is iterated through all dimensions one by one, and the corresponding drug name and probability value are read sequentially to carry out stratified screening. First, all drugs with probability values ​​greater than the preset judgment threshold are screened out. These components are the substances with the highest proportion and clear main action in the drug to be tested, and are uniformly classified as main candidate components. The specific probability value corresponding to each main candidate component is recorded simultaneously. After the main candidate component screening is completed, the remaining dimensions are traversed to screen out other drugs with probability values ​​greater than the preset warning threshold and less than or equal to the preset judgment threshold. These components are mostly trace metabolites, suspected mixed excipients or cross-interference components, and are uniformly classified as warning candidate components. The corresponding probability values ​​are also retained. For drugs with probability values ​​less than or equal to the preset warning threshold, they are judged as having no effective detected components and are directly removed.

[0072] The main candidate components and warning candidate components obtained from the screening are integrated in the order of classification, and the component type and corresponding predicted probability are labeled. The complete content after integration is the component qualitative result. If no qualified components are screened after the process, the component qualitative result is marked as no target anti-infective drug is detected.

[0073] After completing the qualitative analysis of the components, the mean absolute difference between the preprocessed spectrum and the metabolic interference correction spectrum at all wavelengths is calculated. The preprocessed spectrum is the original standard spectral sequence without interference attenuation processing, while the metabolic interference correction spectrum is the new spectral sequence after the attenuation of the metabolite signal. The wavelength start and end range, sampling step size, and total number of wavelength points of the two sets of spectra are completely consistent, which is the basis for the difference calculation.

[0074] First, initialize the total absolute difference accumulation variable by setting its initial value to zero. Simultaneously, count the total number of wavelength points with the same wavelength in both sets of spectra. Perform calculations point by point in order of wavelength from low to high. For each wavelength point, read the absorbance value corresponding to the preprocessed spectrum and the absorbance value corresponding to the metabolic interference correction spectrum. Calculate the difference between the two values ​​and obtain the absolute value of the result. This value is the single-point absolute difference for the current wavelength point. Accumulate the single-point absolute difference into the total absolute difference accumulation variable.

[0075] After all the single-point absolute differences of all wavelength points have been calculated and accumulated, the final value of the total absolute difference summation variable is divided by the total number of wavelength points. The result is the average absolute difference between the two sets of spectra. This index can objectively reflect the interference intensity of the metabolites of anti-infective drugs on the original spectrum. The larger the value of the average absolute difference, the more obvious the interference of the original spectrum with the metabolites, and the greater the magnitude of the spectral correction.

[0076] After obtaining the mean absolute difference, the pre-defined difference levels are retrieved. These levels are divided into multiple consecutive ranges based on numerical intervals. Each range corresponds to a fixed range of mean absolute difference values ​​and is associated with a standardized text prompt. The calculated mean absolute difference is compared with the numerical ranges of each range to determine the range to which the current value belongs. The corresponding standard text is then retrieved and combined with the original mean absolute difference value to generate a complete spectral difference prompt. The prompt clearly indicates the spectral interference level, the deviation before and after correction, and a basic explanation of the source of interference.

[0077] After obtaining two types of information—qualitative results of the components and spectral difference indications—a comprehensive judgment is made by calling a locally stored preset rule base. The preset rule base is jointly formulated by pharmaceutical professionals in conjunction with incompatibilities of anti-infective drugs, clinical drug safety guidelines, and spectral interference risk levels. The rule base contains multiple independent judgment entries, each of which clearly defines the combination conditions of the component combination form, the number of warning components, the spectral difference level, and the corresponding dispensing safety rating. The dispensing safety rating is divided into multiple gradient levels to distinguish the safety risk levels of drug dispensing.

[0078] First, extract the main candidate component types, the number and type of warning candidate components from the component qualitative results. Then, extract the difference level corresponding to the spectral difference level prompt. Combine the two types of information and match them one by one with the judgment entries in the rule library. When the combined conditions completely match a certain rule, retrieve the blending safety rating corresponding to that rule and record the matching basis of this rule.

[0079] In the actual matching process, various working conditions are distinguished. If the main candidate component is a compliant anti-infective drug, there are no warning candidate components, and the spectral difference is a low level of interference, the rule base will match to obtain a safety level. If there are a few warning candidate components and the spectral difference is a medium level of interference, the matching will obtain a concern level, reminding pharmacists to review the components. If a drug combination with incompatible ingredients is detected and the spectral difference reaches a high level of interference, the matching will obtain a risk level. If multiple warning candidate components are superimposed and the spectrum shows an extremely high level of interference, the matching will obtain a high-risk level, directly triggering a medication risk warning.

[0080] After all the judgment procedures are completed, the three categories of content—qualitative results of components, spectral difference indications, and formulation safety rating—are integrated and formatted according to the unified output format of the hospital's test reports. The component qualitative results area distinguishes and displays the main candidate components, warning candidate components, and their corresponding predicted probabilities. The spectral difference indication area marks the original value of the average absolute difference and the interference level description. The formulation safety rating area displays the final safety level and the basis for rule matching. At the same time, traceability information such as the drug number, test time, spectral equipment number, and model version corresponding to this test are also attached.

[0081] All integrated content is output in real time through multiple interfaces such as local terminal interface, hospital pharmacy management, and clinical pharmacy workstation, for pharmacy staff and clinical pharmacists to view and use. This not only realizes the intelligent qualitative analysis of anti-infective drug components, but also completes the automated assessment of medication risks, fully meeting the application requirements of drug component detection and medication safety management in the field of anti-infective clinical pharmacy.

[0082] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely preferred examples and are not intended to limit the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.

Claims

1. A smart detection method for drug components based on anti-infective clinical pharmacy, characterized in that: Includes the following steps: S1. Collect the initial spectral data of the drug to be tested; S2. Obtain the medical order information of the anti-infective drug currently being used by the patient corresponding to the drug to be tested through the hospital information module. Based on the generic name of the drug in the medical order information, retrieve the standard spectral data of the anti-infective drug and its known metabolites from the pre-constructed anti-infective drug metabolite spectral feature database. The anti-infective drug metabolite spectral feature database is based on the in vivo metabolic pathways of different anti-infective drugs and includes the characteristic spectra of the parent drug and its main metabolites under the same detection conditions. S3. Preprocess the initial spectral data to obtain the preprocessed spectrum. Perform spectral residual analysis on the preprocessed spectrum and the standard spectrum to calculate the correlation coefficient between the absorbance at each wavelength point and the standard spectrum of the metabolite. Mark the continuous wavelength range with the correlation coefficient greater than the preset interference threshold as the metabolite interference region. S4. For the regions where metabolites interfere, a weighting factor adjusted according to the correlation coefficient is used to attenuate the spectral signal, while the original signal is preserved for the unlabeled regions to obtain the metabolic interference corrected spectrum. S5. Input the metabolic interference correction spectrum into a deep learning component identification model that has been pre-trained using the spectrum of anti-infective drug standards, output the component qualitative results of the drug to be tested, and generate auxiliary information including the difference in spectral density before and after correction and the formulation safety rating.

2. The intelligent detection method for drug components based on anti-infective clinical pharmacy according to claim 1, characterized in that: The acquisition of initial spectral data for the drug to be tested specifically includes: The prepared drug product is scanned non-contactly using a portable near-infrared spectrometer. The raw spectral signal obtained from the scan is transmitted to a data preprocessing module. In the data preprocessing module, the raw spectral signal is subjected to dark current noise subtraction, ambient light noise elimination, and smoothing filtering in sequence to obtain a preliminary denoised spectral signal. The wavelength of the preliminary denoised spectral signal is calibrated to be consistent with the detection conditions of the anti-infective drug metabolite spectral characteristic database. The wavelength-calibrated spectral signal is then stored as the initial spectral data of the drug product.

3. The intelligent detection method for drug components based on anti-infective clinical pharmacy according to claim 1, characterized in that: Pure samples of known anti-infective drug standards and their known metabolites, separated and identified in serum samples using liquid chromatography-mass spectrometry, were collected. At least three replicate standard spectral data points for each pure sample were obtained using methods consistent with the detection conditions of the anti-infective drug metabolite spectral feature database. The replicate standard spectral data points for each group were averaged and normalized to obtain a unique standard spectral fingerprint. Simultaneously, virtual characteristic spectra of intermediate metabolites under the same detection conditions were generated using pharmacokinetic simulation software based on the generic name of the drug and the patient's liver and kidney function parameters. The unique standard spectral fingerprint and the virtual characteristic spectra were then linked and stored together to form the anti-infective drug metabolite spectral feature database.

4. The intelligent detection method for drug components based on anti-infective clinical pharmacy according to claim 1, characterized in that: The system analyzes medical orders obtained from the hospital information module, extracts the generic names of drugs and their corresponding administration times, and queries the anti-infective drug metabolite spectral feature database using the generic name as a keyword. It matches and retrieves the standard spectral fingerprint of the parent drug corresponding to the generic name. Simultaneously, it assesses the drug metabolism stage based on the interval between the administration time and the current time, and retrieves the standard spectral fingerprints of known major metabolites related to that stage from the database. Then, it retrieves all virtual feature spectra related to the generic name in the anti-infective drug metabolite spectral feature database. The retrieved parent drug standard spectral fingerprints, metabolite standard spectral fingerprints, and virtual feature spectra are merged into a standard spectral data set of the anti-infective drug and its known metabolites.

5. The intelligent detection method for drug components based on anti-infective clinical pharmacy according to claim 1, characterized in that: The step of performing spectral residual analysis between the preprocessed spectrum and the standard spectrum specifically includes: Each standard spectral fingerprint or virtual feature spectrum in the standard spectral data set is subtracted sequentially from the preprocessed spectrum to generate a residual spectral sequence. For each residual spectral sequence, the average absolute residual value over the entire wavelength range is calculated, and a dynamic residual threshold is set to identify bands in the residual spectral sequence where the residual value of consecutive wavelength points is lower than the dynamic residual threshold. These bands are considered as potential spectral interference regions corresponding to the standard spectrum.

6. The intelligent detection method for drug components based on anti-infective clinical pharmacy according to claim 5, characterized in that: The acquisition of absorbance at each wavelength point specifically includes: After processing the initial spectral data to obtain the preprocessed spectrum, the signal intensity value corresponding to each specific wavelength is read from the preprocessed spectrum. The signal intensity value is subjected to non-contact scanning and preprocessing to characterize the degree of light absorption at each wavelength point, which is used as the absorbance at each wavelength point.

7. The intelligent detection method for drug components based on anti-infective clinical pharmacy according to claim 1, characterized in that: The calculation of the correlation coefficient between the absorbance at each wavelength point and the standard spectrum of the metabolite, and the marking of continuous wavelength intervals with correlation coefficients greater than a preset interference threshold as metabolite interference regions, specifically includes: The absorbance at each wavelength point of the preprocessed spectrum is used as data sequence one, and the absorbance at each wavelength point of each metabolite standard spectral fingerprint or virtual feature spectrum in the standard spectral data set is used as data sequence two. Under the same wavelength coordinates, the similarity correlation coefficient between data sequence one and data sequence two within a local window is calculated using the sliding window method. When the average value of the similarity correlation coefficient of all wavelength points in a certain continuous wavelength interval is greater than the preset interference threshold, and the similarity correlation coefficient of a single wavelength point exceeding the proportional threshold in the continuous wavelength interval is also greater than the preset interference threshold, then this continuous wavelength interval is determined to be a metabolite interference region.

8. The intelligent detection method for drug components based on anti-infective clinical pharmacy according to claim 7, characterized in that: The attenuation of spectral signals in the region interfering with metabolites using a weighting factor adjusted according to the correlation coefficient specifically includes: For each wavelength point within each metabolite interference region, based on the similarity correlation coefficient calculated for each wavelength point, an attenuation weighting factor between zero and one is calculated using a preset nonlinear attenuation function. The original absorbance of the wavelength point is multiplied by the corresponding attenuation weighting factor to obtain the new absorbance value of the wavelength point after attenuation. For wavelength points not marked as metabolite interference regions, their attenuation weighting factor is always one, keeping their original absorbance value unchanged. After all wavelength points undergo this weighted calculation, a new spectral curve is formed, namely the metabolic interference correction spectrum.

9. The intelligent detection method for drug components based on anti-infective clinical pharmacy according to claim 1, characterized in that: A standard solution containing various common anti-infective drugs and mixed samples at different concentrations and pH levels were prepared. Raw spectral data of all samples were collected under the aforementioned detection conditions and preprocessed to form a training spectral dataset. The training spectral dataset was augmented to expand its size. A deep learning model was constructed using a convolutional neural network. The expanded training spectral dataset and its corresponding known drug ingredient labels were input into the deep learning model. The network parameters were iteratively optimized to minimize the error between the network output and the actual ingredient labels, ultimately obtaining a deep learning ingredient recognition model.

10. The intelligent detection method for drug components based on anti-infective clinical pharmacy according to claim 1, characterized in that: The metabolic interference-corrected spectrum is input into a deep learning component identification model, which outputs a probability distribution vector. Components with probability values ​​exceeding a preset judgment threshold are selected as primary candidate components, and other components with probability values ​​exceeding a preset warning threshold are selected as warning candidate components. Together, they form the component qualitative result. Simultaneously, the average absolute difference between the preprocessed spectrum and the metabolic interference-corrected spectrum at all wavelengths is calculated. The average absolute difference is compared with a preset difference level to generate a spectral difference prompt. Combining the component qualitative result and the spectral difference prompt, a formulation safety rating is generated based on a preset rule base. The component qualitative result, the spectral difference prompt, and the formulation safety rating are output together.