A data check processing method
By defining elements, logical relationships, and validation rules in the database, a flexible data validation method is implemented, which solves the problems of large code volume and difficult maintenance in existing technologies and provides a data validation solution that is easy to extend and maintain.
Patent Information
- Application Number
- CN202211260372.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-14
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2042-10-14
Smart Images

Figure CN115454991B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data verification rule configuration technology, and in particular to a data verification processing method. Background Technology
[0002] Data entry is a fundamental business requirement for most information systems. Different information systems require different types of data, and the industries they serve vary widely. Existing data verification methods mainly fall into two categories:
[0003] The advantages of a rule engine are that it can reduce business complexity and later maintenance costs, and improve system scalability; the disadvantages are that the existing rule engine has a large amount of code, and adding new logical rules requires high programming skills.
[0004] Code validation has the advantage of allowing you to write corresponding data validation rules based on business needs; however, it also has the disadvantage of requiring modification or addition of program code when requirements change or new data logic validation rules are needed, which is not conducive to later maintenance and expansion. Summary of the Invention
[0005] The purpose of this invention is to provide a data verification method to solve the problem of numerical logic verification in data entry. When processing user-entered data in an information system, this invention performs logical rule verification on the numerical values and provides prompt information for numerical values that do not conform to the configured logical rules.
[0006] The present invention achieves the above objectives through the following technical solutions:
[0007] A data validation processing method includes the following steps:
[0008] Step 1: Create data tables in the database for elements, logical relationships between elements, templates, template element relationships, and template validation rules, and write logical rule methods for data validation in the database;
[0009] Step 2: In the element table, add an element list. If the element data value needs to be retrieved from the data table, then the value retrieval table for that element must be configured.
[0010] Step 3: In the element relationship table, add logical relationships between elements;
[0011] Step 4: Create a data entry template. Select the required elements from the element table to form the data entry template style; all data templates are created based on the permutation and combination of elements.
[0012] Step 5: Configure template validation rules. For the template to be used, select the validation method corresponding to the validation rule to be used, as well as the list of elements to be validated for each validation rule;
[0013] Step 6: Receive data entered by the user using the data template, search for the validation rules configured in Step 5 according to the template, and check the validity of each element value and the correctness of the logical relationship between elements according to the configured element list. If a validation method fails, return the corresponding error message. If all validation methods pass, save the data to the business data table.
[0014] Step 7: Add new elements to expand the requirements of the template definition, write new validation methods, add them to the logic rule base, and expand the scope of application of the validation rules.
[0015] A further approach is to define basic element information in step 1, including descriptive information such as element ID, element name, displayed value, actual value, data type, and data length.
[0016] A further approach is that, in step 1, the constraints of the elements are defined, including maintaining a data table of element values and a data table of cascading relationships between element combinations.
[0017] A further solution is that, in step 1, basic template information is defined, including template ID, template name, referenced elements and their reference order, whether referenced elements are allowed to be entered repeatedly, and whether null values are allowed to be entered.
[0018] A further proposed solution is that, in step 5, a database stored procedure and method are written to implement data validation logic rules. Template ID and element ID are used as parameters to achieve flexible configuration, and at least the following validation rules are implemented: existence validation, cascading relationship validation, duplication validation, and control validation.
[0019] A further approach is that, in step 5, the verification rule method to be called is configured according to the template, and the combination of element IDs to be verified is passed as a parameter to the verification rule method.
[0020] A further solution is that, in step 6, the business data entered by the user according to the template is obtained and temporarily stored in a temporary table. The verification rule method configured in step 5 is called to obtain the data verification result. If the verification passes, the data is saved to the business data table. If there is data that fails the verification, the user is prompted with the corresponding information to check the entered data.
[0021] The beneficial effects of this invention are as follows:
[0022] This invention provides a data verification processing method that performs logical verification on business data during user data entry by defining elements, defining logical relationships between elements, defining templates, using threshold verification methods, and configuring data verification. This reduces the risk of users entering incorrect data. Furthermore, this invention is based on existing mature database functions and is more lightweight, simpler, and easier to maintain and extend compared to other logical rule engine tools. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a flowchart of the present invention. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be described in detail below. Obviously, the described embodiments are merely some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other implementation methods obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0026] In any embodiment, such as Figure 1 As shown, a data verification processing method of the present invention includes the following steps:
[0027] Step 1: Create data tables in the database for elements, logical relationships between elements, templates, template element relationships, and template validation rules, and write logical rule methods for data validation in the database;
[0028] Define basic information about an element, including element ID, element name, displayed value, actual value, data type, data length, and other descriptive information;
[0029] Define the constraints of elements, including maintaining a data table of element values and a data table of cascading relationships between elements;
[0030] Define the basic information of the template, including template ID, template name, referenced elements and their reference order, whether the referenced elements are allowed to be entered repeatedly, and whether null values are allowed;
[0031] Step 2: In the element table, add an element list. If the element data value needs to be retrieved from the data table, then the value retrieval table for that element must be configured.
[0032] Step 3: In the element relationship table, add logical relationships between elements;
[0033] Step 4: Create a data entry template. Select the required elements from the element table to form the data entry template style; all data templates are created based on the permutation and combination of elements.
[0034] Step 5: Configure template validation rules. For the template to be used, select the validation method corresponding to the validation rule to be used, as well as the list of elements to be validated for each validation rule;
[0035] Write database stored procedures and methods to implement data validation logic rules, using template ID and element ID as parameters to achieve flexible configuration, and implement at least the following validation rules: existence check, cascading relationship check, duplicate check, and control check;
[0036] Configure the validation rule methods that need to be called according to the template, and pass the combination of element IDs to be validated as parameters to the validation rule methods;
[0037] Step 6: Receive data entered by the user using the data template, search for the validation rules configured in Step 5 according to the template, and check the validity of each element value and the correctness of the logical relationship between elements according to the configured element list. If a validation method fails, return the corresponding error message. If all validation methods pass, save the data to the business data table.
[0038] Alternatively, the business data entered by the user according to the template can be obtained, temporarily stored in a temporary table, and the validation rule method configured in step 5 can be called to obtain the data validation result. If the validation passes, the data is saved to the business data table; if there is data that fails the validation, the user is prompted with the corresponding information to check the entered data.
[0039] Step 7: Add new elements to expand the requirements of the template definition, write new validation methods, add them to the logic rule base, and expand the scope of application of the validation rules.
[0040] The processing method of this invention includes data elements, logical relationships between elements, data templates, a validation method library, and configuration information. Data elements define basic field information, data templates define the element composition of the template, the validation rule library includes logical rules and validation methods for data validation, and the configuration information includes a list of validation methods called by the template and a list of validation fields. The above solution only uses database tools for data storage. Technically, it only requires basic database design and query statement writing skills to support user-defined configuration of data entry template formats, independent configuration of the content to be validated, and the fields to be validated. By writing new database functions and adding them to the function library, the validation rules can be expanded.
[0041] In one specific embodiment, such as Figure 1 As shown, a data verification processing method of the present invention includes the following steps:
[0042] Define basic element attributes, including element ID, element name, data type, length, displayed value, and actual value. For example, for the company element, the displayed value is the company name, and the actual value is the companyCode. That is, the name may be the same, but the code will not be repeated. The value range comes from the company list dimension table. For the purchase amount element, the data type is numeric, and the precision is 4 decimal places.
[0043] Define the logical relationships between elements: cascade relationship data table; for example, if there is a hierarchical relationship between a company and a factory, a company-factory cascade relationship data table needs to be maintained.
[0044] Design data entry templates: including template name, data elements used in the template, and the order in which elements are referenced; for example, when collecting material inventory information from various factories, elements such as company, factory, material, and inventory quantity are required; by expanding the element list in section 1, the template definition can be made more flexible and diverse;
[0045] Define the element value attribute constraints in the data entry template, including whether duplicate entries are allowed and whether null values are allowed. For example, when designing the material inventory information of each factory in the data entry template, each factory is only allowed to enter one set of data, duplicate entries are not allowed, and factories are not allowed to enter null values. The factory element in the template needs to be configured to not have duplicate values and not have null values under this template.
[0046] The data logic rule validation method is implemented by writing database stored procedures and methods to query the extended attributes of elements and identify whether the element values exist in the element value table, thereby achieving data existence validation; query the element cascading relationship data table to determine whether the cascading relationship of multiple elements in the template is correct; and validate the data for duplicates and null values based on the value attribute constraints of the elements in the template definition.
[0047] Configure the required validation rule methods according to the template, and pass the array of element IDs to be validated as parameters to the validation rule methods; for example, in the definition of basic element attributes, the template needs to use the existence validation method, duplicate validation method, null value validation method, etc. in the data logic rule validation method implementation to verify whether the factory element input value is correct, and the cascading relationship validation method to verify whether the company and factory cascading relationship is correct.
[0048] Retrieve user-entered data according to the template and temporarily store it in a temporary table; execute the pre-configured data validation rules methods that need to be called according to the template configuration. If the rule validation passes, store the data in the business data table; if any rule validation method fails, prompt the user with the corresponding information.
[0049] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims. It should also be noted that the various specific technical features described in the above embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, the present invention will not describe the various possible combinations separately. Furthermore, various different embodiments of the present invention can also be arbitrarily combined, as long as they do not violate the spirit of the present invention, they should also be considered as the content disclosed in the present invention.
Claims
1. A processing method of data check, characterized in that, The method comprises the following steps: Step 1: creating element, element logical relationship, template, template element relationship and template check rule configuration data table in the database, and writing logical rule method of data check in the database; Step 2: adding element list in the element table, and configuring the value table of the element if the element data value needs to be obtained from the data table; Step 3: adding logical relationship between elements in the element relationship table; Step 4: creating data entry template, selecting required elements of the template from the element table, and composing data entry template style; All data templates are created based on arrangement and combination of elements; Step 5: configuring template check rule, selecting check method corresponding to the check rule to be used for the template, and selecting element list to be checked for each check rule; Writing database storage process and method to realize data check logical rule, using template ID and element ID as parameters to realize flexible configuration, and realizing at least the following check rules: existence check, cascade relationship check, repeatability check and null value check; Combining element ID to be checked as parameters and passing to the check rule method according to the check rule method to be called according to the template configuration; Step 6: receiving data entered by the user using the data template, searching the check rule configured in step 5 according to the template, checking the legality of each element value and the correctness of the logical relationship between elements according to the configured element list, returning corresponding error information if a check method is not passed, and saving the data to the business data table if all check methods are passed; Step 7: adding new elements, expanding the requirements of template definition, and writing new check method and adding to the logical rule library to expand the application scope of the check rule.
2. The method of claim 1, wherein the data check is performed by a data check module. In step 1, the basic information of the element is defined, including element ID, element name, display value, real value, data type and data length description information.
3. The method of claim 1, wherein the data check is performed by a data check module. In step 1, the constraint condition of the element is defined, including the value data table of the element to be maintained and the cascade relationship data table of the element combination with cascade relationship.
4. The method of claim 1, wherein the data check is performed by a data check module. In step 1, the basic information of the template is defined, including template ID, template name, referenced element and reference order, whether the referenced element is allowed to be repeatedly entered and whether the referenced element is allowed to be entered as null value.
5. The data verification processing method as described in claim 1, characterized in that, In step 6, the business data entered by the user according to the template is obtained and temporarily stored in the temporary table, the check rule method configured in step 5 is called to obtain the data check result, and the data is saved to the business data table if the check is passed; if there is data that does not pass the check, the user is prompted with corresponding information to remind the user to check the entered data.
Citation Information
Patent Citations
Classification and quality inspection method and system based on verification rules
CN105824870A
Excel data entry component, entry method and device
CN111414739A
Dynamic verification method and system of data table, medium and electronic equipment
CN114490607A