Data processing method, device and equipment and computer readable storage medium
By obtaining data attribute information and using the calculation engine to obtain data cleaning rules from the rule base, the data cleaning rules are dynamically updated, which solves the problem of processing different data sources, improves data cleaning efficiency and accuracy, and meets real-time and flexibility requirements.
Patent Information
- Application Number
- CN202410623855.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-17
- Publication Date
- 2024-08-23
AI Technical Summary
It is difficult for the existing technology to process data from different data sources during data cleaning, resulting in low data cleaning efficiency and poor quality. The preset data cleaning rules cannot be dynamically updated, affecting the accuracy of data analysis.
By obtaining the attribute information of the data to be processed, the real-time computing engine or offline computing engine is used to obtain the corresponding data cleaning rules from the rule library, perform real-time or batch processing, and dynamically update the data cleaning rules to achieve targeted data cleaning.
It improves the efficiency and effectiveness of data cleaning, solves data processing problems from different data sources, meets the needs of real-time and flexibility, and ensures the accuracy of data analysis and data security.
Smart Images

Figure CN118535560A
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, device, equipment and computer-readable storage medium. Background Art
[0002] With the popularity of the Internet and mobile devices, a large amount of data is generated every second, including social media posts, search engine queries, e-commerce transaction records, etc. All walks of life will collect and analyze data according to their own needs to extract useful information and form conclusions. In the data analysis process, data cleaning is a more important link, and the quality of data cleaning is directly related to the accuracy of data analysis.
[0003] Data cleaning can find and correct identifiable errors in data, and data cleaning can improve data quality. Currently, before data cleaning, data cleaning rules are set in advance so that data can be cleaned using the preset data cleaning rules. However, the heterogeneity of data sources makes it difficult to standardize and structure data, and the preset data cleaning rules are difficult to handle data from different sources. This data cleaning method is inefficient, increases the difficulty of data cleaning, and cannot guarantee the quality of data cleaning. Summary of the invention
[0004] In view of this, the purpose of the present application is to provide a data processing method, device, equipment and computer-readable storage medium, so that data cleaning is targeted, the effectiveness of data cleaning is improved, and the efficiency of data cleaning is improved, and the problem that the preset data cleaning rules are difficult to process data from different sources is solved. The specific technical solution is as follows:
[0005] In a first aspect, the present application provides a data processing method, the method comprising:
[0006] Acquire data to be processed, where the data to be processed includes data from one or more data sources;
[0007] Determining attribute information of the data to be processed, wherein the attribute information indicates whether the data to be processed is real-time data or batch data;
[0008] If the data to be processed is real-time data, a real-time computing engine is used to obtain data cleaning rules corresponding to the data to be processed from a rule base, wherein the real-time computing engine is used to process the data to be processed in real time, and the rule base is used to store data cleaning rules corresponding to different data sources;
[0009] The real-time computing engine is used to clean the data to be processed based on the data cleaning rules corresponding to the data to be processed to obtain real-time cleaned data.
[0010] In a possible implementation, the method further includes:
[0011] The data cleaning rules in the rule base are written using a rule engine, and the rule base is stored in the rule engine.
[0012] In a possible implementation manner, determining the attribute information of the data to be processed includes:
[0013] When the data to be processed is text data, attribute information of the data to be processed is determined.
[0014] In a possible implementation, after obtaining the real-time cleansing data, the method further includes:
[0015] Performing data analysis on the real-time cleaning data to obtain real-time feature data;
[0016] The real-time feature data is stored in a database.
[0017] In a possible implementation, the performing data analysis on the real-time cleaning data to obtain real-time feature data includes:
[0018] The real-time computing engine is used to perform data analysis on the real-time cleaning data to obtain feature analysis data.
[0019] In a possible implementation manner, after determining the attribute information of the data to be processed, the method further includes:
[0020] If the data to be processed is batch data, an offline computing engine is used to obtain data cleaning rules corresponding to the data to be processed from the rule base, and the offline computing engine is used to perform batch processing on the data to be processed;
[0021] The offline computing engine is used to clean the data to be processed based on the data cleaning rule to obtain offline cleaned data.
[0022] In a second aspect, the present application further provides a data processing device, the device comprising:
[0023] An acquisition module, used to acquire data to be processed, wherein the data to be processed includes data from one or more data sources;
[0024] A determination module, used to determine attribute information of the data to be processed, wherein the attribute information indicates whether the data to be processed is real-time data or batch data;
[0025] A real-time acquisition module, used for, if the data to be processed is real-time data, obtaining data cleaning rules corresponding to the data to be processed from a rule base using a real-time computing engine, wherein the real-time computing engine is used for processing the data to be processed in real time, and the rule base is used for storing data cleaning rules corresponding to different data sources;
[0026] The real-time cleaning module is used to use the real-time computing engine to clean the data to be processed based on the data cleaning rules corresponding to the data to be processed, so as to obtain real-time cleaned data.
[0027] In a possible implementation manner, the device further includes:
[0028] A writing module is used to write the data cleaning rules in the rule base using a rule engine, and the rule base is stored in the rule engine.
[0029] In a third aspect, the present application further provides a computer device, characterized in that it includes: a memory and a processor;
[0030] Wherein, the memory is used to store computer programs;
[0031] The processor is used to execute the computer program in the memory to implement the method described in the first aspect or any one of the first aspects.
[0032] In a fourth aspect, the present application further provides a computer-readable storage medium, characterized in that it stores instructions that, when executed on a computer, enable the computer to execute the method described in the first aspect or any one of the first aspects.
[0033] In an embodiment of the present application, data to be processed is obtained, and the data to be processed includes data from one or more data sources; attribute information of the data to be processed is determined, and the attribute information characterizes whether the data to be processed is real-time data or batch data; if the data to be processed is real-time data, a real-time computing engine is used to obtain data cleaning rules corresponding to the data to be processed from a rule base, and the real-time computing engine is used to perform real-time processing on the data to be processed, and the rule base is used to store data cleaning rules corresponding to different data sources; the real-time computing engine is used to perform data cleaning on the data to be processed based on the data cleaning rules corresponding to the data to be processed, and real-time cleaned data is obtained. The embodiment of the present application obtains data cleaning rules corresponding to the data to be processed from the rule base, so that data cleaning is targeted, the effectiveness of data cleaning is improved, and the efficiency of data cleaning is improved, and the problem that the preset data cleaning rules are difficult to process data from different sources is solved. The embodiment of the present application also determines the processing method of the data to be processed through the attribute information of the data to be processed, improves the flexibility of data processing, and can also meet the real-time requirements of users. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0035] Figure 1 A flow chart of a data processing method provided by an embodiment of the present application is shown;
[0036] Figure 2 A Flink operation flow chart provided in an embodiment of the present application is shown;
[0037] Figure 3 A flowchart of another data processing method provided by an embodiment of the present application is shown;
[0038] Figure 4 A structural schematic diagram of a data processing device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0040] In the process of data analysis, data cleaning is a more important link, and the quality of data cleaning is directly related to the accuracy of data analysis. Data cleaning is the process of re-examining and verifying data, with the aim of removing duplicate information, correcting existing errors, checking data consistency, and handling invalid and missing values. Data cleaning helps eliminate inconsistencies in data, such as differences in naming formats, date formats, data types, units, etc., which can make data more standardized and easier to compare and analyze.
[0041] At present, data comes from a wide range of sources, and each data production system only designs the data format and data structure according to the production intention, so that data from different data sources have different data formats and data structures. When it is necessary to collect and analyze data from multiple data production systems, if the collected data is not cleaned, it will increase the difficulty of data analysis and affect the accuracy of data analysis. If the collected data is cleaned, it is necessary to configure a variety of data cleaning rules, but the data cleaning rules between different data production systems cannot be reused, which increases the difficulty of configuring data cleaning rules.
[0042] At present, some data cleaning rules are pre-set and encapsulated so that the data can be cleaned by the service program encapsulated with the data cleaning rules in the future, which solves the above problems to a certain extent. However, data cleaning in this way cannot guarantee the accuracy of data cleaning, and the pre-set data cleaning rules may not be applicable to data from all data sources. In addition, it is difficult to add data cleaning rules in this way, and the data cleaning rules cannot be updated dynamically. If the data cleaning rules are updated, the service program needs to be restarted, but this may cause business interruption of the service program.
[0043] Therefore, the present application proposes a data processing method that can dynamically update data cleaning rules and perform data cleaning in real time, thereby reducing the time and resource consumption in the data analysis process and improving the efficiency of data processing.
[0044] The present application can provide a data processing system, which is used to clean data. The data processing system at least includes a processor, a message queue, a real-time computing engine, and an offline computing engine.
[0045] See also Figure 1 , shows a flow chart of a data processing method provided by an embodiment of the present application, and the embodiment of the present application is applied to a processor of a data processing system. The embodiment of the present application at least includes the following steps:
[0046] S11, obtaining data to be processed.
[0047] The embodiment of the present application can obtain the data to be processed through the message queue, specifically, obtain the data to be processed from the message queue. The message queue can be connected to one or more data production systems to collect and save the data to be processed. The data to be processed is the data that needs to be cleaned, and the data to be processed includes data from one or more data sources. The data production system can be understood as a data source. Message Queue (MQ) is an asynchronous service-to-service communication method. MQ can be compared to a container for storing data. When the data is needed, the data can be taken out for use. Common MQs include RocketMQ, RabbitMQ, Kafka, etc.
[0048] In the embodiment of the present application, Kafka can be used as a message queue to collect data from one or more data production systems in real time. Kafka is a distributed open source message queue system with high throughput, persistence, and scalability. It is used in this application to build real-time data stream processing, log collection, event-driven architecture and other scenarios.
[0049] Specifically, each data production system has a corresponding data collection service program, which can collect and save the data generated by the corresponding data production system. Kafka accesses the data collection service program of each data production system in real time to obtain and save the data of each data production system.
[0050] The embodiment of the present application obtains data from a data production system and can complete data cleaning work on the data of the data production system before a data consumption system has a demand for the data of the data production system, thereby improving the efficiency of data processing.
[0051] S12, determining attribute information of the data to be processed.
[0052] The attribute information of the embodiment of the present application characterizes whether the data to be processed is real-time data or batch data. If the data to be processed is real-time data, it means that the data to be processed needs to be stream processed; if the data to be processed is batch data, it means that the data to be processed does not need to be stream processed and can be batch processed. The embodiment of the present application determines the attribute information of the data to be processed, clarifies the processing method of the data to be processed, and improves the flexibility of data processing.
[0053] The processing methods of the embodiments of the present application include stream processing and batch processing. Stream processing is the instant processing of each data in the data stream as it arrives. This method is particularly suitable for scenarios that require real-time feedback, such as real-time monitoring, real-time recommendations, and alarms. Compared with stream processing, batch processing is not real-time, but a one-time analysis and processing of a batch of accumulated data. This method is suitable for scenarios where immediate results are not required, such as large-scale data backup and data cleaning tasks that can be performed at night.
[0054] One implementation of determining the attribute information of the data to be processed may be that the processor determines the attribute information of the data to be processed. Then when obtaining the data to be processed, the processor obtains the data to be processed from the message queue.
[0055] Another implementation method for determining the attribute information of the data to be processed may be that the processor uses a computing engine to determine the attribute information of the data to be processed. Then, when obtaining the data to be processed, the processor uses the computing engine to obtain the data to be processed from the message queue. The computing engine includes a real-time computing engine and an offline computing engine, and the real-time computing engine and the offline computing engine will be described in subsequent embodiments.
[0056] S13: If the data to be processed is real-time data, a real-time computing engine is used to obtain data cleaning rules corresponding to the data to be processed from a rule base.
[0057] After determining that the data to be processed is real-time data, it is necessary to clean the data to be processed immediately. The embodiment of the present application uses a real-time computing engine to perform real-time data cleaning on the data to be processed. Before data cleaning, it is necessary to obtain data cleaning rules. Then the embodiment of the present application uses a real-time computing engine to obtain data cleaning rules corresponding to the data to be processed from a rule base. Among them, the real-time computing engine is used to perform real-time processing of the data to be processed, and the rule base is used to store data cleaning rules corresponding to different data sources. Real-time computing engines include Apache Storm, Flink, etc. The specific real-time computing engine can be selected by the technician according to the actual scenario needs, and the embodiment of the present application is not limited.
[0058] In the embodiment of the present application, Flink can be used as a real-time computing engine to process the data to be processed in real time. Flink is a high-performance open source stream processing framework that can consume data streams in Kafka in real time. Specifically, when the data to be processed is real-time data, the Flink system is used to obtain data cleaning rules corresponding to the data to be processed from the rule library.
[0059] Flink's main operating architecture includes the JobManager and the TaskManager. The JobManager is used to start the TaskManager and control the TaskManager to execute tasks. The TaskManager is used to execute tasks and regularly report the task status to the JobManager. The task can be a data cleaning task. Flink also has the function of state backend storage. The State Backend is used to distinguish the storage method and storage location of the task status. Figure 2As shown in the figure, the operation process of Flink consists of three parts: Source, Window, and Sink. Source is mainly responsible for reading data from Kafka and distinguishing the source of data. Window is mainly responsible for data cleaning operations. Sink is mainly responsible for the output of final data. The data flowing between each part is called streams. There can be Kafka, ElasticSearch, Socket, RabbitMQ and other sink methods.
[0060] The embodiment of the present application utilizes a rule base to store data cleaning rules corresponding to different data sources, and the data cleaning rules in the rule base can be added, reduced, and modified later, so that the data cleaning rules corresponding to the data to be processed can be found from the rule base, thereby improving the effectiveness of data cleaning and solving the problem that the preset data cleaning rules are difficult to process data from different sources.
[0061] S14, using a real-time computing engine to clean the data to be processed based on a data cleaning rule corresponding to the data to be processed, to obtain real-time cleaned data.
[0062] After obtaining the data cleaning rules corresponding to the data to be processed, the real-time computing engine is used to clean the data to be processed based on the obtained data cleaning rules, thereby obtaining real-time cleaned data. The real-time cleaned data can be used when performing data analysis to improve the accuracy of data analysis.
[0063] Specifically, the Flink system is used to clean the data to be processed based on the data cleaning rules corresponding to the data to be processed, so as to obtain real-time cleaned data.
[0064] Data that has not been cleaned may cause deviations in the analysis results of data analysis. Therefore, the embodiment of the present application performs data cleaning on the data to improve the accuracy of data analysis. In addition, the embodiment of the present application uses a real-time computing engine to perform real-time data cleaning, avoiding the cost and time of processing a large amount of dirty data afterwards, improving the efficiency of the data processing process, and can also help and handle potential data security risks, such as sensitive information leakage, to protect data security.
[0065] In an embodiment of the present application, data to be processed is obtained, and the data to be processed includes data from one or more data sources; attribute information of the data to be processed is determined, and the attribute information characterizes whether the data to be processed is real-time data or batch data; if the data to be processed is real-time data, a real-time computing engine is used to obtain data cleaning rules corresponding to the data to be processed from a rule base, and the real-time computing engine is used to perform real-time processing on the data to be processed, and the rule base is used to store data cleaning rules corresponding to different data sources; the real-time computing engine is used to perform data cleaning on the data to be processed based on the data cleaning rules corresponding to the data to be processed, and real-time cleaned data is obtained. The embodiment of the present application obtains data cleaning rules corresponding to the data to be processed from the rule base, so that data cleaning is targeted, the effectiveness of data cleaning is improved, and the efficiency of data cleaning is improved, and the problem that the preset data cleaning rules are difficult to process data from different sources is solved. The embodiment of the present application also determines the processing method of the data to be processed through the attribute information of the data to be processed, improves the flexibility of data processing, and can also meet the real-time requirements of users.
[0066] See also Figure 3 , shows a flow chart of another data processing method provided by an embodiment of the present application, and the embodiment of the present application at least includes the following steps:
[0067] S31, obtaining data to be processed.
[0068] S32, determining the attribute information of the data to be processed.
[0069] Before determining the attribute information of the data to be processed, the embodiment of the present application first determines whether the data to be processed is text data. If the data to be processed is text data, the attribute information of the data to be processed is determined. If the data to be processed is not text data, the data to be processed is stored in the file system. The data to be processed that is not text data can be in picture format, portable document format (PDF), etc.
[0070] In an embodiment of the present application, the data to be processed that is not text data can be widely stored in file systems such as Hadoop Distributed File System (HDFS), Object-based Storage Device (OSD), etc. The data storage medium can be distinguished according to different usage requirements. Storing cold data on low-cost storage media (such as HDFS, OSD file system) can reduce storage costs, which is particularly beneficial for large-scale data storage and long-term data retention. Among them, cold data can be data with a storage cycle of more than three years. Storing hot data on high-speed storage media (such as solid-state drives, etc.) can speed up data access and improve response performance. Among them, hot data is data within a storage cycle of one month.
[0071] The attribute information of the embodiment of the present application indicates whether the data to be processed is real-time data or batch data. If the data to be processed is real-time data, S33 to S34 are executed; if the data to be processed is batch data, S35 to S36 are executed.
[0072] S33, using the real-time computing engine to obtain data cleaning rules corresponding to the data to be processed from the rule base.
[0073] S34, using the real-time computing engine to clean the data to be processed based on the data cleaning rules corresponding to the data to be processed, to obtain real-time cleaned data.
[0074] S31 to S34 can refer to Figure 1 S11 to S14 in the corresponding embodiments can be understood and will not be repeated here.
[0075] S35, using the offline computing engine to obtain data cleaning rules corresponding to the data to be processed from the rule base.
[0076] After determining that the data to be processed is batch data, it is not necessary to clean the data to be processed immediately. The data to be processed can be marked first, and the data to be processed can be cleaned when the marked data to be processed reaches a preset number or the preset batch processing time is reached. The preset number and preset batch processing time can be set by the technician according to the actual scenario needs, and the embodiments of this application are not limited thereto.
[0077] The embodiment of the present application uses an offline computing engine to clean the data to be processed. Before data cleaning, it is necessary to obtain data cleaning rules. Then the embodiment of the present application uses an offline computing engine to obtain data cleaning rules corresponding to the data to be processed from a rule base. Among them, the offline computing engine is used to batch process the data to be processed. Offline computing engines include MapReduce, Hadoop, Spark, etc. The specific offline computing engine can be selected by the technician according to the actual scenario needs, and the embodiment of the present application is not limited.
[0078] In the embodiment of the present application, Spark can be used as an offline computing engine to perform batch processing on the data to be processed. Spark is a fast and general computing engine designed for large-scale data processing, which can be used for large-scale, low-latency data analysis. Specifically, when the data to be processed is batch data, the Spark system is used to obtain data cleaning rules corresponding to the data to be processed from the rule library.
[0079] S36, using an offline computing engine to clean the data to be processed based on data cleaning rules to obtain offline cleaned data.
[0080] After obtaining the data cleaning rules corresponding to the data to be processed, the offline computing engine is used to clean the data to be processed based on the obtained data cleaning rules, thereby obtaining offline cleaned data. The offline cleaned data can be used when performing data analysis to improve the accuracy of data analysis.
[0081] Specifically, the Spark system is used to clean the data to be processed based on the data cleaning rules corresponding to the data to be processed, so as to obtain offline cleaned data.
[0082] The embodiment of the present application combines the two processing methods of streaming and batch processing by determining the attribute information of the data to be processed. The data processing mode that combines streaming and batch processing achieves higher flexibility and efficiency by integrating the advantages of streaming and batch processing. This combination method allows the data processing system to adopt the optimal processing strategy for different types of data: streaming processing is used for scenarios that require rapid response and real-time analysis; and batch processing is used for scenarios that require in-depth analysis and historical data aggregation. The data processing mode that combines streaming and batch processing can significantly reduce development and operation and maintenance costs. It reduces the number and complexity of systems that need to be maintained, and also simplifies the data processing process.
[0083] S37, performing data analysis on the cleaned data to obtain characteristic data.
[0084] In the embodiment of the present application, the cleaning data includes real-time cleaning data and offline cleaning data, and the feature data also correspondingly includes real-time feature data and offline feature data.
[0085] After obtaining the cleaned data, the embodiment of the present application can store the cleaned data in Kafka as a data basis for data analysis. When data analysis is required for the cleaned data, the cleaned data is obtained from Kafka.
[0086] One implementation method of performing data analysis on the cleaned data to obtain the characteristic data may be to perform data analysis on the real-time cleaned data to obtain the real-time characteristic data.
[0087] Specifically, the real-time computing engine is used to perform data analysis on the real-time cleansing data to obtain feature analysis data.
[0088] Taking the scenario where the data processing method of the embodiment of the present application is applied to the processing of medical data as an example, the hospital is the data production system. The feature analysis data can be the data upload volume of each region, the data upload volume of each hospital, the disease information of each patient, the disease type set, the gender ratio, the age ratio, etc.
[0089] The embodiment of the present application can also generate a label for each object based on the feature analysis data. The objects include regions, hospitals, and patients. The label of each region may include data upload volume, hospital information, data type information, disease type information, gender ratio, age ratio, etc. The label of each hospital may include data upload volume, data type information, disease type information, gender ratio, age ratio, etc. The label of each patient may include personal information, corresponding disease type, medication information, etc.
[0090] Specifically, the Redis system is used to analyze the real-time cleansing data to obtain feature statistics, which indicate the values corresponding to the preset features. Redis is a key-value storage system that is single-threaded and time-series at the instruction execution level, and can well guarantee the accuracy of data indicator calculation.
[0091] Continuing to take the scenario where the data processing method of the embodiment of the present application is applied to the processing of medical data as an example, the preset features can be the number of patients in each age group, the number of patients of each disease type, etc. Different age groups can be divided according to preset age intervals, and the specific preset age intervals can be set by technicians according to actual scene needs, and the embodiment of the present application does not limit it.
[0092] Another implementation method of performing data analysis on the cleaned data to obtain the characteristic data may be to perform data analysis on the offline cleaned data to obtain the offline characteristic data.
[0093] Specifically, the offline computing engine is used to perform data analysis on the offline cleaned data to obtain the index analysis data. The detailed process of this step can be referred to the relevant introduction of "Using the real-time computing engine to perform data analysis on the real-time cleaned data to obtain the characteristic data".
[0094] Unlike feature analysis data, when using offline computing engines for data analysis, the data is more complete, and a deeper analysis can be performed on the data. The appropriate segmentation method can be found to perform parallel analysis on the data. Using offline computing engines, case information of the same patient in different hospitals can be summarized to obtain case information; multiple examination results of the patient in a hospital can be summarized to obtain examination reports; and the types and characteristics of diseases in each region can be summarized to obtain a disease database. Obtaining a disease database can provide data support for disease prevention and control.
[0095] When the offline computing engine analyzes the offline cleaned data, it can also analyze the historical data. The historical data can be obtained through Kafka. After obtaining the historical data, the offline computing engine is used to clean the historical data.
[0096] The combined stream and batch data processing model encourages the reuse of code and logic between different processing modes, which means that the results produced by stream tasks can be applied in batch tasks, thereby improving efficiency and reducing duplication of work.
[0097] That is, the offline computing engine can also perform data analysis on the real-time cleansing data and feature analysis data, that is, the offline computing engine can perform a deeper analysis on the real-time cleansing data and feature analysis data.
[0098] Specifically, the Redis system is used to perform data analysis on the offline cleaning data to obtain indicator statistics, where the indicator statistics indicate the values corresponding to the preset indicators. For the detailed process of this step, please refer to the relevant introduction of "Using the Redis system to perform data analysis on real-time cleaning data to obtain feature statistics".
[0099] S38, storing the feature data in a database.
[0100] After obtaining the feature data, the feature data is stored in a database so that users can use the feature data for further data analysis. The database can be mysql, postgresSQL, Renmin University of China Jincang, etc. The specific database can be selected by the technician according to the actual scenario needs, and the embodiment of the application is not limited.
[0101] The embodiment of the present application can also store intermediate data, real-time cleaning data and offline cleaning data in the data cleaning process into a database to facilitate data tracking.
[0102] The embodiment of the present application uses Flink, Spark and Redis systems to perform data analysis on the cleaned data, making the data easier to understand and providing support for users' in-depth data analysis.
[0103] exist Figure 1 , Figure 3 On the basis of the corresponding embodiments, the embodiments of the present application can also compile data cleaning rules in the rule base.
[0104] Specifically, the data cleaning rules in the rule base are written using a rule engine. The rule engine is an embedded component that separates business decisions from application code and uses predefined semantic modules to write business decisions. It accepts data input, interprets business rules, and makes business decisions based on business rules. In an embodiment of the present application, the rule engine is used to write data cleaning rules and store data cleaning rules. The rule base is stored in the rule engine. Rule engines include Drools, VisualRules, iLog, etc. The specific rule engine can be selected by technical personnel according to the actual scenario needs, and the embodiment of the present application does not limit it.
[0105] The embodiment of the present application can use Drools as a rule engine to implement the writing of data cleaning rules. Drools is an open source business rule engine that is easy to adjust and manage, making it easy to view and verify whether the encoded rules are correctly executed. The main work of using Drools is to write rule files, which define the cleaning rules related to the data.
[0106] The embodiment of the present application uses a rule engine to freely add, reduce and modify data cleaning rules, which solves the problem of encapsulating data cleaning rules in service programs, making it difficult to add data cleaning rules, and further improves the effectiveness and efficiency of data cleaning.
[0107] The introduction of Drools provides the data processing system with the ability to dynamically update business logic. Through the Application Program Interface (API) call, Flink can pull the latest data cleaning rules to process the data, and dynamically refresh the data cleaning rules even without restarting the service program, so as to adapt to changes in business needs.
[0108] Flink is designed to support high throughput and low latency data processing, which makes it very suitable for processing large amounts of data. Combined with Kafka as a data message queue, efficient data transmission and storage can be achieved. The Drools rule engine provides efficient business logic execution capabilities, ensuring the accuracy and consistency of data processing.
[0109] The data processing system provided by the embodiment of the present application may include a processor, a message queue, a real-time computing engine, an offline computing engine, a rule engine, a database, a Redis system, and a file system. The embodiment of the present application also provides a unified scheduling front-end page for the data processing system, encapsulates the configuration information of the data processing system, and performs scheduling configuration in the form of dragging and dropping, which greatly reduces the amount of development code and the difficulty of development. At the same time, it can realize unified monitoring of the scheduling status, which is convenient for operation and maintenance personnel to manage.
[0110] Next, we will introduce the data cleaning rules.
[0111] Data cleaning rules for missing value processing may include: simple filling: use mean, median, mode for filling. Numerical variables can be filled with mean or median, and categorical variables are filled with mode; hot card filling: also called nearest filling, find a record in the complete data that is most similar to the record with missing values to fill; cluster filling: after clustering, for the missing values in a class, use the sample mean in that class to fill; fitting missing values: use other variables as input to the model to predict the missing variables.
[0112] The data cleaning rules for outlier processing may include: treating outliers as missing values and processing them using the data cleaning rules for missing value processing; and correcting them using the average value.
[0113] The data cleaning rules for duplicate value processing may include: deleting duplicate values so that only one duplicate value exists.
[0114] In addition to common data cleaning rules such as outlier processing and missing value processing, the rule base of the embodiment of the present application may also include other data cleaning rules. The data processing method of the embodiment of the present application is applied to the scenario of processing medical data as an example for explanation:
[0115] Data cleaning rules for special situations may include: assuming that the patient has undergone two examinations, both of which have uploaded their ID numbers, and the information from the first examination is relatively complete, then the second examination information will be filled in based on personal information such as the ID number and name.
[0116] Data cleaning rules for names may include: determining whether it is null or empty; if it is a Chinese name, removing all other characters except Chinese characters; if it is an English name, removing all other characters except English letters and spaces, and removing leading and trailing spaces; if the name contains both Chinese and English, the Chinese name shall prevail and the name shall be cleaned according to the national standard document.
[0117] Data cleaning rules for gender can include: determining whether it is null or an empty character; replacing all keywords including male, m, M, nan, NAN, Ma, etc. with 1; replacing all keywords including female, F, f, W, w, nv, NV, UN, etc. with 2; replacing characters containing "unknown" with 0.
[0118] Data cleaning rules for age can include: determining whether it is null or an empty character; replacement general rules: replacing leading and trailing spaces with empty strings, ".00" with an empty string, ".0" with an empty string, Y with "years old", y with "years old", M with "months", m with "months", D with "days", d with "days", H with "hours", h with "hours"; removing all characters other than numbers for characters containing "years old", and then concatenating the "years old" character.
[0119] It should be noted that the data cleaning rules in the rule library can be set by technicians according to actual scenario needs, and the embodiments of this application do not make limitations.
[0120] The embodiments of this application achieve data standardization through data cleaning, ensuring that all data follows a unified format and standard, enabling the data consumption system to obtain data in a unified format from the data processing system of the embodiments of this application, facilitating the data consumption system to perform data analysis based on the data in the unified format, improving the efficiency and accuracy of data analysis, and helping to avoid misleading conclusions caused by data quality problems.
[0121] Next, a data processing device provided by the embodiments of this application will be introduced. The data processing device introduced below can be correspondingly referred to with the data processing method introduced above.
[0122] Please refer to Figure 4 , which shows a schematic structural diagram of a data processing device provided by the embodiments of this application. The device includes:
[0123] An acquisition module 41, configured to acquire data to be processed, where the data to be processed includes data from one or more data sources;
[0124] A determination module 42, configured to determine the attribute information of the data to be processed, where the attribute information characterizes the data to be processed as real-time data or batch processing data;
[0125] A real-time acquisition module 43, configured to, if the data to be processed is real-time data, use a real-time computing engine to acquire data cleaning rules corresponding to the data to be processed from the rule library, where the real-time computing engine is used to perform real-time processing on the data to be processed, and the rule library is used to store data cleaning rules corresponding to different data sources;
[0126] The real-time cleaning module 44 is used to use the real-time computing engine to clean the data to be processed based on the data cleaning rules corresponding to the data to be processed, so as to obtain real-time cleaned data.
[0127] In the embodiment of the present application, the device further includes:
[0128] A writing module is used to write the data cleaning rules in the rule base using a rule engine, and the rule base is stored in the rule engine.
[0129] In the embodiment of the present application, the determination module 42 is specifically used to:
[0130] When the data to be processed is text data, attribute information of the data to be processed is determined.
[0131] In the embodiment of the present application, the device further includes:
[0132] An analysis module, used for performing data analysis on the real-time cleaning data to obtain real-time feature data;
[0133] The storage module is used to store the real-time feature data in a database.
[0134] In the embodiment of the present application, the analysis module includes:
[0135] The real-time analysis unit is used to perform data analysis on the real-time cleansing data using the real-time computing engine to obtain feature analysis data.
[0136] In the embodiment of the present application, the device further includes:
[0137] An offline acquisition module, used for acquiring data cleaning rules corresponding to the data to be processed from the rule base by using an offline computing engine if the data to be processed is batch processing data, and the offline computing engine is used for batch processing of the data to be processed;
[0138] The offline cleaning module is used to use the offline computing engine to clean the data to be processed based on the data cleaning rule to obtain offline cleaned data.
[0139] The embodiment of the present application also provides a computer device, including: a memory and a processor;
[0140] Wherein, the memory is used to store computer programs;
[0141] The processor is used to execute the computer program in the memory to implement the method described in the above method embodiment.
[0142] The embodiment of the present application also provides a computer-readable storage medium storing instructions, which, when executed on a computer, enables the computer to execute the method described in the above method embodiment.
[0143] In an embodiment of the present application, the acquisition module acquires the data to be processed, and the data to be processed includes data from one or more data sources; the determination module determines the attribute information of the data to be processed, and the attribute information characterizes whether the data to be processed is real-time data or batch data; if the data to be processed is real-time data, the real-time acquisition module uses the real-time computing engine to obtain the data cleaning rules corresponding to the data to be processed from the rule base, the real-time computing engine is used to perform real-time processing on the data to be processed, and the rule base is used to store data cleaning rules corresponding to different data sources; the real-time cleaning module uses the real-time computing engine to perform data cleaning on the data to be processed based on the data cleaning rules corresponding to the data to be processed, and obtains real-time cleaned data. The embodiment of the present application obtains the data cleaning rules corresponding to the data to be processed from the rule base, so that the data cleaning is targeted, the effectiveness of data cleaning is improved, and the efficiency of data cleaning is improved, and the problem that the preset data cleaning rules are difficult to process data from different sources is solved. The embodiment of the present application also determines the processing method of the data to be processed through the attribute information of the data to be processed, improves the flexibility of data processing, and can also meet the real-time requirements of users.
[0144] It should be noted that the same or similar parts between the various embodiments can be referred to each other. As for the device embodiment and the system embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0145] For the above-mentioned embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present application is not limited by the order of the actions described, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0146] Finally, it should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0147] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
[0148] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: Acquire data to be processed, where the data to be processed includes data from one or more data sources; Determining attribute information of the data to be processed, wherein the attribute information indicates whether the data to be processed is real-time data or batch data; If the data to be processed is real-time data, a real-time computing engine is used to obtain data cleaning rules corresponding to the data to be processed from a rule base, wherein the real-time computing engine is used to process the data to be processed in real time, and the rule base is used to store data cleaning rules corresponding to different data sources; The real-time computing engine is used to clean the data to be processed based on the data cleaning rules corresponding to the data to be processed to obtain real-time cleaned data.
2. The method according to claim 1, characterized in that The method further comprises: The data cleaning rules in the rule base are written using a rule engine, and the rule base is stored in the rule engine.
3. The method according to claim 1, characterized in that The determining the attribute information of the data to be processed includes: When the data to be processed is text data, attribute information of the data to be processed is determined.
4. The method according to any one of claims 1 to 3, characterized in that: After obtaining the real-time cleaning data, the method further includes: Performing data analysis on the real-time cleaning data to obtain real-time feature data; The real-time feature data is stored in a database.
5. The method according to claim 4, characterized in that The performing of data analysis on the real-time cleaning data to obtain real-time feature data includes: The real-time computing engine is used to perform data analysis on the real-time cleaning data to obtain feature analysis data.
6. The method according to any one of claims 1 to 3, characterized in that: After determining the attribute information of the data to be processed, the method further includes: If the data to be processed is batch data, an offline computing engine is used to obtain data cleaning rules corresponding to the data to be processed from the rule base, and the offline computing engine is used to perform batch processing on the data to be processed; The offline computing engine is used to clean the data to be processed based on the data cleaning rule to obtain offline cleaned data.
7. A data processing device, characterized in that: The device comprises: An acquisition module, used to acquire data to be processed, wherein the data to be processed includes data from one or more data sources; A determination module, used to determine attribute information of the data to be processed, wherein the attribute information indicates whether the data to be processed is real-time data or batch data; A real-time acquisition module, used for, if the data to be processed is real-time data, obtaining data cleaning rules corresponding to the data to be processed from a rule base using a real-time computing engine, wherein the real-time computing engine is used for processing the data to be processed in real time, and the rule base is used for storing data cleaning rules corresponding to different data sources; The real-time cleaning module is used to use the real-time computing engine to clean the data to be processed based on the data cleaning rules corresponding to the data to be processed, so as to obtain real-time cleaned data.
8. The device according to claim 7, characterized in that The device also includes: A writing module is used to write the data cleaning rules in the rule base using a rule engine, and the rule base is stored in the rule engine.
9. A computer device, characterized in that: include: Memory and processor; The memory is used to store computer programs; The processor is used to execute the computer program in the memory to implement the method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: The device stores instructions which, when executed on a computer, enable the computer to execute the method according to any one of claims 1 to 6.
