Canine-derived visceral leishmaniasis monitoring and early warning system and risk prediction method
By combining multi-source data acquisition, intelligent preprocessing, and machine learning prediction technologies with Web GIS technology, the problems of lag and inefficiency in the monitoring of canine visceral leishmaniasis have been solved, achieving high-precision, real-time risk warning and resource optimization, and is applicable to the monitoring and early warning of diseases transmitted by various vectors.
Patent Information
- Application Number
- CN202511696659.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-02-13
AI Technical Summary
Existing surveillance technologies for canine visceral leishmaniasis suffer from problems such as monitoring lag, insufficient multi-source data integration capabilities, spatial analysis limitations, and low prediction accuracy and efficiency, making it impossible to achieve efficient and accurate risk warning and resource optimization.
By employing multi-source data acquisition, intelligent preprocessing, machine learning prediction, and interactive visualization technologies, a risk prediction model based on the random forest algorithm is constructed. Combined with Web GIS technology for dynamic updates, it achieves standardized integration of multi-source data and efficient risk prediction, providing intuitive risk distribution display and decision support.
It achieves high-precision (≥85%) and high-efficiency (5-10 times improvement in computational efficiency) risk prediction, can identify potential high-risk areas, support real-time early warning and resource optimization, provide scientific decision-making basis, and is applicable to the monitoring and early warning of diseases transmitted by various vectors.
Smart Images

Figure CN121528581A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of infectious disease surveillance and early warning technology, specifically to a spatial distribution monitoring and risk warning system for canine visceral leishmaniasis (VIA) based on Geographic Information System (GIS), remote sensing technology, and machine learning algorithms. This system can integrate multi-source data on canine visceral leishmaniasis, perform intelligent risk prediction, provide interactive visualization, and dynamically update the data. It also has the capability to extend to other vector-borne tropical diseases such as dengue fever and malaria. Background Technology
[0002] Canine visceral leishmaniasis is a parasitic disease caused by Leishmaniasis, primarily transmitted through sandfly bites. Clinical manifestations include prolonged fever, hepatosplenomegaly, and anemia. Without timely treatment, the mortality rate is high. This disease is prevalent globally in tropical, subtropical, and temperate regions. In China, canine visceral leishmaniasis is mainly concentrated in the Northwest, North China, and parts of the Southwest. Influenced by factors such as climate, vegetation, topography, and human activities, the disease's spread exhibits significant spatial heterogeneity.
[0003] Existing surveillance technologies and systems for canine visceral leishmaniasis have the following key problems: The monitoring model is outdated: Traditional monitoring relies on case reports from medical institutions, which is a passive monitoring method. It can only record cases that have occurred and cannot identify potential high-risk areas in advance, resulting in prevention and control measures lagging behind the disease transmission process.
[0004] Insufficient ability to integrate multi-source data: The spread of canine visceral leishmaniasis is closely related to vegetation cover (NDVI), climate (temperature, rainfall), topography (altitude), and human activities (nighttime light), but existing systems mostly focus on single data types, making it difficult to achieve standardized integration of multi-dimensional environmental variables and failing to fully reflect the driving factors of disease transmission.
[0005] Limitations of spatial analysis: Existing tools are mostly based on statistical analysis of discrete case points, which cannot generate a continuous risk distribution covering the entire study area. It is difficult to accurately locate potential high-risk areas without cases but with conditions for transmission, resulting in unreasonable allocation of prevention and control resources.
[0006] Low prediction accuracy and efficiency: Traditional statistical methods (such as logistic regression) cannot handle the complex nonlinear relationship between environmental factors and disease transmission, and the prediction accuracy is usually less than 70%. At the same time, the pixel-by-pixel cyclic processing mode takes up to several hours to process large-scale data (such as cross-provincial regions), which cannot meet the needs of real-time early warning.
[0007] Weak visualization and decision support: Existing systems mostly display results in tables or simple charts, lacking intuitive spatial visualization tools, making it difficult for non-professionals to quickly understand risk distribution; and they do not provide decision support information such as environmental factor importance analysis and high-risk area lists, which cannot directly guide prevention and control practices.
[0008] Therefore, there is an urgent need to develop a canine visceral leishmaniasis monitoring and early warning system with the capabilities of multi-source data fusion, high-precision prediction, efficient calculation, intuitive visualization and dynamic updating, so as to achieve a technological leap from passive monitoring to active early warning and provide scientific support for precise prevention and control. Summary of the Invention
[0009] The purpose of this invention is to overcome the shortcomings of existing canine visceral leishmaniasis surveillance technologies, such as lag, inefficiency, low accuracy, and weak decision support. It provides a comprehensive canine visceral leishmaniasis surveillance and early warning system integrating multi-source data acquisition, intelligent preprocessing, machine learning prediction, interactive visualization, and dynamic updates. Specific objectives include: standardizing and integrating case data, remote sensing data, meteorological data, and topographic data to construct a multi-source data system covering key factors influencing disease transmission; developing efficient vectorization processing technology to reduce large-scale data prediction time to minutes, improving computational efficiency by 5-10 times; constructing a high-precision prediction model based on the random forest algorithm to ensure a disease transmission risk prediction accuracy of ≥85% and an AUC value of ≥0.9; building a WebGIS interactive visualization platform to intuitively display continuous risk distribution and spatial correlation of cases, reducing the barrier to entry for non-professionals; and achieving real-time data updates and automatic model retraining to ensure the timeliness of early warning results, providing direct decision-making basis for the allocation of prevention and control resources and the delineation of high-risk areas.
[0010] To achieve the above objectives, the present invention adopts the following technical solution: A canine visceral leishmaniasis monitoring and early warning system includes a data acquisition module, a data preprocessing module, a training data generation module, a risk prediction module, a spatial visualization module, a statistical analysis module, a model evaluation module, and a data export module, connected in sequence. The data acquisition module acquires multi-source heterogeneous data. The data preprocessing module standardizes multi-source data through spatial registration, data cleaning, and environmental variable extraction. The training data generation module constructs a balanced training dataset based on case points and random background points. The risk prediction module uses vectorization technology combined with a random forest algorithm to achieve batch risk prediction. The spatial visualization module uses Web GIS technology to interactively display risk distribution. The statistical analysis module mines data patterns through risk grading and variable importance assessment. The model evaluation module verifies model performance using multi-dimensional indicators to ensure reliable prediction results. The data export module supports multi-format output to adapt to business needs.
[0011] Furthermore, the data acquisition module includes a case data acquisition unit, a remote sensing data acquisition unit, a meteorological data acquisition unit, a topographic data acquisition unit, and an administrative boundary data acquisition unit. The case data acquisition unit acquires the latitude and longitude coordinates and onset time of confirmed cases of canine visceral leishmaniasis, storing them in CSV format, and the data must contain the core fields "long" and "lat". The remote sensing data acquisition unit acquires monthly / annual synthetic data of Normalized Difference Vegetation Index (NDVI) and Nighttime Light Intensity (NTLI) data, both stored in GeoTIFF format, with a spatial resolution of no less than 1000 meters for the NDVI data. The meteorological data acquisition unit acquires raster data of minimum temperature, maximum temperature, and total rainfall, with a spatial resolution of 1 km, and the data source is the WorldClim or ERA5 database. The topographic data acquisition unit acquires SRTM digital elevation model (DEM) data and extracts elevation information. The administrative boundary data acquisition unit acquires vector data of provincial or county-level administrative divisions in Shapefile format.
[0012] Furthermore, the data preprocessing module includes a spatial registration unit, a data cleaning unit, a coordinate transformation unit, and an environmental variable extraction unit. The spatial registration unit uses the rasterio library to read all GeoTIFF files, uniformly reprojecting raster data from different sources to the WGS84 geographic coordinate system (EPSG:4326) or a projection coordinate system applicable to the study area. Using the NDVI raster as a reference, bilinear interpolation or nearest neighbor interpolation is used to resample to the same spatial resolution, number of rows and columns, and geographic range. The data cleaning unit uniformly marks NoData values as np.nan, removes outliers using quantile methods (e.g., 1%~99th percentile), deduplicates case data, and verifies coordinate validity. The coordinate transformation unit realizes mutual conversion between raster coordinates (rows and columns) and geographic coordinates (longitude and latitude) based on affine transformation matrices. The environmental variable extraction unit extracts six environmental variable values from each raster data based on the coordinates of the case points: NDVI, minimum temperature, maximum temperature, rainfall, nighttime light intensity, and altitude.
[0013] Furthermore, the training data generation module includes a positive sample construction unit, a negative sample generation unit, a sample balancing unit, and a feature engineering unit. The positive sample construction unit reads the case CSV file, extracts valid coordinates, removes records containing NaN, calls the environmental variable extraction unit to obtain the values of six environmental variables, further removes samples where any variable is NaN, and marks them as positive (class=1). The negative sample generation unit randomly generates 500-2000 background points within the effective pixel range of the NDVI raster, converts them to geographic coordinates, extracts environmental variable values, removes samples containing NaN, and marks them as negative (class=0). The sample balancing unit adjusts the ratio of positive to negative samples to a range of 1:1 to 1:5 by oversampling positive samples or undersampling negative samples. The feature engineering unit preprocesses the environmental variables using Z-score normalization or Min-Max normalization to eliminate dimensional differences.
[0014] Furthermore, the risk prediction module includes a model training unit, a vectorized prediction unit, a block processing unit, and a probability calculation unit. The model training unit uses a random forest algorithm to construct a binary classification prediction model with the following parameters: number of decision trees (n_estimators) 50-300, maximum depth (max_depth) 8-15, minimum number of samples for node splits (min_samples_split) 3-10, random seed (random_state) 42, and uses all CPU cores (n_jobs=-1) to accelerate training. The vectorized prediction unit... The prediction unit stacks the six environmental variable rasters into a three-dimensional array (6, height, width) along the first dimension, reshapes it into a two-dimensional matrix (n_pixels, 6) (n_pixels = height × width), and then batch-predicts the risk probability after filtering out all valid pixels of the variables. The block processing unit divides ultra-large-scale data (such as study areas > 1 million square kilometers) into blocks of 500-2000 rows, predicts them sequentially, and then stitches the results together to avoid memory overflow. The probability calculation unit outputs the disease transmission risk probability value (range 0-1) for each raster cell.
[0015] Furthermore, the specific implementation steps of the vectorized prediction unit are as follows: (1) Call the stack function of the NumPy library to stack the raster data corresponding to NDVI, minimum temperature, maximum temperature, rainfall, nighttime light intensity, and altitude according to axis=0 to form a three-dimensional array of shape (6, height, width); (2) Reshape the three-dimensional array into a two-dimensional matrix of (height×width, 6) using the reshape function, where each row represents the 6 environmental variable values of a raster cell; (3) Use the np.isnan function in combination with any(axis= 1) Generate a Boolean mask to filter out all valid pixels whose environmental variable values are not NaN; (4) Call the predict_proba method of the random forest model to perform batch prediction on the environmental variable matrix of valid pixels and extract the second type of probability value (i.e. the probability of disease incidence); (5) Create an array of the same size as the total number of pixels in the raster and initialize it to NaN, and fill the predicted risk probability into the corresponding valid pixel position; (6) Reshape the filled one-dimensional array into a raster shape of (height, width) using the reshape function, and apply the mask of the reference raster to ensure that the spatial range is consistent.
[0016] Furthermore, the spatial visualization module includes an interactive map unit, a multi-base map switching unit, a risk heatmap unit, a case point annotation unit, and a legend control unit. The interactive map unit creates a WebGIS map based on the Folium library, setting the map center point as the geometric center of the study area, with an initial zoom level of 5-8. The multi-base map switching unit adds at least three base maps: OpenStreetMap, ArcGIS World Imagery, and topographic base maps, supporting user switching via layer controls. The risk heatmap unit uses a range from dark blue (#000080) to dark red (#990000). The map uses an 8-level continuous color band, and a color map is created using matplotlib's LinearSegmentedColormap. The risk raster is converted to RGBA format and its transparency is set to 40%-60%. It is then added to the map using ImageOverlay. The case point annotation unit marks the location of historical cases with red circular markers (radius 3-5px, fill transparency 0.7-0.9). Clicking the marker displays the case's latitude and longitude and the time of onset. The legend control unit creates a legend fixed in the lower left corner of the map using HTML, which includes the risk probability range (0.0-1.0), the corresponding color band, and a description of the risk level.
[0017] Furthermore, the statistical analysis module includes a descriptive statistics unit, a quantile analysis unit, a risk grading unit, a high-risk area identification unit, and an environmental variable importance assessment unit. The descriptive statistics unit extracts effective risk values from the risk raster and calculates the mean, median, standard deviation, minimum, and maximum values. The quantile analysis unit calculates the risk values at the 25th, 75th, 90th, and 95th percentiles to clarify the risk distribution characteristics. The risk grading unit counts the number and proportion of pixels at each level according to the criteria of risk probability < 0.3 (low risk), 0.3 ≤ risk probability < 0.7 (medium risk), and risk probability ≥ 0.7 (high risk). The high-risk area identification unit, combined with administrative boundary data, locates the county-level or provincial-level administrative unit to which the high-risk pixels belong and generates a list of high-risk areas. The environmental variable importance assessment unit, based on the feature_importances_ attribute of the random forest model, quantifies the contribution of six environmental variables to disease transmission, arranges them in descending order of importance, and generates a visualization chart.
[0018] Furthermore, the model evaluation module includes a data segmentation unit, a performance metric calculation unit, a confusion matrix generation unit, and a cross-validation unit. The data segmentation unit uses stratified sampling to divide the training dataset into a training set (X_train, y_train) and a test set (X_test, y_test) in a ratio of 2:8 to 4:6, ensuring that the class distribution of the test set is consistent with that of the training set. The performance metric calculation unit calculates accuracy, precision, recall, F1 score, and AUC based on the prediction results of the test set. The confusion matrix generation unit generates a confusion matrix of the model prediction results, visually displaying the number of true positives (TP), true negatives (TN), false positives (FP), and false negatives (FN). The cross-validation unit uses 5-fold or 10-fold cross-validation, repeatedly dividing the training set and test set and evaluating the model performance, calculating the average metric to improve the reliability of the evaluation results.
[0019] Furthermore, the data export module includes a raster export unit, a point data export unit, and a report generation unit. The raster export unit exports the risk probability raster in GeoTIFF format, copies the spatial metadata (coordinate reference system, affine transformation parameters, geographic range) of the reference raster, sets the data type to float32, uses LZW compression to reduce file size, and adds descriptive information on the transmission risk probability of canine visceral leishmaniasis to the raster bands. The point data export unit spatially samples the risk raster, with the sampling interval adaptively adjusted according to the raster size (ensuring the output file size is <100MB), extracts the latitude and longitude coordinates and corresponding risk values of the sampled points, and exports them in CSV format, with fields including LongitudeLatitude and risk_probability. The report generation unit automatically generates an analysis report containing risk statistics, a list of high-risk areas, environmental variable importance analysis, model performance indicators, and risk visualization charts, supporting export in Word or PDF format.
[0020] Furthermore, it also includes an incremental update module, which comprises a data update unit and a model retraining unit. The data update unit supports three update modes: real-time upload and update of new case data, on-demand update of environmental data (such as new meteorological observation data), timed refresh update (such as monthly update of NDVI data), and event-driven update (such as update of terrain data after natural disasters). The model retraining unit is set with trigger conditions: when the amount of new case data reaches 15%-25% of the existing training set, or when environmental data undergoes a major update (such as significant changes in temperature and rainfall data due to climate anomalies), the model retraining process is automatically triggered to integrate new data, optimize model parameters, and update risk prediction results and spatial visualization content.
[0021] This invention also provides a risk prediction method for canine visceral leishmaniasis, comprising the following steps: S1: Data acquisition, acquiring case data, remote sensing data, meteorological data, topographic data, and administrative boundary data through a data acquisition module, wherein case data includes latitude and longitude coordinates and onset time, remote sensing data includes NDVI and NTLI data, and meteorological data includes minimum temperature, maximum temperature, and total rainfall; S2: Data preprocessing, performing spatial registration, data cleaning, coordinate transformation, and environmental variable extraction on the acquired data through a data preprocessing module, unifying the coordinate system, resolution, and data format, handling missing and outlier values, and extracting six environmental variable values corresponding to case points; S3: Training data generation, constructing positive samples (case points + environmental variables, class=1) and negative samples (random background points + environmental variables, class=0) through a training data generation module, adjusting the sample ratio to a balanced state, performing standardized preprocessing on the environmental variables, and forming a training dataset; S4: Model training and evaluation. The training dataset is divided into training and test sets proportionally. A random forest prediction model is trained using the training set, and performance metrics such as accuracy and precision are calculated using the test set. Model parameters are optimized using cross-validation. S5: Risk Prediction. The risk prediction module stacks environmental variable rasters into a three-dimensional array, reshapes it into a two-dimensional matrix, filters effective pixels, and predicts risk probabilities in batches. For ultra-large-scale data, block processing is used to output risk probability raster. S6: Result Visualization and Analysis. An interactive web map is built using the spatial visualization module to display risk heatmaps and case point distribution. The statistical analysis module calculates risk statistics, classifies risk levels, identifies high-risk areas, and assesses the importance of environmental variables. S7: Result Export. The data export module exports risk rasters, sampling point data, and analysis reports in GeoTIFF, CSV, and Word / PDF formats, respectively. S8: Incremental Update. The incremental update module receives new data in real time and automatically retrains the model and updates the warning results when trigger conditions are met.
[0022] Furthermore, the specific implementation process of batch prediction in step S5 is as follows: S51: Raster stacking, using the np.stack function to stack the raster data corresponding to NDVI, minimum temperature, maximum temperature, rainfall, nighttime light intensity, and altitude according to axis=0, forming a three-dimensional array of (6, height, width); S52: Matrix reshaping, using the reshape function to convert the three-dimensional array into a two-dimensional matrix of (height×width, 6), where each row represents a combination of environmental variables for a raster cell; S53: Effective cell filtering, generating a Boolean mask (~np.isnan(env_matrix).any(axis=1)) to filter out cells where all environmental variable values are not NaN. S54: Model prediction: Call the `predict_proba` method of the trained random forest model to perform batch predictions on the environmental variable matrix of effective pixels, and obtain the risk probability value (taking the second type probability) for each effective pixel; S55: Result reconstruction: Create a one-dimensional array with the same number of pixels as the total number of pixels in the raster and initialize it to NaN, fill the corresponding effective pixel index position with the predicted risk probability, and then convert it into a (height, width) risk probability raster using the `reshape` function; S56: Mask application: Read the mask information of the reference raster (such as the NDVI raster), and set the areas in the risk probability raster where the reference raster is NoData to NaN as well, to ensure consistent spatial range.
[0023] Further, the specific process of block processing in step S5 is as follows: S5a: Block division, according to the height of the raster data, the raster is divided into several continuous blocks with a block size of 500-2000 rows, and the start and end rows of each block are recorded; S5b: Block-by-block processing, for each block, the following operations are performed: (1) Extract the raster data of the 6 environmental variables corresponding to the block and stack them into a three-dimensional subarray of (6, block_height, width); (2) Reshape the three-dimensional subarray into a two-dimensional submatrix of (block_height×width, 6); (3) Filter the effective pixels in the submatrix and predict the risk probability; (4) Reconstruct the prediction result into a risk sub-raster of (block_height, width); S5c: Result splicing, splice the risk sub-rasters of all blocks in the row direction to form a complete risk probability raster of the study area; S5d: Progress monitoring, during the block processing, calculate the proportion of the number of completed blocks to the total number of blocks in real time and display the processing progress bar.
[0024] This invention also provides an application of a canine visceral leishmaniasis monitoring and early warning system in the prevention and control of vector-borne tropical diseases. The application includes the following scenarios: (1) High-risk area identification: through the risk probability grid and high-risk area list output by the system, county-level or provincial-level administrative units with high risk of canine visceral leishmaniasis transmission are identified, guiding health departments to concentrate prevention and control resources on high-risk areas; (2) Provision of environmental intervention basis: based on the environmental variable importance analysis results of the system, ecological intervention measures related to vegetation clearing and temperature regulation are formulated for key influencing factors such as NDVI (vegetation index) and minimum temperature; (3) Early warning: through Through the system’s real-time monitoring and incremental update function, the spatial change trend of disease transmission risk can be captured in a timely manner, and early warnings can be issued for potential high-risk areas with no previous cases but a risk probability ≥ 0.7; (4) Optimize the allocation of prevention and control resources. Combine the area and population distribution data of each risk level area statistically collected by the system, and rationally allocate resources such as monitoring points, medicines, and prevention and control personnel to improve prevention and control efficiency; (5) Extend the application to other vector-borne tropical diseases. By replacing the data source of the data acquisition module (such as replacing it with dengue fever case data and mosquito density remote sensing data) and adjusting the parameters of the random forest model, the system can be applied to the monitoring and early warning of other vector-borne diseases such as dengue fever and malaria.
[0025] This invention's data acquisition module collects multi-source data in a standardized format, providing a unified input for the preprocessing module. The preprocessing module eliminates data heterogeneity and ensures data quality through spatial registration and data cleaning, solving the problem of difficult multi-source data integration. The training data generation module constructs a class-balanced, feature-standardized training dataset, providing high-quality input for model training in the risk prediction module. The random forest algorithm used in the risk prediction module fully utilizes standardized data to capture complex nonlinear relationships, while vectorization processing technology achieves batch prediction based on the preprocessed raster data structure, realizing high-precision and high-efficiency risk prediction. The risk raster data output by the risk prediction module provides the core data source for the spatial visualization module. The spatial visualization module uses multi-base... Features such as graph switching and risk heatmap rendering transform abstract risk data into intuitive visualizations, enabling accurate presentation and efficient interpretation of risk distribution. The statistical analysis module quantifies risk prediction results, identifying high-risk areas and key influencing factors. The data export module exports analysis results in a standardized format and generates reports, providing direct evidence for prevention and control decisions, thus achieving a closed loop from data analysis to decision support. The incremental update module connects with the data acquisition module to access new data, triggering the data preprocessing module for standardization, driving the training data generation module to update the training set, and then triggering the risk prediction module to retrain the model, updating spatial visualization and statistical analysis results, achieving dynamic optimization of the entire system and ensuring its real-time performance and accuracy.
[0026] This invention employs a random forest machine learning algorithm, which effectively captures the complex nonlinear relationship between environmental factors and disease transmission, achieving a prediction accuracy of over 85% and an AUC of 0.92, significantly higher than traditional statistical methods (which typically have an accuracy of <70%). It innovatively integrates six environmental variables (NDVI, minimum temperature, maximum temperature, rainfall, nighttime light, and altitude) to construct a standardized multi-source data fusion framework, comprehensively reflecting the environmental drivers of disease transmission and solving the problem of existing technologies' inability to comprehensively consider multidimensional environmental variables. It generates a risk probability grid covering the entire study area, achieving spatially continuous risk assessment and overcoming the limitation of traditional methods that can only assess known case locations, enabling the identification of potentially high-risk areas with no prior cases but conditions for transmission. The core innovative vectorization processing technology replaces traditional pixel-by-pixel iterative processing with batch matrix operations, improving computational efficiency by 5-10 times. It can complete risk assessment and real-time early warning updates for epidemic areas in seven provinces within minutes, solving the problems of slow processing speed and poor real-time performance in existing technologies. Based on Web... The GIS technology-based interactive visualization platform supports multiple base map switching, risk heat map rendering, and case point annotation. It uses continuous color bands to clearly present risk gradients, allowing even non-professionals to quickly grasp risk distribution and improve decision-making efficiency. Through an incremental update module, it supports real-time data updates and automatic model retraining, ensuring that risk prediction results promptly reflect changes in disease transmission trends, achieving a technological leap from passive monitoring to proactive early warning. It automatically identifies high-risk areas, quantifies the contribution of environmental factors, and generates standardized analysis reports, providing a scientific basis for resource allocation, key area delineation, and ecological intervention measures, thus contributing to precise prevention and control. The system architecture is flexible and modular, easily expandable to monitoring and early warning of other vector-borne diseases such as dengue fever and malaria by replacing data sources in the data acquisition module and adjusting model parameters, making it widely applicable. It supports importing and exporting multiple mainstream data formats such as GeoTIFF, CSV, and Shapefile, and is compatible with mainstream GIS and statistical analysis software, facilitating integration with existing business systems and lowering the application threshold. It provides environmental variable importance analysis and model performance evaluation indicators, making the prediction process interpretable and the results verifiable, meeting the transparency requirements of public health decision-making.
[0027] To more clearly illustrate the structural features and effects of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. Attached Figure Description
[0028] Figure 1 This is a flowchart of the risk prediction method for monitoring canine visceral leishmaniasis mentioned in this invention; Figure 2 This is a flowchart of the data preprocessing module mentioned in this invention. Detailed Implementation
[0029] The present invention will now be further described in conjunction with the accompanying drawings and relevant knowledge, and will be described clearly and completely. Obviously, the described applications are only some embodiments of the present invention, and not all embodiments.
[0030] Reference Figures 1-2 As shown, this invention discloses a monitoring and early warning system for canine visceral leishmaniasis, comprising a data acquisition module, a data preprocessing module, a training data generation module, a risk prediction module, a spatial visualization module, a statistical analysis module, a model evaluation module, and a data export module connected in sequence. The data acquisition module acquires multi-source heterogeneous data. The data preprocessing module standardizes multi-source data through spatial registration, data cleaning, and environmental variable extraction. The training data generation module constructs a balanced training dataset based on case points and random background points. The risk prediction module uses vectorization processing technology combined with a random forest algorithm to achieve batch risk prediction. The spatial visualization module uses Web GIS technology to interactively display risk distribution. The statistical analysis module mines data patterns through risk grading and variable importance assessment. The model evaluation module verifies model performance through multi-dimensional indicators to ensure reliable prediction results. The data export module supports multi-format output to adapt to business needs.
[0031] This invention provides a monitoring and early warning system for canine visceral leishmaniasis, which solves the problems of monitoring lag, insufficient spatial analysis capability, difficulty in integrating environmental factors, and low prediction accuracy in the prior art, and realizes accurate prediction and real-time monitoring of the risk of canine visceral leishmaniasis transmission. This invention innovatively constructs a full-chain technology system of data acquisition, intelligent preprocessing, model training, real-time prediction, and dynamic early warning, integrating multi-dimensional environmental variables such as vegetation index, climate elements, terrain features, and socio-economic factors, and establishing an intelligent prediction model for disease transmission risk based on an ensemble learning algorithm. The system supports real-time uploading of case data, dynamic updates of environmental changes, and automatic retraining of the early warning model, realizing a closed-loop feedback mechanism of monitoring, analysis, and early warning. The core technologies of the system include: (1) a vectorized batch processing algorithm, which improves computational efficiency by 10 times compared with traditional methods; (2) spatial continuous risk assessment technology, which realizes full coverage early warning of the study area; (3) an incremental model update mechanism, which supports the immediate inclusion of new cases in the analysis; (4) environmental data can be uploaded in real time according to the actual situation, supporting multiple modes such as on-demand update, timed refresh, and event-driven update; (5) a Web GIS real-time visualization platform, which supports dynamic rendering of risk heat maps, multi-layer overlay display, and automatic identification of high-risk areas; (6) a multi-format data interface, which can export GeoTIFF raster and CSV point data for business system calls. Practical verification has shown that the system's prediction accuracy exceeds 85%, and it can complete risk assessment and real-time early warning updates for seven endemic provinces of canine visceral leishmaniasis within minutes, achieving a technological leap from passive monitoring to proactive early warning. This invention can be widely applied to real-time monitoring, early warning, and prevention and control decision support for vector-borne tropical diseases such as canine visceral leishmaniasis, dengue fever, and malaria, and has significant public health application value.
[0032] In a preferred embodiment of the present invention, the data acquisition module is used to comprehensively acquire multi-source data required for monitoring canine visceral leishmaniasis, providing a data foundation for subsequent analysis.
[0033] Specifically, the case data collection unit collects information such as the latitude and longitude coordinates (longitude, latitude) and onset date of confirmed cases through the reporting channels of medical institutions, and stores it in CSV format to ensure that the data contains the core long and lat fields, which facilitates subsequent coordinate matching.
[0034] The remote sensing data acquisition unit acquires monthly or annual composite products of MODIS NDVI (spatial resolution 1000 meters) and nighttime light intensity (NTLI) data of VIIRS / DMSP-OLS, both stored in GeoTIFF format. The former reflects vegetation cover and the latter reflects the intensity of human activities.
[0035] The meteorological data acquisition unit obtains raster data of minimum temperature (tmin), maximum temperature (tmax), and total rainfall (ptot) from the WorldClim or ERA5 database, with a spatial resolution of 1km and stored in GeoTIFF format, to capture the impact of climate on disease transmission.
[0036] The terrain data acquisition unit acquires SRTM digital elevation model (DEM) data, extracts elevation information, stores it in GeoTIFF format, and reflects the role of terrain in the ecological environment and disease transmission.
[0037] The administrative boundary data collection unit collects vector data (Shapefile format) of provincial or county-level administrative divisions to provide a basis for the statistical analysis of administrative divisions in risk areas.
[0038] It can achieve standardized collection and storage of multi-type and multi-dimensional data, covering case information related to disease transmission, ecological environment, climate conditions, geographical features and administrative division data, laying the foundation for subsequent multi-source data fusion analysis.
[0039] In a preferred embodiment of the present invention, the data preprocessing module performs standardization processing on the collected multi-source data to eliminate data heterogeneity and ensure data quality and spatial consistency.
[0040] Specifically, this includes: using the rasterio library to read all GeoTIFF files for spatial registration, checking the consistency of the coordinate reference system (CRS), and if inconsistent, reprojecting to the WGS84 geographic coordinate system (EPSG:4326) or the applicable projection coordinate system for the study area using the GDAL tool; using the NDVI raster as a reference, bilinear interpolation or nearest neighbor interpolation is used to resample other rasters to the same spatial resolution, number of rows and columns, and geographic range to ensure spatial alignment.
[0041] The data cleaning unit uniformly marks the NoData values of all raster data as np.nan; identifies and removes outliers (such as temperatures >50℃ or <-40℃) that are outside the reasonable range using the quantile method; performs deduplication on case data and verifies the validity of coordinates (such as latitude and longitude within the study area).
[0042] The coordinate transformation unit is based on the affine transformation matrix to realize the mutual conversion between raster coordinates (rows and columns) and geographic coordinates (longitude and latitude); It can eliminate interference caused by differences in data format, coordinate system, and resolution, handle data quality issues such as missing values and outliers, extract environmental variables corresponding to case points, and provide standardized, high-quality data input for model training.
[0043] Furthermore, the training data generation module is used to construct a training dataset that meets the requirements of machine learning models, ensuring sample validity and class balance.
[0044] Specifically, the process includes: the positive sample construction unit reads the case CSV file, extracts the long and lat columns, and removes records containing NaN; it calls the environment variable extraction function to obtain the values of 6 environment variables, and further removes samples where any variable is NaN; it adds a class column and assigns a value of 1 to mark it as a positive sample (case).
[0045] The negative sample generation unit selects 500-2000 background points within the effective pixel range of the NDVI raster using a random sampling method; obtains the latitude and longitude of the background points by converting raster coordinates to geographic coordinates; extracts environmental variable values and removes samples containing NaN; adds a class column and assigns a value of 0 to mark it as a negative sample (non-case).
[0046] The sample balancing unit calculates the ratio of positive to negative samples. If the ratio is unbalanced (e.g., the proportion of positive samples is <10% or >90%), the ratio is adjusted to the range of 1:1 to 1:5 by oversampling positive samples or undersampling negative samples to avoid the model being biased towards the majority class.
[0047] The feature engineering unit standardizes (Z-score standardization) and normalizes (Min-Max normalization) environmental variables to eliminate dimensional differences. This enables the construction of high-quality training datasets that include positive and negative samples, feature standardization, and class balance, providing reliable data support for subsequent model training and avoiding poor model generalization ability due to sample issues.
[0048] In a preferred embodiment of the present invention, the risk prediction module constructs a prediction model based on machine learning algorithms to achieve batch and efficient prediction of the risk of canine visceral leishmaniasis transmission in the study area.
[0049] Specifically, the model training unit uses the random forest algorithm to construct a binary classification prediction model with the following parameters: number of decision trees (n_estimators) 50-300, maximum depth (max_depth) 8-15, minimum number of samples for node splits (min_samples_split) 3-10, and random seed (random_state) 42. All CPU cores (n_jobs=-1) are used to accelerate training. The model is fitted using training set data. The vectorized prediction unit, as a core innovation, uses vectorization processing technology to improve prediction efficiency. First, stack the six environmental variable rasters along the first dimension to form a three-dimensional array of (6, height, width); then reshape it into a two-dimensional matrix of (n_pixels, 6) (n_pixels = height × width); filter for all valid pixels using Boolean indexing; call the model's predict_proba method to batch predict the risk probability of valid pixels (taking the second type of probability value, i.e., the risk of disease); create an array of the same size as the original raster, fill the corresponding valid pixel positions with the prediction results, and set invalid positions to NaN; finally, reshape it back to the original raster shape and apply a reference raster mask. For ultra-large-scale raster data (such as a study area > 500,000 square kilometers), the block processing unit divides the data into rows and blocks, with each block containing 500-2000 rows. It then performs stacking, reshaping, filtering, prediction, and reconstruction processes on each block in sequence, finally stitching them together to form a complete risk raster. At the same time, it displays a processing progress bar to avoid memory overflow.
[0050] The probability calculation unit outputs the risk probability value (0-1) for each grid cell, where 0 indicates no risk of propagation and 1 indicates extremely high risk of propagation.
[0051] It can capture the complex nonlinear relationship between environmental factors and disease transmission through the random forest algorithm, with a prediction accuracy of over 85%; vectorization processing technology improves computational efficiency by 5-10 times, enabling rapid prediction of large-scale data; block processing units ensure the system's compatibility with ultra-large-scale data and avoid memory shortage problems.
[0052] Furthermore, the spatial visualization module is used to display risk prediction results in an intuitive and interactive way, making it easier for decision-makers to quickly understand the risk distribution.
[0053] Specifically, this includes: an interactive map unit that creates a WebGIS map based on the Folium library, setting the map center point to the geometric center of the study area, and an initial zoom level of 6; and a multi-base map switching unit that adds OpenStreetMap (street map) and ArcGIS World. At least three base maps, including Imagery (satellite imagery) and topographic base maps, are available, allowing users to switch between them as needed. The risk heatmap unit uses an 8-level continuous color band from dark blue (#000080) to dark red (#990000), with color mapping created via LinearSegmentedColormap. Risk rasters are converted to RGBA format with transparency set between 40% and 60%. The risk heatmap is added to the map via ImageOverlay. The case point annotation unit iterates through case data, marking historical case locations with red circular markers (4px radius, 0.8 fill transparency). Clicking the marker displays the case's latitude and longitude information. The legend control unit uses HTML to create a legend fixed in the lower left corner of the map, containing the risk probability range (0.0-1.0) and corresponding color bands, while also displaying risk statistics. This provides an intuitive and interactive display of risk distribution, supports multi-view viewing, and allows even non-professionals to quickly identify high-risk areas and case distribution correlations, improving decision-making efficiency.
[0054] Furthermore, the statistical analysis module is used to quantitatively analyze the risk prediction results and uncover risk patterns and key influencing factors.
[0055] Specifically, this includes: a descriptive statistics unit that extracts effective risk values from the risk grid and calculates the mean, median, standard deviation, minimum, maximum, and 25%, 75%, 90%, and 95% quantiles; and a quantile analysis unit that clarifies the distribution characteristics of different risk levels through quantile calculation, providing data support for risk classification.
[0056] The risk grading unit is based on the criteria of risk probability < 0.3 (low risk), 0.3 ≤ risk probability < 0.7 (medium risk), and risk probability ≥ 0.7 (high risk), and the number and proportion of pixels at each level are counted. The high-risk area identification unit locates the spatial position of high-risk pixels, combines administrative boundary data, counts the county or provincial administrative units involved in the high-risk area, and generates a list of high-risk areas.
[0057] The environmental variable importance assessment unit, based on the feature_importances_ attribute of the random forest model, quantifies the contribution of six environmental variables to disease transmission and ranks them by importance. It can quantify risk distribution characteristics, clarify the scope of high-risk areas, identify key environmental factors affecting disease transmission, and provide data support for the formulation of prevention and control strategies.
[0058] Furthermore, the model evaluation module is used to verify the performance of the prediction model, ensuring model reliability and prediction accuracy.
[0059] Specifically, the system includes: a data segmentation unit that uses stratified sampling to divide the training dataset into a training set (X_train, y_train) and a test set (X_test, y_test) in a ratio of 2:8 to 4:6, ensuring that the class distribution of the test set is consistent with that of the training set; a performance metric calculation unit that calculates core metrics such as accuracy, precision, recall, and F1 score based on the prediction results of the test set; a confusion matrix generation unit that generates a confusion matrix of the model's prediction results, visually displaying the number of true positives, true negatives, false positives, and false negatives; and a cross-validation unit that uses k-fold cross-validation (k=5 or 10) to repeatedly divide the training and test sets and evaluate the model performance, calculating average metrics to improve the reliability of the evaluation results. This allows for a comprehensive evaluation of model performance, ensuring that the model's prediction accuracy meets the needs of practical applications and providing a basis for optimizing model parameters.
[0060] Furthermore, the data export module is used to export risk prediction results and analysis data in a standardized format, which facilitates subsequent in-depth analysis and business system calls.
[0061] Specifically, this includes: the raster export unit exports the risk probability raster in GeoTIFF format, copies the spatial metadata (coordinate reference system, affine transformation parameters, geographic extent) of the reference raster, sets the data type to float32, and uses LZW compression to reduce file size; the point data export unit performs spatial sampling on the risk raster, with the sampling interval adaptively adjusted according to the raster size (ensuring the output file size is <100MB), extracts the latitude and longitude coordinates of the sampling points and the corresponding risk values, and exports them in CSV format. The report generation unit automatically generates analysis reports that include risk statistics, a list of high-risk areas, importance analysis of environmental variables, model performance indicators, and risk visualization charts, and supports export in Word or PDF format.
[0062] It can achieve standardized export of risk data, and is compatible with mainstream GIS software (such as ArcGIS and QGIS) and statistical analysis software (such as R and Python), which facilitates subsequent in-depth analysis and integration with existing business systems.
[0063] Furthermore, the incremental update module supports real-time data updates and dynamic model optimization, ensuring the timeliness and accuracy of the system's predictions.
[0064] Specifically, this includes multiple modes of data updates: real-time uploading of new case data, on-demand updating of environmental data (such as adding meteorological observation data), scheduled refresh (such as monthly updates of NDVI data), and event-driven updates (such as updating terrain data after natural disasters).
[0065] Model retraining: When the amount of new case data reaches 20% of the existing training set or when environmental data is significantly updated, the system automatically triggers the model retraining process to integrate new data, optimize model parameters, and update risk prediction results.
[0066] It can enable dynamic optimization of the system, ensuring that risk prediction results can reflect the disease transmission trend and the impact of environmental changes in a timely manner, and improving the real-time performance and reliability of the system.
[0067] The system of this invention consists of a hierarchical relationship and data flow logic of 8 core modules, and the modules and their relationships are as follows: Data Collection Module: As the system's data input layer, it is responsible for collecting five types of core data, including case data (latitude and longitude coordinates, onset time, etc., CSV format), remote sensing data (NDVI vegetation index, NTLI nighttime light, GeoTIFF format), meteorological data (minimum temperature, maximum temperature, total rainfall, GeoTIFF format), topographic data (DEM elevation, slope and aspect, SRTM data), and administrative boundary data (provincial / county boundaries, Shapefile format).
[0068] The Data Preprocessing Module receives the output from the Data Acquisition Module and performs four core processing steps: spatial registration (unifying the coordinate system and resampling the resolution), data cleaning (identifying and handling missing and outlier values), coordinate transformation (affine transformation between raster coordinates and geographic coordinates), and variable extraction (extracting environmental variable values based on case point coordinates).
[0069] Training Data Generation Module: Constructs a model training set based on preprocessed data, including positive sample construction (case point + corresponding environmental variable, labeled class=1), negative sample generation (random background point in the study area + environmental variable, labeled class=0), and sample balancing (adjusting the ratio of positive to negative samples to avoid class imbalance).
[0070] Risk Prediction Module: The core computing layer of the system, which adopts the random forest algorithm to achieve spatial continuous risk assessment through model training (parameter optimization, cross-validation), vectorized prediction (grid stacking, batch processing), block processing (big data memory optimization), and probability calculation (outputting risk values in the 0-1 interval). The computational performance is 10 times better than traditional methods.
[0071] Spatial Visualization Module: Responsible for visualizing results, providing interactive web maps, multiple base map switching, risk heat maps (blue to red continuous color bands), case point annotation, legend control, and other functions.
[0072] Statistical Analysis Module: Conducts quantitative analysis, including descriptive statistics, risk classification, high-risk area identification, environmental variable importance assessment, and quantile analysis.
[0073] Model evaluation module: Through training set-test set splitting, it calculates metrics such as accuracy, precision, recall, and F1 score, generates a confusion matrix, and implements cross-validation to ensure model reliability.
[0074] Data export module: Supports output of results in multiple formats, including GeoTIFF format raster data (LZW compressed), CSV format point data, and analysis reports with statistical charts.
[0075] Through spatial continuous risk prediction, an accuracy rate of 89.3%, random forest algorithm, vectorized batch processing, WebGIS visualization, etc., the final output includes risk distribution maps, statistical analysis reports, and lists of high-risk areas, providing support for prevention and control deployment, decision support, and scientific research.
[0076] The internal execution logic of the data preprocessing module of this invention starts with the input data and outputs standardized data through four core steps, as follows: Input data includes case data (CSV format, containing long and lat fields), remote sensing data (GeoTIFF format, NDVI.tif, NTLI.tif), meteorological data (GeoTIFF format, TMIN.tif, TMAX.tif, PTOT.tif), and topographic data (GeoTIFF format, ELEV.tif, DEM data source). The remote sensing data may contain multiple time dimensions, the temperature data units may differ, and the topographic data may contain negative values for water bodies.
[0077] Step 1: Spatial Registration 1.1 Read the spatial metadata (CRS, Transform, Bounds) of all rasters; 1.2 Select NDVI raster as reference, and use EPSG:4326 (WGS84) as the unified coordinate system. By using rasterio to read metadata, check CRS consistency. If reprojection is required, use the GDAL tool to keep the Transform matrix unchanged.
[0078] Step 2: Resolution Resampling 2.1 Check the size and resolution of all grids, using the grid shape (height, width) as a reference; 2.2 Use bilinear interpolation (suitable for continuous data such as temperature and elevation) or nearest neighbor interpolation (suitable for categorical data such as nighttime lights) to resample all raster cells to a uniform resolution; This ensures that all grid shapes are consistent and verifies pixel alignment accuracy.
[0079] Step 3: Extent Clipping 3.1 Calculate the intersection of the geographic extents of all rasters; 3.2 Use window clipping technology to clip all grids to a common area; This allows for maintaining spatial consistency while updating Transform parameters.
[0080] Step 4: Data Cleaning 4.1 The NoData value is uniformly marked as np.nan, replacing invalid value representations from different data sources (such as -9999, -3.4e38). 4.2 Remove outliers based on quantile method to handle values that exceed the reasonable range; Key technical points: Verify the validity of case coordinates and record processing logs.
[0081] Common Data Issues and Quality Checklist Common issues: Inconsistent coordinate systems, differences in spatial resolution, inconsistent geographical scope, different NoData value representations, and inconsistent data types (Int16, Float32, Float64). Quality inspection items: CRS consistency, Shape consistency, Bounds consistency, effective data ratio > 50%, unified coordinate system (EPSG: 4326), unified resolution (1km × 1km), Transform matrix verification, NoData value uniformity, and range uniformity.
[0082] The core relies on affine transformation, which defines the mapping relationship between pixel coordinates and geographic coordinates through the Transform matrix, ensuring that all raster data are spatially perfectly aligned.
[0083] This invention compares the differences between traditional pixel-by-pixel processing and the vectorization processing of this invention, as detailed below: Traditional methods (pixel-by-pixel processing) - slow Step 1: Generate a coordinate grid and iterate through all cell positions; Step 2: Convert coordinates point by point, converting only the geographic coordinates and raster coordinates of one pixel at a time; Step 3: Extract variables point by point, repeat the coordinate transformation operation, and extract only 6 variables from 1 pixel each time; Step 4: Point-by-point prediction, with each model call predicting only the risk value of one pixel; Performance bottleneck: Too many loops (such as 500,000 coordinate transformations, 500,000 variable extractions, and 500,000 model calls) make parallel computing impossible, taking 218 seconds and resulting in low efficiency.
[0084] The vectorization method of this invention (batch processing) is 10 times faster. Step 1: Raster stacking, stacking the raster data of the 6 variables ndvi, tmin, tmax, ptot, ntli, and elev into a 3D array at once; Step 2: Matrix reshaping, converting the 3D array (6,H,W) into a 2D matrix (N,6), where N=height×width, using pure matrix operations without loops; Step 3: Valid cell filtering. Quickly filter cells where all variables are valid using Boolean indexing, completing coordinate transformation and association in one go; Step 4: Batch prediction, call model.predict_proba(valid_env) to predict the risk value of all valid pixels at once; Performance advantages: Utilizing the C++ underlying optimizations of NumPy and sklearn, only 4 core operations (stacking, reshaping, filtering, and prediction) are required, taking 23 seconds, which is 9.5 times more efficient than traditional methods.
[0085] Data Structure Comparison: Traditional methods rely on loop processing, repeatedly executing the same operations, and cannot fully utilize the parallel computing capabilities of hardware; Vectorized methods are based on matrix operations, centrally processing all data, fully leveraging underlying optimizations, and significantly reducing the number of operations. This invention transforms the point-by-point loop processing mode into matrix batch operations, fundamentally solving the efficiency bottleneck of traditional methods and achieving a 10-fold improvement in computing performance.
[0086] The layout and functional division of the system's web visualization interface of this invention are as follows: System Identifier: Displays the layout of the web interface for the canine visceral leishmaniasis monitoring and early warning system, with the version number v1.0 and the Optimized indicator. Function Navigation: Includes 5 navigation tabs containing data, map results, and performance information.
[0087] Data Input and Control Area: Case Data: Supports CSV file upload and displays data loading status (√ Case data has been loaded); Environmental Variables: Lists 6 variables (NDVI, TMIN, TMAX, PTOT, NTLI, ELEV) and displays loading status; Model Parameters: Configurable number of decision trees, number of negative samples, and prediction method; Predictive statistics area, core statistical indicators: effective pixels 420,000, average risk 0.342, maximum risk 0.876, high-risk area 12,450, processing time 23 seconds; system status: divided into 4 categories of case data environmental variable model training risk prediction, showing statuses such as completed and loaded.
[0088] Risk probability legend area, color band range: 0.0-1.0, marked with scales at 0.2 intervals (0.0, 0.2, 0.4, 0.6, 0.8, 1.0); risk level: corresponding to low risk, medium risk, and high risk, with the color band gradually changing from light to dark.
[0089] The map display area shows a heat map of the risk distribution of the study area, with overlaid case point markers, and supports interactive operations such as switching between multiple base maps, zooming, and panning.
[0090] Data Overview: Case Data: Total cases 352, valid coordinates 350, coordinate range validated; Environmental Variables: Resolution 1km, range aligned; Model Training: Training samples 1,350, positive samples 350, negative samples 1,000, number of features 6, model type Random Forest; Risk Prediction: Accuracy 89.3%, F1 score 84.0%, time taken 23 seconds, method Optimized.
[0091] The color-coded rules for risk probability, the risk level classification, and the technical implementation details in this invention are as follows: Complete continuous color band, risk value range: 0.0-1.0, divided into 7 gradients at 0.143 intervals (0.0, 0.143, 0.286, 0.429, 0.571, 0.714, 0.857, 1.0); Risk level description: There are 5 levels: extremely low risk, low risk, medium risk, high risk, and extremely high risk.
[0092] Color decomposition, clarifying the risk value ranges and RGB color values corresponding to the 8 colors: Risk value 0.000-0.143 (extremely low risk): #000080 (dark blue), RGB(0,0,128); Risk value 0.143-0.286 (low risk): #0066CC (blue), RGB(0,102,204); Risk value 0.286-0.429 (lower risk): #00CCFF (cyan), RGB(0,204,255); Risk value 0.429-0.571 (medium risk): #66FFCC (cyan), RGB(102,255,204); Risk value 0.571-0.714 (higher risk): #FFFF66 (yellow), RGB(255,255,102); Risk value 0.714-0.857 (high risk): #FF9900 (orange), RGB(255,153,0); Risk value 0.857-1.000 (extremely high risk): #FF3300 (red), RGB(255,51,0); Risk value 0.900-1.000 (urgent concern area): #990000 (deep red), RGB(153,0,0).
[0093] Risk level classification and recommendations: Low risk: Probability < 0.3, routine monitoring recommended; Medium risk: 0.3 ≤ probability < 0.7, monitoring is recommended; High risk: Probability ≥ 0.7, key prevention and control measures recommended.
[0094] This invention uses the `feature_importances_` attribute of a random forest model to demonstrate the contribution of six environmental variables to the transmission of canine visceral leishmaniasis. The data source is 352 case data points + 1000 background data points, as detailed below: Core importance ranking (from highest to lowest percentage) NDVI (Vegetation Index): 28.5%; TMIN (Minimum Temperature): 23.7%; ELEV (elevation): 18.2%; NTLI (Night Lighting): 12.6%; TMAX (maximum temperature): 9.8%; PTOT (Total Rainfall): 7.2%.
[0095] Grouping by variable category Ecological factors: NDVI vegetation index (28.5%). Climate factors: TMIN + TMAX + PTOT (total 31.5%); Geographical factors: ELEV elevation (18.2%); Human activity: NTLI nighttime light (12.6%).
[0096] Statistical Summary Total number of features: 6; Total importance: 100.0%; The top 3 features accounted for 70.4%; Highest / lowest ratio: 3.96:1 (NDVI percentage / PTOT percentage); Average importance: 16.7%; Standard deviation: 8.3%.
[0097] Scientific Explanation and Prevention Recommendations NDVI vegetation index (28.5%): Scientific mechanism: Vegetation provides habitat for sandflies, influencing microclimate and humidity conditions; Prevention and control recommendations: Focus on monitoring densely vegetated areas and appropriately clear overly dense shrubs.
[0098] Temperature factor (33.5%): Scientific mechanism: The minimum temperature determines the overwintering ability of the vector and affects the breeding cycle of sandflies; the temperature range determines the dispersal season. Prevention and control recommendations: Strengthen monitoring in spring and summer and pay attention to the impact of global warming.
[0099] Altitude and human activity (30.8%): Scientific mechanisms: Altitude affects the distribution of ecozones (18.2%), nighttime light reflects population density (12.6%), and is positively correlated with the frequency of human-animal contact; Prevention and control recommendations: Focus on the 500-2000 meter altitude zone and strengthen prevention and control in densely populated areas and agricultural and pastoral areas.
[0100] The importance scores of each variable (range 0.00-0.25) clearly highlight NDVI, minimum temperature, and altitude as the three key factors influencing the transmission of canine visceral leishmaniasis.
[0101] This invention comprehensively demonstrates the performance evaluation results of the random forest model, including core metrics, confusion matrix, supplementary metrics, and parameter configurations, as detailed below: Key performance metrics: Accuracy: 89.3%, defined as the proportion of correctly predicted samples out of the total sample, rated as excellent (above 80% is considered excellent); Precision: 85.7%, defined as the proportion of actual positives among predicted positives, rated as good, reducing false alarms and avoiding resource waste; Recall: 82.4%, defined as the proportion of actual positives correctly identified, rated as good, reducing underreporting and avoiding missing high-risk areas; F1 score: 84.0%, the harmonic mean of precision and recall, rated as good, reflecting excellent balance between the two.
[0102] The confusion matrix analysis showed that the false positive and false negative ratios were within an acceptable range, and only the prediction threshold needed to be appropriately lowered to reduce the risk of underreporting. The model performed well and could be used for actual canine visceral leishmaniasis risk prediction.
[0103] This invention also provides a risk prediction method for canine visceral leishmaniasis, comprising the following steps: S1: Data acquisition, acquiring case data, remote sensing data, meteorological data, topographic data, and administrative boundary data through a data acquisition module, wherein case data includes latitude and longitude coordinates and onset time, remote sensing data includes NDVI and NTLI data, and meteorological data includes minimum temperature, maximum temperature, and total rainfall; S2: Data preprocessing, performing spatial registration, data cleaning, coordinate transformation, and environmental variable extraction on the acquired data through a data preprocessing module, unifying the coordinate system, resolution, and data format, handling missing and outlier values, and extracting six environmental variable values corresponding to case points; S3: Training data generation, constructing positive samples (case points + environmental variables, class=1) and negative samples (random background points + environmental variables, class=0) through a training data generation module, adjusting the sample ratio to a balanced state, performing standardized preprocessing on the environmental variables, and forming a training dataset; S4: Model training and evaluation. The training dataset is divided into training and test sets proportionally. A random forest prediction model is trained using the training set, and performance metrics such as accuracy and precision are calculated using the test set. Model parameters are optimized using cross-validation. S5: Risk Prediction. The risk prediction module stacks environmental variable rasters into a three-dimensional array, reshapes it into a two-dimensional matrix, filters effective pixels, and predicts risk probabilities in batches. For ultra-large-scale data, block processing is used to output risk probability raster. S6: Result Visualization and Analysis. An interactive web map is built using the spatial visualization module to display risk heatmaps and case point distribution. The statistical analysis module calculates risk statistics, classifies risk levels, identifies high-risk areas, and assesses the importance of environmental variables. S7: Result Export. The data export module exports risk rasters, sampling point data, and analysis reports in GeoTIFF, CSV, and Word / PDF formats, respectively. S8: Incremental Update. The incremental update module receives new data in real time and automatically retrains the model and updates the warning results when trigger conditions are met.
[0104] Furthermore, the specific implementation process of batch prediction in step S5 is as follows: S51: Raster stacking, using the np.stack function to stack the raster data corresponding to NDVI, minimum temperature, maximum temperature, rainfall, nighttime light intensity, and altitude according to axis=0, forming a three-dimensional array of (6, height, width); S52: Matrix reshaping, using the reshape function to convert the three-dimensional array into a two-dimensional matrix of (height×width, 6), where each row represents a combination of environmental variables for a raster cell; S53: Effective cell filtering, generating a Boolean mask (~np.isnan(env_matrix).any(axis=1)) to filter out cells where all environmental variable values are not NaN. S54: Model prediction: Call the `predict_proba` method of the trained random forest model to perform batch predictions on the environmental variable matrix of effective pixels, and obtain the risk probability value (taking the second type probability) for each effective pixel; S55: Result reconstruction: Create a one-dimensional array with the same number of pixels as the total number of pixels in the raster and initialize it to NaN, fill the corresponding effective pixel index position with the predicted risk probability, and then convert it into a (height, width) risk probability raster using the `reshape` function; S56: Mask application: Read the mask information of the reference raster (such as the NDVI raster), and set the areas in the risk probability raster where the reference raster is NoData to NaN as well, to ensure consistent spatial range.
[0105] Further, the specific process of block processing in step S5 is as follows: S5a: Block division, according to the height of the raster data, the raster is divided into several continuous blocks with a block size of 500-2000 rows, and the start and end rows of each block are recorded; S5b: Block-by-block processing, for each block, the following operations are performed: (1) Extract the raster data of the 6 environmental variables corresponding to the block and stack them into a three-dimensional subarray of (6, block_height, width); (2) Reshape the three-dimensional subarray into a two-dimensional submatrix of (block_height×width, 6); (3) Filter the effective pixels in the submatrix and predict the risk probability; (4) Reconstruct the prediction result into a risk sub-raster of (block_height, width); S5c: Result splicing, splice the risk sub-rasters of all blocks in the row direction to form a complete risk probability raster of the study area; S5d: Progress monitoring, during the block processing, calculate the proportion of the number of completed blocks to the total number of blocks in real time and display the processing progress bar.
[0106] This invention presents the complete operational logic of the system from data input to result output in a phased process, including 5 core stages, 8 key steps, and decision nodes, as detailed below: Phase 1: Data Preparation (S1-S2) S1: Collect case data, extract latitude and longitude coordinates, and verify data integrity (whether all 6 environmental variables are complete). S2: Collect environmental data (NDVI, meteorological, topographic, etc.) and read GeoTIFF raster data; Through spatial registration algorithms (affine transformation matrix) and vectorization processing (NumPy matrix operations, batch predict_proba).
[0107] Phase 2: Preprocessing (S3-S4) S3: Spatial registration, unifying coordinate system and resolution; S4: Data cleaning, handling missing values and outliers, removing invalid coordinates; Quality assessment: Check whether the data quality is up to standard and whether the number of valid samples is greater than 10. If not, return supplementary data. Time estimate: Data preparation takes about 5 minutes, model training takes about 30 seconds, risk prediction takes about 23 seconds, and the total time is about 6 minutes.
[0108] Phase 3: Model Training (S5-S6) S5: Construct training data, extract the values of 6 environmental variables corresponding to the case points, and combine positive and negative samples; S6: Train the random forest model, split the training set and the test set in a 7:3 ratio, and configure n_estimators=100 and max_depth=10; Performance assessment: Calculate the model accuracy. If it is less than 80%, adjust the parameters and retrain until the model is acceptable.
[0109] Phase 4: Risk Prediction (S7) S7: Vectorized batch prediction, stacking environmental rasters into a 3D array (6,H,W), reshaping it into a 2D matrix (N,6), and batch calculating risk probabilities (0-1).
[0110] Phase 5: Output Results (S8) S8: Visualization and export, displaying risk distribution (blue → red band) through a web map, and conducting statistical analysis such as risk classification.
[0111] This invention also provides an application of a canine visceral leishmaniasis monitoring and early warning system in the prevention and control of vector-borne tropical diseases. The application includes the following scenarios: (1) High-risk area identification: through the risk probability grid and high-risk area list output by the system, county-level or provincial-level administrative units with high risk of canine visceral leishmaniasis transmission are identified, guiding health departments to concentrate prevention and control resources on high-risk areas; (2) Provision of environmental intervention basis: based on the environmental variable importance analysis results of the system, ecological intervention measures related to vegetation clearing and temperature regulation are formulated for key influencing factors such as NDVI (vegetation index) and minimum temperature; (3) Early warning: through Through the system’s real-time monitoring and incremental update function, the spatial change trend of disease transmission risk can be captured in a timely manner, and early warnings can be issued for potential high-risk areas with no previous cases but a risk probability ≥ 0.7; (4) Optimize the allocation of prevention and control resources. Combine the area and population distribution data of each risk level area statistically collected by the system, and rationally allocate resources such as monitoring points, medicines, and prevention and control personnel to improve prevention and control efficiency; (5) Extend the application to other vector-borne tropical diseases. By replacing the data source of the data acquisition module (such as replacing it with dengue fever case data and mosquito density remote sensing data) and adjusting the parameters of the random forest model, the system can be applied to the monitoring and early warning of other vector-borne diseases such as dengue fever and malaria.
[0112] In this invention, reference is made to Figure 1 The diagram illustrates the entire workflow of the system, from data acquisition to output. The functions and logical relationships of each module are as follows: Data Collection Module Responsible for acquiring data from multiple sources, providing basic input for the system: Case data: Includes information such as the latitude and longitude coordinates of the case and the time of onset, stored in CSV format.
[0113] Remote sensing data: including NDVI (Normalized Difference Vegetation Index), NLT (Nighttime Light Data), etc., stored in GeoTIFF format, used to characterize environmental features such as surface vegetation and human activities.
[0114] Meteorological data: including indicators such as minimum temperature, maximum temperature, and total rainfall, reflecting the climatic conditions for the spread of leishmaniasis.
[0115] Topographic data: This includes DEM (Digital Elevation Model), slope and aspect data, and SRTM (Shuttle Radar Topographic Mapping Mission) data, used to analyze the impact of terrain on propagation.
[0116] Administrative boundary data: including provincial and county-level boundaries, stored in Shapefile format, used for spatial statistics and regional division.
[0117] Data Preprocessing Module: The collected data is standardized to ensure data consistency and usability: Spatial registration: unifying coordinate systems (such as EPSG:4326) and resolution to align multi-source data spatially.
[0118] Data cleaning: handling missing values, identifying outliers, and ensuring data quality.
[0119] Coordinate transformation: Perform affine transformations and datum transformations to adapt to coordinate systems with different analysis needs.
[0120] Variable extraction: Extract key information such as site vegetation and environmental variable values from the raw data to provide input for subsequent modeling.
[0121] Training Data Generation Module: Construct a sample set for model training: Positive sample construction: Case points are combined with corresponding environmental variables and labeled as Class=1 (causing leishmaniasis).
[0122] Negative sample generation: Randomly select background points and mark them as Class=0 (no leishmaniasis occurred).
[0123] Sample balancing: Adjusting the ratio of positive to negative samples to avoid model bias due to sample imbalance.
[0124] Risk Prediction Module: The system's core algorithm module enables spatial prediction of leishmaniasis risk: Model training: Machine learning algorithms such as random forest are used to build a prediction model through parameter optimization and cross-validation.
[0125] Vectorized prediction: Perform matrix operations on batch data to achieve efficient raster-level prediction, improving performance by 10 times.
[0126] Chunking: Optimizes memory and monitors progress for large-scale data, addressing computational resource limitations.
[0127] Probability calculation: Output risk value (0-1), raster output, spatial connection and other results to quantify the probability of leishmaniasis occurrence.
[0128] Spatial visualization: The prediction results are presented in an intuitive map format: It provides interactive web maps, multi-range layers, risk heat maps, continuous color gradation (blue-red) rendering, legend control and other functions to help users understand the spatial distribution of risks.
[0129] Statistical analysis: Quantitative analysis of prediction results and data characteristics: It includes descriptive statistics, risk classification, high-risk area identification, variable importance analysis, quantile analysis, etc., to reveal the key influencing factors and regional characteristics of leishmaniasis transmission.
[0130] Model evaluation: Verify the accuracy and reliability of the model: The model performance is evaluated using methods such as training / test set splitting, accuracy and precision / recall, recall F1 score, confusion matrix, and cross-validation.
[0131] Data export: Supports multiple output formats: It includes GeoTIFF, CSV, analysis reports, statistical charts, TZW (compressed format), etc., to meet the application needs of results in different scenarios.
[0132] Output Products: Final deliverables in the following form: Risk distribution map: Visually displays the spatial pattern of leishmaniasis risk.
[0133] Statistical Analysis Report: Quantitative analysis of the transmission characteristics and influencing factors of leishmaniasis.
[0134] Raster data file: The original prediction results are stored in raster format for easy secondary analysis.
[0135] List of high-risk areas: Identifying high-risk areas provides a targeted basis for prevention and control decisions.
[0136] In this invention, reference is made to Figure 2 The detailed flowchart of the data preprocessing module is described above. The specific execution flow, from input data, step breakdown, technical details to quality checks, implements standardized data processing logic. Input data, specifying the input type and format for the preprocessing module: Case data: CSV format, containing latitude and longitude (lon,lat), original registration records, and other information.
[0137] Remote sensing data: GeoTIFF format, such as NDVI, NLT, etc., may contain multiple time dimensions.
[0138] Meteorological data: GeoTIFF format, including TMIN (minimum temperature), TMAX (maximum temperature), and PTOT (total rainfall).
[0139] Topographic data: GeoTIFF format, including ELEV (elevation), DEM slope and aspect, etc.
[0140] It also lists common data issues, such as coordinate system conflicts (WGS84 vs UTM vs Albers), spatial resolution differences (250m vs 500m vs 1km), inconsistent geographical ranges, different NoData value representations, and data type conflicts (Int16, Float32, Float64), providing a way to predict problems in preprocessing.
[0141] The processing steps involve four core steps to achieve data standardization: Step 1: Spatial Registration Operation: Read the spatial metadata of all rasters (e.g., gdal.Info), obtain Transform and Bounds information, and unify the coordinate reference system (ref_crs=EPSG:4326). Use Rasterio to read the data, check CRS consistency, maintain the Transform matrix, and ensure global uniformity.
[0142] Step 2: Unify resolution. Check the raster dimensions (height, width) and resample to a uniform resolution using bilinear interpolation, implemented via `rasterio.enums.Resampling.bilinear`. Bilinear interpolation ensures continuous data accuracy, guarantees consistency across all raster dimensions, and verifies pixel alignment.
[0143] Step 3: ExtentClipping. Calculate the intersection boundaries of all grid cells (common_bounds = intersection(all_bounds)), and clip to the common boundaries using rasterio.rio.clip. Calculate the boundary intersection, use window clipping technology, maintain spatial consistency, and update the Transform parameters.
[0144] Step 4: Data cleaning, marking NoData values (e.g., data[data==nodata_value]=np.nan), removing outliers (based on quantiles). Use np.nan to mark missing values, quantiles to detect outliers, and maintain data processing logs.
[0145] The technical implementation details are refined, specifying the key technical points of each step, clarifying the tools (such as Rasterio), methods (such as bilinear interpolation), and verification items (such as CRS consistency and pixel alignment) to ensure the reproducibility of the processing.
[0146] The quality checklist verifies the quality of preprocessing results from multiple dimensions: CRS consistency check, Shape consistency check, Bounds consistency check, data type consistency, Transform matrix verification, and NoData value unification, ensuring the reliability of the output data.
[0147] Preprocessing complete - output standardized data, clarifying the standardized characteristics of the final output: unified coordinate system (EPSG:4326), unified resolution (e.g., 5km×5km), unified geographical range, to provide consistent, high-quality input data for subsequent modules.
[0148] Example: A monitoring and early warning system for canine visceral leishmaniasis. This system, developed using Python, integrates multi-source heterogeneous data with machine learning algorithms to construct a fully automated monitoring and early warning system encompassing data acquisition, preprocessing, model training, risk prediction, visualization, and result export. Its core innovation lies in employing vectorization processing technology to address the inefficiency of traditional pixel-by-pixel computation. Simultaneously, it utilizes a random forest algorithm to accurately capture the complex correlation between canine visceral leishmaniasis transmission and environmental factors, enabling real-time prediction and intuitive display of disease transmission risks, thus providing scientific support for public health prevention and control decisions.
[0149] Detailed implementation steps: Step 1: Data Acquisition and Import (1) Case data Data source: Information on confirmed cases of canine visceral leishmaniasis in the study area was collected by connecting with the infectious disease reporting system of medical institutions and the monitoring database of disease control centers.
[0150] Core fields include a unique case identifier (case_id), latitude and longitude coordinates (longitude, accurate to 4 decimal places; latitude, accurate to 4 decimal places), onset date (onset_date, format YYYY-MM-DD), and diagnosis type (clinical diagnosis / laboratory confirmation). The inclusion of long (longitude) and lat (latitude) columns is mandatory to ensure accurate spatial positioning.
[0151] (2) Remote sensing data (MODIS NDVI) Data product: Download the MODIS NDVI monthly composite product (product number MOD13A3) from the NASA Earthdata platform. This product has undergone preprocessing such as atmospheric correction and cloud removal, and the data is highly reliable.
[0152] Technical parameters: Spatial resolution of 1000 meters, time period of monthly or annual composite (selected according to monitoring accuracy requirements; monthly data is suitable for short-term dynamic monitoring, and annual data is suitable for long-term trend analysis), data format is GeoTIFF.
[0153] Preprocessing requirements: The original data values range from -2000 to 10000. They need to be standardized to the range of 0 to 1 using the formula NDVI = original value / 10000. Here, -2000 represents invalid values, and the standardized values are labeled as np.nan.
[0154] (3) Meteorological data Data source selection: Prioritize WorldClim (global climate data, suitable for long-term monitoring) or ERA5 (European Centre for Medium-Range Weather Forecasts reanalysis data, suitable for short-term high-precision monitoring).
[0155] Key metrics: tmin: Average monthly minimum temperature (°C), effective range is -40°C to 50°C; tmax: Average monthly maximum temperature (°C), effective range is -30°C to 60°C; ptot: Total monthly rainfall (mm), valid range is 0mm~2000mm; Technical parameters: Spatial resolution 1km, data format GeoTIFF, time period consistent with NDVI data to ensure spatiotemporal matching.
[0156] (4) Nighttime light data (NTLI) Data source: Select VIIRS (next-generation nighttime light data, 500-meter resolution) or DMSP-OLS (traditional nighttime light data, 1 km resolution), and choose the appropriate data according to the scale of the study area.
[0157] Light intensity reflects the intensity of human activity, including population density, urban distribution, and major transportation routes, indirectly linking it to host activities and the breeding environment of vectors in the transmission of canine visceral leishmaniasis.
[0158] Storage format: GeoTIFF format, requires resampling to 1km resolution, and needs to maintain spatial consistency with other environmental data.
[0159] (5) Topographic data (DEM) Data source: Download digital elevation model data from the USGS SRTM database at a resolution of 90 meters or 30 meters.
[0160] Extraction indicators: Elevation (unit: meters) is extracted as the core topographic variable. Subsequent extraction of derivative indicators such as slope and aspect can be carried out to assist in the analysis of the impact of topography on the distribution of communication media.
[0161] Storage format: GeoTIFF format, resampled to 1km resolution, invalid values (such as water areas, glacier areas) are marked as np.nan.
[0162] Step 2: Data Preprocessing (1) Spatial registration ensures that the coordinate reference system (CRS) and geographic extent of all raster data are completely consistent.
[0163] Use the rasterio library to read the metadata of all GeoTIFF files and extract CRS information (such as EPSG encoding). If there are inconsistencies in CRS (e.g., some data are UTM projection and some are WGS84), use the gdalwarp function of the GDAL tool to reproject and unify to the WGS84 geographic coordinate system (EPSG:4326). If there is a specific applicable projection coordinate system for the study area (e.g., UTM partitioning), the coordinate system can be selected first to reduce projection distortion. Using NDVI raster data as a reference, other raster data are cropped using the rasterio.rio.clip tool to ensure that the geographic extent of all data is perfectly matched.
[0164] (2) Raster resampling: All environmental variable rasters must have the same spatial resolution, number of rows and columns and geographical range to eliminate data heterogeneity.
[0165] Operation details: The NDVI raster is used as a reference (its resolution and number of rows and columns are used as standards); Bilinear interpolation was used to resample continuous data (temperature, rainfall, altitude, NDVI) to preserve the continuity of the data; nearest neighbor interpolation was used to resample discrete data (nighttime light intensity) to avoid destroying classification features. After resampling, the raster's metadata (resolution, number of rows and columns, geographic extent) is verified using the rasterio library to ensure complete consistency.
[0166] (3) Data cleaning Raster data cleaning: Unify the identification and marking of NoData values as np.nan, including invalid values of NDVI, missing values of meteorological data, outliers of terrain data, etc. Remove obviously abnormal values: values with temperatures exceeding -40°C to 60°C, rainfall exceeding 2000 mm, and values with NDVI normalization exceeding the range of 0 to 1 are all marked as np.nan; Case data cleaning: Deduplication: Delete duplicate records based on case_id or long+lat+onset_date combination; Coordinate validity check: Filter by geographical boundaries (such as the extreme values of latitude and longitude of the study area) and remove invalid cases whose coordinates are outside the study area; Date format standardization: Standardize the onset date format to YYYY-MM-DD and remove records with incorrect date formats or that are outside the monitoring period.
[0167] (4) Environmental variable extraction function implementation: Based on the latitude and longitude coordinates of the case, extract the corresponding 6 environmental variable values (NDVI, tmin, tmax, ptot, NTLI, altitude) from the registered raster data to establish the association between the case and environmental factors.
[0168] Instructions for use: Input an array of case coordinates and a raster data dictionary, and output a DataFrame containing 6 environment variables to facilitate the construction of subsequent training data.
[0169] Step 3: Training Data Generation (1) Construction of positive samples Implementation process: Use the pandas library to read the case CSV file, extract the long and lat columns, and form a coordinate array; Remove records containing NaN from the coordinate array to ensure coordinate validity; Call the extract_env_vars function to extract the values of the 6 environment variables corresponding to each case; Remove any sample whose environment variable is NaN to ensure the integrity of the sample data; Add a class column and assign a value of 1 to mark it as a positive sample (representing a case of canine visceral leishmaniasis). Output: Positive sample DataFrame, containing long lat NDVI tmin tmax ptot NTLI altitude class columns. The sample size is adjusted based on the quality of the original case data.
[0170] (2) Generation of negative samples Implementation process: Determine the number of samples N: This is set based on the number of positive samples, usually 500-2000. It is recommended that the number of negative samples be 2-5 times that of positive samples to ensure class balance. Generate random background points: Within the effective pixel range of the NDVI raster (excluding the np.nan area), randomly generate N raster coordinates (row, col). Coordinate transformation: Convert raster coordinates to geographic coordinates (lon, lat) using an affine transformation matrix; Environment variable extraction: The extract_env_vars function is called to extract the values of 6 environment variables for each background point; Data cleaning: Remove samples where any environment variable is NaN; Add a class column and assign a value of 0 to mark it as a negative sample (representing a non-case background area). Constraints: Negative samples must maintain a certain spatial distance from positive samples (e.g., ≥5km) to avoid spatial autocorrelation leading to model overfitting.
[0171] (3) Data merging Implementation process: Merge positive and negative samples row by row to form a complete training dataset; Shuffle the sample order: Use the pandas sample function (frac=1, random_state=42) to shuffle the data order. random_state ensures that the results are repeatable. Category ratio check: Calculate the ratio of positive samples to negative samples. If the ratio is unbalanced (e.g., the proportion of positive samples is <10% or >40%), use oversampling (e.g., SMOTE algorithm) or undersampling to adjust the ratio to ensure that the model training is not affected by category bias. Output: A unified training dataset containing feature columns (6 environment variables) and label columns (class).
[0172] Step 4: Random Forest Model Training (1) Data partitioning Implementation process: Separating the feature matrix and label vector: Remove the class column from the training dataset to obtain the feature matrix X; use the class column as the label vector y; Stratified splitting: Using the train_test_split function of sklearn, the data is divided into a training set (X_train, y_train) and a test set (X_test, y_test) in a 7:3 ratio. Stratify=y is set to ensure that the class ratio of the training set and the test set is consistent, avoiding class imbalance caused by data splitting. Parameter settings: test_size=0.3 (test set percentage 30%), random_state=42 (ensure results are repeatable); (2) Model configuration and training, algorithm selection: Random forest is an ensemble learning algorithm. It has advantages such as anti-overfitting, processing high-dimensional data, and assessing feature importance by constructing multiple decision trees and voting to output results. It is suitable for modeling the complex association between the transmission risk of canine visceral leishmaniasis and multiple environmental factors.
[0173] Parameter configuration: n_estimators=100: Number of decision trees, balancing model accuracy and computational efficiency; max_depth=10: Maximum depth of the decision tree, limiting the complexity of the tree and preventing overfitting; min_samples_split=5: The minimum number of samples required for a node to split, ensuring node purity; random_state=42: Random seed, ensuring that the model training results are repeatable; n_jobs=-1: Use all CPU cores for parallel computing to improve training speed; (3) Model evaluation Evaluation objective: To verify the model's predictive performance and generalization ability, and to ensure the model's reliability.
[0174] Evaluation metrics: Accuracy, Precision, Recall, F1 score, AUC (Area Under ROC Curve), and confusion matrix are selected to comprehensively evaluate model performance; Results Interpretation: Accuracy reflects the overall correctness of predictions, precision reflects the reliability of positive predictions, recall reflects the ability to identify actual cases, F1 score balances precision and recall, and AUC value ≥0.9 indicates that the model has excellent discriminative ability.
[0175] Step 5: Risk Prediction (Vectorization Method) The present invention employs vectorization processing technology to replace the traditional pixel-by-pixel cyclic calculation, and achieves batch prediction through matrix operations, which significantly improves the processing efficiency of large-scale raster data.
[0176] (1) Stacking of environment variables Implementation process: Stack the raster data of 6 environmental variables (NDVI, tmin, tmax, ptot, NTLI, altitude) into a 3D array according to the first dimension (variable dimension), with a shape of (6, height, width), where 6 is the number of environmental variables, and height and width are the number of rows and columns of the raster; (3) Effective pixel screening Implementation process: Generate a Boolean mask to filter out raster cells where all environment variable values are valid (not np.nan) to avoid invalid values affecting the prediction results; Efficiency advantages: Vectorized batch prediction avoids the inefficiency of pixel-by-pixel looping and significantly improves efficiency when processing large-scale data.
[0177] (5) Result reconstruction Implementation process: Reconstruct the one-dimensional risk probability array into a risk raster with the same size as the original raster, and fill invalid cell positions with np.nan; (6) Mask application Implementation process: Apply a mask to the reference grid (such as NDVI) and set the area in the risk grid where the reference grid is invalid (np.nan) to np.nan as well, to ensure that the spatial range of the risk grid is consistent with the original environmental data; Step 6: Spatial Visualization (1) Web map creation Tool selection: Use the folium library to build interactive web maps, which support multiple base map switching, layer control and other functions, making it easy for users to intuitively view the risk distribution; (2) Risk layer rendering Color scheme: Create a continuous color band from dark blue (low risk) to dark red (high risk) to visually reflect the differences in risk levels; (3) Case point marking Implementation process: Mark the locations of historical cases on the web map and highlight them with red circular markers. Clicking the marker will allow you to view basic case information. (4) Adding legend Implementation process: Use HTML to create a risk legend in a fixed position, including the risk probability range and corresponding color, so that users can easily interpret the risk level; Step 7: Statistical Analysis (1) Descriptive statistics Implementation process: Extract effective risk values from the risk grid, calculate statistical indicators such as mean, median, and standard deviation, and quantify the risk distribution characteristics; (2) Risk classification Grading Standards: Based on the risk probability, grid cells are divided into three levels: low, medium, and high, and the spatial distribution and proportion of each level are clearly defined. (3) Importance of environmental variables Implementation process: Based on the feature_importances_ attribute of the random forest model, quantify the contribution of each environmental variable to the transmission of canine visceral leishmaniasis and identify key influencing factors; Application of results: Based on the order of importance, develop targeted prevention and control measures (such as focusing on areas with high vegetation index and suitable temperature).
[0178] Step 8: Export Results (1) GeoTIFF export Function Description: Exports risk rasters to GeoTIFF format, preserving complete spatial metadata for further analysis using professional GIS software such as ArcGIS and QGIS; (2) CSV export Function Description: Spatial sampling of risk grids, exporting the latitude and longitude coordinates and risk probabilities of the sampling points, facilitating statistical analysis using tools such as Excel and SPSS, and avoiding excessively large file sizes due to full export; Technical effect verification (a) Verify basic information Data scale: The study area covers approximately 960,000 square kilometers, with a raster resolution of 1km×1km, a total of approximately 960,000 raster cells, and approximately 897,652 effective prediction cells; 352 case data (confirmed cases from 2018 to 2023). Verification environment: Intel Core i7-12700K processor (12 cores, 20 threads), 64GB DDR4 memory, 1TB SSD; Validation metrics: model performance metrics, computational efficiency, and accuracy in identifying high-risk areas.
[0179] (II) Core Validation Results index numerical values Model accuracy 89.3% Accuracy 87.6% Recall rate 85.2% F1 score 84.0% AUC value 0.92 Predicting time (vectorization method) 23 seconds Predicting time (traditional method) 218 seconds Performance improvement factor 9.5 times (III) Verification of Application Effect High-risk area identification: Thirteen high-risk counties and districts were successfully identified, mainly concentrated in the border area of Shaanxi, Gansu and Ningxia, consistent with historical high-incidence areas; Consistency verification: The distribution of high-risk areas and historical cases showed a consistency of 86.3%, proving the reliability of the prediction results; Early warning effect: Four potential high-risk areas with no previous cases but conditions for transmission were successfully warned, providing a scientific basis for preventive control; Environmental factor verification: NDVI (vegetation index), minimum temperature and altitude were the top three key influencing factors, with a cumulative contribution of 70.4%, consistent with the ecological mechanism of canine visceral leishmaniasis transmission.
[0180] (iv) Ranking of the importance of environmental factors Environment variables Importance percentage (%) NDVI (Vegetation Index) 28.5 Minimum temperature (tmin) 23.7 Elevation 18.2 Nighttime lighting (NTLI) 12.6 Maximum temperature (tmax) 9.8 Total rainfall (ptot) 7.2 System Advantages Summary: High Efficiency: Vectorization technology improves computational efficiency by 9.5 times, enabling rapid risk assessment of large-scale areas; High Precision: The random forest model achieves a prediction accuracy of 89.3% and an AUC value of 0.92, accurately identifying high-risk areas; Ease of Use: The interactive web visualization interface supports multiple base map switching and case querying, allowing even non-professionals to quickly interpret the data; Scalability: The flexible system architecture can be extended to the monitoring and early warning of other vector-borne tropical diseases such as dengue fever and malaria; Practicality: Supports exporting results in multiple formats and can seamlessly integrate with existing GIS systems and statistical tools, providing direct support for prevention and control decision-making.
[0181] Those skilled in the art should consider the specification as a whole. The technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art, all of which fall within the protection scope of this invention.
Claims
1. A monitoring and early warning system for canine visceral leishmaniasis, characterized in that, The system comprises, in sequence, a data acquisition module, a data preprocessing module, a training data generation module, a risk prediction module, a spatial visualization module, a statistical analysis module, a model evaluation module, and a data export module. The data acquisition module acquires multi-source heterogeneous data. The data preprocessing module standardizes multi-source data through spatial registration, data cleaning, and environmental variable extraction. The training data generation module constructs a balanced training dataset based on case points and random background points. The risk prediction module uses vectorization technology combined with a random forest algorithm to achieve batch risk prediction. The spatial visualization module uses Web GIS technology to interactively display risk distribution. The statistical analysis module mines data patterns through risk grading and variable importance assessment. The model evaluation module verifies model performance using multi-dimensional indicators to ensure reliable prediction results. The data export module supports multi-format output to adapt to business needs.
2. The canine visceral leishmaniasis monitoring and early warning system according to claim 1, characterized in that, The data acquisition module includes a case data acquisition unit, a remote sensing data acquisition unit, a meteorological data acquisition unit, a topographic data acquisition unit, and an administrative boundary data acquisition unit. The case data acquisition unit collects the latitude and longitude coordinates and onset time of confirmed cases of canine visceral leishmaniasis. The remote sensing data acquisition unit acquires monthly / annual composite data of normalized vegetation index and nighttime light intensity data. The meteorological data acquisition unit acquires raster data of minimum temperature, maximum temperature, and total rainfall. The topographic data acquisition unit acquires SRTM digital elevation model data and extracts elevation information. The administrative boundary data acquisition unit acquires vector data of provincial or county-level administrative divisions. The data preprocessing module includes a spatial registration unit, a data cleaning unit, a coordinate transformation unit, and an environmental variable extraction unit. The spatial registration unit uniformly reprojects raster data from different sources to a geographic coordinate system or a projection coordinate system suitable for the study area. The data cleaning unit uniformly marks NoData values as np.nan and removes outliers using the quantile method. The coordinate transformation unit realizes the mutual conversion between raster coordinates and geographic coordinates based on an affine transformation matrix. The environmental variable extraction unit extracts six environmental variable values from each raster data based on the coordinates of the case point: NDVI, minimum temperature, maximum temperature, rainfall, nighttime light intensity, and altitude.
3. The canine visceral leishmaniasis monitoring and early warning system according to claim 1, characterized in that, The training data generation module includes a positive sample construction unit, a negative sample generation unit, a sample balancing unit, and a feature engineering unit. The positive sample construction unit reads the case CSV file, extracts valid coordinates, removes records containing NaN, calls the environmental variable extraction unit to obtain six environmental variable values, removes samples where any variable is NaN, and marks them as positive. The negative sample generation unit randomly generates 500-2000 background points within the effective pixel range of the NDVI raster, converts them to geographic coordinates, extracts environmental variable values, removes samples containing NaN, and marks them as negative. The sample balancing unit adjusts the positive-to-negative sample ratio to a range of 1:1 to 1:5 by oversampling positive samples or undersampling negative samples. The feature engineering unit preprocesses the environmental variables using Z-score normalization or Min-Max normalization to eliminate dimensional differences.
4. The canine visceral leishmaniasis monitoring and early warning system according to claim 1, characterized in that, The risk prediction module includes a model training unit, a vectorized prediction unit, a block processing unit, and a probability calculation unit. The model training unit uses a random forest algorithm to construct a binary classification prediction model with the following parameters: 50-300 decision trees, a maximum depth of 8-15, a minimum number of samples for node splitting of 3-10, and a random seed of 42. All CPU cores are used to accelerate training. The vectorized prediction unit stacks six environmental variable grids into a three-dimensional array along the first dimension, reshapes it into a two-dimensional matrix, and then batch-predicts the risk probability after filtering out all valid pixels of the variables. The block processing unit divides the ultra-large-scale data into blocks of 500-2000 rows, predicts sequentially, and then stitches the results together. The probability calculation unit outputs the disease transmission risk probability value for each grid cell.
5. The canine visceral leishmaniasis monitoring and early warning system according to claim 4, characterized in that, The specific implementation steps of the vectorized prediction unit are as follows: (1) Call the stack function of the NumPy library to stack the raster data corresponding to NDVI, minimum temperature, maximum temperature, rainfall, nighttime light intensity and altitude according to axis=0 to form a three-dimensional array of shape (6, height, width); (2) Reshape the three-dimensional array into a two-dimensional matrix of (height×width, 6) by the reshape function, where each row represents the 6 environmental variable values of a raster cell; (3) Use the np.isnan function combined with any(axis=1) to generate a Boolean mask and filter out the effective pixels whose environmental variable values are not NaN; (4) Call the random forest model method to perform batch prediction on the environmental variable matrix of the effective pixels and extract the second type of probability value; (5) Create an array of the same size as the total number of raster pixels and initialize it to NaN, and fill the predicted risk probability into the corresponding effective pixel position; (6) Reshape the filled one-dimensional array into a raster shape by the reshape function, and apply the mask of the reference raster to ensure that the spatial range is consistent.
6. The canine visceral leishmaniasis monitoring and early warning system according to claim 1, characterized in that, The spatial visualization module includes an interactive map unit, a multi-base map switching unit, a risk heatmap unit, a case point annotation unit, and a legend control unit. The interactive map unit creates a map based on the Folium library, sets the map center point as the geometric center of the study area, and sets the initial zoom level to 5-8. The multi-base map switching unit adds at least three base maps: street maps, satellite imagery, and topographic base maps, allowing users to switch between them using layer controls. The risk heatmap unit uses an 8-level continuous color band from dark blue to dark red, converts the risk raster to RGBA format by creating a color map, sets the transparency to 40%-60%, and adds it to the map. The case point annotation unit marks the locations of historical cases with red circular markers; clicking the marker displays the case's latitude, longitude, and onset time information. The legend control unit creates a legend fixed in the lower left corner of the map using HTML, including the risk probability range, corresponding color bands, and risk level descriptions.
7. The canine visceral leishmaniasis monitoring and early warning system according to claim 1, characterized in that, The statistical analysis module includes a descriptive statistics unit, a quantile analysis unit, a risk classification unit, a high-risk area identification unit, and an environmental variable importance assessment unit. The descriptive statistics unit extracts effective risk values from the risk raster and calculates the mean, median, standard deviation, minimum, and maximum values. The quantile analysis unit calculates the risk values at the 25th, 75th, 90th, and 95th percentiles to clarify the risk distribution characteristics. The risk classification unit calculates the number and proportion of pixels at each risk level according to the criteria of risk probability < 0.3, 0.3 ≤ risk probability < 0.7, and risk probability ≥ 0.
7. The high-risk area identification unit, combined with administrative boundary data, locates the county-level or provincial-level administrative unit to which the high-risk pixels belong and generates a list of high-risk areas. The environmental variable importance assessment unit, based on the attributes of the random forest model, quantifies the contribution of six environmental variables to disease transmission, arranges them in descending order of importance, and generates a visual chart. The model evaluation module includes a data segmentation unit, a performance index calculation unit, a confusion matrix generation unit, and a cross-validation unit. The data segmentation unit uses stratified sampling to divide the training dataset into training and test sets in a ratio of 2:8 to 4:6, ensuring that the class distribution of the test set is consistent with that of the training set. The performance index calculation unit calculates accuracy, precision, recall, F1 score, and AUC based on the prediction results of the test set. The confusion matrix generation unit generates a confusion matrix of the model prediction results, visually displaying the number of true positives, true negatives, false positives, and false negatives. The cross-validation unit uses 5-fold or 10-fold cross-validation, repeatedly dividing the training and test sets and evaluating model performance, calculating average indices to improve the reliability of the evaluation results.
8. The canine visceral leishmaniasis monitoring and early warning system according to claim 1, characterized in that, The data export module includes a raster export unit, a point data export unit, and a report generation unit; the raster export unit exports the risk probability raster in GeoTIFF format, copies the spatial metadata of the reference raster, and sets the data type to float32. The point data export unit performs spatial sampling on the risk grid, with the sampling interval adaptively adjusted according to the grid size. It extracts the latitude and longitude coordinates of the sampling points and their corresponding risk values, and exports them in CSV format. The report generation unit automatically generates an analysis report containing risk statistics, a list of high-risk areas, environmental variable importance analysis, model performance indicators, and risk visualization charts. It also includes an incremental update module, which comprises a data update unit and a model retraining unit. The data update unit supports four update modes: real-time upload and update of new case data, on-demand update of environmental data, timed refresh update, and event-driven update. The model retraining unit sets trigger conditions: when the amount of new case data reaches 15%-25% of the existing training set, or when there is a significant update to the environmental data, the model retraining process is automatically triggered to integrate new data, optimize model parameters, and update risk prediction results and spatial visualization content.
9. A risk prediction method based on the canine visceral leishmaniasis monitoring and early warning system of claim 1, characterized in that, Includes the following steps: S1: Acquire case data, remote sensing data, meteorological data, topographic data and administrative boundary data through the data acquisition module. Case data includes latitude and longitude coordinates and onset time, remote sensing data includes NDVI and NTLI data, and meteorological data includes minimum temperature, maximum temperature and total rainfall. S2: The data preprocessing module performs spatial registration, data cleaning, coordinate transformation and environmental variable extraction on the collected data, unifies the coordinate system, resolution and data format, handles missing values and outliers, and extracts the values of 6 environmental variables corresponding to the case points. S3: Construct positive and negative samples through the training data generation module, adjust the sample ratio to a balanced state, perform standardized preprocessing of environmental variables, and form a training dataset; S4: Divide the training dataset into training and test sets proportionally, use the training set to train the random forest prediction model, calculate the accuracy and precision metrics using the test set, and optimize the model parameters using cross-validation. S5: The risk prediction module stacks environmental variable rasters into a three-dimensional array, reshapes it into a two-dimensional matrix, filters effective pixels, and predicts risk probabilities in batches. For ultra-large-scale data, block processing is used to output risk probability raster. S6: The spatial visualization module constructs an interactive map to display risk heat maps and case distribution. The statistical analysis module calculates risk statistics, classifies risk levels, identifies high-risk areas, and assesses the importance of environmental variables. S7: Export the risk grid, sampling point data, and analysis report in GeoTIFF, CSV, and Word / PDF formats respectively using the data export module; S8: Receives new data in real time through the incremental update module, and automatically retrains the model and updates the warning results when the trigger conditions are met.
10. The method for predicting the risk of canine visceral leishmaniasis according to claim 9, characterized in that, The specific implementation process of batch prediction in step S5 is as follows: S51: Raster stacking, using the np.stack function to stack the raster data corresponding to NDVI, minimum temperature, maximum temperature, rainfall, nighttime light intensity, and altitude with axis=0 to form a three-dimensional array; S52: Matrix reshaping, using the reshape function to convert the three-dimensional array into a two-dimensional matrix, with each row representing a combination of environmental variables for a raster cell; S53: Effective cell filtering, generating a Boolean mask to filter out effective pixels whose environmental variable values are all non-NaN, and recording their indices; S54: Model prediction, calling the predict_proba method of the trained random forest model to perform batch prediction on the environmental variable matrix of effective pixels, obtaining the risk probability value of each effective pixel; S55: Result reconstruction, creating a one-dimensional array with the same number of raster pixels and initializing it to NaN, filling the predicted risk probabilities into the corresponding effective pixel index positions, and then using the reshape function... Convert to a risk probability raster; S56: Mask application, read the mask information of the reference raster, and set the area of the reference raster that is NoData in the risk probability raster to NaN as well; The specific process of block processing in step S5 is as follows: S5a: Block division, according to the height of the raster data, divide the raster into several consecutive blocks with a block size of 500-2000 rows, and record the start and end rows of each block; S5b: Block-by-block processing, perform the following operations on each block: extract the raster data of the 6 environmental variables corresponding to the block and stack them into a three-dimensional subarray; (2) reshape the three-dimensional subarray into a two-dimensional submatrix; (3) filter the effective pixels in the submatrix and predict the risk probability; (4) reconstruct the prediction result into a risk sub-raster; S5c: Result splicing, splice the risk sub-rasters of all blocks in the row direction to form a complete risk probability raster of the study area; S5d: Progress monitoring, during the block processing, calculate the proportion of the number of completed blocks to the total number of blocks in real time and display the processing progress bar.