CN113760367B - Data processing method, device, electronic equipment and storage medium - Google Patents

Data processing method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113760367B
CN113760367B CN202111060339.7A CN202111060339A CN113760367B CN 113760367 B CN113760367 B CN 113760367B CN 202111060339 A CN202111060339 A CN 202111060339A CN 113760367 B CN113760367 B CN 113760367B
Authority
CN
China
Prior art keywords
target
data structure
target character
rule
processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111060339.7A
Other languages
Chinese (zh)
Other versions
CN113760367A (en
Inventor
朱明奇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Ping An Medical Health Technology Service Co Ltd
Original Assignee
Shenzhen Ping An Medical Health Technology Service Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Ping An Medical Health Technology Service Co Ltd filed Critical Shenzhen Ping An Medical Health Technology Service Co Ltd
Priority to CN202111060339.7A priority Critical patent/CN113760367B/en
Publication of CN113760367A publication Critical patent/CN113760367A/en
Application granted granted Critical
Publication of CN113760367B publication Critical patent/CN113760367B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/30007Arrangements for executing specific machine instructions to perform operations on data operands
    • G06F9/30018Bit or string instructions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3802Instruction prefetching
    • G06F9/3814Implementation provisions of instruction buffers, e.g. prefetch buffer; banks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application discloses a data processing method, a data processing device, electronic equipment and a storage medium, which can be applied to the field of data processing. The method may include: searching a target rule corresponding to the first data processing instruction; replacing the expression by using the target character string corresponding to each expression, and replacing the operator by using the target character corresponding to each operator to obtain a replaced target rule; obtaining a target element set according to the replaced target rule; traversing the target element set, executing data structure access operation according to the data structure operation strategy corresponding to the traversed element, obtaining a first execution result based on the first data structure, and responding to the first data processing instruction according to the first execution result. The method can help to improve the processing efficiency of the target rule. The embodiment of the application can also be applied to the field of blockchain, for example, a first data structure comprising N elements can be stored in the blockchain.

Description

Data processing method, device, electronic equipment and storage medium
Technical Field
The present application relates to the field of data processing, and in particular, to a data processing method, apparatus, electronic device, and storage medium.
Background
In many cases, processing of rules is used to obtain corresponding execution results, where the rules typically have multiple expressions, operators, and brackets, the content in the brackets having a higher processing priority. In the practical process, the inventor finds that the operation aiming at the complex logic rule generally needs to traverse the rule to determine whether brackets exist, if the brackets exist, the contents in the brackets in the rule need to be processed first, then other contents are processed, if more brackets exist in the rule, repeated cycle traversal is needed, the judgment logic is complex, and the judgment efficiency of the rule is low.
Disclosure of Invention
The embodiment of the application provides a data processing method, a data processing device, electronic equipment and a storage medium, which are beneficial to improving the processing efficiency of target rules.
In one aspect, an embodiment of the present application discloses a data processing method, where the method includes:
receiving a first data processing instruction submitted by first equipment, wherein the first data processing instruction comprises a rule identifier of a target rule;
Searching a target rule corresponding to the rule identification, wherein the target rule comprises a plurality of expressions and at least one operator for connecting the plurality of expressions;
determining a target character string corresponding to each expression in the plurality of expressions and used for replacing the expression, determining a target character corresponding to each operator in the at least one operator and used for replacing the operator, replacing the expression by the target character string corresponding to each expression, and replacing the operator by the target character corresponding to each operator to obtain a replaced target rule;
Obtaining a target element set comprising M elements according to the replaced target rule, wherein the M elements comprise target character strings corresponding to each expression and target characters corresponding to each operator;
Traversing the target element set;
executing data structure access operation according to the traversed elements and the data structure operation strategies corresponding to the traversed elements to obtain a first data structure comprising N elements, wherein the N elements comprise target character strings corresponding to each expression and target characters corresponding to each operator, and N is smaller than or equal to M;
sequentially fetching the N elements in the first data structure;
after one element of the first N-1 elements included in the first data structure is fetched each time, invoking a processing strategy corresponding to the fetched element to obtain a processing result according to the fetched element, and storing the processing result into a second data structure;
After the Nth element in the first data structure is taken out, invoking a processing strategy corresponding to the Nth element to process according to the Nth element and a processing result included in the second data structure, so as to obtain a first execution result of the target rule;
and responding to the first data processing instruction according to the first execution result.
In another aspect, an embodiment of the present application discloses a data processing apparatus, including:
the receiving unit is used for receiving a first data processing instruction submitted by first equipment, wherein the first data processing instruction comprises a rule identifier of a target rule;
A processing unit, configured to find a target rule corresponding to the rule identifier, where the target rule includes a plurality of expressions and at least one operator for connecting the plurality of expressions;
The processing unit is further configured to determine a target character string corresponding to each of the plurality of expressions and used for replacing the expression, determine a target character corresponding to each of the at least one operator and used for replacing the operator, replace the expression with the target character string corresponding to each of the expressions, and replace the operator with the target character corresponding to each of the operators, so as to obtain a replaced target rule;
the processing unit is further configured to obtain a target element set including M elements according to the replaced target rule, where the M elements include a target string corresponding to each expression and a target character corresponding to each operator;
The processing unit is further used for traversing the target element set;
The processing unit is further configured to perform a data structure access operation according to the traversed element and a data structure operation policy corresponding to the traversed element, so as to obtain a first data structure including N elements, where N includes a target string corresponding to each expression and a target character corresponding to each operator, and N is smaller than or equal to M;
the processing unit is further configured to sequentially fetch the N elements in the first data structure;
the processing unit is further configured to call a processing policy corresponding to the fetched element after one element of the first N-1 elements included in the first data structure is fetched each time, so as to obtain a processing result according to the fetched element, and store the processing result into a second data structure;
the processing unit is further configured to invoke a processing policy corresponding to an nth element after the nth element in the first data structure is fetched, so as to perform processing according to the nth element and a processing result included in the second data structure, and obtain a first execution result of the target rule;
And the processing unit is also used for responding to the first data processing instruction according to the first execution result.
In yet another aspect, an embodiment of the present application provides an electronic device, including a processor, a memory, wherein the memory is configured to store a computer program, the computer program including program instructions, the processor being configured to perform the steps of:
receiving a first data processing instruction submitted by first equipment, wherein the first data processing instruction comprises a rule identifier of a target rule;
Searching a target rule corresponding to the rule identification, wherein the target rule comprises a plurality of expressions and at least one operator for connecting the plurality of expressions;
determining a target character string corresponding to each expression in the plurality of expressions and used for replacing the expression, determining a target character corresponding to each operator in the at least one operator and used for replacing the operator, replacing the expression by the target character string corresponding to each expression, and replacing the operator by the target character corresponding to each operator to obtain a replaced target rule;
Obtaining a target element set comprising M elements according to the replaced target rule, wherein the M elements comprise target character strings corresponding to each expression and target characters corresponding to each operator;
Traversing the target element set;
executing data structure access operation according to the traversed elements and the data structure operation strategies corresponding to the traversed elements to obtain a first data structure comprising N elements, wherein the N elements comprise target character strings corresponding to each expression and target characters corresponding to each operator, and N is smaller than or equal to M;
sequentially fetching the N elements in the first data structure;
after one element of the first N-1 elements included in the first data structure is fetched each time, invoking a processing strategy corresponding to the fetched element to obtain a processing result according to the fetched element, and storing the processing result into a second data structure;
After the Nth element in the first data structure is taken out, invoking a processing strategy corresponding to the Nth element to process according to the Nth element and a processing result included in the second data structure, so as to obtain a first execution result of the target rule;
and responding to the first data processing instruction according to the first execution result.
In yet another aspect, embodiments of the present application provide a computer readable storage medium having stored therein computer program instructions for performing the following steps when executed by a processor:
receiving a first data processing instruction submitted by first equipment, wherein the first data processing instruction comprises a rule identifier of a target rule;
Searching a target rule corresponding to the rule identification, wherein the target rule comprises a plurality of expressions and at least one operator for connecting the plurality of expressions;
determining a target character string corresponding to each expression in the plurality of expressions and used for replacing the expression, determining a target character corresponding to each operator in the at least one operator and used for replacing the operator, replacing the expression by the target character string corresponding to each expression, and replacing the operator by the target character corresponding to each operator to obtain a replaced target rule;
Obtaining a target element set comprising M elements according to the replaced target rule, wherein the M elements comprise target character strings corresponding to each expression and target characters corresponding to each operator;
Traversing the target element set;
executing data structure access operation according to the traversed elements and the data structure operation strategies corresponding to the traversed elements to obtain a first data structure comprising N elements, wherein the N elements comprise target character strings corresponding to each expression and target characters corresponding to each operator, and N is smaller than or equal to M;
sequentially fetching the N elements in the first data structure;
after one element of the first N-1 elements included in the first data structure is fetched each time, invoking a processing strategy corresponding to the fetched element to obtain a processing result according to the fetched element, and storing the processing result into a second data structure;
After the Nth element in the first data structure is taken out, invoking a processing strategy corresponding to the Nth element to process according to the Nth element and a processing result included in the second data structure, so as to obtain a first execution result of the target rule;
and responding to the first data processing instruction according to the first execution result.
In yet another aspect, embodiments of the present application disclose a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-described data processing method.
In the embodiment of the application, a first data processing instruction submitted by first equipment can be received, the first data processing instruction comprises a rule identifier of a target rule, and further a target rule corresponding to the rule identifier is searched, wherein the target rule comprises a plurality of expressions and at least one operator for connecting the plurality of expressions; determining a target character string for replacing the expression corresponding to each expression in the plurality of expressions, determining a target character for replacing the operator corresponding to each operator in at least one operator, replacing the expression by using the target character string corresponding to each expression, replacing the operator by using the target character corresponding to each operator, obtaining a replaced target rule, obtaining a target element set comprising M elements according to the replaced target rule, and traversing the target element set; executing data structure access operation according to the traversed elements and the data structure operation strategies corresponding to the traversed elements to obtain a first data structure comprising N elements, sequentially taking out N elements in the first data structure, calling the processing strategies corresponding to the taken out elements to process according to the taken out elements, and further obtaining a first execution result of the target rule to respond to the first data processing instruction according to the first execution result. Therefore, the recognition errors of the expressions can be reduced by replacing the expressions and the operators, and the first data structure is obtained through the data structure operation strategy, so that repeated cycle traversal is avoided, and the processing efficiency of the target rule is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a data processing method according to an embodiment of the present application;
FIG. 2 is an effect schematic diagram of a construction flow of a first data structure according to an embodiment of the present application;
FIG. 3 is an effect schematic diagram of a construction flow of a first data structure according to an embodiment of the present application;
FIG. 4 is a schematic flow chart of a data processing method according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a data processing apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The application provides a data processing scheme, which can determine a corresponding target rule according to a rule identifier included in a first data processing instruction after receiving the first data processing instruction submitted by first equipment, further replace an expression included in the target rule with a target character string, replace an operator included in the target rule with a target character, generate a target element set according to the replaced target rule, traverse elements in the target element set and execute data structure access operation to obtain a first data structure, further take out the elements from the first data structure for processing to obtain a first execution result aiming at the target rule, and perform corresponding response processing on the first data processing instruction according to the first execution result. Therefore, the recognition errors of the expressions can be reduced by replacing the expressions and the operators, and the first data structure is obtained through the data structure operation strategy, so that repeated cycle traversal is avoided, and the processing efficiency of the target rule is improved.
The technical scheme of the application can be applied to electronic equipment, wherein the electronic equipment can be a terminal, a server or other equipment for data processing, and the application is not limited. Optionally, the method comprises the steps of. The server can be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, and can also be a cloud server for providing cloud services, cloud databases, cloud computing, cloud storage, network services, middleware services, basic cloud computing services such as big data and artificial intelligent platforms and the like. The terminal may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, etc.
Based on the above description, the embodiment of the application provides a data processing method. Referring to fig. 1, fig. 1 is a flow chart of a data processing method according to an embodiment of the application. The method may be performed by the above-mentioned electronic device. The method may comprise steps S101-110.
S101, receiving a first data processing instruction submitted by first equipment.
Wherein the first device may be any device that submits the first data processing instructions. For example, the first device may include a target client through which a user may submit data processing instructions, e.g., in the context of grouping target medical records, the target client may be a client capable of providing functionality of the submitted medical records grouping instructions. And the electronic equipment can receive the first data processing instruction submitted by the target client so as to perform data processing operation according to the first data processing instruction.
The first data processing instruction includes a rule identifier of the target rule, where the rule identifier may be information for uniquely identifying the target rule, for example, may be a rule name or a rule number, and the like, and is not limited herein. The target rule may be a rule for judging a response process of the first data processing instruction.
Optionally, the first data processing instruction may further include a set of information for the target rule. That is, the set of information may be a set of information for determining a first execution result of the target rule. The information set may include information of parameters required to be determined by the target rule, for example, if the target rule needs to determine whether age information of the object to which the data processing instruction is directed is greater than a threshold value, the information set may include age information.
S102, searching a target rule corresponding to the rule identification.
Wherein the target rule may include a plurality of expressions and at least one operator for connecting the plurality of expressions.
The expression may be an expression for making information judgment. For example, the expression may be that the data item 1 is equal to the target value, the expression may be noted as "data item 1=target value", and if the expression is true, that is, the data item 1 is equal to the target value, the processing result of the expression is 1; if the expression is false, i.e., data item 1 is equal to the target value, the processing result of the expression is 0. For another example, the expression may be a result of subtracting data item 2 from data item 1 greater than a target value, the expression may be noted as "data item 1-data item 2> target value", and if the expression is true, i.e., the result of subtracting data item 2 from data item 1 is greater than the target value, the processing result of the expression is 1; if the expression is false, that is, the result of subtracting data item 2 from data item 1 is not greater than the target value, the processing result of the expression is 0. It will be appreciated that the specifics of the expression are determined by the target rule and are not limited in this regard. In an actual calculation, the value of the data item 1 may be determined based on the set of information in the first data processing instruction. Alternatively, the expression may also be referred to as a judgment term or a condition term, or the like.
The operator may be an operator for processing a processing result of an expression, and the operator may be used to connect the above-described expressions. The operator may be an AND logic operator (≡) or an OR logic operator (|). It will be appreciated that if any of the processing results associated with the logical operator is 0, the processing result for the logical operator is 0, that is, if the processing results associated with the logical operator are all 1, the processing result for the logical operator is 1. If any one of the processing results associated with the or logical operator is 1, the processing result for the or logical operator is 1, that is, if the processing results associated with the or logical operator are all 0, the processing result for the or logical operator is 0.
For example, the target rule may be expression 1 and expression 2 and expression 3, and then the processing result related to the first is the processing result of expression 1 and expression 2, that is, the first may perform an or logic operation on the processing result of expression 1 and the processing result of expression 2 to obtain the processing result for the first; the processing result related to the first|is the processing result for the first|and the processing result of expression 3, that is, the second|may perform an or logical operation on the processing result of the first|and the processing result of expression 3.
In a possible implementation manner, the target rule may further include at least one left bracket and a right bracket corresponding to each left bracket. The left bracket and the right bracket corresponding to the left bracket may constitute a pair of brackets. The pair of brackets may give higher processing priority to expressions and operators in the pair of brackets. For example, the target rule may be expression 1| (expression 2& & expression 3), and when the target rule is processed, it is necessary to perform an and logic operation on expression 2 and expression 3 to obtain a processing result of & & in the bracket pair, and then perform an or logic operation on the processing result of expression 1 and the processing result corresponding to the bracket pair, so as to obtain a first execution result of the target rule.
In one possible implementation, the target rule corresponding to the rule identifier is searched, and the rule corresponding to the rule identifier can be searched from at least one candidate rule based on the rule identifier as the target rule. In one embodiment, the candidate rules may be rules stored in the electronic device for validating instructions, each candidate rule having a corresponding rule identification.
S103, determining a target character string for replacing the expression corresponding to each expression in the plurality of expressions, determining a target character for replacing the operator corresponding to each operator in at least one operator, replacing the expression by the target character string corresponding to each expression, and replacing the operator by the target character corresponding to each operator to obtain a replaced target rule.
Wherein the target character string may be a character string replacing an expression in the target rule, and the target character may be a character replacing an operator in the target rule. It will be appreciated that the target character string for each expression in the target rule is different, as is the target character for each operator.
For example, if the target rule is expression 1 and expression 2, expression 1 may be replaced with target character string key1, expression 2 may be replaced with target character string key2, and expression 3 may be replaced with target character string key3. And the operator may be replaced with the target character and the operator with the target character. The target rule after replacement can thus be found to be key1|ke2|ke3. Thereby, the expressions and operators in the target rule can be converted, the storage space can be reduced, and the error probability of the identification of the expressions in the processing of the target rule can be reduced.
Optionally, the target character string corresponding to each expression does not include the character corresponding to each operator.
Optionally, if the target rule further includes a pair of brackets, the left bracket or the right bracket corresponding to the pair of brackets may not be replaced. For example, if the target rule is expression 1| (expression 2& & expression 3& expression 4) |expression 5, expression 1 may be replaced with target character string key1, expression 2 may be replaced with target character string key2, expression 3 may be replaced with target character string key3, expression 4 may be replaced with target character string key4, and expression 5 may be replaced with target character string key5. And the operator | may be replaced with the target character |, and the operator | may be replaced with the target character &. The target rule after replacement can thus be found to be key1| (key 2& key3& key 4) |key5.
S104, obtaining a target element set comprising M elements according to the replaced target rule.
The M elements may include a target character string corresponding to each expression and a target character corresponding to each operator.
Optionally, if the target rule further includes at least one pair of brackets, the M elements may further include at least one pair of brackets in the target rule, where the left bracket and the right bracket corresponding to the pair of brackets are one element, respectively, that is, the M elements may include a target string corresponding to each expression, a target character corresponding to each operator, and a left bracket and a right bracket in at least one pair of brackets.
In one possible implementation, the target element set including M elements is obtained according to the replaced target rule, and the target element set may be generated for each element directly according to the target rule. It will be appreciated that the elements in the target set of elements have a sequential relationship between them that corresponds to the target rule. For example, if the replaced target rule is key1| (key 2& key3& key 4) |key5, the generated target element set may be { key1| (key 2& key3& key 4) |key5}, where the target element set includes 11 elements, i.e., m=11. That is, the target rule can be converted into the corresponding element set, and then the target element set can be processed in the subsequent processing, so that the processing efficiency of the target rule is improved, and the data storage space can be reduced.
In a possible implementation manner, the target element set including M elements is obtained according to the replaced target rule, and the method further includes the following steps: extracting each target character string and each target character included in the replaced target rule; constructing an initial element set comprising each target character string and each target character; adding spacers between two adjacent elements of the initial element set to obtain an element set comprising each target character string, each target character and the added spacers; an element set including each target character string, each target character, and the added spacer is determined as a target element set. The initial element set may be an element set including each target character string and each target character extracted from the target rule, and each element in the initial element set has a sequence relationship corresponding to the target rule. The spacer may be a symbol for spacing the elements, for example, the spacer may be a symbol of ", etc., without limitation. It is understood that the spacer is a symbol different from each character corresponding to the target character string and the target character. For example, if the replaced target rule is key1|key2|key3, the target character strings key1, key2 and key3 and the target characters|and| in the replaced target rule may be extracted to construct an initial element set { key1|key2|key3}, and further a spacer ",", specifically, key1 and|are adjacent elements, may be added between key1 and |and a spacer ",", and |and key2 are adjacent elements, and a spacer ",", and so on, may be added between |and key2, so as to obtain a target element set { key1, |, key2, |, and key3} including each target character string, each target character, and the added spacer, where the target element set has 5 elements, i.e., m=5.
In a possible implementation manner, if the target rule further includes at least one bracket pair, a target element set including M elements is obtained according to the replaced target rule, and the method further includes the following steps: extracting each target character string, each target character and each bracket pair included in the replaced target rule; constructing an initial element set comprising each target character string, each target character and each bracket pair; adding spacers between two adjacent elements of the initial element set to obtain an element set comprising each target character string, each target character, each bracket pair and the added spacers; an element set including each target character string, each target character, each bracket pair, and the added spacer is determined as a target element set. The initial element set may be an element set including each target character string, target character and bracket pair extracted from the target rule. For example, if the replaced target rule is key1 (key 2& key3& key 4) |key5, then the target character strings key1, key2, key3, key4, key5, and the target characters & and| in the replaced target rule may be extracted to construct an initial element set { key1| (key 2& key3& key 4) |key5}, and then a spacer ",", specifically, key1 and |are adjacent elements, a spacer "," |and (are adjacent elements, a spacer ",", and a similar to each other may be added between |and (between), and thus, a target element set { key1, | } (, key2, & key3, & key4,/, and/or }) including each target character string, each pair of brackets, and the added spacer may be obtained, wherein the element set { key1, | }, (, key2, & key3, & key 4), = is 11, and the element set is 11.
S105, traversing the target element set.
Wherein, when traversing the target element set, the traversing can be performed according to the sequence relation of each element in the target element set. For example, if the target element set is { key1| (key 2& key3& key 4) |key5}, traversal may be performed sequentially from left to right when traversing the target element set.
In one possible implementation, if the target element set is an element set to which spacers are added, each element may be distinguished according to the spacers. When traversing the target element set from left to right, each time a spacer is traversed, the character between the spacer and the last spacer or the starting point of the traversal is determined to be an element. For example, the target element set is { key1, |, (, key2, & gt, key3, & gt, key4,), |, key5}, key1 between the first spacer and the traversal start point may be determined as one element when traversing to the first spacer, and |between the second spacer and the first spacer may be determined as one element when traversing to the second spacer, and so on, which will not be described herein.
In one possible implementation, if the target set of elements is a set of elements generated directly from individual elements in the target rule, each element may be distinguished according to the target character and bracket pairs in the target set of elements. When traversing the target element set in order from left to right, it is possible to take the left bracket and the right bracket included in each target character and bracket pair as one element, and determine the character string between the target character or bracket pair and the last target character, bracket pair, or traversal start point as one element. For example, the target element set is { key1| (key 2& key3& key 4) |key5}, when traversing to the first target character |, key1 between the first target character | and the starting point of the traversal may be determined as an element, and the |may be determined as an element, when traversing to the first left bracket, the left bracket may be determined as an element, when traversing to the first target character |, key2 between the first target character | and the left bracket may be determined as an element, and the first target character | may be determined as an element, when traversing to the second target character |, key3 between the second target character | and the first target character | may be determined as an element, and the second target character | may be determined as an element, and so on, which will not be repeated herein.
S106, executing data structure access operation according to the traversed elements and the data structure operation strategies corresponding to the traversed elements to obtain a first data structure comprising N elements.
The N elements comprise target character strings corresponding to each expression and target characters corresponding to each operator, and N is smaller than or equal to M. The N elements do not include pairs of brackets. That is, if the target rule does not include a pair of brackets, the N elements are the same as M elements in the target element set, i.e., m=n; if the target rule does not include a pair of brackets, the N elements are smaller than the M elements in the target element set because the N element set does not include a pair of brackets, N < M. The first data structure may be a queue comprising N elements.
The data structure operation policy may be a policy that is processed based on a data structure corresponding to the traversed element, and the data structure may be a queue and/or a stack. Wherein the queue has a first-in first-out characteristic, that is, elements stored in the queue are preferentially fetched when fetched; the stack has the property of first in and last out, that is, elements stored in the stack are preferentially fetched when fetched. It will be appreciated that there are corresponding processing strategies for the target string, target character and bracket pairs.
In one possible implementation manner, if the target element set does not include a pair of brackets, performing a data structure access operation according to the traversed element and a data structure operation policy corresponding to the traversed element, to obtain a first data structure including N elements, and may include the following steps: when the traversed element is a target character string, storing the target character string into a queue; when the traversed element is a target character, storing the target character into a stack; when the end of traversing the target element set is detected, if at least one element is included in the stack, each element in the stack is taken out, and each element is stored in a queue, so that a queue including a target character string corresponding to each expression and a target character corresponding to each operator is obtained; a queue including a target character string corresponding to each expression and a target character corresponding to each operator is determined as a first data structure.
For example, referring to fig. 2, fig. 2 is an effect schematic diagram of a construction flow of a first data structure according to an embodiment of the present application. If the target element set is { key1, |, key2, |, key3}, traversing each element in the target element set, and storing key1 into a queue when traversing to the target character string key1, wherein the element in the queue is { key1}, and the element in the stack is empty, referring to (1) in fig. 2; when traversing to the first target character, |, storing the first target character into a stack, wherein the element in the queue is { key1}, and the element in the stack is { | }, as shown by (2) in fig. 2; when traversing to the target character string key2, storing the key2 into a queue, wherein the elements in the queue are { key1 key2}, the elements in the stack are { | }, and referring to (3) in fig. 2; when traversing to the second target character, |, storing the second target character into a stack, wherein the element in the queue is { key1 key2}, and the element in the stack is { | }, referring to (4) in fig. 2; when traversing to the target character string key2, storing the key2 into a queue, wherein the elements in the queue are { key1 key2 key3}, and the elements in the stack are { | }, referring to (5) in fig. 2; at this time, the element in the stack is taken out and stored in the queue when the element in the stack is taken out and then the element in the stack (namely, the second target character) is preferentially taken out and stored in the queue, the element which is firstly stored in the stack (namely, the first target character) is taken out and stored in the queue, at this time, the element in the queue is { key1 key2 key3| } and the element in the stack is empty, as shown in (6) in fig. 2. That is, the queue shown in (6) in fig. 2 is a first data structure including the target character string in the target element set and the target character.
In one possible implementation manner, if the target rule includes at least one left bracket and a right bracket corresponding to each left bracket, the data structure access operation is performed according to the traversed element and the data structure operation policy corresponding to the traversed element, so as to obtain a first data structure including N elements, and the method further includes the following steps: when the traversed element is a target character string, storing the target character string into a queue; when the traversed element is a target character, storing the target character into a stack; when traversing to a left bracket, storing the left bracket into a stack; when traversing to the right bracket, taking out the left bracket corresponding to the right bracket from the stack, then storing the elements in the stack, storing the taken-out elements in a queue, and taking out the left bracket corresponding to the right bracket from the stack; when the end of traversing the target element set is detected, each element in the stack is taken out, and each element is stored in a queue, so that a queue comprising target character strings corresponding to each expression and target characters corresponding to each operator is obtained; a queue including a target character string corresponding to each expression and a target character corresponding to each operator is determined as a first data structure.
For example, referring to fig. 3, fig. 3 is an effect schematic diagram of a construction flow of a first data structure according to an embodiment of the present application. If the target element set is { key1, |, (, key2, & gt, key3,), |, key4}, traversing each element in the target element set, and storing key1 into a queue when traversing to the target character string key1, wherein the element in the queue is { key1}, and the element in the stack is empty, referring to (1) in fig. 3; when traversing to the first target character, |, storing the first target character into a stack, wherein the element in the queue is { key1}, and the element in the stack is { | }, as shown by (2) in fig. 3; when traversing to the left bracket (when the left bracket is stored in the stack, the element in the queue is { key1}, the element in the stack is { | (}, refer to (3) in fig. 3); when traversing to the target character string key2, storing the key2 in the queue, wherein the element in the queue is { key1 key2}, the element in the stack is { I }, as shown by (4) in FIG. 3, when traversing to the first target character, & gt is stored in the stack, wherein the element in the queue is { key1 key2}, the element in the stack is { I } (& gt, as shown by (5) in FIG. 3, when traversing to the target character string key3, the key3 is stored in the queue, wherein the element in the queue is { key1 key2 key3}, the element in the stack is { I }, as shown by (6) in FIG. 3, and when traversing to the right bracket), the element in the stack, namely the first target character }, is fetched from the stack, and then the fetched target character & is stored in the queue, and the element in the left bracket is fetched from the stack, the element in { key1 key2}, the {1 key3 is the {1 key3}, the element in the stack is { 4, |is shown by (4) in the queue, |1 key3, the element in the stack is shown by (4) in the target character string,), reference is made to (9) in fig. 3; at this time, the element in the stack is taken out and stored in the queue when the element in the stack is taken out and then the element in the stack (namely, the second target character) is preferentially taken out and then the element in the stack is stored in the queue, the element which is firstly stored in the stack (namely, the first target character) is taken out and then the element in the queue is stored in the queue, at this time, the element in the queue is { key1 key2 key3& key4| } and the element in the stack is empty, as shown by (10) in fig. 3. That is, the queue shown in (10) in fig. 3 is a first data structure including the target character string and the target character in the target element set.
S107, sequentially taking out N elements in the first data structure.
When the first data structure is a queue, N elements in the first data structure are sequentially fetched, the elements stored in the first data structure are preferentially fetched according to the first-in first-out characteristic of the queue. For example, if the first data structure is { key1 key2 key3& key4| } then when N elements in the first data structure are sequentially fetched, the N elements are sequentially fetched from key1 until the second target character|is fetched.
S108, after one element in the first N-1 elements included in the first data structure is fetched each time, invoking a processing strategy corresponding to the fetched element to obtain a processing result according to the fetched element processing, and storing the processing result into the second data structure.
The processing policy may be a policy that processes each element to obtain a corresponding processing result. It will be appreciated that there are different processing strategies for the target string and the target character in the first data structure. The second data structure may be a stack.
In one possible implementation manner, after each time one element of the first N-1 elements included in the first data structure is fetched, a processing policy corresponding to the fetched element is called to obtain a processing result according to the fetched element processing, and the processing result is stored in the second data structure, which may include the following steps: when the element extracted from the first data structure is a target character string, determining an expression corresponding to the target character string; processing according to the expression and the information set corresponding to the target character string to obtain a processing result aiming at the target character string, and storing the processing result into a second data structure; when the element extracted from the first data structure is a target character, determining an operator corresponding to the target character; and retrieving the processing result associated with the target character from the second data structure, processing the processing result for the target character according to the processing result and the operator associated with the target character, and storing the processing result into the second data structure.
The information set is an information set contained in the first data processing instruction, and the processing result aiming at the target character string can be obtained by processing based on an expression corresponding to the target character string in the information set. For example, if the expression corresponding to the extracted target character string key1 is used to indicate that the age information is greater than the target value, the expression may be expressed as an age > target value, and further when the processing result for the target character string key1 is calculated, the age information may be determined from the information set, if the age information in the information set is 45, the processing may be performed based on the age information (i.e., age=45) in the information set and the expression corresponding to the target character string, that is, whether 45 is greater than the target value, if 45 is greater than the target value, the processing result for the target character string is 1, and if 45 is less than the target value, the processing result for the target character string key1 is 0.
The processing result associated with the target character may be two processing results last stored in the second data structure, and then the processing result for the target character may be obtained based on processing the two processing results last stored in the second data structure and the operator corresponding to the target character. For example, the processing results in the second data structure include { R1, R2, R3}, the operator corresponding to the fetched target character & is the and logic operator (& gt), and the processing result associated with & gt is the two processing results finally stored in the second data structure, namely R2 and R3, so that the processing result for the target character & can be obtained by calculating R2& R3.
For example, if N elements in the first data structure are { key1 key2 key3& key4| } then sequentially fetching the first N-1 elements in the first data structure, when the fetched element is the target character string key1, determining an expression corresponding to the key1, and processing according to the information set and the expression to obtain a processing result R1 for the target character string key1, and storing the processing result R1 in the second data structure, where the processing result in the second data structure is { R1}; when the extracted element is a target character string key2, determining an expression corresponding to the key2, processing according to the information set and the expression to obtain a processing result R2 aiming at the target character string key2, and storing the processing result R2 into a second data structure, wherein the processing result in the second data structure is { R1R 2}; when the extracted element is a target character string key3, determining an expression corresponding to the key3, processing according to the information set and the expression to obtain a processing result R3 aiming at the target character string key3, and storing the processing result R3 into a second data structure, wherein the processing result in the second data structure is { R1R 2R 3}; when the target character is taken out, determining a corresponding operator which is & &, and taking out a processing result related to the target character from a second data structure which is two processing results R2 and R3 finally stored in the second data structure, and calling the operator &toprocess the R2 and the R3 to obtain a processing result R23 aiming at the target character and storing the processing result R23 into the second data structure, wherein the processing result in the second data structure is { R1R 23}; when the extracted element is a target character string key4, determining an expression corresponding to the key4, processing according to the information set and the expression to obtain a processing result R4 aiming at the target character string key4, and storing the processing result R4 into a second data structure, wherein the processing result in the second data structure is { R1R 23R 4}; when the first target character I is taken out, determining an operator corresponding to the first target character I, namely the operator I, and taking out a processing result associated with the target character from the second data structure, namely two processing results R4 and R23 which are finally stored in the second data structure, and calling the operator I to process the R4 and the R23 to obtain a processing result R234 aiming at the target character and storing the processing result R234 into the second data structure, wherein the processing result in the second data structure is { R1R 234}; thus, processing is completed for the first N-1 elements in the first data structure, resulting in a second data structure comprising { R1R 234 }.
S109, after the Nth element in the first data structure is taken out, invoking a processing strategy corresponding to the Nth element to process according to the Nth element and a processing result included in the second data structure, and obtaining a first execution result of the target rule.
Wherein the nth element may also be referred to as the last element fetched from the first data structure. It will be appreciated that the process of obtaining the first data structure may be explicit, and the last element in the first data structure is the target character. That is, the processing result for the last target character is the execution result for the target rule.
For example, when N elements in the first data structure are { key1 key2 key3& key4| } and the first N-1 elements in the first data structure are fetched and processed, a processing result stored in the second data structure may be { R1R 234}, and when the last element (i.e., the second target character|) in the first data structure is fetched, an operator corresponding to the second target character| is determined, and a processing result associated with the target character is fetched from the second data structure, that is, two processing results R1 and R234 which are finally stored in the second data structure are fetched, and the operator|is called to process R4 and R23, so as to obtain a processing result R234 for the target character|, that is, obtain a first execution result of the target rule.
S110, responding to the first data processing instruction according to the first execution result.
The response processing is performed on the first data processing instruction according to the first execution result, and different response processing may be performed for different first execution results. When the first execution result meets the preset condition, the target rule can be indicated to be met when the target rule is processed based on the information set contained in the first data processing instruction, and then the processing operation indicated by the first data processing instruction can be executed. When the first execution result does not meet the preset condition, the target rule may indicate that the target rule is not met when the target rule is processed based on the information set included in the first data processing instruction, and further, the processing operation indicated by the first data processing instruction is not executed. The preset condition may be a condition that the processing operation indicated by the execution of the first data processing instruction needs to satisfy, for example, the preset condition may be that the first execution result is 1.
In one possible implementation manner, the first data processing instruction may be a medical records grouping instruction for grouping the target medical records, and when the first execution result meets a preset condition, grouping the target medical records in response to the first data processing instruction; when the first execution result does not meet the preset condition, the target medical records are not subjected to grouping processing, and prompt information is sent to the first device to prompt that the target medical records do not meet the preset condition, and specific related description can refer to the related description of the embodiment shown in fig. 4, which is not repeated here.
In a possible implementation manner, the embodiment of the present application may further store a first data structure including N elements in a cache area; recording a correspondence between rule identifications and a first data structure comprising N elements; receiving a second data processing instruction submitted by a second device, wherein the second data processing instruction comprises a rule identifier; determining a first data structure corresponding to the rule identifier and comprising N elements from the cache area according to the corresponding relation; obtaining a second execution result for the target rule based on a first data structure including N elements; and responding to the second data processing instruction according to the second execution result.
The buffer area may be a storage area in the electronic device, and may store a first data structure including N elements for the target rule. The correspondence may be a correspondence between a first data structure including N elements and a target rule, that is, when the first data structure is stored in the cache area, the first data structure may be stored in association with a rule identifier of the target rule, and further, the first data structure of the target rule may be directly obtained from the cache area based on the rule identifier of the target rule. The second device may be any device that submits the second data processing instruction, and the second device may be the same device or a different device than the first device, which is not limited herein. The second data processing instruction may be an instruction for triggering a data processing operation, where a rule identifier included in the second data processing instruction and a rule identifier included in the first data processing instruction may further determine, according to a correspondence, a first data structure including N elements corresponding to the rule identifier from a cache area, and the second data processing instruction may further carry an information set for a target rule corresponding to the target rule identifier. Obtaining a relevant description of the second execution result for the target rule based on the first data structure including N elements may refer to the relevant descriptions of steps S107-S109, that is, sequentially fetching N elements in the first data structure; after one element of the first N-1 elements included in the first data structure is fetched each time, invoking a processing strategy corresponding to the fetched element to obtain a processing result according to the fetched element processing, and storing the processing result into the second data structure; after the nth element in the first data structure is taken out, a processing strategy corresponding to the nth element is called to process according to the nth element and a processing result included in the second data structure, so as to obtain a second execution result of the target rule, which is not described herein. It will be appreciated that the value of the second execution result depends on the set of information carried by the second data processing instruction, and that the second execution result may be the same as or different from the first execution result. And then the second data processing instruction can be responded and processed according to the second execution result, so that the processing time for acquiring the corresponding first data structure again according to the target rule can be reduced, and the data processing efficiency is greatly improved.
In the embodiment of the application, a first data processing instruction submitted by first equipment can be received, the first data processing instruction comprises a rule identifier of a target rule, and further a target rule corresponding to the rule identifier is searched, wherein the target rule comprises a plurality of expressions and at least one operator for connecting the plurality of expressions; determining a target character string for replacing the expression corresponding to each expression in the plurality of expressions, determining a target character for replacing the operator corresponding to each operator in at least one operator, replacing the expression by using the target character string corresponding to each expression, replacing the operator by using the target character corresponding to each operator, obtaining a replaced target rule, obtaining a target element set comprising M elements according to the replaced target rule, and traversing the target element set; executing data structure access operation according to the traversed elements and the data structure operation strategies corresponding to the traversed elements to obtain a first data structure comprising N elements, sequentially taking out N elements in the first data structure, calling the processing strategies corresponding to the taken out elements to process according to the taken out elements, and further obtaining a first execution result of the target rule to respond to the first data processing instruction according to the first execution result. Therefore, the recognition errors of the expressions can be reduced by replacing the expressions and the operators, and the first data structure is obtained through the data structure operation strategy, so that repeated cycle traversal is avoided, and the processing efficiency of the target rule is improved.
Referring to fig. 4, fig. 4 is a flowchart of a data processing method according to an embodiment of the application. The method may be performed by an electronic device. The method comprises the following steps.
S401, a medical records grouping instruction submitted by the first equipment and used for grouping target medical records is received.
The target medical records can be any medical records which need to be grouped, and the medical records can be records of medical activity processes such as examination, diagnosis, treatment and the like of medical staff on occurrence, development and reversion of diseases of patients.
The medical records grouping instruction may be an instruction for triggering grouping of target medical records, where the medical records grouping instruction includes a rule identifier of a target rule. The medical records grouping instruction may further include an information set for the target rule, where the information set may include medical records information for the target medical records, and further may process the target rule based on the medical records information. Wherein the medical records information, i.e., information recorded in the medical records, such as information on the type of disease diagnosed for the patient, operation performed, discharge condition, age, sex, etc., are not limited herein.
S402, searching for a target rule corresponding to the rule identification.
S403, determining a target character string for replacing the expression corresponding to each expression in the plurality of expressions, determining a target character for replacing the operator corresponding to each operator in at least one operator, replacing the expression by the target character string corresponding to each expression, and replacing the operator by the target character corresponding to each operator to obtain a replaced target rule.
S404, obtaining a target element set comprising M elements according to the replaced target rule, wherein the M elements comprise target character strings corresponding to each expression and target characters corresponding to each operator.
S405, traversing the target element set.
S406, executing data structure access operation according to the traversed elements and the data structure operation strategies corresponding to the traversed elements to obtain a first data structure comprising N elements.
S407, sequentially taking out N elements in the first data structure.
S408, after one element of the first N-1 elements included in the first data structure is fetched each time, a processing strategy corresponding to the fetched element is called to obtain a processing result according to the fetched element processing, and the processing result is stored in the second data structure.
S409, after the Nth element in the first data structure is taken out, invoking a processing strategy corresponding to the Nth element to process according to the Nth element and a processing result included in the second data structure, so as to obtain a first execution result of the target rule.
Steps S402 to S409 can be referred to as steps S102 to S109, and will not be described here.
S410, if the first execution result meets the preset condition, grouping the target medical records in response to the medical records grouping instruction.
The preset condition may be a condition that needs to be met when the target medical records are subjected to grouping processing, and if the first execution result is 1. It can be understood that if the first execution result satisfies the preset condition, the medical records information representing the target medical records satisfy the target rule, that is, the medical records information of the target medical records pass through the verification of the target rule, so that the medical records grouping operation indicated by the medical records grouping instruction can be executed in response to the medical records grouping instruction, and the grouping processing can be performed on the target medical records.
The grouping of the target medical records may be performed to determine a group to which the target medical records belong, for example, determine a disease diagnosis related group (DRG group) of the target medical records, so as to determine a payment manner of the medical fee for the patient corresponding to the target medical records according to the DRG group. DRG is essentially a case-combination classification scheme, i.e., a system that manages patients into several diagnostic groups based on age, disease diagnosis, complications, treatment regimen, severity of the condition, and outcome and resource consumption. For example, grouping the target medical records may invoke a grouping engine to group the target medical records according to an international disease classification code (ICD code) of the target medical records. Therefore, before the target medical records are grouped, the medical records of the target medical records are verified, after the verification is passed, the target medical records are grouped, and the situation that the medical records of patients are incomplete or have errors is avoided, so that the DRG of the patients are grouped in error, the grouping accuracy is lower, and further economic losses are caused.
In one possible embodiment, if the first execution result does not meet the preset condition, the target medical records are not subjected to grouping processing. Optionally, a prompt message may also be sent to the first device to prompt that the target medical record does not meet the preset condition.
If the first execution result does not meet the preset condition, the grouping processing is not performed on the target medical records, and the medical record information representing the target medical records does not meet the target rule, for example, the first execution result may be 0. That is, the medical records information of the target medical records do not pass the verification of the target rule, and the medical records grouping operation indicated by the medical records grouping instruction is not executed, that is, the grouping processing is not performed on the target medical records. Optionally, a prompt message may also be output to prompt that the target medical record does not satisfy the preset condition. Therefore, when the medical records information of the target medical records does not meet the target rule, the target medical records are not subjected to grouping processing, the situation that grouping errors are caused by information errors or missing of the target medical records is avoided, and the grouping accuracy is improved.
In a possible implementation manner, the embodiment of the application may further record each target character string with a processing result of 0, if the first execution result of the target character string with the processing result of 0 is 0, determine, according to an expression corresponding to the target character string with the processing result of 0, which information in the information set causes the first execution result of the target character string to fail to meet a preset condition, and further send, when the prompt information is sent to the first device, information causing the first execution result of the target character string to fail to meet the preset condition, so that it is beneficial for related personnel to quickly check the case information in the target case, and adjust the case information in the target case, so that the case information can pass verification of the target rule, and accuracy of subsequent grouping is improved.
In the embodiment of the application, a medical records grouping instruction submitted by first equipment for grouping target medical records can be received, wherein the medical records grouping instruction comprises a rule identifier of a target rule, and further a target rule corresponding to the rule identifier is searched, and the target rule comprises a plurality of expressions and at least one operator for connecting the plurality of expressions; determining a target character string for replacing the expression corresponding to each expression in the plurality of expressions, determining a target character for replacing the operator corresponding to each operator in at least one operator, replacing the expression by using the target character string corresponding to each expression, replacing the operator by using the target character corresponding to each operator, obtaining a replaced target rule, obtaining a target element set comprising M elements according to the replaced target rule, and traversing the target element set; executing data structure access operation according to the traversed elements and the data structure operation strategies corresponding to the traversed elements to obtain a first data structure comprising N elements, sequentially taking out N elements in the first data structure, calling the processing strategies corresponding to the taken out elements to process according to the taken out elements, and further obtaining a first execution result of the target rule to perform grouping processing on the target medical records in response to the medical records grouping instruction. Therefore, the target medical records can be verified through the target rules before being subjected to grouping processing, accuracy of grouping processing is improved, recognition errors of the expressions are reduced through replacement of the expressions and the operators, the first data structure is obtained through the data structure operation strategy, repeated circulation traversal is avoided, and processing efficiency of the target rules is improved.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application. Alternatively, the data processing device may be provided in the above-described electronic apparatus. As shown in fig. 5, the data processing apparatus described in the present embodiment may include:
A receiving unit 501, configured to receive a first data processing instruction submitted by a first device, where the first data processing instruction includes a rule identifier of a target rule;
A processing unit 502, configured to find a target rule corresponding to the rule identifier, where the target rule includes a plurality of expressions and at least one operator for connecting the plurality of expressions;
The processing unit 502 is further configured to determine a target character string corresponding to each of the plurality of expressions and used for replacing the expression, determine a target character corresponding to each of the at least one operator and used for replacing the operator, replace the expression with the target character string corresponding to each of the expressions, and replace the operator with the target character corresponding to each of the operators, so as to obtain a replaced target rule;
the processing unit 502 is further configured to obtain a target element set including M elements according to the replaced target rule, where the M elements include a target string corresponding to each expression and a target character corresponding to each operator;
The processing unit 502 is further configured to traverse the target element set;
The processing unit 502 is further configured to perform a data structure access operation according to the traversed element and a data structure operation policy corresponding to the traversed element, to obtain a first data structure including N elements, where N includes a target string corresponding to each expression and a target character corresponding to each operator, and N is smaller than or equal to M;
the processing unit 502 is further configured to sequentially fetch the N elements in the first data structure;
The processing unit 502 is further configured to call, after one element of the first N-1 elements included in the first data structure is fetched each time, a processing policy corresponding to the fetched element to obtain a processing result according to the processing of the fetched element, and store the processing result in a second data structure;
the processing unit 502 is further configured to invoke a processing policy corresponding to an nth element after the nth element in the first data structure is fetched, so as to perform processing according to the nth element and a processing result included in the second data structure, and obtain a first execution result of the target rule;
The processing unit 502 is further configured to perform response processing on the first data processing instruction according to the first execution result.
In one implementation, the processing unit 502 is specifically configured to:
When the traversed element is a target character string, storing the target character string into a queue;
When the traversed element is a target character, storing the target character into a stack;
When the end of traversing the target element set is detected, each element in the stack is taken out, and the elements are stored in the queue, so that a queue comprising target character strings corresponding to each expression and target characters corresponding to each operator is obtained;
and determining the queue comprising the target character string corresponding to each expression and the target character corresponding to each operator as a first data structure.
In one implementation, the target rule includes at least one left bracket and a right bracket corresponding to each left bracket, and the processing unit 502 is specifically configured to:
When the traversed element is a target character string, storing the target character string into a queue;
When the traversed element is a target character, storing the target character into a stack;
when traversing to a left bracket, storing the left bracket into a stack;
when traversing to a right bracket, taking out a left bracket corresponding to the right bracket from the stack, then storing the elements in the stack, storing the taken-out elements in the queue, and taking out a left bracket corresponding to the right bracket from the stack;
When the end of traversing the target element set is detected, if the stack comprises at least one element, taking out each element in the stack, and storing each element into the queue to obtain a queue comprising target character strings corresponding to each expression and target characters corresponding to each operator;
and determining the queue comprising the target character string corresponding to each expression and the target character corresponding to each operator as a first data structure.
In one implementation, the processing unit 502 is specifically configured to:
extracting each target character string and each target character included in the replaced target rule;
constructing an initial element set comprising the target character strings and the target characters;
adding a spacer between two adjacent elements of the initial element set to obtain an element set comprising each target character string, each target character and the added spacer;
And determining an element set comprising the target character strings, the target characters and the added spacers as a target element set.
In one implementation, the first data processing instruction further includes a set of information for the target rule;
The processing unit 502 is specifically configured to:
When the element extracted from the first data structure is a target character string, determining an expression corresponding to the target character string;
Processing according to the expression corresponding to the target character string and the information set to obtain a processing result aiming at the target character string, and storing the processing result into a second data structure;
When the element extracted from the first data structure is a target character, determining an operator corresponding to the target character;
and extracting a processing result associated with the target character from the second data structure, processing the processing result for the target character according to the processing result associated with the target character and the operator, and storing the processing result into the second data structure.
In one implementation, the first data processing instruction is a medical records grouping instruction for grouping target medical records; the processing unit 502 is specifically configured to:
And if the first execution result meets a preset condition, grouping the target medical records in response to the medical records grouping instruction.
In one implementation, the processing unit 502 is further configured to:
storing the first data structure comprising N elements to a cache area;
recording the corresponding relation between the rule identification and the first data structure comprising N elements;
Receiving a second data processing instruction submitted by a second device, wherein the second data processing instruction comprises the rule identification;
Determining a first data structure corresponding to the rule identifier and comprising the N elements from the cache area according to the corresponding relation; obtaining a second execution result for the target rule based on the first data structure including the N elements;
and responding to the second data processing instruction according to the second execution result.
Referring to fig. 6, fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the application. The electronic device described in the present embodiment includes: processor 601, memory 602. Optionally, the electronic device may further include a network interface 603 or a power module. Data may be interacted between the processor 601, the memory 602, and the network interface 603.
The Processor 601 may be a central processing unit (Central Processing Unit, CPU), which may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), off-the-shelf Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The network interface 603 may include input devices, such as a control panel, microphone, receiver, etc., and/or output devices, such as a display screen, transmitter, etc., which are not illustrated herein. For example, in an embodiment of the application, the network interface may include a receiver and a transmitter.
The memory 602 may include read only memory and random access memory, and provides program instructions and data to the processor 601. A portion of the memory 602 may also include non-volatile random access memory. Wherein the processor 601, when calling the program instructions, is configured to execute:
receiving a first data processing instruction submitted by first equipment, wherein the first data processing instruction comprises a rule identifier of a target rule;
Searching a target rule corresponding to the rule identification, wherein the target rule comprises a plurality of expressions and at least one operator for connecting the plurality of expressions;
determining a target character string corresponding to each expression in the plurality of expressions and used for replacing the expression, determining a target character corresponding to each operator in the at least one operator and used for replacing the operator, replacing the expression by the target character string corresponding to each expression, and replacing the operator by the target character corresponding to each operator to obtain a replaced target rule;
Obtaining a target element set comprising M elements according to the replaced target rule, wherein the M elements comprise target character strings corresponding to each expression and target characters corresponding to each operator;
Traversing the target element set;
executing data structure access operation according to the traversed elements and the data structure operation strategies corresponding to the traversed elements to obtain a first data structure comprising N elements, wherein the N elements comprise target character strings corresponding to each expression and target characters corresponding to each operator, and N is smaller than or equal to M;
sequentially fetching the N elements in the first data structure;
after one element of the first N-1 elements included in the first data structure is fetched each time, invoking a processing strategy corresponding to the fetched element to obtain a processing result according to the fetched element, and storing the processing result into a second data structure;
After the Nth element in the first data structure is taken out, invoking a processing strategy corresponding to the Nth element to process according to the Nth element and a processing result included in the second data structure, so as to obtain a first execution result of the target rule;
and responding to the first data processing instruction according to the first execution result.
In one implementation, the processor 601 is specifically configured to:
When the traversed element is a target character string, storing the target character string into a queue;
When the traversed element is a target character, storing the target character into a stack;
When the end of traversing the target element set is detected, each element in the stack is taken out, and the elements are stored in the queue, so that a queue comprising target character strings corresponding to each expression and target characters corresponding to each operator is obtained;
and determining the queue comprising the target character string corresponding to each expression and the target character corresponding to each operator as a first data structure.
In one implementation, the target rule includes at least one left bracket and a right bracket corresponding to each left bracket, and the processor 601 is specifically configured to:
When the traversed element is a target character string, storing the target character string into a queue;
When the traversed element is a target character, storing the target character into a stack;
when traversing to a left bracket, storing the left bracket into a stack;
when traversing to a right bracket, taking out a left bracket corresponding to the right bracket from the stack, then storing the elements in the stack, storing the taken-out elements in the queue, and taking out a left bracket corresponding to the right bracket from the stack;
When the end of traversing the target element set is detected, if the stack comprises at least one element, taking out each element in the stack, and storing each element into the queue to obtain a queue comprising target character strings corresponding to each expression and target characters corresponding to each operator;
and determining the queue comprising the target character string corresponding to each expression and the target character corresponding to each operator as a first data structure.
In one implementation, the processor 601 is specifically configured to:
extracting each target character string and each target character included in the replaced target rule;
constructing an initial element set comprising the target character strings and the target characters;
adding a spacer between two adjacent elements of the initial element set to obtain an element set comprising each target character string, each target character and the added spacer;
And determining an element set comprising the target character strings, the target characters and the added spacers as a target element set.
In one implementation, the first data processing instruction further includes a set of information for the target rule;
The processor 601 is specifically configured to:
When the element extracted from the first data structure is a target character string, determining an expression corresponding to the target character string;
Processing according to the expression corresponding to the target character string and the information set to obtain a processing result aiming at the target character string, and storing the processing result into a second data structure;
When the element extracted from the first data structure is a target character, determining an operator corresponding to the target character;
and extracting a processing result associated with the target character from the second data structure, processing the processing result for the target character according to the processing result associated with the target character and the operator, and storing the processing result into the second data structure.
In one implementation, the first data processing instruction is a medical records grouping instruction for grouping target medical records; the processor 601 is specifically configured to:
And if the first execution result meets a preset condition, grouping the target medical records in response to the medical records grouping instruction.
In one implementation, the processor 601 is further configured to:
storing the first data structure comprising N elements to a cache area;
recording the corresponding relation between the rule identification and the first data structure comprising N elements;
Receiving a second data processing instruction submitted by a second device, wherein the second data processing instruction comprises the rule identification;
Determining a first data structure corresponding to the rule identifier and comprising the N elements from the cache area according to the corresponding relation; obtaining a second execution result for the target rule based on the first data structure including the N elements;
and responding to the second data processing instruction according to the second execution result.
Optionally, the program instructions may further implement other steps of the method in the above embodiment when executed by the processor, which is not described herein.
The present application also provides a computer readable storage medium storing a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the above-described method, such as the method performed by the above-described electronic device, which is not described herein in detail.
Alternatively, a storage medium such as a computer-readable storage medium to which the present application relates may be nonvolatile or may be volatile.
Alternatively, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created from the use of blockchain nodes, and the like. The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The blockchain (Blockchain), essentially a de-centralized database, is a string of data blocks that are generated in association using cryptographic methods, each of which contains information from a batch of network transactions for verifying the validity (anti-counterfeit) of its information and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
It should be noted that, for simplicity of description, the foregoing method embodiments are all expressed as a series of action combinations, but it should be understood by those skilled in the art that the present application is not limited by the order of action described, as some steps may be performed in other order or simultaneously according to the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present application.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be implemented by a program to instruct related hardware, the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
Embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps performed in the embodiments of the methods described above. For example, the computer device may be a terminal, or may be a server.
The foregoing has described in detail a data processing method, apparatus, electronic device and storage medium according to embodiments of the present application, and specific examples have been applied to illustrate the principles and embodiments of the present application, where the foregoing examples are only for aiding in understanding the method and core idea of the present application; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (10)

1. A method of data processing, comprising:
receiving a first data processing instruction submitted by first equipment, wherein the first data processing instruction comprises a rule identifier of a target rule;
Searching a target rule corresponding to the rule identification, wherein the target rule comprises a plurality of expressions and at least one operator for connecting the plurality of expressions;
determining a target character string corresponding to each expression in the plurality of expressions and used for replacing the expression, determining a target character corresponding to each operator in the at least one operator and used for replacing the operator, replacing the expression by the target character string corresponding to each expression, and replacing the operator by the target character corresponding to each operator to obtain a replaced target rule;
Obtaining a target element set comprising M elements according to the replaced target rule, wherein the M elements comprise target character strings corresponding to each expression and target characters corresponding to each operator;
Traversing the target element set;
executing data structure access operation according to the traversed elements and the data structure operation strategies corresponding to the traversed elements to obtain a first data structure comprising N elements, wherein the N elements comprise target character strings corresponding to each expression and target characters corresponding to each operator, and N is smaller than or equal to M;
sequentially fetching the N elements in the first data structure;
after one element of the first N-1 elements included in the first data structure is fetched each time, invoking a processing strategy corresponding to the fetched element to obtain a processing result according to the fetched element, and storing the processing result into a second data structure;
After the Nth element in the first data structure is taken out, invoking a processing strategy corresponding to the Nth element to process according to the Nth element and a processing result included in the second data structure, so as to obtain a first execution result of the target rule;
and responding to the first data processing instruction according to the first execution result.
2. The method of claim 1, wherein the performing a data structure access operation according to the traversed element and the data structure operation policy corresponding to the traversed element, to obtain a first data structure including N elements, includes:
When the traversed element is a target character string, storing the target character string into a queue;
When the traversed element is a target character, storing the target character into a stack;
When the end of traversing the target element set is detected, each element in the stack is taken out, and the elements are stored in the queue, so that a queue comprising target character strings corresponding to each expression and target characters corresponding to each operator is obtained;
and determining the queue comprising the target character string corresponding to each expression and the target character corresponding to each operator as a first data structure.
3. The method of claim 1, wherein the target rule includes at least one left bracket and a right bracket corresponding to each left bracket, and wherein the performing a data structure access operation according to the traversed element and the data structure operation policy corresponding to the traversed element results in a first data structure including N elements, including:
When the traversed element is a target character string, storing the target character string into a queue;
When the traversed element is a target character, storing the target character into a stack;
when traversing to a left bracket, storing the left bracket into a stack;
when traversing to a right bracket, taking out a left bracket corresponding to the right bracket from the stack, then storing the elements in the stack, storing the taken-out elements in the queue, and taking out a left bracket corresponding to the right bracket from the stack;
When the end of traversing the target element set is detected, if the stack comprises at least one element, taking out each element in the stack, and storing each element into the queue to obtain a queue comprising target character strings corresponding to each expression and target characters corresponding to each operator;
and determining the queue comprising the target character string corresponding to each expression and the target character corresponding to each operator as a first data structure.
4. The method of claim 1, wherein the obtaining a target element set comprising M elements according to the replaced target rule comprises:
extracting each target character string and each target character included in the replaced target rule;
constructing an initial element set comprising the target character strings and the target characters;
adding a spacer between two adjacent elements of the initial element set to obtain an element set comprising each target character string, each target character and the added spacer;
And determining an element set comprising the target character strings, the target characters and the added spacers as a target element set.
5. The method of claim 1, wherein the first data processing instruction further comprises a set of information for the target rule;
and after each time one element of the first N-1 elements included in the first data structure is fetched, invoking a processing strategy corresponding to the fetched element to obtain a processing result according to the fetched element processing, and storing the processing result into a second data structure, wherein the processing method comprises the following steps:
When the element extracted from the first data structure is a target character string, determining an expression corresponding to the target character string;
Processing according to the expression corresponding to the target character string and the information set to obtain a processing result aiming at the target character string, and storing the processing result into a second data structure;
When the element extracted from the first data structure is a target character, determining an operator corresponding to the target character;
and extracting a processing result associated with the target character from the second data structure, processing the processing result for the target character according to the processing result associated with the target character and the operator, and storing the processing result into the second data structure.
6. The method of claim 1, wherein the first data processing instruction is a medical records grouping instruction for grouping target medical records;
the responding processing to the first data processing instruction according to the first execution result comprises the following steps:
And if the first execution result meets a preset condition, grouping the target medical records in response to the medical records grouping instruction.
7. The method according to claim 1, wherein the method further comprises:
storing the first data structure comprising N elements to a cache area;
recording the corresponding relation between the rule identification and the first data structure comprising N elements;
Receiving a second data processing instruction submitted by a second device, wherein the second data processing instruction comprises the rule identification;
Determining a first data structure corresponding to the rule identifier and comprising the N elements from the cache area according to the corresponding relation;
Obtaining a second execution result for the target rule based on the first data structure including the N elements;
and responding to the second data processing instruction according to the second execution result.
8. A data processing apparatus, comprising:
the receiving unit is used for receiving a first data processing instruction submitted by first equipment, wherein the first data processing instruction comprises a rule identifier of a target rule;
A processing unit, configured to find a target rule corresponding to the rule identifier, where the target rule includes a plurality of expressions and at least one operator for connecting the plurality of expressions;
The processing unit is further configured to determine a target character string corresponding to each of the plurality of expressions and used for replacing the expression, determine a target character corresponding to each of the at least one operator and used for replacing the operator, replace the expression with the target character string corresponding to each of the expressions, and replace the operator with the target character corresponding to each of the operators, so as to obtain a replaced target rule;
the processing unit is further configured to obtain a target element set including M elements according to the replaced target rule, where the M elements include a target string corresponding to each expression and a target character corresponding to each operator;
The processing unit is further used for traversing the target element set;
The processing unit is further configured to perform a data structure access operation according to the traversed element and a data structure operation policy corresponding to the traversed element, so as to obtain a first data structure including N elements, where N includes a target string corresponding to each expression and a target character corresponding to each operator, and N is smaller than or equal to M;
the processing unit is further configured to sequentially fetch the N elements in the first data structure;
the processing unit is further configured to call a processing policy corresponding to the fetched element after one element of the first N-1 elements included in the first data structure is fetched each time, so as to obtain a processing result according to the fetched element, and store the processing result into a second data structure;
the processing unit is further configured to invoke a processing policy corresponding to an nth element after the nth element in the first data structure is fetched, so as to perform processing according to the nth element and a processing result included in the second data structure, and obtain a first execution result of the target rule;
And the processing unit is also used for responding to the first data processing instruction according to the first execution result.
9. An electronic device comprising a processor, a memory, wherein the memory is configured to store a computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the method of any of claims 1-7.
10. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of any of claims 1-7.
CN202111060339.7A 2021-09-10 2021-09-10 Data processing method, device, electronic equipment and storage medium Active CN113760367B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111060339.7A CN113760367B (en) 2021-09-10 2021-09-10 Data processing method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111060339.7A CN113760367B (en) 2021-09-10 2021-09-10 Data processing method, device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113760367A CN113760367A (en) 2021-12-07
CN113760367B true CN113760367B (en) 2024-05-14

Family

ID=78794605

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111060339.7A Active CN113760367B (en) 2021-09-10 2021-09-10 Data processing method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113760367B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114610544B (en) * 2022-03-07 2023-03-28 丁跃辉 Artificial intelligence big data analysis processing system and method based on block chain

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111460815A (en) * 2020-03-16 2020-07-28 平安科技(深圳)有限公司 Rule processing method, apparatus, medium, and electronic device
CN112468370A (en) * 2020-11-30 2021-03-09 北京锐驰信安技术有限公司 High-speed network message monitoring and analyzing method and system supporting custom rules

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090024366A1 (en) * 2007-07-18 2009-01-22 Microsoft Corporation Computerized progressive parsing of mathematical expressions

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111460815A (en) * 2020-03-16 2020-07-28 平安科技(深圳)有限公司 Rule processing method, apparatus, medium, and electronic device
CN112468370A (en) * 2020-11-30 2021-03-09 北京锐驰信安技术有限公司 High-speed network message monitoring and analyzing method and system supporting custom rules

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于双栈结构的中缀表达式算法设计与实现;许晓宇;;智能计算机与应用;20171226(第06期);全文 *

Also Published As

Publication number Publication date
CN113760367A (en) 2021-12-07

Similar Documents

Publication Publication Date Title
WO2021068547A1 (en) Log schema extraction method and apparatus
US20180025092A1 (en) Modular memoization, tracking and train-data management of feature extraction
US20230004536A1 (en) Systems and methods for a data search engine based on data profiles
WO2021179630A1 (en) Complications risk prediction system, method, apparatus, and device, and medium
CN111695593A (en) XGboost-based data classification method and device, computer equipment and storage medium
CN110222790B (en) User identity identification method and device and server
US20200394448A1 (en) Methods for more effectively moderating one or more images and devices thereof
US20230409565A1 (en) Data aggregation with microservices
CN113760367B (en) Data processing method, device, electronic equipment and storage medium
WO2019205307A1 (en) Resource processing node operation method and device, and terminal device and medium
WO2021120587A1 (en) Method and apparatus for retina classification based on oct, computer device, and storage medium
WO2021000645A1 (en) Contract generation method and apparatus based on data crawling and computer device
CN104125254B (en) Obtain the method and system of platform user data
CN111767543B (en) Replay attack vulnerability determination method, device, equipment and readable storage medium
CN113658711B (en) Medical data localization method, device, computer equipment and storage medium
CN113626483B (en) Front-end caching method, system, equipment and storage medium for filling forms
CN114048512A (en) Method and device for processing sensitive data
CN113808740B (en) Data processing method, device, electronic equipment and storage medium
CN114360732A (en) Medical data analysis method and device, electronic equipment and storage medium
CN113723524B (en) Data processing method based on prediction model, related equipment and medium
CN114756901B (en) Operational risk monitoring method and device
CN117201193B (en) Virus detection method and device, storage medium and electronic equipment
CN117635081B (en) Data processing method, device, equipment and storage medium
US20220327237A1 (en) System and a method for identifying private user information
CN117633796A (en) Event chain extraction method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20220525

Address after: 518000 China Aviation Center 2901, No. 1018, Huafu Road, Huahang community, Huaqiang North Street, Futian District, Shenzhen, Guangdong Province

Applicant after: Shenzhen Ping An medical and Health Technology Service Co.,Ltd.

Address before: Room 12G, Area H, 666 Beijing East Road, Huangpu District, Shanghai 200001

Applicant before: PING AN MEDICAL AND HEALTHCARE MANAGEMENT Co.,Ltd.

GR01 Patent grant
GR01 Patent grant