A method and system for matching results of a survey
By separating the logical modules of the questionnaire and using a matching expression method, zero-code construction of the questionnaire was achieved, solving the problems of large workload, long cycle and low flexibility in the existing technology, reducing R&D costs and improving the flexibility of configuration and logical judgment.
Patent Information
- Application Number
- CN202211590365.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-12
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2042-12-12
AI Technical Summary
Existing technologies for logical judgment in survey questionnaires involve a large workload, long cycle, low flexibility, poor reusability, high R&D costs, and cannot be adapted to different engines.
By separating the logic modules of questionnaire-type questions and using methods such as replacing matching unit placeholders in matching expressions, matching answers with matching units, replacing placeholders in the order of the matching list, and replacing logical operators, zero-code construction is achieved, supporting adaptation to different engines and logical priority operations.
It enables zero-code construction of questionnaires, reducing learning and development costs, improving configuration and logical judgment flexibility, and supporting arbitrary combinations of logical relationships and priority operations between multiple questions.
Smart Images

Figure CN115910253B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of computer and information processing, and particularly relates to a result matching method and system suitable for a questionnaire. BACKGROUND
[0002] The statements in this section merely provide background information related to the present application and do not necessarily constitute prior art.
[0003] The questionnaire function is needed in many scenarios, such as disease assessment, hospital service quality assessment, epidemic investigation, etc. In these assessment questionnaires and the like, in addition to the questions, there are many logical judgments in some scenarios.
[0004] The prior art generally codes according to specific logical rules, and then performs different operations according to different logical branches. This implementation has the following disadvantages:
[0005] 1. Large workload, each new logic needs to go through a series of research and development test processes;
[0006] 2. Long implementation period, after a series of development processes, the implementation function may take several days or even weeks;
[0007] 3. Low flexibility, each time the form is changed, it needs to be redeveloped and tested, and the change frequency of the form according to the customer's demand is uncontrollable, which increases the work intensity;
[0008] 4. Low reusability, the specificity of such demand is particularly strong, the probability of repeating the demand proposed by each customer is very low, and basically one-time development cannot be used multiple times;
[0009] 5. High research and development cost, generally, such demand is some relatively simple but necessary function, and each time it is developed individually, which undoubtedly increases the research and development cost;
[0010] 6. Low flexibility, simply matching according to the order of the questions;
[0011] 7. Unable to adapt to different engines. SUMMARY
[0012] In order to solve the technical problems in the above background art, the present application provides a result matching method and system suitable for a survey questionnaire, which can separate the logical modules of questionnaire problems, realize zero-code construction of the survey questionnaire, and realize the adaptation of different engines and the high flexibility of configuration through the steps of replacing the placeholders in the matching units in the matching expression, matching the answers and the matching units, replacing the placeholders in the matching list order, and replacing the conjunctions with logical operators, and supports the priority operation of logic and has high flexibility in logical judgment.
[0013] In order to achieve the above-mentioned purpose, the present application adopts the following technical solutions:
[0014] The first aspect of the present application provides a result matching method suitable for a survey questionnaire, which comprises:
[0015] Obtaining a set of answers to the survey questionnaire;
[0016] Comparing the set of answers with a pre-constructed matching expression to obtain a matching result; in the matching process of the answer information and each matching expression, first, the matching units in the matching expression are taken out, then the matching units in the matching expression are replaced with placeholders to obtain a matching expression after the placeholders are replaced, the answers of each question are matched with the matching units to obtain a matching list of a Boolean type, finally, the placeholders in the matching expression after the placeholders are replaced are replaced with the matching list order, and the conjunctions are replaced with logical operators to obtain an expression that can be executed by a specified engine and has a Boolean result, so that the engine calculates a matching result of a Boolean type;
[0017] The construction rule of the matching expression comprises: the definition of each matching expression contains conjunctions and matching units, the matching units are used to match the answers of a single question, and the conjunctions are used to connect the matching units into a compound statement; and the priority operation of logic is supported.
[0018] Further, the matching units have the following rules: optional matching, strict matching, string matching, any item matching, skip matching, and negation.
[0019] Further, the construction rule of the matching expression further comprises: if there are m check result branches, at least m-1 matching expressions need to be defined.
[0020] Further, the construction rule of the matching expression further comprises: if there are n questions, there are n matching units.
[0021] Further, if the specified engine is a js engine, the conjunctions ∨ and ∧ are replaced with logical operators || and &&, respectively.
[0022] The second aspect of the present application provides a result matching system suitable for a questionnaire, comprising:
[0023] an answer obtaining module configured to obtain a set of answers to the questionnaire;
[0024] a matching module configured to: match the set of answers with a pre-constructed matching expression to obtain a matching result; in the matching process of the answer information and each matching expression, first, a matching unit is taken out from the matching expression, then the matching unit in the matching expression is replaced by a placeholder to obtain a placeholder-replaced matching expression, a matching list of a Boolean type is obtained by matching each answer of a question with the matching unit, finally, the matching list is used to sequentially replace the placeholders in the placeholder-replaced matching expression, and a connector is replaced by a logical operator to obtain an expression of a Boolean type which can be executed by a specified engine, so that the engine calculates a matching result of a Boolean type;
[0025] wherein the construction rule of the matching expression comprises: the definition of each matching expression contains a connector and a matching unit, the matching unit is used to match the answer of a single question, and the connector is used to connect the matching units into a compound statement; and a logical priority operation is supported.
[0026] Further, the construction rule of the matching expression further comprises: if there are m check result branches, at least m-1 matching expressions need to be defined.
[0027] Further, the construction rule of the matching expression further comprises: if there are n questions, there are n matching units.
[0028] The third aspect of the present application provides a computer readable storage medium having a computer program stored thereon, the program being executed by a processor to implement the steps of the result matching method suitable for a questionnaire as described above.
[0029] The fourth aspect of the present application provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the result matching method suitable for a questionnaire as described above when executing the program.
[0030] Compared with the prior art, the present application has the following beneficial effects:
[0031] The present application provides a result matching method suitable for a questionnaire, which can separate the logic module of the questionnaire problem, realize zero-code construction of the questionnaire, does not depend on programming scripts, has low learning cost, is easy to understand, does not require programming experience, and effectively reduces the research and development cost.
[0032] The application provides a result matching method for a questionnaire, which realizes the adaptation of different engines and high flexibility of configuration through the steps of matching placeholder replacement of matching units in a matching expression, answer and matching unit comparison matching, matching list order replacing placeholders and replacing connectors with logical operators.
[0033] The application provides a result matching method for a questionnaire, which supports logical relationship operation and logical priority operation of multiple questions in an arbitrary combination, and has high flexibility in logical judgment. BRIEF DESCRIPTION OF DRAWINGS
[0034] The accompanying drawings, which form a part of this specification, illustrate the present application and serve to explain the principles of the present application. The present application is described in its preferred embodiments, illustrating the principles of the application and its practical application. Thus, no undue limitations should be made on the scope of the present application.
[0035] Figure 1 is a flow chart of a result matching method for a questionnaire according to the first embodiment of the application;
[0036] Figure 2 is a matching flow chart of answer information and a matching expression according to the first embodiment of the application. DETAILED DESCRIPTION
[0037] The application will be further described below in conjunction with the drawings and embodiments.
[0038] It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the application belongs.
[0039] Embodiment one
[0040] The embodiment provides a result matching method for a questionnaire, as shown in Figure 1 which specifically includes the following steps:
[0041] Step 1, Symbolization of the answer sheet. Obtain the user's answer to each question in the questionnaire, and store all the user's answers to the questions in the questionnaire in the form of a two-dimensional list (the purpose of using a two-dimensional list is to meet the needs of multiple choices), such as the following questionnaire:
[0042] 1. Your age is
[0043] A. Less than 10 years old B. Greater than or equal to 10 years old and less than 50 years old C. Greater than 50 years old
[0044] 2. Your hobbies are
[0045] A. basketball B. soccer C. table tennis
[0046] 3. Your name is (_____)
[0047] The process of symbolization of the answer is as follows:
[0048] Step 101, define a two-dimensional list list;
[0049] Step 102, define n sub-lists according to the number of questions n, and the elements in each sub-list are the serial numbers of the options for the user to choose (counting from 1), if it is a fill-in-the-blank question, put the string into the corresponding list;
[0050] Step 103, put the n lists obtained in step 102 into the list obtained in step 101. Get a two-layer list, the outer list is the list of questions, and the inner layer is the options of each question. Since this calculation method also supports multiple selection, the inner layer needs to define a list.
[0051] Suppose user 1 chooses B, user 2 chooses BC, and user 3 fills in "Zhang San", the answer set is [[2],[2,3],["Zhang San"]]. Specifically, a loop is done for all questions, and a sub-list is defined for each question, which fills the user's options, and then this sub-list is put into the parent list to get the answer set.
[0052] Step 2, compare the answer set with each pre-constructed matching expression to get the matching result. If it matches, it is true, otherwise it is false.
[0053] As shown in Figure 2 the matching process between the answer information and each matching expression EXi:
[0054] ① First, get n matching units from the matching expression;
[0055] ② Replace the matching units in the matching expression EXi with special placeholders to obtain a placeholder matching expression EXRi; for example, replace the predefined matching expression with 1∧2∧"^123" with the placeholder Δ to obtain an expression Δ∧Δ∧Δ;
[0056] ③ Match the answer to each question in the answer set with the corresponding matching unit to obtain the matching result Ri for each question, i = 1, 2, ..., n. A match is true, otherwise it is false, thus obtaining a boolean matching list. For the answer set, directly write a number to specify which option, for example, 1 means selecting the first one as true; [1,3] means that if option 1 or 3 is selected, it is true; {1,3} means that if option 1 and 3 are both selected, it is true; ? The asterisk (*) indicates that the options have values, and the user's choice of any option will result in true; the asterisk (*) indicates that the user's choice will result in true regardless of the option selected. For example, if I want to select "over 50 years old, loves football, and has the name Zhang San", and the user's answer is a, b, Zhang San, the resulting list will be [false, true, true]. ④ Replace the special placeholders in EXRi with the order of elements in this matching list, and replace the connectors with logical operators (if using a JS engine, replace the connectors "∨" and "∧" with the logical operators "||" and "&&" respectively), resulting in a boolean expression that can be executed by a specified engine (e.g., a JS engine). For example, true&&(false||true) will result in true using a JS engine.
[0057] ⑤ Use the specified engine to calculate the expression obtained in step ④ and get a boolean result.
[0058] The rules for constructing the matching expression are as follows:
[0059] 1. If there are m validation result branches, at least m-1 matching expressions need to be defined for matching (if no matching rule is hit, a default logical branch can be followed); each matching expression corresponds to a validation result, but one validation result can correspond to multiple matching expressions.
[0060] 2. If there are n questions, there must be n matching units; otherwise, the validation will fail.
[0061] 3. Each matching expression definition needs to include a connector (∧ for AND, ∨ for OR) and a matching unit (responsible for matching the answer to a single question). The connector is used to link matching units into compound statements. The matching units have the following rules:
[0062] A. Optional list matching, where the matching unit [i,j] represents the i-th option or the j-th option, such as [2,3], which represents the 2nd option or the 3rd option;
[0063] B. List strict match, i.e. match unit {i,j} means contains and only contains i-th option or j-th option, such as {2,3} means contains and only contains 2-th option and 3-th option;
[0064] A. String match, implemented using regular expression;
[0065] B. List any item match "?";
[0066] C. Skip match (no matter what this question selects or does not select, it will return true) "*";
[0067] D. Negation "!";
[0068] For example, a rule expression: ([1]∨[1]∨[1]∨[1]∨[1]∨[1]∨[1]∨[1])∧*∧*, which means that the first question to the eighth question selects the first item of any one, the ninth question and the tenth question no matter what is selected, it will match through.
[0069] 4. Support priority operation of logic, in order to determine the operation priority of expression, parentheses can be used, the operation in parentheses is superior to the operation outside the parentheses.
[0070] For example: 1 selects a or (2 selects b and 3 selects c), first perform 2 selects b and 3 selects c matching; 1 does not select a and (2 selects b and 3 selects c) is also first perform 2 selects b and 3 selects c matching.
[0071] According to the behavior of expression query, use code to execute the relevant behavior logic, according to the different of each system, the specific implementation can be realized.
[0072] For example, a survey questionnaire containing 17 questions, except for the 8th question which is multiple choice, the 8th question contains 8 options, the rest are single choice. Assuming that the matching expression constructed includes:
[0073] 6 or 7 is selected, 8 is not selected 8th option, the check result is yellow, the matching expression is:
[0074] *∧*∧*∧*∧*∧([1]∨[1]∨[1,2,3,4,5,6,7])∧*∧*∧*∧*∧*∧*∧*∧*∧*
[0075] 10 or 11 or 12 is selected, the check result is red, the matching expression is:
[0076] *∧*∧*∧*∧*∧*∧*∧*∧([1]∨[1]∨[1]∨[1])∧*∧*∧*∧*∧*
[0077] 17 is not selected, the check result is red, the matching expression is:
[0078] *∧*∧*∧*∧*∧*∧*∧*∧*∧*∧*∧*∧*∧*∧*∧*∧[2]
[0079] …
[0080] When the user answers 17 questions, the matching method of the embodiment can obtain relevant result information.
[0081] The result matching method for the questionnaire provided by the embodiment can separate the logical module of the questionnaire type problem, realize the function through zero code configuration, does not depend on the programming script, has low learning cost, is easy to understand, does not need programming experience, and effectively reduces the research and development cost.
[0082] The result matching method for the questionnaire provided by the embodiment greatly improves the function implementation efficiency in the application of the questionnaire function of the epidemic survey, is well applied in multiple hospitals, and has high configuration flexibility.
[0083] The result matching method for the questionnaire provided by the embodiment has high flexibility in logical judgment, supports logical relationship operation (and, or, not), the logical relationship between multiple questions can be arbitrarily combined, and supports the priority operation of the logic, instead of simply matching according to the order of the questions.
[0084] The result matching method for the questionnaire provided by the embodiment supports multiple matching modes, such as matching the string containing some keywords, containing some options in the multiple-choice question, and not containing some options.
[0085] The result matching method for the questionnaire provided by the embodiment abstracts the answers in a symbolic form, and uses an expression to match, and the execution of the matching result meets the corresponding set rules.
[0086] The result matching method for the questionnaire provided by the embodiment is a general means, which can realize the related function in the form function of the questionnaire, the epidemic survey table and the like by using a simple and fast configuration mode, and realizes the function through zero code.
[0087] Embodiment two
[0088] The result matching system for the questionnaire provided by the embodiment specifically includes the following modules:
[0089] The answer acquisition module is configured to acquire a set of answers to the questionnaire;
[0090] The matching module is configured to: match the answer set with a pre-constructed matching expression to obtain a matching result; in the matching process of the answer information and each matching expression, first, a matching unit is taken from the matching expression, then the matching unit in the matching expression is replaced by a placeholder to obtain a matching expression after the placeholder, a matching list of a Boolean type is obtained by matching each answer of the question with the matching unit, finally, the matching list is used to sequentially replace the placeholders in the matching expression after the placeholder, and a connector is replaced by a logical operator to obtain an expression that can be executed by a specified engine, so that the engine calculates a matching result of a Boolean type;
[0091] The construction rule of the matching expression includes that the definition of each matching expression includes a connector and a matching unit, the matching unit is used to match the answer of a single question, and the connector is used to connect the matching units into a compound statement; and the logical priority operation is supported.
[0092] It should be noted that each module in the embodiment corresponds to each step in Embodiment One, and the specific implementation process is the same, which will not be repeated here.
[0093] Embodiment Three
[0094] The embodiment provides a computer readable storage medium, which stores a computer program, and the program is executed by a processor to implement steps in a result matching method suitable for a questionnaire.
[0095] Embodiment Four
[0096] The embodiment provides a computer device, which includes a memory, a processor and a computer program stored in the memory and capable of running on the processor, and the processor implements steps in a result matching method suitable for a questionnaire when executing the program.
[0097] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by a computer program instructing related hardware, and the program can be stored in a computer readable storage medium, and the program can include the processes of the above-mentioned embodiments when executed.
[0098] The above merely provides the preferred embodiments of the present application, and is not used to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modifications, equivalent replacements, improvements, etc. made within the principles and technical scope of the present application shall fall into the scope of the present application.
Claims
1. A method for matching results of surveys, characterized by, The method comprises the following steps: obtaining a set of answers to the questionnaire; comparing the set of answers with a pre-constructed matching expression to obtain a matching result; in the matching process of the answer information and each matching expression, first, a matching unit is taken out from the matching expression, then a placeholder is used to replace the matching unit in the matching expression to obtain a matching expression after the placeholder, a matching list of a Boolean type is obtained by matching each answer of the question with the matching unit, finally, the matching list is used to sequentially replace the placeholders in the matching expression after the placeholder, and a connector is replaced with a logical operator to obtain an expression that can be executed by a specified engine and has a Boolean result, so that the engine calculates a matching result of a Boolean type; wherein the construction rules of the matching expression include that the definition of each matching expression contains a connector and a matching unit, the matching unit is used to match the answer of a single question, and the connector is used to connect the matching units into a compound statement; and priority operations of the supported logic are performed.
2. The method for matching results of a survey questionnaire according to claim 1, wherein, The matching unit has the following rules: optional matching, strict matching, string matching, any item matching, skip matching, and negation.
3. The method for matching results of a survey questionnaire according to claim 1, wherein, The construction rules of the matching expression further include that if there are m verification result branches, at least m-1 matching expressions need to be defined.
4. The method for matching results of a survey questionnaire according to claim 1, wherein, The construction rules of the matching expression further include that if there are n questions, there are n matching units.
5. The method for matching results of a survey questionnaire according to claim 1, wherein, If the specified engine is a js engine, the connectors ∨ and ∧ are replaced with logical operators || and &&, respectively.
6. A result matching system for a survey, characterized by, The method comprises the following steps: an answer obtaining module configured to obtain a set of answers to the questionnaire; a matching module configured to compare the set of answers with a pre-constructed matching expression to obtain a matching result; in the matching process of the answer information and each matching expression, first, a matching unit is taken out from the matching expression, then a placeholder is used to replace the matching unit in the matching expression to obtain a matching expression after the placeholder, a matching list of a Boolean type is obtained by matching each answer of the question with the matching unit, finally, the matching list is used to sequentially replace the placeholders in the matching expression after the placeholder, and a connector is replaced with a logical operator to obtain an expression that can be executed by a specified engine and has a Boolean result, so that the engine calculates a matching result of a Boolean type; wherein the construction rules of the matching expression include that the definition of each matching expression contains a connector and a matching unit, the matching unit is used to match the answer of a single question, and the connector is used to connect the matching units into a compound statement; and priority operations of the supported logic are performed.
7. A result matching system for surveys as claimed in claim 6, wherein, The construction rules of the matching expression further include that if there are m verification result branches, at least m-1 matching expressions need to be defined.
8. A result matching system for surveys as claimed in claim 6, wherein, The construction rules of the matching expression further include that if there are n questions, there are n matching units.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the steps of the result matching method for the questionnaire according to any one of claims 1-5.
10. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to implement the steps of the result matching method for the questionnaire according to any one of claims 1-5.
Citation Information
Patent Citations
Interactive method based on questionnaire and related equipment
CN108563384A
Questionnaire editing method and device, electronic equipment and storage medium
CN111859869A