Water quality antibiotic tracing method and system based on data analysis

By constructing the PI-GAT model and the AIRL framework, the problems of low model accuracy and low inversion efficiency in existing antibiotic source tracing technologies have been solved. This has enabled high-precision prediction of antibiotics in water bodies and accurate location of pollution sources, thereby improving the robustness and efficiency of source tracing technologies.

CN120892686BActive Publication Date: 2026-01-27GUANGXI ZHUANG AUTONOMOUS REGION ECOLOGICAL ENVIRONMENT MONITORING CENT +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510978249.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-16
Publication Date
2026-01-27
Estimated Expiration
2045-07-16

AI Technical Summary

Technical Problem

Existing antibiotic source tracing technologies suffer from low propagation model accuracy and poor adaptability to complex water systems when dealing with complex aquatic environments. Their inversion algorithms are inefficient and prone to getting trapped in local optima, making it difficult to accurately locate pollution sources.

Method used

A data analysis-based approach is adopted to construct a Physical Information-Graph Attention Network (PI-GAT) propagation prediction model, and combined with the Adversarial Inverse Reinforcement Learning (AIRL) framework. By processing complex river network data through graph attention networks, physical laws and data-driven approaches are integrated to achieve efficient and robust pollution source inversion.

Benefits of technology

It enables high-precision spatiotemporal distribution prediction of antibiotics in water bodies and accurate location of pollution sources, improves the efficiency of inversion calculation, avoids local optima, and provides a scientific basis for source tracing analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120892686B_ABST
    Figure CN120892686B_ABST
Patent Text Reader

Abstract

The application discloses a water quality antibiotic tracing method and system based on data analysis, comprising the following steps: first, constructing a water system network into a topological graph, and establishing a physical information-graph attention network as a pollutant propagation prediction model; the model integrates the partial differential equation of the convection and diffusion of the pollutant into a loss function as a physical constraint, so as to realize physical fidelity prediction of the spatio-temporal distribution of the antibiotic concentration in the water body; secondly, constructing a pollution source tracing problem into a reverse reinforcement learning task, adopting an adversarial reverse reinforcement learning framework, taking the propagation prediction model as a dynamic environment, and through adversarial training of a generator and a discriminator, learning a pollution source reward function which can optimally explain the observation results from the real downstream monitoring data; finally, generating a probability distribution graph of the upstream candidate pollution source position according to the reward function, and combining the hydrodynamic constraint condition to accurately position, which significantly improves the accuracy, robustness and calculation efficiency of the tracing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information technology, and in particular to a method and system for tracing the source of antibiotics in water quality based on data analysis. Background Technology

[0002] Antibiotic pollution in aquatic environments has become a global environmental health threat, with its widespread presence posing a serious risk to ecosystem balance and human health. Antibiotic pollution sources are typically characterized by diversity, concealment, and intermittent occurrence, making the accurate and rapid identification of pollution sources and the tracing of their migration and transformation pathways a major challenge in water environmental protection. Effective source tracing is a prerequisite for developing precise pollution control strategies and implementing emergency responses.

[0003] Current antibiotic source tracing technologies mainly rely on traditional chemical analysis and statistical methods, which have significant limitations when dealing with complex aquatic systems. Traditional methods often separate antibiotic concentration detection from pollution source location, lacking a deep understanding of the dynamic propagation process of pollutants in water bodies. Furthermore, existing technologies struggle to effectively integrate multi-source, heterogeneous monitoring data, failing to fully utilize the spatiotemporal distribution information of antibiotics in water bodies to infer the location of pollution sources.

[0004] The spread and diffusion of antibiotics in water bodies are influenced by both hydrodynamic conditions and the physicochemical properties of the antibiotics themselves. Water flow velocity and turbulent diffusion coefficient determine the basic transport characteristics of antibiotics in water, while physicochemical properties such as molecular weight and solubility directly affect their migration and transformation behavior under different aquatic environmental conditions. This complex physicochemical coupling process makes the spread path of antibiotics from the pollution source to the downstream detection point highly nonlinear. Accurately describing the concentration changes during spread requires comprehensive consideration of multiple key parameters in the convection-diffusion equation, and these parameters often exhibit spatiotemporal variability in actual aquatic environments, making the prediction of the spatial distribution of antibiotics extremely difficult.

[0005] On the other hand, while data-based statistical methods bypass complex physical processes to some extent, their effectiveness heavily relies on large amounts of high-quality monitoring data and struggles to reveal the intrinsic mechanisms of pollutant propagation, often resulting in a lack of physical interpretation in their source tracing results. More importantly, in the computational stage of pollution source inversion (i.e., tracing upstream sources from downstream observations), existing technologies generally employ traditional optimization algorithms (such as genetic algorithms and particle swarm optimization) to solve the propagation model in reverse. These algorithms are inefficient in their search process, requiring repeated calls to the time-consuming forward propagation model and are prone to getting trapped in local optima, making it difficult to meet practical requirements in terms of robustness and reliability of source tracing results. How to construct an accurate mathematical model of propagation and diffusion based on hydrodynamic principles and the physicochemical properties of antibiotics, and effectively solve the convection-diffusion equations through numerical simulation to achieve accurate prediction of the spatial distribution of antibiotics in water bodies at different time points, thereby providing a reliable theoretical basis for the propagation mechanism in source tracing analysis, has become a key issue in the development of water quality antibiotic pollution source tracing technology. Therefore, a new antibiotic pollution source tracing technology that integrates the advantages of physical mechanisms and data-driven approaches, and possesses efficient and robust inversion capabilities, is urgently needed. Summary of the Invention

[0006] The purpose of this application is to overcome the above-mentioned defects of the prior art and provide a water quality antibiotic source tracing method and system based on data analysis. It aims to solve the technical problems of low accuracy of propagation models, poor adaptability to complex water systems, low efficiency of inversion algorithms and easy getting trapped in local optima in the existing water pollution source tracing technology.

[0007] To achieve the above objectives, this application provides the following technical solution:

[0008] In a first aspect, the present invention discloses a method for tracing the source of antibiotics in water quality based on data analysis, comprising the following steps:

[0009] S1: Data Acquisition and Preprocessing. Antibiotic concentration monitoring data and corresponding hydrological data from multiple monitoring stations in the target water area are acquired. The heterogeneous raw data from multiple sources are cleaned, aligned, and standardized to form a spatiotemporal sequence dataset containing spatial coordinates, timestamps, and standardized concentration values, which serves as the basis for subsequent model training and validation.

[0010] S2: Construct and train a Physical Information-Graph Attention Network (PI-GAT) propagation prediction model. This step aims to establish a high-accuracy, highly physically interpretable positive model of pollutant propagation.

[0011] S21: Structuring the River System Graph. The river network of the target water area is abstracted into a graph structure G = (V, E), where V is the set of nodes, representing key locations such as monitoring stations, river bifurcation points, or confluence points; E is the set of edges, representing river segments connecting the nodes. Node features may include historical concentration data and water depth, while edge features may include river segment length and flow velocity.

[0012] S22: Construct the PI-GAT model architecture. The core of this model is the Graph Attention Network (GAT), which can process graph-structured inputs and adaptively learn the influence weights of different neighboring nodes on the state update of the central node through an attention mechanism, thereby effectively capturing the spatial dependence of pollutants in irregular river networks.

[0013] S23: Incorporating Physical Constraints. To ensure that the model's predictions not only fit the data but also obey physical laws, the convection-diffusion partial differential equation (PDE) for antibiotic propagation in water is introduced as a regularization term into the model's loss function. The total loss function is defined as L_total = α * L_data + β * L_phys. Here, L_data is the data-driven supervised loss, such as the mean squared error (MSE) between the model's predicted values ​​and the actual monitored values; L_phys is the physical constraint loss, obtained by calculating the residuals of the PDE at randomly sampled collocation points throughout the computational domain. Specifically, the automatic differentiation function of the neural network is used to calculate the partial derivatives of the concentration field output by the model with respect to time and spatial coordinates, which are then substituted into the PDE equation, with the norm of the equation residuals used as the physical loss. α and β are adjustable weight hyperparameters. The model is trained end-to-end by minimizing the total loss function.

[0014] S3: Use Adversarial Inverse Reinforcement Learning (AIRL) for probabilistic source tracing of pollution. This step aims to efficiently and robustly invert pollution sources using a trained propagation model.

[0015] S31: Construct a reinforcement learning environment for source tracing. Use the PI-GAT model trained in step S2 as the dynamic environment. This environment can receive an action, i.e., the release strategy (such as location, intensity, and time) of a candidate pollution source, and quickly simulate the concentration change sequence at downstream monitoring points caused by the strategy, i.e., the trajectory.

[0016] S32: Construct the AIRL framework. This framework includes a generator (Generator / Policy) and a discriminator. The generator's task is to explore and generate various possible pollution source release strategies. The discriminator's task is to distinguish between the "expert trajectory" (i.e., the actual downstream monitoring concentration sequence) and the "simulated trajectory" generated by the generator.

[0017] S33: Perform adversarial training. The generator and discriminator engage in a minimax game similar to that of a Generative Adversarial Network (GAN). The discriminator is trained to maximize its ability to distinguish between real and fake trajectories, while the generator is trained to generate trajectories that are as realistic as possible to "fool" the discriminator. Within the AIRL framework, the discriminator's optimization process can implicitly recover a reward function.

[0018] S34: Learn and generate a probability distribution map. After the adversarial training converges, the learned reward function R(s,a) can evaluate the rationality of any pollution source strategy (action a). By evaluating and normalizing this reward function across the spatial dimension of the entire upstream potential pollution area, a refined probability distribution map of candidate pollution source locations can be obtained. Regions with higher probability values ​​in the map are more likely to be actual pollution sources.

[0019] S4: Locate the pollution source and output the results. Based on the probability distribution map obtained in step S3, set a probability threshold (e.g., 0.8) to filter out high-probability candidate pollution areas. Then, apply hydrodynamic constraints to these candidate areas for verification, such as verifying whether the water flow path of the candidate pollution source can indeed reach the downstream monitoring point where abnormal concentrations occur. Areas that pass the verification are identified as the final antibiotic pollution source. Finally, generate a visual source tracing analysis report that includes the pollution source location, confidence level, and a simulated animation of the pollutant propagation path.

[0020] Secondly, this application also provides a source tracing system, including a data preprocessing module, a propagation prediction module, an inversion calculation module, and a pollution source location module, to implement the above method.

[0021] The technical solution provided by this invention may include the following beneficial effects:

[0022] This invention discloses a method for tracing the source of antibiotic pollution in aquatic environments. It standardizes multi-source, heterogeneous antibiotic concentration monitoring data to establish a unified spatiotemporal sequence dataset and constructs a Physical Information-Graph Attention Network (PI-GAT) as a pollutant propagation prediction model. This model incorporates the pollutant convection-diffusion partial differential equation as a physical constraint into the loss function to achieve physically accurate prediction of the spatiotemporal distribution of antibiotic concentrations in water bodies. Secondly, the pollution source tracing problem is constructed as an inverse reinforcement learning task. Using the Adversarial Inverse Reinforcement Learning (AIRL) framework, with the propagation prediction model as the dynamic environment, an optimal pollution source reward function that can interpret the observation results is learned from real downstream monitoring data through adversarial training between the generator and discriminator. Finally, a probability distribution map of the upstream candidate pollution source locations is generated based on this reward function, and precise location is achieved by combining hydrodynamic constraints. This invention realizes a full-process source tracing analysis from monitoring data to pollution source identification, providing a scientific basis for the treatment of antibiotic pollution in aquatic environments and having significant implications for protecting the aquatic ecological environment.

[0023] 1. By combining graph neural networks with physical information constraints, the propagation model of this application can effectively handle complex and irregular river networks and sparse monitoring data. Its prediction results not only have high data fidelity, but also conform to physical laws, and its generalization ability far exceeds that of traditional numerical models.

[0024] 2. This application adopts an adversarial inverse reinforcement learning framework, which transforms the traditional source tracing optimization search problem into a robust probability distribution learning problem, effectively avoiding the problem of local optima. At the same time, it uses neural networks for inference, which greatly improves the efficiency of inversion calculation. Attached Figure Description

[0025] Figure 1 This is an overall flowchart of a water quality antibiotic tracing method provided in the embodiments of this application.

[0026] Figure 2 This is a schematic diagram of the physical information-graph attention network (PI-GAT) model architecture in the embodiments of this application.

[0027] Figure 3 This is a schematic diagram of the adversarial inverse reinforcement learning (AIRL) source tracing framework in the embodiments of this application.

[0028] Figure 4 This is a visual example of the pollution source probability distribution map that is finally output by the embodiments of this application.

[0029] Figure 5 This is a bar chart comparing the traceability performance of the method in this application with that of traditional methods.

[0030] Figure 6This is a functional block diagram of a water quality antibiotic traceability system provided in an embodiment of this application.

[0031] Figure 7 A flowchart of a water quality antibiotic tracing method based on data analysis, provided as another embodiment of the present invention. Detailed Implementation

[0032] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0033] Example 1

[0034] This embodiment uses the emergency source tracing of antibiotic pollution in a certain river basin as a background to elaborate on the following: Figure 1 The specific steps for implementing the water quality antibiotic tracing method are shown.

[0035] S1: Data acquisition and preprocessing. Acquire antibiotic concentration monitoring data and corresponding hydrological data from multiple monitoring stations in the target water area. Clean, align and standardize the heterogeneous raw data from multiple sources to form a spatiotemporal sequence dataset containing spatial coordinates, timestamps and standardized concentration values, which serves as the basis for subsequent model training and validation.

[0036] For example, suppose the watershed has 20 water quality monitoring stations capable of monitoring the concentrations of various antibiotics, including tetracycline and amoxicillin, and simultaneously recording hydrological data such as flow velocity and water depth. The raw data is uploaded to the data center via a wireless network in different formats (e.g., JSON, CSV) and at different frequencies (e.g., every 15 minutes, every hour). Specifically, the following operations are performed:

[0037] Data access and parsing: Raw data from each monitoring station is obtained through API interface or file polling, and parsed according to predefined rules to extract key fields such as concentration value, hydrological parameters, timestamp and station ID.

[0038] Data cleaning: Identifying and handling outliers and missing values. For example, the Isolation Forest algorithm is used to identify outliers in multivariate data (such as concentration abruptly dropping to 0 or reaching a maximum value due to instrument malfunction); for missing data over a short period (such as no more than 4 consecutive missing sampling points), Kriging interpolation based on neighboring spatiotemporal points is used for imputation.

[0039] Spatiotemporal alignment: Unify all data to a standard time grid (e.g., uniform resampling at 30-minute intervals), and unify the timestamp format to the UTC standard. Convert the spatial coordinates of all sites to the WGS84 geographic coordinate system.

[0040] Data standardization: To eliminate the influence of different antibiotic concentration levels and different hydrological parameter units, the Z-score standardization method was used to normalize all numerical features so that they follow a standard normal distribution with a mean of 0 and a variance of 1.

[0041] After the above processing, a clean and well-organized spatiotemporal sequence dataset is finally generated for subsequent model input. Each record contains: monitoring point ID, timestamp, longitude, latitude, antibiotic type, and concentration value.

[0042] Another possible method for data acquisition and preprocessing is to acquire raw data on antibiotic concentrations in the water environment from multiple monitoring stations using a data acquisition interface. This raw data includes concentration values, timestamps, and location information in different formats. A data cleaning module performs quality checks on the raw data. If the data integrity is below a preset threshold, it is marked as abnormal data; if the data format does not conform to specifications, it is converted to obtain cleaned monitoring data. Based on the timestamp information in the cleaned monitoring data, a time standardization algorithm is used to convert timestamps from different time zones and formats into a unified time format, determining a standardized time series. For the spatial coordinate information in the standardized time series, coordinate system transformation is used to unify the location data under different coordinate systems into a standard geographic coordinate system, obtaining a standardized spatial coordinate set. Data fusion technology is used to correlate and match the standardized spatial coordinate set with the corresponding antibiotic concentration values. If the spatial coordinates and concentration data match successfully, a spatiotemporal correlation is established, resulting in a spatiotemporal correlation data matrix. An LSTM neural network is used to perform sequence modeling on the spatiotemporal correlation data matrix, constructing multi-dimensional feature vectors based on the time and spatial dimensions to determine the continuity and completeness of the data sequence. Based on the spatiotemporal distribution characteristics of the multidimensional feature vectors, an interpolation algorithm is used to supplement the concentration data of missing time nodes, thereby obtaining a complete spatiotemporal sequence dataset of antibiotic concentrations.

[0043] S2: Build and train the PI-GAT propagation prediction model. The goal is to create a high-precision forward propagation model. For specific implementation details, refer to [link / reference needed]. Figure 2 .

[0044] 1. River system graph structuring: The river network of the basin (including 20 monitoring stations and 5 major river confluences) is constructed as a topological graph G = (V, E) containing 25 nodes and 30 edges, where V is the set of nodes and E is the set of edges.

[0045] Node: Each node represents a monitoring station or junction. The feature vector v_i of a node at time step t is represented as v_i^t=[c_1(t),c_2(t),...,d(t),f(t),...], where c_k(t) is the standardized concentration of the k-th antibiotic at time t, d(t) is the water depth, and f(t) is the flow rate.

[0046] Edge: Each edge represents a segment of the river connecting nodes. The feature vector e_{ij} of an edge is represented as [L_{ij}, S_{ij}, U_{ij}, ...], where L is the length of the river segment, S is the slope, and U is the average flow velocity. These features can be used as static feature inputs during training.

[0047] 2. PI-GAT Model Design:

[0048] GAT Layer: The model employs a stacked multi-layer graph attention network. In each layer, the new features of node i are computed by aggregating the features of its neighboring nodes j∈N(i). The attention coefficient α_{ij} measures the importance of neighbor j to node i, and is calculated as α_{ij}=

[0049] The function `softmax(LeakyReLU(W*[h_i||h_j]))` is used, where W is a learnable weight matrix, h is the feature representation of a node, and || is the concatenation operation. This allows the model to automatically learn the importance of different spatial relationships, such as upstream water flow and tributary inflow, making it more expressive than fixed-weight graph convolutional networks (GCNs).

[0050] Temporal processing: GRU (Gated Recurrent Unit) or LSTM (Long Short-Term Memory) units can be embedded between GAT layers to capture the evolution of antibiotic concentration over time.

[0051] Physical constraints (PINN part):

[0052] Two-dimensional transient convection-diffusion equations (PDEs) are selected as physical constraints: Where S represents source and sink terms.

[0053] During training, in addition to using monitoring points with real data (to calculate L_data), tens of thousands of virtual "configuration points" (x,y,t) are randomly sampled throughout the entire water computational domain. For each configuration point, the PI-GAT model predicts the concentration C_pred(x,y,t) at that point. Then, using TensorFlow's tf.GradientTape or PyTorch's torch.autograd.grad, the first and second partial derivatives of C_pred with respect to t,x,y are precisely calculated. These derivative values ​​are substituted into the aforementioned PDE equation to calculate the residual Residual(x,y,t).

[0054] Physical loss L_phys is defined as the mean square error of the residuals at all placement points: L_phys =

[0055] mean(||Residual(x_i,y_i,t_i)||2).

[0056] Training: The total loss function is L_total = α * L_data + β * L_phys. α and β are hyperparameters, which can be set to, for example, 1.0 and 0.01, and can be adjusted through cross-validation. The Adam optimizer is used, and the model is trained end-to-end to minimize the loss function at a suitable learning rate (e.g., 1e-3). This hybrid-driven training approach enables the model to make smooth and reasonable concentration interpolations and predictions that conform to physical laws, even in river sections with sparse monitoring data. Furthermore, its prediction results not only match existing data but also approximately satisfy the physical governing equations throughout the entire spatiotemporal domain, demonstrating strong generalization ability and physical consistency.

[0057] S3: Use AIRL for probabilistic source tracing of pollution. This step aims to efficiently and robustly invert pollution sources using a trained propagation model, achieving efficient inversion. For specific implementation details, refer to [link to implementation details]. Figure 3 .

[0058] 1. Constructing the RL Environment: The trained PI-GAT model is encapsulated into an OpenAI Gym-style environment. The `step(action)` function of this environment receives an `action`, which is a parameterized pollution source policy, such as a tuple containing location (x, y), constant release intensity Q, and duration Δt. This function calls the PI-GAT model to quickly simulate the concentration change sequence at 20 downstream monitoring points caused by the pollution source over the next 48 hours, returning the trajectory τ_sim.

[0059] 2. AIRL Framework Implementation:

[0060] Expert trajectory τ_exp: The abnormal concentration sequences of downstream monitoring points actually observed during this emergency event are used as expert demonstration data.

[0061] The generator G (policy network π) employs a multilayer perceptron (MLP) as the policy network. It receives the current state (which can be an empty state or upstream background concentration information) and outputs a probability distribution of actions. For continuous pollution source parameters (such as location and intensity), it can output the mean and variance of a Gaussian distribution. The generator's task is to explore and generate various possible pollution source release strategies.

[0062] Discriminator D / Reward Function R: This is the core of AIRL. The discriminator network D(s,a,s') is designed to decouple the reward function. Specifically, the reward function R is modeled as R(s,a)=g(s)-f(s,a,s'), where g and f are two neural networks that model the state and state-action pairs, respectively. The discriminator is trained to minimize a cross-entropy loss, i.e., L_D=-E_exp[log(D(s,a,s'))]-E_sim[log(1-D(s,a,s'))].

[0063] Competitive training:

[0064] a. (Update the discriminator): Sample (s,a,s') triples from τ_exp and τ_sim generated by G, and train D to better distinguish them.

[0065] b. (Update the generator): Fix D, and recover the current reward function R from D. Then, use the Trust Region Policy Optimization (TRPO) algorithm or the Proximity Policy Optimization (PPO) algorithm to update the parameters of the generator G so that the policy it generates can obtain higher cumulative rewards.

[0066] Generating the probability distribution map: After hundreds of rounds of adversarial training, the reward function R converges, accurately evaluating the quality of any potential pollution source. At this point, a fine-grained geographic grid (e.g., 100x100) is constructed across the entire upstream potential pollution area. For each grid point (x_i, y_j), it is treated as the pollution source location, and a typical intensity and duration are set, constituting a test action a_test. The value of R(s, a_test) is calculated, and the reward values ​​of all grid points are normalized (e.g., using Softmax), resulting in the following probability distribution map: Figure 4 The diagram shows the probability distribution of pollution sources.

[0067] S4: Pollution Source Location and Results Output

[0068] according to Figure 4The probability distribution map shown indicates that the probability value of the area near (x = 2.2 km, y = 2.2 km) reached 0.95, far exceeding the set threshold of 0.8, and was therefore identified as a high-suspect area. A hydrodynamic model (or flow field data) was then used for verification, confirming that the water flow at this point could reach the downstream anomaly monitoring point within approximately 12 hours. Therefore, the system ultimately marked this area as the source of this antibiotic contamination incident and generated a detailed report, including the GPS coordinates of the contamination source, confidence level, possible leak time, and dynamic visualization of the contaminant propagation path.

[0069] Example 2

[0070] This embodiment provides a water quality antibiotic tracing system based on data analysis, referencing... Figure 6 This system can be deployed on cloud computing platforms (such as Alibaba Cloud and AWS) to provide scalable computing resources and convenient access services. The system includes the following functional modules:

[0071] 1. Data Preprocessing Module: This is a data processing pipeline built on the ETL (Extract-Transform-Load) framework. This module generally follows the ETL architecture and can be subdivided into three main stages: data extraction, data transformation, and data loading.

[0072] The first stage is data extraction. The goal of this stage is to reliably and efficiently obtain raw monitoring data from heterogeneous data sources.

[0073] Multi-source data adapters: The module includes pre-built adapters for different data source types. For example, for modern monitoring platforms that provide RESTful API interfaces, an HTTP client adapter is configured to periodically (e.g., every 5 minutes) poll the API to obtain incremental JSON format data; for traditional sites that provide daily or hourly reports via FTP servers, an FTP / SFTP client adapter is configured to automatically log in, download, and parse CSV or custom-formatted text files; and for data directly written to relational databases (such as MySQL, PostgreSQL), a JDBC adapter is configured to retrieve data via SQL queries.

[0074] Raw data buffering and initial parsing: The acquired raw data is first buffered in a high-throughput message queue (such as Apache Kafka). This design decouples data acquisition from subsequent processing, effectively handling sudden traffic spikes from the front-end data source. A dedicated parsing service consumes messages from Kafka and, according to preset parsing rules (such as regular expressions, JSON path expressions, etc.), uniformly parses the raw data streams of different formats into structured records containing key fields such as "site ID," "timestamp," "parameter name," and "parameter value."

[0075] Second, the data transformation phase is primarily responsible for deep cleaning, repairing, and standardizing the structured data stream. The computational tasks in this phase are typically deployed on distributed computing clusters such as Apache Spark to ensure timely processing of massive amounts of data. This includes:

[0076] (1). Multi-dimensional spatiotemporal anomaly detection submodule

[0077] Traditional univariate anomaly detection methods (such as the 3σ criterion) only consider individual time series in isolation and cannot detect anomalies in the correlation between variables. For example, during a rainfall period, river flow (u) increases, and pollutant concentration (C) should be diluted and reduced. If both flow and concentration are abnormally high at the same time, this constitutes a multivariate anomaly event, which univariate methods are prone to overlooking. This application employs an anomaly detection algorithm based on DBSCAN (Density-Based Spatial Clustering of Applications with Noise) clustering, which can effectively identify such complex multivariate spatiotemporal anomaly patterns.

[0078] Feature Vector Construction: To perform multivariate analysis, a high-dimensional feature vector needs to be constructed for each spatiotemporal point (i.e., a station at a specific timestamp). In one implementation, this vector F(s,t) is defined at station s and time t as follows:

[0079]

[0080] Where C_1 to C_n are the standardized concentration values ​​of n different antibiotics; U is the standardized flow rate; D is the standardized water depth; and G is the standardized water level gradient. and These are the time-varying rates of change of concentration and flow velocity (i.e., first-order differences), used to characterize the drasticness of the changes. By combining these physically related variables, a snapshot that comprehensively reflects the state of the water body is constructed.

[0081] Introducing spatiotemporal neighborhood information: To capture spatiotemporal anomalies, the construction of feature vectors is further extended to include neighborhood information. For example, the feature vector F'(s,t) can be formed by concatenating or weighting the feature vectors of the center point (s,t) and its spatial neighbors (such as the nearest upstream and downstream stations) and temporal neighbors (such as the two preceding and following time steps). This allows the algorithm to not only determine whether a point itself is abnormal, but also whether it is "out of place" with its surrounding spatiotemporal environment.

[0082] DBSCAN algorithm execution flow:

[0083] a. Adaptive Parameter Selection: The DBSCAN algorithm has two key parameters: neighborhood radius (Eps) and minimum number of neighbors (MinPts). The settings of these parameters directly affect the detection performance. This module uses an adaptive method to determine them: First, calculate the distance from each point in the dataset to its k-th nearest neighbor (k is MinPts, usually set according to the data dimension and experience; for example, for a 10-dimensional vector, it can be set to 20). Then, sort these k-distance values ​​from largest to smallest and plot them as a "k-distance graph". The "elbow" position in the graph represents the optimal Eps value; this point marks the boundary where the data density changes significantly.

[0084] b. Clustering and Noise Identification: In a distributed environment, all feature vectors are used as input, and the DBSCAN algorithm is executed on Spark. The algorithm divides data points into three categories: core points (the number of points in their neighborhood is greater than MinPts), border points (the number of points in the neighborhood of core points but are not core points themselves), and noise points (neither core points nor border points).

[0085] c. Anomaly Labeling: All data records identified as noise points by the DBSCAN algorithm are labeled as "multivariate spatiotemporal anomalies". These points represent "outliers" that are located in sparse regions of the multidimensional feature space and do not belong to any dense clusters. They are the anomalous data that need to be removed or given special attention.

[0086] (2) Spatiotemporal missing value interpolation submodule

[0087] After removing outliers or data gaps due to equipment malfunction, it is necessary to fill the "holes" in the data matrix. Simple linear interpolation or mean filling ignores the spatiotemporal autocorrelation of the data. This application uses spatio-temporal kriging, a statistically based optimal linear unbiased estimation method that can accurately interpolate by utilizing both spatial and temporal correlations.

[0088] Empirical Spatiotemporal Variation Function Calculation: The core of Kriging interpolation is quantifying the spatiotemporal correlation between data points, which is achieved through the variogram function γ(h,u), where h is the spatial distance and u is the time lag. The calculation formula is as follows:

[0089] γ(h,u)=(1 / 2N(h,u))*Σ[(Z(s_i,t_k)-Z(s_j,t_l))^2]

[0090] Here, Z(s,t) represents the observation at station s at time t. The summation iterates through all data point pairs with a spatial distance of approximately h and a time interval of approximately u, and N(h,u) is the number of such pairs. In Spark, this calculation can be efficiently performed using a self-join operation combined with a distance calculation function. The result is an empirical, discrete variogram.

[0091] Theoretical variogram model selection and fitting: In order to obtain a continuous variogram model for interpolation, a theoretical model is needed to fit the empirical variogram contour plot mentioned above.

[0092] a. Model Selection: This module provides a variety of theoretical models to choose from, including but not limited to spherical, exponential, Gaussian, and nested models (such as a linear combination of two models). The choice of model is based on the morphological characteristics of the empirical variogram. For example, if the data shows that the correlation rapidly disappears after a certain distance and tends to a plateau (sill value), then the spherical model is a good choice; if the data shows strong short-range variability, then the exponential model is more suitable.

[0093] b. Model Fitting: Once a theoretical model is selected (e.g., a spherical model with three parameters: nugget, si, and range), its optimal parameters need to be determined. This module uses Weighted Least Squares (WLS) for fitting. WLS gives greater weight to empirical variogram values ​​calculated from more data points because they are considered more reliable. The fitting process is a nonlinear optimization problem, solved using iterative algorithms (such as Levenberg-Marquardt) to minimize the weighted squared error between the theoretical model and the empirical values.

[0094] Kriging interpolation is performed as follows: For any missing point (s_0, t_0), Kriging interpolation determines the optimal weights λ_i of its surrounding N known data points by solving a system of linear equations, such that the estimated value Z(s_0, t_0) = Σλ_i*Z(s_i, t_i) is unbiased and has the minimum estimation variance. The coefficient matrix of this system of equations is calculated from the fitted theoretical variogram model based on the spatiotemporal distances between the points. After solving this system of equations, the optimal estimate of the missing point can be obtained.

[0095] Third, in the data loading stage, the processed standardized spatiotemporal sequence data is stored in a high-efficiency columnar storage database (such as Parquet format files stored in HDFS or object storage) for rapid reading and analysis by subsequent modules. To ensure the stability, repeatability, and efficiency of the above complex data processing workflow, the execution of this stage is managed by a workflow scheduling system (such as Apache Airflow), and all computational tasks are executed on an Apache Spark cluster.

[0096] Through the aforementioned sophisticated algorithm design and robust distributed system architecture, the data preprocessing module of this application can provide a high-quality, complete, and reliable data foundation for subsequent tracing models.

[0097] 2. Propagation Prediction Module: The core of this module is the PI-GAT model implemented using TensorFlow or PyTorch. This module is not only responsible for model training, but its more crucial function is to provide a high-performance, high-fidelity inference engine. This inference engine is the computational core of the entire source tracing system, directly serving the high-throughput simulation needs of the inversion calculation module and the high-precision prediction needs of the source tracing visualization module. The design and implementation of the inference engine deeply integrates high-performance computing, numerical simulation concepts, and deep learning model optimization techniques. Its architecture, core algorithms, and working mechanisms will be described in detail below.

[0098] The core task of the inference engine is to load a pre-trained Physical Information-Graph Attention Network (PI-GAT) model and efficiently perform forward propagation based on the input instructions to simulate or predict the spatiotemporal evolution of antibiotics in water. Internally, it can be divided into four main sub-components: a model loader and distributor, an input processor, a core computation executor, and an output and state manager.

[0099] I. Model Loader & Distributor

[0100] Model Repository Interface: This component is responsible for interacting with the system's model repository. The model repository stores multiple versions of pre-trained PI-GAT models for different watersheds, different hydrological periods, and different pollutant types. Each model is serialized and stored in a standardized format (such as ONNX-Open Neural Network Exchange or PyTorch's TorchScript format), which includes the complete network topology and optimized weight parameters.

[0101] Version control and selection: When an inference task starts, the loader selects the most matching model version from the model repository based on the task's metadata (such as target watershed ID, current date, target pollutant). For example, the system will prioritize the model that is closest to the hydrological conditions of the current season to ensure the initial accuracy of the prediction.

[0102] Distributed Loading and Caching: In a distributed computing environment (such as a cluster of multiple GPU servers), the loader is responsible for efficiently loading the selected model into the memory (especially GPU memory) of each computing node. It employs intelligent caching strategies (such as LRU - Least Recently Used) to keep the most frequently used models resident in GPU memory, avoiding the I / O overhead caused by repeated loading. For particularly large models, the loader also supports model parallelism, which distributes different layers of the model across different GPUs.

[0103] II. Input Processor

[0104] This component is responsible for preparing all the input data required by the core computation executor and adapting it according to different operating modes. The inference engine supports two main operating modes:

[0105] Mode 1: High-throughput batch simulation mode for AIRL

[0106] Requirements Analysis: The AIRL algorithm in the inversion calculation module needs to evaluate thousands or even tens of thousands of different contamination source "hypotheses" (actions) in parallel during its policy exploration phase. This means that the inference engine must be able to handle a large number of independent simulation tasks simultaneously and return results with extremely high throughput.

[0107] Input Adaptation: In this mode, the input processor receives a batch of actions from the AIRL generator, where Batch_Actions = [action_1, action_2, ..., action_B], and B is the batch size (e.g., B = 1024). Each action defines an independent pollution source scenario. The input processor vectorizes these discrete actions, converting them into tensor forms suitable for the PI-GAT model input. Specifically, it constructs a source term feature for each pollution source, including its location and intensity, on the corresponding graph node and concatenates it with the initial state of the simulated scenario (e.g., background concentration field).

[0108] Vectorized State Management: To simulate B scenarios simultaneously, the processor maintains a state tensor of shape [B, N, F_node], where N is the number of nodes in the graph and F_node is the dimension of the node features. All B simulations share the same set of model weights but each has its own independent state, enabling the GPU to perform highly efficient parallel computation in a SIMD (Single Instruction, Multiple Data) manner.

[0109] Mode 2: High-Fidelity Simulation Mode for Visualization / Forecasting

[0110] Requirements Analysis: When the source tracing task is completed or when future pollution trends need to be predicted, the system needs to run a long-term, high-precision simulation. In this mode, accuracy, physical realism, and the ability to handle dynamic external inputs are paramount.

[0111] Dynamic boundary condition handling: In this mode, the input processor continuously monitors the real-time data stream from the data preprocessing module. For example, if simulating a tidal estuary, the processor acquires tidal data in real time and dynamically updates the characteristics (such as water level and flow velocity) of the corresponding boundary nodes in the model computation graph, ensuring that the model's predictions reflect the actual tidal backwater effect. Similarly, if there are other known reservoir releases or rainfall runoff events upstream, this information is also smoothly and in real-time injected into the model's input.

[0112] 3. Core Computation Executor: This is the brain of the inference engine, responsible for executing the core forward propagation algorithm of the PI-GAT model.

[0113] Timing Iterative Loop: The simulation process is a timing iterative loop. During each time step from t to t+Δt, the actuator performs a complete PI-GAT forward propagation.

[0114] PI-GAT Forward Propagation Kernel:

[0115] (1). Message Passing: For each node i in the graph, information is first collected from its neighboring node j. This information (i.e., the feature vector h_j of the neighboring node) is combined with the features of the connecting edge e_ij to form a "message".

[0116] (2). Attention Calculation: Using the graph attention (GAT) mechanism, the importance weight α_ij of each neighbor j's message to the central node i is calculated. α_ij is dynamically calculated based on the current features of nodes i and j, which allows the model to adaptively focus on the most important information sources (for example, in an upstream pollution event, the weight from upstream nodes will naturally increase).

[0117] (3). Information aggregation: The messages of all neighboring nodes are weighted and summed according to the calculated attention weights to obtain an aggregated context vector h'_i.

[0118] (4). Node Update: The aggregated vector h'_i is combined with the feature h_i of node i at the previous time step through a gated recurrent unit (GRU) or a similar recurrent neural network unit to calculate the new feature vector h_i^{t+Δt} of node i at the next time step.

[0119] h_i^{t+Δt}=GRU(h_i^t,h'_i). The use of GRU makes the update of node state memory-based, and can capture temporal dependencies.

[0120] (5). Decoding output: Finally, the final feature vectors of all nodes are converted into physically interpretable concentration values ​​C_pred(s,t+Δt) by a decoder consisting of one or more fully connected layers (MLP).

[0121] The adaptive time-stepping mechanism is designed to balance computational efficiency and simulation accuracy by embedding an adaptive time-stepping control logic within the actuator.

[0122] Gradient monitoring: After each iteration, the actuator quickly calculates the maximum gradient of the current concentration field in space. and the maximum rate of change over time

[0123] Step size adjustment strategy: Preset a CFL (Courant-Friedrichs-Lewy)-like stability condition or a maximum allowable change threshold Th. If This indicates a rapid change in concentration (e.g., at the leading edge of a pollution plume). In this case, the engine will automatically decrease the next time step Δt (e.g., Δt = Δt * 0.8) to capture this rapid change more precisely. Conversely, if the concentration field changes gradually, Δt can be increased appropriately (e.g., Δt = Δt * 1.1) to speed up the simulation. This makes the entire simulation process both accurate and efficient.

[0124] IV. Output & State Manager

[0125] API Interface: This component provides well-defined API interfaces to the upper-level modules (AIRL module and visualization module). For example, the `simulate(batch_actions, num_steps)` interface serves the AIRL module, returning a result tensor of shape [B, num_steps, N, F_output]. The `forecast(initial_state, duration, dynamic_inputs_stream)` interface serves the visualization module.

[0126] Post-processing of results: The output from the core actuator is a standardized value. The manager is responsible for denormalizing it to restore the true concentration value with physical units (such as μg / L) before returning it via the API.

[0127] Implementation of performance optimization strategies:

[0128] Model Quantization: For deployments on edge devices or scenarios with extremely high latency requirements, low-precision quantization techniques such as INT8 or FP16 can be applied during the model loading stage. This significantly reduces model size and computational cost, although it may result in a slight loss of accuracy.

[0129] Just-In-Time Compilation: Using torch.jit.script or TensorFlow's XLA (Accelerated Linear Algebra) compiler, the PI-GAT Python computation graph can be statically compiled into a highly optimized, hardware-independent intermediate representation. This eliminates the overhead of the Python interpreter and can trigger deeper graph optimizations, such as operator fusion, thereby significantly improving inference speed.

[0130] In summary, the inference engine of the propagation prediction module in this application, with its dedicated support for high-throughput batch processing and high-precision dynamic simulation, as well as its internal adaptive time step and dynamic boundary condition processing capabilities, together ensure that it can provide the entire traceability system with the ability to predict the future quickly, accurately, and physically reliably.

[0131] 3. Inversion Calculation Module: This is the core intelligent decision-making module for probabilistic pollution source tracing, including:

[0132] AIRL Framework Implementation: This module integrates the complete AIRL algorithm logic. It encapsulates the inference engine of the propagation prediction module into an RL environment. The generator and discriminator are independent neural network models and are also stored in a model repository.

[0133] Task Manager: When a tracing task is triggered, the manager initializes the AIRL framework, loads real "expert trajectory" data from the data preprocessing module, and starts the adversarial training loop. Hyperparameters of the training process (such as learning rate, number of iterations, PPO algorithm parameters, etc.) are configurable. Training logs and intermediate results (such as changes in the reward function) are recorded for analysis and debugging.

[0134] Probabilistic map generator: After training converges, this component is responsible for calling the converged reward function, performing gridded evaluation within a preset geographical range, and generating the final probability distribution map data (usually a two-dimensional matrix).

[0135] 4. Pollution Source Location Module: This is a post-processing and decision verification module. It receives the probability matrix output by the inversion calculation module and executes a threshold screening algorithm to find one or more connected high-probability regions.

[0136] This module integrates a hydrodynamic constraint database that stores flow field information for each region. It performs path connectivity analysis on the selected high-probability regions, eliminating candidate regions that are physically unlikely to affect downstream monitoring points.

[0137] The final output is a structured result containing information such as the GPS coordinates of the pollution source, confidence score, and recommended level of concern.

[0138] Furthermore, the system may include a source tracing visualization module: a user-friendly web interface. Using a GIS map as the base map, it can overlay a heatmap onto the pollution source probability distribution map. It can receive simulation data from the propagation prediction module and display the propagation process of pollutants from the identified source to downstream areas on the map in the form of a dynamic, color-coded "pollution cloud." It displays historical data, predicted data, and confidence levels of source tracing results for each monitoring point in dashboard and chart formats, providing decision-makers with one-stop situational awareness and decision support.

[0139] Example 3

[0140] Scenario Description: In a large drinking water source protection area, downstream water quality monitoring station A issued an alarm at 10:00 AM on July 10, 2025, detecting an abnormal increase in tetracycline concentration from the background value of 0.05 μg / L to 0.8 μg / L. The environmental emergency response center needs to immediately initiate source tracing to identify the pollution source.

[0141] System application process:

[0142] 1. Initiate the task: The emergency center operator initiates the process in the tracing system (e.g., ...). Figure 6 On the user interface, create a new emergency source tracing task, set the target pollutant as tetracycline, and specify the abnormal data sequence of monitoring station A as the source tracing target (i.e., expert trajectory).

[0143] 2. Automated processing: The system executes automatically in the background. The data preprocessing module immediately retrieves water quality and hydrological data from all relevant monitoring points within the water source protection area over the past 48 hours from the database and completes data cleaning and standardization within 5 minutes.

[0144] 3. Intelligent Inversion: The propagation prediction module loads a pre-trained PI-GAT model for this water source. The inversion calculation module starts the AIRL algorithm. The generator begins generating various possible leakage hypotheses (actions) within the upstream industrial park, agricultural area, and residential area. The discriminator continuously compares the simulation results generated by these hypotheses with the actual concentration curve at Station A.

[0145] 4. Results Presentation: After approximately 30 minutes of adversarial training, the inversion calculation converged. The pollution source localization module generated results as follows: Figure 4 The probability distribution map shown clearly indicates that the river section located approximately 8 kilometers upstream near a livestock farm has a probability of being a pollution source as high as 0.95. Hydrodynamic verification also confirms that pollutants from this location can reach Station A downstream.

[0146] 5. Decision-Making and Action: The source tracing visualization module highlighted the location of the farm on the GIS dashboard and dynamically simulated the entire process of wastewater leaking from that point and reaching monitoring station A within approximately 6 hours. Based on this accurate and rapid source tracing result, the emergency response team immediately went to the farm for on-site investigation and found that its wastewater treatment facilities were indeed malfunctioning, leading to the leakage of wastewater with excessive antibiotic levels. Simultaneously, according to the PI-GAT model's prediction, the downstream water body would return to normal levels within 24 hours, providing a scientific basis for formulating a downstream water supply scheduling plan.

[0147] The method proposed in this application (hereinafter referred to as "the method of this application", i.e., the combination of PI-GAT+AIRL) was compared with a representative traditional water quality tracing method (hereinafter referred to as "traditional method", such as the combination of PDE solving based on the finite difference method (FD) and particle swarm optimization (PSO) algorithm inversion). The two methods were run under exactly the same simulated aquatic environment and monitoring data, and the performance comparison results are as follows: Figure 5 As shown.

[0148] Appendix Figure 5 It is a bar chart showing the normalized comparison results of the two methods on two key performance indicators: "average positioning error" and "source tracing calculation time". The performance of the traditional method is set as the baseline value of 1.0, and the lower the value, the better the performance.

[0149] like Figure 5 As shown, the normalized score of the method in this application is 0.18 in terms of average positioning error, which means that its positioning error is only 18% of that of traditional methods. In other words, the source tracing accuracy of this application is about 4.5 times higher than that of traditional methods. The finite difference model used in traditional methods is essentially a discrete approximation of a continuous physical process, and its accuracy is severely limited by the mesh subdivision accuracy and the prior accuracy of physical parameters (such as diffusion coefficient and velocity field). In real and complex river networks, these parameters are often difficult to obtain accurately, resulting in significant "model errors" in the model itself. The PI-GAT model in this application perfectly adapts to the topology of the river network through a graph structure and learns the complex spatiotemporal correlations contained in real data through an attention mechanism. More importantly, the introduction of the Physical Information Neural Network (PINN) allows the model to be "constrained" and "corrected" by physical laws during training. Even in river sections without monitoring data, the model's inferences must follow the laws of material conservation and transport. This makes the PI-GAT model a high-fidelity simulator that is much closer to a "digital twin" level than the traditional FD model. A more accurate propagation model is the prerequisite and foundation for the source tracing algorithm to accurately reverse the process.

[0150] Furthermore, the PSO algorithm used in traditional methods is a heuristic search algorithm. The movement and updates of its particle swarm largely rely on randomness and local optima. When faced with complex source tracing problems involving high dimensions, non-convexity, and multiple peaks, it is prone to getting trapped in local optima. This means it may misclassify a "suboptimal" location with some similarity to the actual pollution source release pattern as the true source, leading to significant location errors. In contrast, the Adversarial Inverse Reinforcement Learning (AIRL) proposed in this application completely changes the solution paradigm. Instead of blindly searching for a "point" in the solution space, it learns a "surface"—the probability distribution surface of pollution sources. Through adversarial game between the generator and the discriminator, the algorithm learns from the data which pollution source assumptions (location, intensity, time) can most probably "reproduce" the actual downstream observations. This probabilistic reasoning approach has higher tolerance for noise, effectively integrates all information, and comprehensively evaluates all possible locations globally, thereby pinpointing the region with the highest confidence containing the true source with a high probability. Essentially, it is a more advanced and robust global optimization strategy.

[0151] In practical applications, the source tracing method proposed in this application allows environmental protection departments to directly target the pollution source, rather than conducting a comprehensive search within a range of hundreds of meters or even kilometers. This not only greatly saves manpower, material resources, and financial resources, but more importantly, it buys a valuable window of time for cutting off the pollution source and controlling the spread of pollution. This can minimize the damage caused by pollution incidents to the ecological environment and the production and lives of the people, and provide conclusive and highly credible scientific evidence for subsequent accountability and punishment.

[0152] like Figure 5As shown, in terms of source tracing computation time, the normalized score of the method in this application is 0.22, meaning that the time required to complete a complete source tracing task is only 22% of that of the traditional method, improving computational efficiency by more than 4 times. The core bottleneck of the traditional method lies in its "online simulation" source tracing mode. Each iteration of the PSO algorithm requires a complete call to the time-consuming FD numerical simulator to evaluate the fitness of each particle (representing a candidate solution). If there are 100 particles and 200 iterations, 20,000 independent numerical solutions from scratch are required, resulting in enormous computational costs. In contrast, the method in this application adopts an "offline training, online inference" mode. The most computationally intensive part is the one-time offline training of the PI-GAT and AIRL models. Once the model training is complete, the source tracing process becomes online inference. As a neural network, the PI-GAT model has an extremely fast forward propagation (i.e., one simulation) computation speed (usually in the millisecond range), which is several orders of magnitude faster than running a complete FD solver. The AIRL framework utilizes this ultra-high-speed simulated "environment," enabling its agents to explore and learn at an extremely high frequency, thereby converging to the optimal reward function in a very short time.

[0153] The method proposed in this application can reduce the source tracing time to the minute level. This means that emergency decision-makers can obtain a highly confident pollution source location report in a very short time after receiving an alert, which can provide strong technical support for protecting life, property and ecological environment safety.

[0154] In summary, under the same scenario, traditional source tracing methods based on finite difference models and particle swarm optimization can result in positioning errors of hundreds of meters and computation times of several hours, making them unsuitable for emergency situations. The method presented in this application not only reduces the positioning error by an order of magnitude (the average error is only 18% of that of traditional methods) but also compresses the total source tracing time to approximately 22% of the original. Compared to traditional methods, it demonstrates significant advantages in both accuracy and timeliness, providing an effective solution for tracing antibiotic-induced water pollution sources. It can also provide environmental protection departments with high-precision pollution source location references to assist in on-site investigations.

[0155] Example 4

[0156] like Figure 7 This embodiment also discloses a water quality antibiotic tracing method based on data analysis, which may specifically include:

[0157] S101. Acquire antibiotic monitoring data in the aquatic environment, standardize the concentration detection information from multiple sources and heterogeneous sources through the data preprocessing module, establish a unified data format based on timestamps and spatial coordinates, and obtain a standardized spatiotemporal sequence dataset of antibiotic concentrations.

[0158] Raw data on antibiotic concentrations in the aquatic environment were acquired from multiple monitoring stations using a data acquisition interface. This raw data included concentration values, timestamps, and location information in different formats. A data cleaning module performed quality checks on the raw data. Data with integrity below a preset threshold was marked as abnormal, and data with non-compliant formats was converted to obtain cleaned monitoring data. Based on the timestamp information in the cleaned monitoring data, a time standardization algorithm was used to convert timestamps from different time zones and formats into a unified time format, determining a standardized time series. For the spatial coordinate information in the standardized time series, coordinate system transformation was used to unify the location data from different coordinate systems into a standard geographic coordinate system, obtaining a standardized spatial coordinate set. Data fusion technology was used to correlate and match the standardized spatial coordinate set with the corresponding antibiotic concentration values. If the spatial coordinates and concentration data matched successfully, a spatiotemporal correlation was established, resulting in a spatiotemporal correlation data matrix. An LSTM neural network was used to model the spatiotemporal correlation data matrix, constructing multi-dimensional feature vectors based on the time and spatial dimensions to determine the continuity and completeness of the data sequence. Based on the spatiotemporal distribution characteristics of the multidimensional feature vectors, an interpolation algorithm is used to supplement the concentration data of missing time nodes, thereby obtaining a complete spatiotemporal sequence dataset of antibiotic concentrations.

[0159] Specifically, the acquisition of water environment antibiotic monitoring data first involves daily water sample collection at 15 monitoring points in a certain watershed using sampling equipment. The concentrations of eight antibiotics, including tetracycline and ampicillin, are then detected using liquid chromatography-mass spectrometry (LC-MS / MS). The raw data formats include three heterogeneous formats: CSV, XML, and JSON. The data preprocessing module uses an ETL framework to uniformly transform the multi-source data. Regular expressions are used to identify concentration fields in different formats, and units are uniformly converted to μg / L. Missing values ​​are filled using linear interpolation algorithms, and outlier detection uses the 3σ criterion to remove data points exceeding the mean ± 3 standard deviations. Timestamp standardization adopts the ISO8601 format, uniformly converting the local time of different monitoring devices to UTC time with a precision of minutes. The spatial coordinate system uses the WGS84 geographic coordinate system, maintaining a latitude and longitude precision of 6 decimal places. A relational database table structure is designed when establishing a unified data format. The primary key is a combination of monitoring point number, timestamp, and antibiotic type. Data is organized according to spatiotemporal dimensions using SQL queries. The final standardized dataset contains 1,825 days of continuous monitoring data from 2019 to 2023. Each spatiotemporal node contains the concentration values ​​of eight antibiotics, and the data integrity reaches 95.2%, providing standardized basic data support for subsequent spatiotemporal analysis.

[0160] S102. The standardized concentration data is spatially interpolated and decomposed into time series using the spatiotemporal distribution analysis method. The concentration values ​​of unmonitored points are calculated by the Kriging interpolation algorithm to obtain the complete spatiotemporal distribution matrix of antibiotic concentration.

[0161] Raw antibiotic monitoring data was acquired, and the concentration data was normalized using the Z-score normalization method to obtain a standardized concentration dataset. Based on the geographic coordinates of the monitoring points in the standardized concentration dataset, a spatial coordinate system was constructed, and the relative positions of each monitoring point were determined using a coordinate transformation algorithm. Kriging interpolation was used to estimate the concentration values ​​of unmonitored points in the spatial coordinate system. If the monitoring point density was greater than a preset threshold, ordinary kriging was used; if the density was less than the preset threshold, co-kriging was used to obtain concentration estimates for a complete spatial grid. The concentration estimates were then separated into trends along the time dimension using time series decomposition technology. The decomposition granularity was determined based on the time interval length, resulting in trend components, seasonal components, and random components. Based on the numerical variation patterns of the trend and seasonal components, a matrix reconstruction method was used to fuse the spatial interpolation results with the time decomposition results to determine the concentration value of each spatiotemporal node. Finally, a data matrix construction algorithm was used to arrange and combine the concentration values ​​of the spatiotemporal nodes according to their time series and spatial location to obtain a complete spatiotemporal distribution matrix of antibiotic concentrations. Based on the spatial gradient changes of concentration values ​​in the spatiotemporal distribution matrix, a neighborhood analysis method is used to identify concentration anomaly regions and change patterns, thereby obtaining the spatiotemporal evolution characteristics of antibiotic concentrations.

[0162] Specifically, the raw antibiotic concentration data were first standardized using the Z-score standardization method to convert the concentration values ​​of different antibiotics into a unified dimension. The calculation formula is Z = (X - μ) / σ, where the amoxicillin concentration at a certain monitoring point was 15.6 μg / L, the mean μ was 12.3 μg / L, and the standard deviation σ was 3.2 μg / L. After standardization, the Z value was 1.03. Based on the standardized data, a spatiotemporal distribution analysis framework was constructed. 25 known monitoring points in the study area were selected as training samples, with the goal of predicting the antibiotic concentration distribution at the other 150 unmonitored points in the area. Spatial interpolation was performed using the ordinary kriging interpolation algorithm. First, a semi-variogram model γ(h) = C + C[1 - exp(-3h / a)] was established, where the nugget value C was set to 0.15, the sill value C was set to 0.85, and the range a was 2.5 km. The optimal parameters were obtained by fitting using the least squares method. For the location P(x, y) to be predicted, its concentration estimate is calculated by weighted averaging Z*(x) = Σλ·Z(x), where the weighting coefficient λ is obtained by solving the Kriging equations to ensure unbiased estimation and minimum variance. Simultaneously, time series decomposition analysis is performed, decomposing the 12-month concentration time series into three components: trend term T, seasonal term S, and random term R. The X-13-ARIMA-SEATS algorithm identifies significant seasonal fluctuations in antibiotic concentrations, with a peak concentration of 18.9 μg / L in summer and a decrease to 8.4 μg / L in winter. Finally, the spatial interpolation results and time decomposition results are integrated to construct a complete spatiotemporal distribution matrix M(i,j,t), where i and j represent spatial grid coordinates, and t represents the time dimension. The matrix size is 100×100×12, covering the antibiotic concentration distribution of all locations within the study area throughout the year.

[0163] S103. Construct a convective diffusion mathematical model based on water flow velocity, turbulent diffusion coefficient and antibiotic physicochemical properties. If the molecular weight of the antibiotic is greater than the preset threshold, adjust the diffusion coefficient weight and determine the numerical range of each coefficient in the model.

[0164] Water flow velocity data and turbulence coefficient parameters are acquired, and real-time flow characteristic data are collected through a sensor monitoring system to obtain a fundamental parameter matrix of the water body dynamics. Based on this fundamental parameter matrix, a convection-diffusion mathematical model is constructed using partial differential equations. A computational framework for the mass transfer process was established, where C represents concentration distribution, t represents time, u represents water flow velocity, x represents spatial coordinates, and D represents turbulence coefficient, thus determining the basic structure of the model. Antibiotic property parameters were detected using chemical analysis instruments to obtain molecular weight, solubility, and distribution coefficient data, and the relationship between the molecular weight value and a preset threshold was determined. If the molecular weight value is greater than the preset threshold, the diffusion weight parameters were adjusted, and the corrected turbulence coefficient was calculated using the weight correction formula D' = D × α, where D' represents the corrected turbulence coefficient and α represents the diffusion weight factor, yielding adaptive diffusion parameters. Based on the adaptive diffusion parameters and water environment conditions, a coefficient prediction model was trained using a support vector machine algorithm, obtaining convection term coefficients ranging from 0.1 to 2.5, diffusion term coefficients ranging from 0.01 to 0.8, and reaction term coefficients ranging from 0.001 to 0.1. These coefficient range parameters were substituted into the convection-diffusion mathematical model, and the spatiotemporal evolution of concentration distribution was calculated using numerical methods to determine the transport and diffusion patterns of antibiotics in water. The model verification program compares the calculation results with the measured data. If the error exceeds the preset accuracy requirement, it returns to the coefficient range adjustment stage to obtain the final optimized mathematical model parameter configuration.

[0165] S104. Solve the convection-diffusion equation using the finite difference numerical simulation algorithm, and use an explicit difference scheme to discretize time and space to obtain the predicted concentration distribution of antibiotics in water at different time points.

[0166] Based on aquatic environmental parameters and the physicochemical properties of antibiotics, the boundary conditions and initial concentration distribution of the convection-diffusion equations are obtained. If the water flow velocity exceeds a preset threshold, the upwind difference scheme is used to handle the convection term; if the velocity is below the threshold, the central difference scheme is used to handle the diffusion term. Time nodes are discretized using an explicit scheme, and the relationship between the time step and spatial step is determined based on stability conditions. If the ratio of the time step to the spatial step exceeds the stability limit, the step parameters are readjusted to obtain discretized parameters that meet numerical stability requirements. The spatial domain is meshed using the finite difference method, and the partial differential equations are transformed into a system of algebraic equations using a difference scheme. Numerical solutions for antibiotic concentrations at each grid node are obtained based on the discretized system of equations. The concentration value at the next time node is calculated using an explicit time-progression scheme based on the concentration distribution data at the current time node. If the concentration gradient changes drastically, a smaller time step is used for calculation to obtain an accurate concentration evolution process. Numerical simulation algorithms are used to iteratively calculate multiple consecutive time nodes, and the concentration distribution matrix is ​​updated based on the calculation results at each time node. If numerical oscillations occur during the calculation process, an artificial viscosity method is used for correction to determine a stable concentration distribution variation pattern. A support vector machine algorithm is used to train the model on historical concentration distribution data, and the trained model is used to predict the concentration distribution at future time points. By comparing the numerical simulation results with the machine learning prediction results, the corrected concentration prediction results are obtained. Based on the concentration distribution data at all time points, an interpolation algorithm is used to generate a concentration change surface in the continuous time domain. By analyzing the gradient and curvature characteristics of the concentration change surface, the diffusion range and peak concentration location of the antibiotic in the water body are determined.

[0167] Specifically, a two-dimensional water body regional grid system is established, with a computational domain length of 1000 meters and a width of 500 meters. A uniform grid is used, with a spatial step of Δx = Δy = 10 meters and a time step of Δt = 0.1 seconds, ensuring that the stability condition of CFL number is less than 0.5 is met. Convection-diffusion equations are then used. Explicit finite difference discretization was employed, where C represents the antibiotic concentration, u = 0.2 m / s is the x-direction velocity, v = 0.1 m / s is the y-direction velocity, the diffusion coefficient Dx = Dy = 0.01 m / s, and the degradation coefficient k = 0.001 s. The time derivative was calculated using a forward difference scheme (Ci,j^(n+1) - Ci,j^n) / Δt. The convection term was treated with an upwind scheme to ensure numerical stability when u > 0. The diffusion term is expressed using a central difference scheme. The initial condition was set as point source pollution, with an initial concentration of 100 mg / L at grid point (50, 25) and 0 concentration at other locations. A zero-gradient boundary condition was used. Concentration distributions at various time points were obtained through iterative calculations. At t = 300 s, the antibiotic diffusion range reached a 200 m × 150 m elliptical region, with the maximum concentration decreasing to 45 mg / L. At t = 600 s, the diffusion expanded to a 400 m × 250 m region, with a maximum concentration of 28 mg / L. This verifies that the diffusion attenuation law of antibiotics in water conforms to the expectations of convection diffusion theory.

[0168] S105. Adjust the model parameters based on the error analysis results between the predicted concentration distribution and the measured concentration distribution. If the error exceeds the preset tolerance range, recalculate the diffusion coefficient and flow velocity parameters to obtain the optimized propagation and diffusion model.

[0169] The predicted and measured concentration distribution data are obtained, and the root mean square error (RMSE) method is used to calculate the degree of deviation between the two sets of data. This deviation is compared with a preset tolerance threshold; if the deviation exceeds the threshold, the model parameters need to be recalculated. The diffusion coefficient is re-fitted using the least squares method, and historical monitoring data is used as training samples to obtain a corrected diffusion coefficient matrix. Based on the corrected diffusion coefficient matrix and flow field observation data, an interpolation algorithm is used to calculate an updated velocity parameter vector. The updated velocity parameter vector and the corrected diffusion coefficient matrix are obtained, and the convection-diffusion equation is solved to obtain a reconstructed propagation-diffusion model. The reconstructed propagation-diffusion model is used to predict the new concentration distribution, obtaining an optimized concentration distribution prediction result. The optimized concentration distribution prediction result is compared with the latest measured data to determine whether the model accuracy meets the preset accuracy requirements and to determine the final propagation-diffusion model.

[0170] Specifically, the system first uses the root mean square error algorithm to calculate the deviation between the predicted and measured concentrations, setting a preset tolerance range of 15%. When the predicted concentration at a certain monitoring point is 2.3 mg / L while the measured concentration is 2.8 mg / L, the relative error reaches 17.9%, exceeding the tolerance range. At this point, the system automatically triggers a parameter adjustment mechanism, refitting the diffusion coefficients using the least squares method, adjusting the original lateral diffusion coefficient from 0.12 m / s to 0.15 m / s and the longitudinal diffusion coefficient from 0.08 m / s to 0.11 m / s. Simultaneously, based on real-time flow velocity monitoring data, the Kalman filter algorithm is used to dynamically correct the flow velocity parameters, updating the average flow velocity from 1.2 m / s to 1.4 m / s and adjusting the flow direction angle from 15° to 18°. The system then substitutes the corrected parameters into the Gaussian diffusion model to recalculate the concentration distribution, using the finite difference method to solve the partial differential equations, with a grid step size of 10 m × 10 m and a time step of 30 seconds. After three iterations of optimization, the predicted concentration was adjusted to 2.7 mg / L, and the relative error was reduced to 3.6%, meeting the accuracy requirements. The entire parameter optimization process used a genetic algorithm for global optimization, with a population size of 50, a crossover probability of 0.8, and a mutation probability of 0.1. After 200 generations of evolution, the model converged, ultimately forming an optimized propagation and diffusion model with an error controlled within 10%.

[0171] S106. The spatiotemporal distribution inversion algorithm is used to solve the optimization model in reverse. The distribution status of possible upstream pollution sources is inferred from the known concentration information of downstream detection points, and the probability distribution map of the candidate pollution source locations is determined.

[0172] Real-time concentration data from downstream monitoring points are acquired, and outliers and noise interference are removed using a data preprocessing module to obtain a standardized concentration sequence. A spatiotemporal correlation matrix is ​​established based on this standardized concentration sequence, and interpolation methods are used to fill in missing concentration values ​​for different time periods, thus determining a complete spatiotemporal concentration distribution dataset. Pollutant diffusion path parameters are calculated using this dataset, and a transmission matrix is ​​constructed from upstream candidate source points to downstream monitoring points to obtain diffusion coefficients and transmission weights. A Bayesian inference algorithm is used to process the transmission matrix and monitoring concentration data. If the concentration at a monitoring point exceeds a preset threshold, the probability of the pollution source in the corresponding upstream area is increased, and the posterior probability distribution of each candidate location is determined. Spatial interpolation is performed based on the posterior probability distribution results, and a continuous probability density surface is generated using the Kriging interpolation method to obtain a refined probability distribution map of pollution source locations. Cluster analysis is performed on high-probability regions in the probability distribution map to identify the coordinates of probability peak points and determine the set of most likely pollution source candidate locations. The candidate location set is matched and verified with the historical pollution event database. If the overlap between the candidate location and the known pollution source location is higher than a set value, the location is confirmed as a key area of ​​concern, and the final pollution source distribution status result is output.

[0173] Specifically, the system first establishes a spatiotemporal distribution inversion mathematical model, and then uses a Bayesian inference framework to construct the objective function J(x,t)=∑[Cobs(i,t)-Csim(i,t)] 2 +λR(x,t), where Cobs are the measured concentrations of the three downstream monitoring points at time t (2.5 mg / L, 3.2 mg / L, and 1.8 mg / L), Csim is the forward simulation concentration, λ = 0.01 is the regularization parameter, and R(x,t) is the spatial smoothing constraint term. The system uses a particle swarm optimization algorithm for inversion solution, setting the number of particles to 200, with each particle representing the location coordinates (xi,yi) of a candidate pollution source. The particle swarm is initialized to be randomly distributed within the study area, and the velocity update formula is vi(k+1) = w × vi(k) + c1 × r1 × (pbesti - xi(k)) + c2 × r2 × (gbest - xi(k)), where the inertia weight w = 0.9 and the learning factors c1 = c2 = 2.0. During the algorithm iteration process, the system calls the two-dimensional convection-diffusion equation for forward modeling, with diffusion coefficients set to Dx = 15 m / s, Dy = 12 m / s, and flow velocity v = 0.8 m / s. The concentration distribution field is solved using the finite difference method, with a grid size of 50 m × 50 m. After 500 iterations, the system calculates the probability Pi = exp(-fi / T) / ∑exp(-fj / T) of each grid point becoming a pollution source based on the fitness function value, where fi is the objective function value of the i-th grid point, and T = 0.1 is the temperature parameter. The final probability distribution map shows that the probability value reaches 0.85 at (1200 m, 800 m) and 0.72 at (1350 m, 750 m), forming two high-probability pollution source candidate areas, providing a scientific basis for emergency decision-making.

[0174] S107. Based on the probability distribution map of the candidate pollution source locations and the hydrodynamic constraints, calculate the pollution source location. If the probability value of a certain location is higher than the identification threshold and meets the water flow direction constraint, it is marked as a suspected pollution source, and the final antibiotic pollution source location identification result is obtained.

[0175] Antibiotic concentration data and corresponding location information of water monitoring points are acquired. A Bayesian inference algorithm is used to calculate the probability distribution value of pollution sources at each monitoring point. A probability distribution map is constructed based on these values, and interpolation methods are used to estimate the probability values ​​of regions between monitoring points, resulting in a complete spatial probability distribution map. Water flow velocity and direction data are acquired, and a hydrodynamic constraint model is established to determine the flow direction constraint parameters for each location. If the probability value at a certain location in the probability distribution map is greater than a preset identification threshold, the flow direction constraint is verified at that location to determine whether it meets the hydrodynamic conditions of an upstream pollution source. If the location simultaneously meets both the probability threshold condition and the flow direction constraint condition, it is marked as a suspected pollution source, and its coordinate information and probability value are recorded. A clustering algorithm is used to perform spatial clustering analysis on the marked suspected pollution source locations, merging suspected source points with close proximity to obtain the final antibiotic pollution source location identification result. A pollution source location distribution map is generated based on the identification result, marking the coordinate location and corresponding pollution probability level information of each pollution source.

[0176] Specifically, a probability distribution map of candidate pollution source locations is constructed based on a Bayesian inference algorithm. The system first divides the study area into 100m × 100m grid cells, generating 10,000 candidate location points using Monte Carlo sampling. The probability of a pollution source's existence in each grid cell is calculated by combining historical monitoring data and environmental factor weights. The probability calculation formula is P(x,y)=∑(wi×fi(x,y)), where wi is the weight of the i-th environmental factor, and fi(x,y) is the standardized value of that factor at coordinates (x,y). A continuous probability distribution map is generated using an interpolation algorithm, with probability values ​​ranging from 0 to 1. Areas with probability values ​​greater than 0.6 are marked as high-risk areas. Hydrodynamic constraints are obtained by solving a two-dimensional shallow water equation set. The finite difference method is used to calculate the velocity field distribution within the grid cell, with a time step of 0.1 seconds and a spatial step of 10 meters. The system sets an identification threshold of 0.75. When the probability value of a location exceeds this threshold and a potential emission source exists within 500 meters upstream of that point, and the constraint condition of the water flow direction angle deviation being less than 30 degrees is met, then that location is marked as a suspected pollution source. Finally, all suspected locations are ranked using a weighted scoring mechanism. The scoring formula is S = 0.4 × P + 0.3 × H + 0.3 × D, where P is the probability value, H is the hydraulic connectivity index, and D is the distance attenuation factor. The top three locations with the highest scores are the final antibiotic pollution source identification results.

[0177] S108. Construct a complete source tracing analysis report based on the pollution source location identification results and propagation path simulation data. Use visualization technology to show the propagation trajectory and concentration change process of pollutants from the source to the detection point, and obtain a complete source tracing chain of antibiotic pollution in water quality.

[0178] Antibiotic concentration data and timestamp information from each monitoring point in the water quality monitoring network are acquired. Outliers and noise interference are removed through a data preprocessing module to obtain a standardized concentration time-series dataset. Based on the concentration gradient distribution characteristics in the standardized concentration time-series dataset, a reverse tracing algorithm is used to analyze the concentration change trend and spatial distribution pattern to determine the geographical coordinate range of potential pollution sources. Environmental parameters such as water flow velocity, temperature, pH value, and dissolved oxygen content are collected within the geographical coordinate range to construct a three-dimensional water environment simulation model for propagation path calculation. If the water flow velocity in the simulation model exceeds a preset threshold, the convection-diffusion equation is used to calculate the antibiotic propagation path in the water body, where C represents concentration, D represents diffusion coefficient, and v represents flow velocity vector, resulting in a spatiotemporal distribution matrix. Based on the concentration change data in the spatiotemporal distribution matrix, a continuous concentration evolution surface is generated through interpolation, forming a three-dimensional diffusion trajectory visualization model from the starting point to each monitoring point. Trajectory backtracking technology is used to perform reverse analysis of the three-dimensional diffusion trajectory. If the error between the trajectory convergence point and the geographical coordinates of the pollution source is less than a preset range, the point is determined to be the location of the actual pollution source. By connecting the location of pollution sources with the transmission paths between various monitoring points, a complete source tracing chain data structure containing time series, concentration changes, and spatial locations is established.

[0179] Specifically, based on multi-point water quality monitoring data, the system first uses a reverse tracing algorithm to identify the location of pollution sources. By analyzing the spatiotemporal distribution characteristics of tetracycline concentration (156.8 μg / L) at monitoring point A and erythromycin concentration (89.3 μg / L) at monitoring point B, and combining this with hydrogeological parameters, a pollution source intensity inversion model is established. The system uses a particle swarm optimization algorithm to solve for the pollution source coordinates, setting the search space to a 500×300 meter grid within the study area. After 200 iterations, the main pollution source is determined to be located at coordinates (127.5, 245.8), with a source intensity of 2.34×10 mg / h. Subsequently, a three-dimensional hydrodynamic model is constructed to simulate the pollutant propagation path. The finite difference method is used to solve the convection-diffusion equation, setting the grid size to 5×5×1 meters and the time step to 0.1 hours, simulating the migration process of antibiotics in the water body over 72 hours. Model calculations show that pollutants mainly spread in a southeast direction, with an average flow velocity of 0.15 m / s, a longitudinal dispersion coefficient of 8.2 m / s, and a lateral dispersion coefficient of 1.6 m / s. The system further analyzes the pollutant concentration decay pattern, considering factors such as biodegradation, adsorption, and photolysis. The half-life of tetracycline is 48 hours, and that of erythromycin is 36 hours. A pollution propagation trajectory map is generated using GIS visualization technology, and a heat map is used to display the concentration distribution at different times. The color gradient transitions from yellow (high concentration area >100 μg / L) to red (low concentration area <10 μg / L), dynamically displaying the pollution plume diffusion process. Ultimately, a complete source tracing chain is established, showing that the pollution source is the upstream pharmaceutical company's emission outlet, traveling through both surface runoff and groundwater infiltration, reaching the downstream drinking water intake point in 18 hours, thus establishing a full-chain traceability system from source identification to impact assessment.

[0180] This application offers the following advantages: 1. High-precision and highly generalizable propagation prediction: By combining graph neural networks with physical information constraints, the propagation model in this application can effectively handle complex and irregular river networks and sparse monitoring data. Its prediction results not only have high data fidelity but also conform to physical laws, exhibiting superior generalization ability compared to traditional numerical models. 2. Efficient and robust probabilistic source tracing: This application employs an adversarial inverse reinforcement learning framework, transforming the traditional source tracing optimization search problem into a robust probability distribution learning problem. This effectively avoids the problem of local optima and, by utilizing neural networks for inference, significantly improves the efficiency of inversion computation.

[0181] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to any specific implementation. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The invention is limited only by the claims and their full scope and equivalents.

Claims

1. A method for tracing the source of antibiotics in water quality based on data analysis, characterized in that, include: Antibiotic concentration monitoring data and corresponding hydrological data from multiple monitoring stations in the target water area are acquired. The multi-source heterogeneous raw data are cleaned, aligned and standardized to form a spatiotemporal sequence dataset containing spatial coordinates, timestamps and standardized concentration values. Each record in the dataset contains: monitoring point ID, timestamp, longitude, latitude, antibiotic type and concentration value. A Physical Information-Graph Attention Network (PI-GAT) propagation prediction model was constructed, and the antibiotic convection-diffusion partial differential equation was directly written into the loss function as a physical constraint to achieve dual-driven training based on data and physical laws. The adversarial inverse reinforcement learning (AIRL) source tracing framework is adopted. The pre-trained physical information-graph attention network model is used as a dynamic environment. Through adversarial training between the generator and the discriminator, the pollution source reward function is learned in reverse, and the probability distribution map of the upstream candidate pollution source location is output. By applying a hydrodynamic constraint verification mechanism, based on the probability distribution map, hydrodynamic verification is added to high-probability candidate points to check whether the water flow path can reach the downstream monitoring point, and candidate areas that are physically impossible to affect the downstream monitoring point are eliminated. Generate a visual source tracing analysis report that includes the location of the pollution source, confidence level, and simulated animation of the pollutant propagation path.

2. The method according to claim 1, characterized in that, The construction of the physical information-graph attention network propagation prediction model includes: The river network of the water environment is abstracted as a topological graph containing nodes and edges, where monitoring stations, river bifurcation points or confluence points are defined as nodes; The graph attention network is used to process the topology graph to learn the spatiotemporal dependencies between the nodes; The partial derivatives of the predicted spatiotemporal distribution of concentration with respect to time and spatial coordinates are calculated using the automatic differentiation function of the neural network, and the partial derivatives are substituted into the convection-diffusion partial differential equation to calculate the physical law constraint loss term.

3. The method according to claim 1 or 2, characterized in that, The adversarial inverse reinforcement learning algorithm includes: Build a generator to generate candidate pollution source release strategies as simulated actions; Construct a discriminator to distinguish between the simulated downstream concentration sequence generated by the generator in the dynamic environment and the expert trajectory; The reward function is iteratively optimized through adversarial training between the generator and the discriminator until the reward function converges.

4. The method according to claim 3, characterized in that, The convergence of the reward function is characterized by the discriminator's inability to effectively distinguish between the simulated downstream concentration sequence and the expert trajectory.

5. The method according to claim 1, characterized in that, The applied hydrodynamic constraint verification mechanism, based on the probability distribution map, adds hydrodynamic verification to high-probability candidate points to check whether the water flow path can reach the downstream monitoring point, including: For candidate locations whose probability values ​​are higher than a preset threshold in the probability distribution map, verify whether the water flow path at the candidate location can reach the monitoring point corresponding to the actual downstream monitoring point concentration sequence.

6. A water quality antibiotic traceability system based on data analysis, used to implement the method as described in any one of claims 1-5, characterized in that, include: The data preprocessing module acquires antibiotic concentration monitoring data and corresponding hydrological data from multiple monitoring stations in the target water area. It cleans, aligns, and standardizes the heterogeneous raw data from multiple sources to form a spatiotemporal sequence dataset containing spatial coordinates, timestamps, and standardized concentration values. Each record in the dataset contains: monitoring point ID, timestamp, longitude, latitude, antibiotic type, and concentration value. The propagation prediction module is used to construct a Physical Information-Graph Attention Network (PI-GAT) propagation prediction model. It directly writes the antibiotic convection-diffusion partial differential equation as a physical constraint into the loss function to achieve dual-driven training based on data and physical laws. The inversion calculation module is used to learn the pollution source reward function in reverse through the adversarial inverse reinforcement learning (AIRL) source tracing framework. It uses a pre-trained physical information-graph attention network model as a dynamic environment and learns the pollution source reward function in reverse through adversarial training between the generator and the discriminator, and outputs the probability distribution map of the upstream candidate pollution source location. The pollution source location module is used to apply the hydrodynamic constraint verification mechanism. Based on the probability distribution map, it adds hydrodynamic verification to high-probability candidate points to check whether the water flow path can reach the downstream monitoring point, and eliminates candidate areas that are physically impossible to affect the downstream monitoring point. Output a structured result containing the pollution source's GPS coordinates, confidence score, and recommended level of concern. The source tracing visualization module uses a GIS map as a base map to overlay and display the probability distribution map of pollution sources on the map in the form of a heat map.

7. A method for tracing the source of antibiotics in water quality based on data analysis, characterized in that, include: Antibiotic monitoring data in the aquatic environment is acquired. The concentration detection information from multiple sources and heterogeneous sources is standardized through a data preprocessing module. A unified data format is established based on timestamps and spatial coordinates to obtain a standardized spatiotemporal sequence dataset of antibiotic concentrations. The standardized concentration data were spatially interpolated and decomposed into time series using a spatiotemporal distribution analysis method. The concentration values ​​at unmonitored sites were calculated using the Kriging interpolation algorithm to obtain a complete spatiotemporal distribution matrix of antibiotic concentrations. A convective diffusion mathematical model is constructed based on water flow velocity, turbulent diffusion coefficient, and physicochemical properties of antibiotics. If the molecular weight of the antibiotic is greater than a preset threshold, the weight of the diffusion coefficient is adjusted to determine the numerical range of each coefficient in the model. The convection-diffusion equation was solved by the finite difference numerical simulation algorithm. The time and space were discretized by the explicit difference scheme to obtain the predicted concentration distribution of antibiotics in water at different time points. The model parameters are adjusted based on the error analysis results between the predicted concentration distribution and the measured concentration distribution. If the error exceeds the preset tolerance range, the diffusion coefficient and flow velocity parameters are recalculated to obtain the optimized propagation and diffusion model. The spatiotemporal distribution inversion algorithm is used to solve the optimization model in reverse. The distribution of possible upstream pollution sources is inferred from the known concentration information of downstream detection points, and the probability distribution map of the candidate pollution source locations is determined. Based on the probability distribution map of candidate pollution source locations and hydrodynamic constraints, pollution source location calculations are performed. If the probability value of a certain location is higher than the identification threshold and meets the water flow direction constraint, it is marked as a suspected pollution source, and the final antibiotic pollution source location identification result is obtained.

8. The method according to claim 7, characterized in that, The method further includes: A complete source tracing analysis report is constructed by identifying the pollution source location and simulating the propagation path. Visualization technology is used to show the propagation trajectory and concentration change process of pollutants from the source to the detection point, thus obtaining a complete source tracing chain for antibiotic pollution in water quality.

Citation Information

Patent Citations

  • River water quality parameter supervision method and system based on deep learning

    CN120319366A