Verification rule generation method, device, equipment and storage medium
By obtaining the corresponding relationship between the preset rules for business data and the data to be verified, the general rule template is analyzed and the verification rules are generated, which solves the problem of the complex process of transforming data standards into verification rules in the existing technology, and achieves high efficiency The verification rule is generated.
Patent Information
- Application Number
- CN202011422974.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-08
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2040-12-08
AI Technical Summary
In the prior art, the process of converting data standards into quality verification rules is complicated, requiring manual programming code, and the operation is cumbersome.
By obtaining the corresponding relationship between the preset rules of business data and the data to be verified, the attributes of the business data are converted into rule parameters, and these parameters are used to analyze the general rule template to generate verification rules.
It realizes automatic conversion of data standards into verification rules, reducing the complexity of verification rules generation, improving efficiency and reducing workload.
Smart Images

Figure CN112396419B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of financial technology (Fintech), and in particular, to a method, apparatus, device and storage medium for generating verification rules. Background Art
[0002] With the development of computer technology, more and more technologies are being applied in the financial field. The traditional financial industry is gradually transforming into financial technology (Fintech), and data quality verification technology is no exception. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on the technology.
[0003] In related technologies, in order to improve data quality, data standards are generally formulated, data quality is verified according to quality verification rules, data quality issues are tracked and root cause analysis is performed, etc. Among them, it is necessary to manually write program code based on the rule definitions related to the formulated data standards, so as to convert the data standards into quality verification rules, and the operation is relatively complicated. Summary of the invention
[0004] Embodiments of the present application provide a method, apparatus, device, and storage medium for generating verification rules to reduce the complexity of converting data standards into quality verification rules.
[0005] In a first aspect, an embodiment of the present application provides a method for generating a verification rule, comprising:
[0006] Acquiring preset rules for business data; the preset rules include: rules for at least one attribute of the business data;
[0007] Obtaining a first correspondence between business data and data to be verified in the preset rule;
[0008] Convert at least one attribute in the business data and the data to be verified into rule parameters;
[0009] According to the rule parameters, the preset rules and the first corresponding relationship, the general rule template is parsed to generate a verification rule.
[0010] In a second aspect, an embodiment of the present application provides a device for generating a verification rule, including:
[0011] An acquisition module, used to acquire preset rules of business data; the preset rules include: rules of at least one attribute of business data;
[0012] The acquisition module is further used to acquire a first corresponding relationship between the business data and the data to be verified in the preset rule;
[0013] A processing module, used for converting at least one attribute in the business data and the data to be verified into rule parameters;
[0014] The processing module is further used to parse the general rule template according to the rule parameters, the preset rules and the first corresponding relationship to generate verification rules.
[0015] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any one of the methods described in the first aspect.
[0016] In a fourth aspect, an embodiment of the present application provides an electronic device, including:
[0017] Processor; and
[0018] A memory, configured to store executable instructions of the processor;
[0019] The processor is configured to perform the method according to any one of the first aspects by executing the executable instructions.
[0020] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the method as described in any one of the first aspects.
[0021] The verification rule generation method, device, equipment and storage medium provided in the embodiments of the present application obtain preset rules for business data; the preset rules include: rules for at least one attribute of the business data, and the preset rules can be used as data standard definitions to constrain the values of the business data; further, according to the rule parameters, the preset rules and the first corresponding relationship, the general rule template is parsed to generate verification rules, wherein the rule parameters are converted according to at least one attribute in the business data and the data to be verified, and the first corresponding relationship is the corresponding relationship between the business data and the data to be verified in the preset rules, thereby realizing automatic conversion of data standards into verification rules, reducing the complexity of verification rule generation, improving the efficiency of converting data standards into verification rules, and reducing the workload of generating verification rules. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0023] Figure 1 A schematic diagram of the system architecture provided for an embodiment of the present application;
[0024] Figure 2It is a flowchart of a method for generating verification rules provided in an embodiment of the present application;
[0025] Figure 3 It is a schematic diagram of the verification principle provided by an embodiment of the present application;
[0026] Figure 4 It is a schematic diagram of the principle provided by an embodiment of the present application;
[0027] Figure 5 It is a structural schematic diagram of a device for generating verification rules provided in an embodiment of the present application;
[0028] Figure 6 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0029] The above drawings show clear embodiments of the present disclosure, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0030] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0031] The terms "including" and "having" and any variations thereof in the specification and claims of the present application and the drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.
[0032] First, some vocabulary and application scenarios involved in the embodiments of the present application are introduced.
[0033] Figure 1 This is a schematic diagram of the system architecture provided in the embodiment of the present application. Figure 1 As shown, the system architecture of the embodiment of the present application may include but is not limited to: an electronic device 11 and a server 12.
[0034] The electronic device 11 and the server 12 may be connected via a network.
[0035] The method provided in the embodiment of the present application can be implemented by an electronic device such as a processor executing corresponding software codes, or can be implemented by an electronic device executing corresponding software codes while performing data interaction with a controller.
[0036] In related technologies, in order to improve data quality, data standards are generally formulated, data quality is verified according to quality verification rules, data quality issues are tracked and root cause analysis is performed, etc. Among them, it is necessary to manually write program code according to the relevant rule definitions in the formulated data standards, so as to convert the data standards into quality verification rules, and the operation is relatively complicated.
[0037] The method of the embodiment of the present application and the technical concept are as follows:
[0038] A correspondence is established between the business data in the preset rules and the data to be verified; the preset rules include: a rule for at least one attribute of the business data, and the preset rule can be used as a data standard definition to constrain the value of the business data; at least one attribute in the business data and the data to be verified are converted into rule parameters, and further, the general rule template is parsed using the aforementioned rule parameters, preset rules and the first correspondence to generate verification rules, thereby realizing automatic conversion of data standards into verification rules, reducing the complexity of verification rule generation, and improving the efficiency of converting data standards into verification rules.
[0039] The technical solution of the present application is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0040] Figure 2 FIG. 1 is a flow chart of an embodiment of a method for generating verification rules provided by the present application. Figure 2 As shown, the method provided in this embodiment includes:
[0041] Step 101: Obtain preset rules for business data; the preset rules include: rules for at least one attribute of the business data.
[0042] The attribute includes at least one of the following: length, type, format, value range or verification rule of the business data.
[0043] Specifically, for the standard definition of business and data, the preset rules describe the relevant requirements of the business data's attributes such as length, type, format, value range, and verification rules. Data that does not meet the preset rules is generally considered to have data quality issues. For example, Table 1 shows the preset rules for business data of certificate type, and Table 2 shows the preset rules for business data of certificate number.
[0044] Table 1. Types of certificates
[0045]
[0046]
[0047] Table 2 Certificate Number
[0048] property definition type Varchar length 50 Accuracy Format Value range Can be empty? no Verification rules The ID card length is 18; the passport length is greater than 3
[0049] Step 102: Obtain a first corresponding relationship between business data in a preset rule and data to be verified.
[0050] Specifically, the data field to be verified stored in the database is associated with the business data in the preset rule, i.e., the first correspondence, which is generally associated with the business meaning of the data field to be verified and the business data in the preset rule. For example, id_no in the Personal_info table in the database is associated with the certificate number in the preset rule, and id_type in the Personal_info table in the database is associated with the certificate type in the preset rule.
[0051] Table 3 Association mapping
[0052]
[0053] Among them, step 101 and step 102 are performed in no particular order.
[0054] Step 103: Convert at least one attribute in the business data and the data to be verified into rule parameters.
[0055] Specifically, each attribute in the business data corresponds to a rule parameter. For example, as shown in Table 4, when the attribute is type, it corresponds to the rule parameter dt.type, etc. Table 5 shows the rule parameters corresponding to the data to be verified.
[0056] Table 4
[0057]
[0058] Table 5
[0059]
[0060] Step 104: parse the general rule template according to the rule parameters, the preset rules and the first corresponding relationship to generate verification rules.
[0061] Specifically, general rule templates can be obtained in advance, and general rule templates include, for example, the following two categories: 1) general rule templates obtained by directly combining and splicing rule parameters, such as items 3-6 in Table 6; 2) general rule templates obtained by parsing preset rules, such as items 7-8 in Table 6.
[0062] For the first type of general rule template, at least two rule parameters are directly obtained, and the at least two rule parameters are combined and spliced to obtain a general rule template, for example:
[0063] Get the rule parameters dt.islenth, dt.len, and target.col, combine and splice the above rule parameters, and get the following general rule template:
[0064] dt.islength=='Y'? string.length(row.${target.col})==${dt.len}: string.length(row.${target.col})<=${dt.len};
[0065] For the second type of general rule template, the preset rules are parsed. For the business data of the certificate type and certificate number, the certificate type can be an ID card, a passport, etc. It can be seen from the analysis that the length of the certificate number is different for different certificate types. Therefore, the following general rule template can be generated in advance: Row.${ruledepend}='01'? String.length(row.${target.col})==18:row.${target.col}!=nil.
[0066] Table 6
[0067]
[0068]
[0069] Table 7
[0070]
[0071] Table 7 is a description of the rule parameters corresponding to the preset rules of the business data, such as the rule parameters corresponding to the last row of the rules in Table 4; Table 7 also shows a general rule template.
[0072] Further, the general rule template is parsed to determine the variables in the general rule template, the rule parameters, the preset rules and the first corresponding relationship are substituted into the general rule template, the variables in the general rule template are assigned values, and the verification rules are generated.
[0073] For example, the general rule template is Row.${ruledepend}='01'? String.length(row.${target.col})==18:row.${target.col}!=nil, the variables are determined to be ruledepend and target.col; according to the rule parameters, the first correspondence and the preset rules, the variable ruledepend is determined to be the document type and assigned a value of 01, and the target.col data to be verified is assigned a value of id.no, then the verification rule corresponding to the general rule template is generated as: String.length(row.${id.no})==18.
[0074] In the above scheme, business data and attributes are converted into rule parameters according to the preset rules defined in the data standard, and the general rule template is parsed, so that the quality verification rules are automatically generated according to the preset rules defined in the data standard, reducing the development workload of verification rule generation. In addition, the embodiment of the present application supports verification rules generated by expressions based on the expression evaluation engine AviatorExpression, and supports verification rules generated by users through custom expression functions. User-defined expression functions, such as the list DataList expression type in Table 8, expand the support scope of expressions and adapt to more rule types.
[0075] Use the validation rules generated by the DataList expression type, such as datalist = ${dt.values.splits(',')}, to verify the value range of a certain business data, such as some business data with discrete values, such as certificate type.
[0076] Table 8
[0077]
[0078] The method of this embodiment obtains preset rules for business data; the preset rules include: rules for at least one attribute of the business data, and the preset rules can be used as data standard definitions to constrain the values of the business data; further, according to the rule parameters, the preset rules and the first corresponding relationship, the general rule template is parsed to generate verification rules, wherein the rule parameters are converted according to at least one attribute in the business data and the data to be verified, and the first corresponding relationship is the corresponding relationship between the business data and the data to be verified in the preset rules, thereby realizing automatic conversion of data standards into verification rules, reducing the complexity of generating verification rules, improving the efficiency of converting data standards into verification rules, and reducing the workload of generating verification rules.
[0079] In one embodiment, the method further comprises:
[0080] Use the verification rules to verify the data.
[0081] Among them, the verification rule can be directly executed in the data quality verification tool.
[0082] For example, if the document type dt.type=01, that is, the data to be verified id_type=01, the verification rule is string.length(row.id_no)==18, the data to be verified and the document number id_no are verified to determine whether the value of the document number id_no complies with the requirements of the data standard.
[0083] In the above implementation, the verification rules are used to verify the data to be verified, which is efficient and the accuracy of the verification result is high.
[0084] Based on the above embodiment, step 103 can be implemented in the following manner:
[0085] According to a preset second corresponding relationship, at least one attribute in the business data and the data to be verified are converted into rule parameters, wherein the second corresponding relationship is a corresponding relationship between a field and a rule parameter.
[0086] Specifically, according to the preset second correspondence, which is the correspondence between the field and the rule parameter, such as the correspondence shown in Table 4 and Table 5, the business data and at least one attribute in the business data are converted into the rule parameter. For example, the attribute length is converted into dt.len, the business data certificate type is converted into the rule parameter depend.col, and the certificate number of the data to be verified is converted into the rule parameter target.col.
[0087] As shown in Table 9, rule parameters include the following: one is the rule parameters converted according to the attributes in the business data; the other is the parameters converted according to the data to be verified, such as the data certificate number to be verified is converted into target.col.
[0088] Table 9
[0089]
[0090]
[0091] In the above implementation, at least one attribute in the business data and the data to be checked are converted into the rule parameters through the preset second corresponding relationship between the field to be checked and the rule parameters, which is highly efficient.
[0092] In one embodiment, the general rule template may be obtained before step 104. Specifically, the general rule template may be obtained in the following ways:
[0093] Combining and splicing the rule parameters to generate the general rule template; or,
[0094] Parse the preset rules to generate the general rule template
[0095] Specifically, as shown in items 3-6 in Table 6, directly combine and splice according to the rule parameters to obtain a general rule template; or,
[0096] As shown in items 7-8 in Table 6, the preset rules are parsed to obtain a general rule template.
[0097] Before generating the general rule template, the expression function may be preset, as shown in Table 10:
[0098] Table 10
[0099]
[0100] In the above implementation, the general rule template is obtained in advance, so that the efficiency of generating the verification rules is higher.
[0101] In one embodiment, step 104 may be implemented as follows:
[0102] Determining variables in the general rule template;
[0103] According to the rule parameters, the preset rules and the first corresponding relationship, the variables in the general rule template are assigned values to generate the verification rules.
[0104] Specifically, the general rule template is parsed to determine the variables in the general rule template. For example, the general rule template is Row.${ruledepend}='01'? String.length(row.${target.col})==18:row.${target.col}!=nil, where ruledepend and target.col are variables.
[0105] The rule parameters, the preset rules and the first corresponding relationship are substituted into the general rule template, and the variables in the general rule template are assigned values to generate the verification rules.
[0106] For example, the general rule template is Row.${ruledepend}='01'? String.length(row.${target.col})==18:row.${target.col}!=nil, and the variables are determined to be ruledepend and target.col. According to the rule parameters, the first correspondence and the preset rules, the variable ruledepend is assigned a value of 01, and the variable target.col is assigned a value of the data to be verified id.no, then the verification rule corresponding to the general rule template is generated as: String.length(row.${id.no})==18.
[0107] In the above implementation, the variables in the general rule template are determined; according to the rule parameters, the preset rules and the first corresponding relationship, the variables in the general rule template are assigned values to generate the verification rules, thereby realizing automatic conversion of data standards into verification rules and reducing the complexity of verification rule generation.
[0108] In one embodiment, if the general rule template is a ternary expression, the following operations may be performed before the step of “determining the variables in the general rule template”:
[0109] Determine the expression result corresponding to the ternary expression according to the rule parameters and the preset rule;
[0110] “Determining the variables in the general rule template” can be specifically implemented in the following ways:
[0111] Determine the variable in the expression result according to the variable identifier;
[0112] "Generate verification rules" can be implemented in the following ways:
[0113] According to the rule parameters, the preset rules and the first corresponding relationship, the variables in the expression result are assigned values to generate the verification rule.
[0114] Specifically, parsing the general rule template includes the following two steps:
[0115] 1) Parsing of ternary expressions.
[0116] Ternary expression is a relatively concise expression in conditional logic judgment, which can easily realize the screening of conditions. The general format of the expression is: B? T:F; where "?" is the conditional judgment symbol, the front part B is the conditional judgment expression, generally a Boolean expression; ":" is the result selector, when B is true, the result is T; when B is false, the result is F.
[0117] For the analysis of the ternary expression, the variables in the conditional judgment expression in the ternary expression may be assigned values, and the expression result corresponding to the ternary expression may be selected according to the result of the conditional judgment expression.
[0118] For example: For template
[0119] dt.islenth=='is'? string.length(row.${target.col})==${dt.len}: string.lenght(row.${target.col})<=${dt.len}
[0120] The result of this expression depends on the dt.islenth (whether the length is fixed) field judgment. When it is "yes" (that is, the field is fixed length), the expression result corresponding to the ternary expression is: string.length(row.${target.col}) == ${dt.len}.
[0121] 2) Assign values to the variables in the expression result.
[0122] The variables in the expression are assigned and replaced according to the "${}" variable identifier. First, the replacement is performed according to the preset rules and rule parameters. The result is as follows:
[0123] For example: string.length(row.${target.col}) == ${dt.len} after assignment and replacement, the result is:
[0124] string.length(row.${target.col})==8;
[0125] Further, according to the first corresponding relationship, the target.col data to be verified is replaced with id.no. The result is as follows:
[0126] string.length(row.${id.no})==8.
[0127] In the above implementation, if the general rule template is a ternary expression, the expression result corresponding to the ternary expression is determined according to the rule parameters and the preset rules; the variables in the expression result are determined according to the variable identifier; and then according to the rule parameters, the preset rules and the first corresponding relationship, the variables in the expression result are assigned values to generate the verification rules, thereby realizing automatic conversion of data standards into verification rules, reducing the complexity of verification rule generation, and improving the efficiency of converting data standards into verification rules.
[0128] In one embodiment, if Figure 3 As shown, in order to ensure that the generated verification rules are available, the following operations may be performed after step 104:
[0129] Converting the verification rules into executable code;
[0130] If the executable code includes a function that is not of a preset type, or the executable code includes a function whose parameter parsing fails, a prompt message is generated to instruct the verification rule to be corrected.
[0131] Specifically, for the verification rules generated in the aforementioned embodiments, the verification rules are converted into executable codes, prompts are given for the verification rules in the following situations, and feedback is given to the developer for confirmation to ensure the executableness of the verification rules. For example, there are the following situations: the executable code summary includes functions that are not of the preset type, such as functions that are not predefined, or the executable code includes functions that fail to parse parameters, such as the function implementation process requires parameters, but the function does not carry relevant parameters, then the error that the parameters cannot be parsed, that is, the parsing fails, will occur. The above two situations indicate that the verification rules are not executable, and prompt information is generated, such as including the cause of the error, for the developer to solve the problem and verify again.
[0132] The above process can be implemented through the execution engine tool. The execution engine tool converts the verification rules into executable code and pre-executes the relevant code (without obtaining the actual data content). If it can be executed successfully, it means that the verification rules are executable; if the pre-execution process fails or there are exceptions, such as the above situations, it means that the verification rules need to be revised.
[0133] In the above implementation, by checking the generated verification rules, the usability of the verification rules finally generated can be made higher.
[0134] In one embodiment, the step of “converting the verification rule into executable code” can be implemented in the following manner:
[0135] Splitting the verification rule according to the logical connector to obtain at least one operation expression;
[0136] For any of the operation expressions, split the operation expression according to the relational operator to obtain a split expression;
[0137] The executable code is obtained according to the split expression.
[0138] Specifically, take the verification rule (string.length(row.id_no)<=8&&string.test!=nil) as an example:
[0139] a) Split the validation rules into single operation expressions according to logical connectors such as && and ||;
[0140] The validation rules can be divided into: string.length(row.id_no)<=8 and string.test!=nil;
[0141] b) Split the operation expression according to the relational operator ('<', '>', '=<', '!=', etc.);
[0142] For example, a) can be broken down into string.length(row.id_no) and 8, and string.test and nil.
[0143] c) Get the executable code based on the split expression. For example, the executable code is
[0144] string.length(row.id_no), and string.test.
[0145] d) Check the executable code, i.e. pre-execution, to determine whether the executable code is executable.
[0146] For example: string.length and row.id are preset expression functions that need to return values, so the values are preset. For example, if the return value of string.length is int, the default value can be set to 1, and the default value 1 is directly returned during pre-execution. If string.test does not find the function in the built-in function list, that is, it is not a pre-defined function, then an "undefined function type" error is reported, indicating that the pre-execution failed and the expression cannot be executed; if string.test is in the built-in function list, but the function implementation process requires parameters, but the function does not have relevant parameters, then an "function parameter cannot be parsed" error is reported, indicating that the parsing failed and the expression cannot be executed.
[0147] The final validation rule is (string.length(row.id_no)<=8&&row.id_no!=nil)
[0148] In one embodiment, if Figure 4 As shown, the method of this embodiment includes:
[0149] Obtaining preset rules, i.e., predefined data standards, the preset rules include: rules for at least one attribute of the business data; converting attributes in the business data into rule parameters;
[0150] Obtain the corresponding relationship between the business data and the data to be verified in the preset rules; convert the data to be verified into rule parameters;
[0151] According to the rule parameters, preset rules and corresponding relationships, the general rule template is parsed to generate verification rules;
[0152] Check the verification rules, solve and verify the problems, and obtain the final verification rules.
[0153] The method of the embodiment of the present application establishes a corresponding relationship between the business data in the preset rules and the data to be verified; the preset rules include: a rule for at least one attribute of the business data, and the preset rules can be used as a data standard definition to constrain the value of the business data; at least one attribute in the business data and the data to be verified are converted into rule parameters, and further, the general rule template is parsed using the aforementioned rule parameters, preset rules and the first corresponding relationship to generate verification rules, thereby realizing automatic conversion of data standards into verification rules, reducing the complexity of verification rule generation, and improving the efficiency of converting data standards into verification rules.
[0154] Figure 5 A schematic diagram of the structure of an embodiment of a device for generating verification rules provided by the present application, such as Figure 5 As shown, the verification rule generation device of this embodiment includes:
[0155] The acquisition module 110 is used to acquire preset rules of business data; the preset rules include: rules of at least one attribute of the business data;
[0156] The acquisition module 110 is further used to acquire a first correspondence between the business data and the data to be verified in the preset rule;
[0157] The processing module 111 is used to convert at least one attribute in the business data and the data to be verified into a rule parameter;
[0158] The processing module 111 is further configured to parse the general rule template according to the rule parameters, the preset rule and the first corresponding relationship to generate a verification rule.
[0159] In a possible implementation, the processing module 111 is specifically configured to:
[0160] According to a preset second corresponding relationship, at least one attribute in the business data is converted and the data to be verified is converted into a rule parameter, wherein the second corresponding relationship is a corresponding relationship between a field and a rule parameter.
[0161] In a possible implementation, the processing module 111 is specifically configured to:
[0162] Determining variables in the general rule template;
[0163] According to the rule parameters, the preset rules and the first corresponding relationship, the variables in the general rule template are assigned values to generate verification rules.
[0164] In a possible implementation, if the general rule template is a ternary expression, the processing module 111 is further configured to:
[0165] Determine the expression result corresponding to the ternary expression according to the rule parameters and the preset rule;
[0166] The processing module 111 is specifically used for:
[0167] Determine the variable in the expression result according to the variable identifier;
[0168] According to the rule parameters, the preset rules and the first corresponding relationship, the variables in the expression result are assigned values to generate the verification rule.
[0169] In a possible implementation, the processing module 111 is further configured to:
[0170] Combining and splicing the rule parameters to generate the general rule template; or,
[0171] Parse the preset rules to generate the general rule template
[0172] In a possible implementation, the processing module 111 is further configured to:
[0173] Converting the verification rules into executable code;
[0174] If the executable code includes a function that is not of a preset type, or the executable code includes a function whose parameter parsing fails, a prompt message is generated to instruct the verification rule to be corrected.
[0175] In a possible implementation, the processing module 111 is specifically configured to:
[0176] Splitting the verification rule according to the logical connector to obtain at least one operation expression;
[0177] For any of the operation expressions, split the operation expression according to the relational operator to obtain a split expression;
[0178] The executable code is obtained according to the split expression.
[0179] In a possible implementation, the attribute includes at least one of the following: length, type, format, value range or verification rule of the business data.
[0180] The device of this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0181] Figure 6 A schematic diagram of the structure of an electronic device embodiment provided in this application, such as Figure 6 As shown, the electronic device includes:
[0182] A processor 210 , and a memory 211 for storing executable instructions of the processor 210 .
[0183] Optionally, it may also include: a communication interface 212 for implementing communication with other devices.
[0184] The above components may communicate via one or more buses.
[0185] Among them, the processor 210 is configured to execute the corresponding method in the aforementioned method embodiment by executing the executable instructions. The specific implementation process can be found in the aforementioned method embodiment and will not be repeated here.
[0186] A computer-readable storage medium is also provided in an embodiment of the present application, on which a computer program is stored. When the computer program is executed by a processor, the corresponding method in the aforementioned method embodiment is implemented. The specific implementation process can be found in the aforementioned method embodiment. The implementation principle and technical effects are similar and will not be repeated here.
[0187] An embodiment of the present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements a method as described in any one of the aforementioned method embodiments. The specific implementation process can be found in the aforementioned method embodiments. The implementation principles and technical effects are similar and will not be repeated here.
[0188] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0189] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for generating a verification rule, characterized in that: include: Preset rules for obtaining business data; The preset rules include: rules for at least one attribute of business data; Acquire a first correspondence between the business data in the preset rule and the data to be verified; the first correspondence is to associate the business data in the preset rule with the business meaning of the data field to be verified; According to a preset second corresponding relationship, at least one attribute in the business data and the data to be checked are converted into rule parameters, wherein the second corresponding relationship is a corresponding relationship between the field to be checked and the rule parameter; Parsing the general rule template according to the rule parameters, the preset rule and the first corresponding relationship to generate a verification rule; Before generating the verification rules, the method further includes: If the rule type is a combination rule, the rule parameters are combined and spliced to generate the general rule template; or, If the rule type is an expression rule, the preset rule is parsed to generate the general rule template.
2. The method according to claim 1, characterized in that The generation verification rule comprises: Determining variables in the general rule template; According to the rule parameters, the preset rules and the first corresponding relationship, the variables in the general rule template are assigned values to generate verification rules.
3. The method according to claim 2, characterized in that If the general rule template is a ternary expression, before determining the variables in the general rule template, the method further includes: Determine the expression result corresponding to the ternary expression according to the rule parameters and the preset rule; The determining of the variables in the general rule template includes: Determine the variable in the expression result according to the variable identifier; The assigning values to the variables in the general rule template according to the rule parameters, the preset rules and the first corresponding relationship to generate the verification rules includes: According to the rule parameters, the preset rules and the first corresponding relationship, the variables in the expression result are assigned values to generate the verification rule.
4. The method according to any one of claims 1 to 3, characterized in that: After generating the verification rule, the method further includes: Converting the verification rules into executable code; If the executable code includes a function that is not of a preset type, or the executable code includes a function whose parameter parsing fails, a prompt message is generated to instruct the verification rule to be corrected.
5. The method according to claim 4, characterized in that The converting the verification rules into executable codes comprises: Splitting the verification rule according to the logical connector to obtain at least one operation expression; For any of the operation expressions, split the operation expression according to the relational operator to obtain a split expression; The executable code is obtained according to the split expression.
6. The method according to any one of claims 1 to 3, characterized in that: The attribute includes at least one of the following: length, type, format, value range or verification rule of the business data.
7. A device for generating verification rules, characterized in that: include: An acquisition module, used to acquire preset rules of business data; the preset rules include: rules of at least one attribute of business data; The acquisition module is further used to acquire a first correspondence between the business data in the preset rule and the data to be verified; the first correspondence is associated with the business data in the preset rule based on the business meaning of the data field to be verified; A processing module, configured to convert at least one attribute in the business data and the data to be checked into a rule parameter according to a preset second corresponding relationship, wherein the second corresponding relationship is a corresponding relationship between a field to be checked and a rule parameter; The processing module is further used to parse the general rule template according to the rule parameters, the preset rules and the first corresponding relationship to generate a verification rule; The processing module is further configured to combine and splice the rule parameters to generate the general rule template before generating the verification rule if the rule type is a combination rule; or If the rule type is an expression rule, the preset rule is parsed to generate the general rule template.
8. A computer-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 6 is implemented.
9. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 6 by executing the executable instructions.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Data verification method and device based on dynamic generation rule
CN105930409A
A business data verification method and device
CN109558134A