Data processing method, device, electronic device and readable storage medium
By using the configuration file to verify the storage format of the target data, the problem of processing script crash caused by human error during data storage format conversion is solved, errors can be quickly located and corrected, and the efficiency and accuracy of data format conversion are improved.
Patent Information
- Application Number
- CN202011585583.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-28
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2040-12-28
Smart Images

Figure 00000000_0000
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, electronic device and readable storage medium. Background Art
[0002] At present, the requirements for data storage formats may be different in different demand scenarios. For example, for fingerprint data, there are many sources of data, including new machine trial data, mobile phone manufacturer data, and tester data. The storage formats of data from different sources may be very different. In order to facilitate subsequent processing of these data, the storage format of these data needs to be converted to the format required by algorithm personnel. Currently, the format conversion is performed through processing scripts.
[0003] However, since a large amount of human participation is involved in the data storage process, there are inevitably many errors in the file storage format, such as files placed in the wrong directory, directory naming errors, etc. This causes the processing script to crash when encountering these errors during runtime, and it takes time and effort for humans to find the cause of the program crash. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a data processing method, device, electronic device and readable storage medium to improve the problem in the prior art that when a processing script encounters these errors during execution, the program crashes and time-consuming and labor-intensive manual work is required to find the cause of the program crash.
[0005] In a first aspect, an embodiment of the present application provides a data processing method, the method comprising:
[0006] Reading a configuration file, wherein the configuration file includes a verification rule for storage format information of target data;
[0007] Using the configuration file to verify the storage format information of the target data, and obtain a verification result;
[0008] Determining that there is erroneous target information in the storage format information in the verification result;
[0009] The target information is output.
[0010] In the above implementation process, the storage format information of the target data is verified by using the configuration file to obtain the erroneous target information in the target data. In this way, the erroneous information in the target data can be quickly located. This can avoid the problem of crashing due to errors when using the processing script for format conversion, which requires manual time-consuming and labor-intensive investigation of the cause of the crash.
[0011] Optionally, the using the configuration file to verify the storage format information of the target data to obtain a verification result includes:
[0012] Parsing to obtain the storage path of the target data and each storage node under the storage path;
[0013] The storage path and the storage format information of each storage node are verified using the configuration file to obtain a verification result.
[0014] In the above implementation process, by verifying the storage path and each storage node of the target data, it is possible to locate the erroneous information in the storage format information more comprehensively.
[0015] Optionally, the using the configuration file to verify the storage path and the storage format information of each storage node to obtain a verification result includes:
[0016] Using the configuration file, verify the node information of each storage node and the storage format information of the target data under the bottom storage node to obtain a first verification result;
[0017] Verifying the data storage organization format of the storage path using the configuration file to obtain a second verification result;
[0018] The verification result includes the first verification result and the second verification result.
[0019] In the above implementation process, the node information of each storage node in the storage path of the target data and the target data under the storage node are verified, and the data storage organization format of the storage path is verified, so that the errors of each storage node can be located more comprehensively.
[0020] Optionally, the verifying the node information of each storage node by using the configuration file to obtain a first verification result includes:
[0021] Extracting key fields from the node information of each storage node;
[0022] The field representation of the key fields in the node information of each storage node is verified by using the regular expression set for the field in the configuration file to obtain the corresponding first sub-verification result; wherein the first verification result includes the first sub-verification result.
[0023] In the above implementation process, regular expressions are used to verify the field representation of key fields of each storage node, so that errors of each storage node can be quickly located.
[0024] Optionally, the verifying the node information of each storage node by using the configuration file to obtain a first verification result includes:
[0025] Extracting key fields from the node information of each storage node;
[0026] The configuration file is used to check whether the key fields in the node information of each storage node are missing, and the corresponding second sub-check result is obtained; wherein the first check result includes the second sub-check result. Thus, the missing key fields can be recorded, which is convenient for subsequent modification of the storage format information.
[0027] Optionally, the using the configuration file to verify whether a key field in the node information of each storage node is missing to obtain a corresponding second sub-verification result includes:
[0028] Matching the key fields in the node information of each storage node by using the regular expression set for the field in the configuration file to obtain the matched key fields;
[0029] It is determined whether the matching key field exists in the dictionary recorded in the configuration file, and a corresponding second sub-verification result is obtained.
[0030] In the above implementation process, the key fields are matched by regular expressions and dictionaries, so that the missing key fields can be effectively and quickly determined.
[0031] Optionally, the using the configuration file to verify the storage format information of the target data under the bottom-level storage node to obtain a first verification result further includes:
[0032] The configuration file is used to verify the size of the target data under the bottom-level storage node; and / or the meta information corresponding to the target data under the bottom-level storage node is verified to obtain a corresponding third sub-verification result, wherein the first verification result includes the third sub-verification result.
[0033] In the above implementation process, the target data itself under the storage node is verified, which can ensure the subsequent smooth format conversion.
[0034] Optionally, the using the configuration file to verify the data storage organization format of the storage path to obtain a second verification result includes:
[0035] Extracting key fields from the node information of each storage node;
[0036] Determine the directory hierarchical relationship of each key field according to the storage path;
[0037] The configuration file is used to verify the data storage organization format according to the target hierarchical relationship of each key field to obtain a corresponding second verification result.
[0038] In the above implementation process, the data storage organization format is verified according to the directory hierarchy relationship of each key field, so that whether the storage organization format of the target data is incorrect can be accurately detected.
[0039] Optionally, the method further comprises:
[0040] The target information is modified to obtain a modified record file, wherein the modified record file is target data obtained after the target information in the target data is modified.
[0041] In the above implementation process, the corrected target data is recorded through the correction record file instead of modifying the original target data, which can avoid the problem of damaging the relevant information of the original target data by modifying the original target data.
[0042] Optionally, the method further comprises:
[0043] The storage format of the target data is converted based on the correction record file to obtain the target data in the target storage format.
[0044] In the above implementation process, the storage format of the target data can be quickly converted based on the correction record file, so that it is more convenient to perform post-processing according to the correction record file to meet different storage format requirements.
[0045] Optionally, after reading the configuration file and before verifying the storage format information of the target data using the configuration file, the method further includes:
[0046] The configuration file is checked to determine whether the configuration file meets a preset syntax format, whether any key fields are missing, and / or whether the data type in the configuration file is a preset type.
[0047] In the above implementation process, the configuration file is verified to avoid the problem that the configuration file crashes during operation due to its own errors.
[0048] In a second aspect, an embodiment of the present application provides a data processing device, the device comprising:
[0049] A configuration file reading module, used to read a configuration file, wherein the configuration file includes a verification rule for storage format information of target data;
[0050] An information verification module, used to verify the storage format information of the target data using the configuration file to obtain a verification result;
[0051] An incorrect information determination module, used to determine if there is incorrect target information in the storage format information in the verification result;
[0052] An information output module is used to output the target information.
[0053] Optionally, the information verification module is used to parse and obtain the storage path of the target data and each storage node under the storage path; use the configuration file to verify the storage format information of the storage path and each storage node to obtain a verification result.
[0054] Optionally, the information verification module is used to use the configuration file to verify the node information of each storage node and the storage format information of the target data under the bottom-level storage node to obtain a first verification result; use the configuration file to verify the data storage organization format of the storage path to obtain a second verification result; wherein the verification results include the first verification result and the second verification result.
[0055] Optionally, the information verification module is used to extract key fields in the node information of each storage node; verify the field representation of the key fields in the node information of each storage node through the regular expression set for the field in the configuration file to obtain the corresponding first sub-verification result; wherein the first verification result includes the first sub-verification result.
[0056] Optionally, the information verification module is used to extract key fields in the node information of each storage node; use the configuration file to verify whether the key fields in the node information of each storage node are missing, and obtain a corresponding second sub-verification result; wherein the first verification result includes the second sub-verification result.
[0057] Optionally, the information verification module is used to match the key fields in the node information of each storage node through the regular expression set for the field in the configuration file to obtain the matching key fields; determine whether the matching key fields exist in the dictionary recorded in the configuration file to obtain the corresponding second sub-verification result.
[0058] Optionally, the information verification module is also used to use the configuration file to verify the size of the target data under the bottom-level storage node; and / or to verify the corresponding meta information of the target data under the bottom-level storage node to obtain a corresponding third sub-verification result, and the first verification result includes the third sub-verification result.
[0059] Optionally, the information verification module is used to extract key fields from the node information of each storage node; determine the directory hierarchical relationship of each key field according to the storage path; use the configuration file to verify the data storage organization format according to the target hierarchical relationship of each key field, and obtain a corresponding second verification result.
[0060] Optionally, the device further comprises:
[0061] The correction module is used to correct the target information and obtain a correction record file, wherein the correction record file is the target data obtained after correcting the target information in the target data.
[0062] Optionally, the device further comprises:
[0063] The format conversion module is used to convert the storage format of the target data based on the correction record file to obtain the target data in the target storage format.
[0064] Optionally, the information verification module is further used to verify the configuration file to determine whether the configuration file meets a preset grammatical format, whether any key fields are missing and / or whether the data type in the configuration file is a preset type.
[0065] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method provided in the first aspect are performed.
[0066] In a fourth aspect, an embodiment of the present application provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the method provided in the first aspect are performed.
[0067] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the embodiments of the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0069] Figure 1 A schematic diagram of the structure of an electronic device for executing a data processing method provided in an embodiment of the present application;
[0070] Figure 2 A flowchart of a data processing method provided in an embodiment of the present application;
[0071] Figure 3 A structural block diagram of a data processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0072] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present application.
[0073] An embodiment of the present application provides a data processing method, which verifies the storage format information of the target data by using a configuration file to obtain erroneous target information in the target data, so that the erroneous information in the target data can be quickly located. In this way, the erroneous information in the target data is first checked, which can avoid the problem of crashing due to errors when using the processing script for format conversion, which requires manual time-consuming and labor-intensive investigation of the cause of the crash.
[0074] The data processing method provided by the present application is described in detail below in conjunction with the accompanying drawings.
[0075] Please refer to Figure 1 , Figure 1 A structural diagram of an electronic device for executing a data processing method provided in an embodiment of the present application, the electronic device may include: at least one processor 110, such as a CPU, at least one communication interface 120, at least one memory 130 and at least one communication bus 140. Among them, the communication bus 140 is used to realize direct connection and communication between these components. Among them, the communication interface 120 of the device in the embodiment of the present application is used to communicate signaling or data with other node devices. The memory 130 can be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 130 can optionally also be at least one storage device located away from the aforementioned processor. Computer-readable instructions are stored in the memory 130. When the computer-readable instructions are executed by the processor 110, the electronic device executes the following Figure 2 In the method process shown, for example, the memory 130 may be used to store configuration files corresponding to data in various storage formats, and the processor 110 may be used to verify the storage format information of the data.
[0076] Understandably, Figure 1The structure shown is for illustration only, and the electronic device may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0077] Please refer to Figure 2 , Figure 2 A flowchart of a data processing method provided in an embodiment of the present application, the method comprising the following steps:
[0078] Step S110: reading a configuration file, wherein the configuration file includes verification rules for storage format information of target data.
[0079] Generally, when the storage format of data is converted, it is converted by running a processing script. The configuration file can be understood as a program for verifying the storage format information of the target data, which includes verification rules for verifying the storage format information.
[0080] Since the storage format information of data from different sources may change frequently, the verification of this part of the storage format information is completed through the configuration file, and the actual processing logic of the format conversion is retained in the processing script. In this way, when facing new data in different storage formats, you only need to modify the verification rules for the storage format information in the configuration file without touching the core processing logic in the processing script, which reduces the burden of adapting to new data.
[0081] In order to facilitate the subsequent conversion of the storage format of the target data, it is necessary to first search for incorrect information in the storage format information through the configuration file. Subsequently, the storage format of the data can be successfully controlled by correcting the incorrect information.
[0082] In addition, the configuration file may be stored in the above-mentioned electronic device or in another device. If the configuration file is stored in the electronic device, the processor of the electronic device may read the corresponding configuration file from the memory when performing storage format information verification. If the configuration file is stored in another device, the electronic device may read the configuration file from the other device.
[0083] Storage format information refers to relevant information describing the storage format of target data. By verifying the storage format information, it is possible to determine whether the storage format of the target data is correct, so as to quickly locate where the storage format is incorrect.
[0084] Since the storage formats of data from different sources are very different in different application scenarios, in order to adapt to data in different storage formats and quickly find errors in the storage format information, a configuration file can be configured for each storage format of data, or for data with only slight differences in storage formats, they can share a configuration file.
[0085] That is, a plurality of configuration files may be stored in the electronic device. When verifying the storage format information of the target data, the configuration file corresponding to the storage format may be obtained, and then the storage format information may be verified using the configuration file.
[0086] The above-mentioned target data may refer to any data that needs to be converted into a storage format, such as new machine usage data or tester data in fingerprint data, and the fingerprint data may be a fingerprint image, etc. Of course, the target data may also refer to other data, such as portrait data from different sources, etc. It can be understood that in different application scenarios, the corresponding target data is different, and this is not particularly limited in the embodiments of the present application.
[0087] Step S120: Using the configuration file, verify the storage format information of the target data to obtain a verification result.
[0088] Since the configuration file includes verification rules for the storage format information of the target data, the configuration file can be used to verify the storage format information of the target data, thereby determining whether the storage format information is incorrect.
[0089] The verification rules can be set manually according to the requirements of different storage formats. For example, the verification rules can include the regular expression of the key field, the regular expression matching position, whether the key field is required, the key field matching dictionary, whether the key field is the default value, the name regular expression of different types of data, size, etc. Then the verification rules are written into the configuration file, so that when the configuration file is run, the verification rules can be used to verify the storage format information.
[0090] Step S130: Determine whether there is erroneous target information in the storage format information in the verification result.
[0091] After the storage format information is verified using the configuration file, the obtained verification result may include target information with errors in the storage format information, or may also include information without errors.
[0092] Step S140: Output the target information.
[0093] After obtaining the target information, the corresponding target information can be output, so that the user can quickly know where the storage format information of the target data has errors, and can delete or modify the target information with errors. Alternatively, it is also possible to manually check whether the target information is really wrong. If it is not a real error, the configuration file can be optimized so that the configuration file can adapt to these errors. This also facilitates the subsequent conversion of the storage format of the target data, and the conversion can be carried out in sequence without causing the program to crash due to storage format information errors.
[0094] In the above implementation process, the storage format information of the target data is verified by using the configuration file to obtain the erroneous target information in the target data. In this way, the erroneous information in the target data can be quickly located. This can avoid the problem of crashing due to errors when using the processing script for format conversion, which requires manual time-consuming and labor-intensive investigation of the cause of the crash.
[0095] In some embodiments, storage format information refers to relevant information used to describe the storage format of target data. In the above process of verifying the storage format information, the target data can be parsed first to obtain the storage path of the target data and each storage node under the storage path, and then the storage path and the storage format information of each storage node can be verified using a configuration file to obtain a verification result.
[0096] The storage format information of the storage path of the target data and the storage format information of the storage node are both verified, so that erroneous information in the storage format information can be more comprehensively located.
[0097] When verifying the storage nodes, the configuration file may be used to verify the node information of each storage node and the storage format information of the target data under the bottom storage node to obtain a first verification result.
[0098] When performing storage path verification, the data storage organization format of the storage path may be verified using the configuration file to obtain a second verification result.
[0099] The above verification results include a first verification result and a second verification result.
[0100] The storage path of the target data can be pre-written into the configuration file manually, or the corresponding storage path for different data is stored in the electronic device. When the configuration file is running, the storage path corresponding to the target data in the memory can be read through the configuration file. After obtaining the storage path of the target data, the idea of recursive traversal can be used to obtain each storage node in the storage path. The storage node can be understood as referring to each directory node, such as a folder or a file, and then the node information of each storage node under the storage path can be obtained. The node information can be understood as the meta information of the storage node, that is, the relevant information used to describe the storage node, including the name, naming format and other information.
[0101] In order to verify the node information, the field representation of the node information may be verified, such as verifying the name or naming format of the node information.
[0102] In the above implementation process, the field representation method of the node information of each storage node in the storage path of the target data is verified, and the data storage organization format of the storage path is verified, so that the errors of each storage node can be located more comprehensively.
[0103] The following introduces the verification of the two aspects of information respectively.
[0104] Among them, verifying the node information can refer to verifying the field expression of the node information. The field expression refers to how a certain layer of directory or directory file name of the target data storage stores certain information, that is, the expression method of storing certain information. For different information, the field expression method may also be different.
[0105] In some implementations, the node information of each storage node is verified using the configuration file, and the process of obtaining the first verification result may be as follows:
[0106] Extract key fields from the node information of each storage node, and then verify the field representation of the key fields in the node information of each storage node through the regular expression set for the field in the configuration file to obtain the corresponding first sub-verification result, which includes the first sub-verification result.
[0107] Among them, regular expression is a logical formula for string operation, which uses some pre-defined specific characters and the combination of these characters to form a regular string, which is used to express a filtering logic for the string. Alternatively, you can also use regular expressions to obtain the desired information from the string.
[0108] Therefore, after obtaining each storage node from the storage path, the key fields in the node information of each storage node can be extracted. The key fields can be understood as the programming language used to describe the storage node, such as the name of the storage node, the naming format, etc. After obtaining these key fields, the pre-configured regular expressions can be used to match each key field. If the key field matches the regular expression, the first sub-check result is that there is no error in the field representation of the key field (that is, there is no error in the field representation corresponding to the storage node). If the key field does not match the regular expression, the first sub-check result is that there is an error in the field representation of the key field (that is, there is an error in the field representation corresponding to the storage node).
[0109] In the above implementation process, regular expressions are used to verify the field representation of key fields of each storage node, so that errors of each storage node can be quickly located.
[0110] In some implementations, in order to perform a more comprehensive verification of the storage format information of the target data, in the process of verifying the node information of each storage node to obtain the first verification result, the key fields in the node information of each storage node are also extracted, and then the configuration file is used to verify whether the key fields in the node information of each storage node are missing to obtain the second sub-verification result, and the first verification result includes the second sub-verification result. In this way, the missing key fields can be recorded, which is convenient for subsequent modification of the storage format information.
[0111] The specific verification process can be: match the key fields in the node information of each storage node through the regular expression set for the field in the configuration file, obtain the matching key fields, and then determine whether the matching key fields exist in the dictionary recorded in the configuration file to obtain the corresponding second sub-verification result.
[0112] The regular expression in the above embodiment is used to verify whether the field representation of the key field is correct, while the regular expression here is used to extract the required key field from the key field, that is, to extract the required key field from multiple key fields in the node information of each storage node through a regular expression, and then determine whether the extracted key field is in the recorded dictionary.
[0113] Among them, the dictionary is a data storage type that stores information in the form of key-value. Here, the value of the dictionary stores the selection range of the key field. If the value of the dictionary matches a part of the extracted key field, it is considered that the key field exists in the dictionary, and its second sub-verification result is that the storage node is not missing the key field. If the value of the dictionary does not match the key field, it is considered that the key field does not exist in the dictionary, and its second sub-verification result is that the storage node is missing the key field.
[0114] In the above implementation process, the key fields are matched by regular expressions and dictionaries, so that the missing key fields can be effectively and quickly determined.
[0115] In addition, after the node information is verified, the target data under the lowest-level storage node can also be verified. The verification process is: use the configuration file to verify the size of the target data under the lowest-level storage node; and / or verify the meta information corresponding to the target data under the lowest-level storage node to obtain the corresponding third sub-verification result. The first verification result includes the third sub-verification result.
[0116] Among them, if it is not the bottom-level node, the data contained in other storage nodes is also a storage node. At this time, the verification of the storage node can be verified by the above-mentioned verification method of node information. Therefore, the bottom-level storage node of the storage path can be obtained by recursive traversal. If the bottom-level storage node is the file node of the target data, the target data can also be verified.
[0117] For example, the size of the target data can be obtained first, and then it can be determined whether the size of the target data is within a preset range. If so, it means that the target data is compliant. If not, it will be recorded in the illegal file list. In addition, the meta information corresponding to the target data can also be verified, such as checking whether the keywords in its meta information and the description of the target data are missing, and then the missing information can be recorded in the field information missing list.
[0118] In the above implementation process, the target data itself is verified, which can ensure the subsequent smooth format conversion.
[0119] The following introduces the verification process of the data storage organization format of the storage path.
[0120] The data storage organization format can be understood as the directory level in which the target data is stored. For example, for each type of data, its data storage organization format may be different. For example, the tester's fingerprint data has three levels of storage directories, while the new machine usage data has four levels of storage directories, and the naming of each level of directory may also be different.
[0121] In some embodiments, the method for verifying the data storage organization format of the storage path can be: extracting key fields from the node information of each storage node, and then determining the directory hierarchy relationship of each key field according to the storage path, and then using the configuration file to verify the data storage organization format according to the directory hierarchy relationship of each key field to obtain a corresponding second verification result.
[0122] It is understandable that the key fields of each storage node can also be extracted by using the regular expression set for each storage node in the configuration file. Each storage node is a parent node or a child node. For example, the previous storage node of the current storage node is the parent node of the current storage node, and its next storage node is the child node of the current storage node. Based on such a relationship, the directory hierarchy relationship corresponding to each key field can be established, such as the directory hierarchy relationship example as follows:
[0123] Key field 1->key field 2, key field 3->key field 4.
[0124] At this time, it represents a three-layer storage node. At this time, key field 1 is located in the first-layer storage node, key field 2 and key field 3 are located in the second-layer storage node, and key field 4 is located in the third-layer storage node. The target hierarchical relationship can be the data storage organization format of the target data. At this time, the directory hierarchical relationship can be compared with the preset data storage organization format of the target data. If the preset storage organization format is that key field 4 should be in the second-layer storage node, but it is in the third-layer storage node at this time, the second verification result is that the data storage organization format of the storage path is unqualified.
[0125] Alternatively, if the target data is a compressed file, there will be an extra layer of storage nodes when decompressing it. In order to improve the accuracy of the verification, when the key fields of each corresponding storage node can be matched through the regular expression, it can be considered that the data storage organization format is qualified.
[0126] It can be understood that for the storage format information of the target data, it can be a recursive traversal of the storage path of the target data, and then the node information of each storage node can be parsed to obtain the node information of each storage node. For each node information, the field representation method can be verified, and in the verification process, in order to subsequently verify the data storage organization format, the meta information recorded in the current storage node can be copied to the next storage node, and then when verifying the next storage node, the meta information of the previous storage node must also be considered, and then according to the depth-first principle, continue to find the next storage node to continue verification until the final target data is obtained, and then the target data is verified.
[0127] In the above implementation process, the data storage organization format is verified according to the directory hierarchy relationship of each key field, so that whether the storage organization format of the target data is incorrect can be accurately detected.
[0128] In some implementations, in order to avoid a configuration file crash, after reading the configuration file, the configuration file may be checked to determine whether the configuration file meets a preset syntax format, whether there are key fields, and / or whether the data type in the configuration file is a preset type.
[0129] For example, whether the configuration file conforms to the JSON data syntax format specification, or whether it is missing a field using a regular expression, such as by running the configuration file, the JSON syntax can be used to find out whether the data format of the configuration file is a preset format, and the preset syntax format is the JSON syntax format. Whether the data type conforms to the preset type refers to determining whether there is a key named keywords in the configuration file, whether the value corresponding to the key named keyword is a dictionary type, etc. It can be understood that in actual applications, other information of the configuration file can also be verified.
[0130] In the above implementation process, the configuration file is verified to avoid the problem that the configuration file crashes during operation due to its own errors.
[0131] In some implementations, in order to facilitate subsequent conversion of storage formats, the target information may be modified to obtain a modified record file, where the modified record file is the target data obtained after modifying the target information in the target data.
[0132] In order to automatically correct the error information in the storage format information through the configuration file, in the initial stage, an initial configuration file can be preliminarily configured, and the target data can be verified through the initial configuration file, and the error information in the corresponding storage format information can be output. The user can modify the configuration file according to the error information, that is, write the correction information of the error information in the configuration file, so that when the configuration file is used to verify the target data again, the corresponding correction information can be directly used to correct the error information. In addition, when the storage format of the target data is changed, the configuration file can also be modified so that the configuration file can adapt to data of different formats.
[0133] The correction record file refers to the result file obtained after the target information is corrected, rather than the file obtained by modifying the storage format information of the original target data, so as to avoid damage to the storage format information of the original target data. For example, if there is really a person named zhangsam, if the user changes the original storage format information to zhangsan according to his own understanding, and later finds this problem, he does not know which ones are changed from zhangsam to zhangsan and which ones are originally zhangsan. In addition, if the original storage format information is modified, it may be impossible to recover it when the code crashes.
[0134] In the above implementation process, the corrected target data is recorded through the correction record file instead of modifying the original target data, which can avoid the problem of damaging the relevant information of the original target data by modifying the original target data.
[0135] After the correction record file is obtained, the storage format of the target data may be converted based on the correction record file to obtain the target data in the target storage format.
[0136] Among them, the method of converting one storage format into another storage format can be converted through a mapping relationship between storage formats. For example, a mapping relationship between two storage formats is pre-stored. When performing format conversion, the mapping relationship can be obtained, and then the conversion can be performed according to the mapping relationship. In this way, the storage format conversion can be performed according to needs, and the specific conversion process is not described in detail here.
[0137] Please refer to Figure 3 , Figure 3 1 is a structural block diagram of a data processing device 200 provided in an embodiment of the present application. The device 200 may be a module, program segment or code on an electronic device. It should be understood that the device 200 is similar to the above Figure 2 The method embodiment corresponds to and can be executed Figure 2 The various steps involved in the method embodiment and the specific functions of the device 200 can be found in the above description. To avoid repetition, the detailed description is appropriately omitted here.
[0138] Optionally, the device 200 includes:
[0139] A configuration file reading module 210, used to read a configuration file, wherein the configuration file includes a verification rule for storage format information of target data;
[0140] An information verification module 220 is used to verify the storage format information of the target data using the configuration file to obtain a verification result;
[0141] An incorrect information determination module 230, used to determine if there is incorrect target information in the storage format information in the verification result;
[0142] The information output module 240 is used to output the target information.
[0143] Optionally, the information verification module 220 is used to parse and obtain the storage path of the target data and each storage node under the storage path; use the configuration file to verify the storage format information of the storage path and each storage node to obtain a verification result.
[0144] Optionally, the information verification module 220 is used to use the configuration file to verify the node information of each storage node and the storage format information of the target data under the bottom-level storage node to obtain a first verification result; use the configuration file to verify the data storage organization format of the storage path to obtain a second verification result; wherein the verification results include the first verification result and the second verification result.
[0145] Optionally, the information verification module 220 is used to extract key fields in the node information of each storage node; verify the field representation of the key fields in the node information of each storage node through the regular expression set for the field in the configuration file, and obtain the corresponding first sub-verification result; wherein the first verification result includes the first sub-verification result.
[0146] Optionally, the information verification module 220 is used to extract key fields in the node information of each storage node; use the configuration file to verify whether the key fields in the node information of each storage node are missing, and obtain a corresponding second sub-verification result; wherein the first verification result includes the second sub-verification result.
[0147] Optionally, the information verification module 220 is used to match the key fields in the node information of each storage node through the regular expression set for the field in the configuration file to obtain the matching key fields; determine whether the matching key fields exist in the dictionary recorded in the configuration file to obtain the corresponding second sub-verification result.
[0148] Optionally, the information verification module 220 is also used to use the configuration file to verify the size of the target data under the bottom-level storage node; and / or to verify the corresponding meta information of the target data under the bottom-level storage node to obtain a corresponding third sub-verification result, and the first verification result includes the third sub-verification result.
[0149] Optionally, the information verification module 220 is used to extract key fields from the node information of each storage node; determine the directory hierarchical relationship of each key field according to the storage path; use the configuration file to verify the data storage organization format according to the target hierarchical relationship of each key field, and obtain a corresponding second verification result.
[0150] Optionally, the device 200 further includes:
[0151] The correction module is used to correct the target information and obtain a correction record file, wherein the correction record file is the target data obtained after correcting the target information in the target data.
[0152] Optionally, the device 200 further includes:
[0153] The format conversion module is used to convert the storage format of the target data based on the correction record file to obtain the target data in the target storage format.
[0154] Optionally, the information verification module 220 is further used to verify the configuration file to determine whether the configuration file meets a preset grammatical format, whether any key fields are missing, and / or whether the data type in the configuration file is a preset type.
[0155] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0156] The present application provides a readable storage medium, wherein when the computer program is executed by a processor, the computer program is executed as follows: Figure 2 The method process in the method embodiment shown is executed by the electronic device.
[0157] The present embodiment discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the methods provided by the above-mentioned method embodiments, for example, including: reading a configuration file, the configuration file including verification rules for storage format information of target data; using the configuration file to verify the storage format information of the target data to obtain a verification result; determining that there is erroneous target information in the storage format information in the verification result; and outputting the target information.
[0158] In summary, the embodiments of the present application provide a data processing method, device, electronic device and readable storage medium. By using a configuration file to verify the storage format information of the target data, erroneous target information in the target data is obtained. In this way, the erroneous information in the target data can be quickly located. This can avoid the problem of crashing due to errors when using a processing script for format conversion, which requires manual time-consuming and labor-intensive investigation of the cause of the crash.
[0159] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0160] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0161] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0162] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0163] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: Reading a configuration file, wherein the configuration file includes a verification rule for storage format information of target data; Using the configuration file to verify the storage format information of the target data, and obtain a verification result; Determining that there is erroneous target information in the storage format information in the verification result; outputting the target information; The using the configuration file to verify the storage format information of the target data to obtain a verification result includes: Parse and obtain the storage path of the target data and each storage node under the storage path; wherein the storage path refers to the storage path of the target data in the memory, and the storage node refers to the directory node in the storage path; Using the configuration file to verify the storage path and the storage format information of each storage node, to obtain a verification result; The using the configuration file to verify the storage path and the storage format information of each storage node to obtain a verification result includes: Using the configuration file, verify the node information of each storage node and the storage format information of the target data under the bottom storage node to obtain a first verification result; Verifying the data storage organization format of the storage path using the configuration file to obtain a second verification result; The verification result includes the first verification result and the second verification result, and the data storage organization format refers to the directory hierarchy for storing the target data.
2. The method according to claim 1, characterized in that The using the configuration file to verify the node information of each storage node to obtain a first verification result includes: Extracting key fields from the node information of each storage node; The field representation of the key fields in the node information of each storage node is verified by using the regular expression set for the field in the configuration file to obtain the corresponding first sub-verification result; wherein the first verification result includes the first sub-verification result.
3. The method according to claim 1, characterized in that The using the configuration file to verify the node information of each storage node to obtain a first verification result includes: Extracting key fields from the node information of each storage node; The configuration file is used to verify whether a key field in the node information of each storage node is missing, and a corresponding second sub-verification result is obtained; wherein the first verification result includes the second sub-verification result.
4. The method according to claim 3, characterized in that The using the configuration file to verify whether the key fields in the node information of each storage node are missing to obtain the corresponding second sub-verification result includes: Matching the key fields in the node information of each storage node by using the regular expression set for the field in the configuration file to obtain the matched key fields; It is determined whether the matching key field exists in the dictionary recorded in the configuration file, and a corresponding second sub-verification result is obtained.
5. The method according to claim 1, characterized in that The using the configuration file to verify the storage format information of the target data under the bottom storage node to obtain a first verification result also includes: Verifying the size of target data under the bottom storage node using the configuration file; and / or The meta information corresponding to the target data under the bottom-level storage node is verified to obtain a corresponding third sub-verification result, wherein the first verification result includes the third sub-verification result.
6. The method according to claim 1, characterized in that The using the configuration file to verify the data storage organization format of the storage path to obtain a second verification result includes: Extracting key fields from the node information of each storage node; Determine the directory hierarchical relationship of each key field according to the storage path; The configuration file is used to verify the data storage organization format according to the target hierarchical relationship of each key field to obtain a corresponding second verification result.
7. The method according to claim 1, characterized in that The method further comprises: The target information is modified to obtain a modified record file, wherein the modified record file is target data obtained after the target information in the target data is modified.
8. The method according to claim 7, characterized in that The method further comprises: The storage format of the target data is converted based on the correction record file to obtain the target data in the target storage format.
9. The method according to any one of claims 1 to 8, characterized in that: After reading the configuration file and before verifying the storage format information of the target data using the configuration file, the method further includes: The configuration file is checked to determine whether the configuration file meets a preset syntax format, whether any key fields are missing, and / or whether the data type in the configuration file is a preset type.
10. A data processing device, characterized in that: The device comprises: A configuration file reading module, used to read a configuration file, wherein the configuration file includes a verification rule for storage format information of target data; An information verification module, used to verify the storage format information of the target data using the configuration file to obtain a verification result; An incorrect information determination module, used to determine if there is incorrect target information in the storage format information in the verification result; An information output module, used for outputting the target information; The information verification module is used to parse and obtain the storage path of the target data and the various storage nodes under the storage path; wherein the storage path refers to the storage path of the target data in the memory, and the storage node refers to the directory node in the storage path; the node information of each storage node and the storage format information of the target data under the bottom storage node are verified using the configuration file to obtain a first verification result; the data storage organization format of the storage path is verified using the configuration file to obtain a second verification result; wherein the verification result includes the first verification result and the second verification result, and the data storage organization format refers to the directory hierarchy for storing the target data.
11. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 9 is executed.
12. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is executed.
