Medical data index query statement generation method and system based on statistical indexes

By defining attributes and adapting statistical indicators to the platform, generating Java syntax parsing code, and defining executor interface specifications, the problem of repeated design of query statements caused by different database platforms is solved, and the standardization and reusability of query statements are realized.

CN119781771AActive Publication Date: 2025-04-08DONGHUA MEDICAL TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411893524.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-04-08
Estimated Expiration
2044-12-20

AI Technical Summary

Technical Problem

In the prior art, the difference between different database platforms in statistical query scenarios leads to repeated design of query statements, resulting in large workloads and no reusability.

Method used

Provide a medical data index query statement generation method and system based on statistical indicators. By defining attributes of statistical indicators, using ANTLR4 to generate Java syntax parsing code, defining executor interface specifications, and implementing platform executor plug-ins under different platforms, identifying and registering platform executors, obtaining intermediate data sets, and processing them into the final index data set.

Benefits of technology

The standardization of query statements is realized without changing with the platform, which solves the problem that technicians need to adapt to different database dialects, and improves the reusability and understanding communication of statistical needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119781771A_ABST
    Figure CN119781771A_ABST
Patent Text Reader

Abstract

The invention relates to a medical data index query statement generation method and system based on statistical indexes. According to the method, attribute definition is carried out on statistical indexes, query grammar is defined, the query grammar is expressed by using an ANTLR4 file through the ANTLR4 file, Java grammar analysis codes are generated from the ANTLR4 file, the grammar in the Java grammar analysis codes are converted into logic execution operators, executor interface specifications are defined, platform executor plug-ins of all platforms are packaged, and a task manager is defined. Identifying and registering a platform executor, calling the platform executor to obtain an intermediate data set IDS from the platform, and processing the intermediate data set IDS, a corresponding statistical index attribute and a logic execution operator into a final index data set KDS; by means of the method and device, standard generation of query languages of different platform data is achieved, and the programming workload of the query languages is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of medical system data processing, and in particular to a method and system for generating medical data index query statements based on statistical indexes. Background Art

[0002] In statistical query scenarios, OLAP calculations are mainly used. For example, if you want to count the number of visits to a certain hospital district of a medical institution within a period of time, the technicians first need to analyze which database tables are used, what the relationship is between the database tables, determine which table to use as the driving table, and then determine which field of the database table to use as the statistical caliber, which field and which calculation function to use to obtain the number of visits during this period; finally, based on the database product used, write a platform-specific SQL dialect or use Python, Java, Go and other programming languages ​​to write code line by line to complete the final result data of the above statistical scenario.

[0003] Based on the above process, the workload of each project in statistical analysis is relatively large. Therefore, how to standardize and reuse this statistical analysis, overcome the differences between different database platforms and specific execution processes, etc., are problems that the current technical solution needs to solve. Summary of the invention

[0004] In view of the above-mentioned deficiencies of the prior art, the present invention aims to provide a method and system for generating medical data indicator query statements based on statistical indicators, so as to solve the problem that query statements need to be repeatedly designed due to different execution processes caused by differences in different database platforms.

[0005] In order to solve the above problems, the present invention adopts the following technical solutions: In one aspect, the present invention provides a method for generating a query statement of medical data indicators based on statistical indicators, comprising: Define the attributes of statistical indicators; Define the query grammar of the query language for statistical indicators, use ANTLR4 to represent the query grammar in a .g4 file, and generate Java grammar parsing code from the .g4 file; Convert the syntax in the Java syntax parsing code into a logical execution operator and define the executor interface specification, which includes executor resource initialization, indicator execution unit planning, whether the logical execution operator can be marked as sinking, logical execution operator conversion, logical execution operator execution and executor resource destruction; Implement the methods defined in the executor interface specification on different platforms and encapsulate them into platform executor plug-ins for each platform. Define the task manager, identify and register the platform executor, parse the query syntax into logical execution operators according to the query syntax of the indicator query language of the statistical indicator, divide it into different execution units, identify the platform executor to be called by the statistical indicator according to the configuration items, and call the platform executor to obtain the intermediate data set IDS from the platform; The intermediate data set IDS, the corresponding statistical indicator attributes and the logical execution operator are processed into the final indicator data set KDS.

[0006] As an implementable method, the attributes of the statistical indicators include business attributes, management attributes, data attributes, display attributes, and technical attributes; the business attributes include fields, business domains and business descriptions, the management attributes include management departments, responsible departments and control directions, the data attributes include statistical calibers, calculation formulas, conditions and data lineage relationships, the display attributes include display names, decimal places and conversion units, and the technical attributes include coding, development status, dependent topics, aggregation functions and data formulas.

[0007] As an implementable embodiment, the syntax keywords of the query syntax include WITH, USING, SELECT, ROWS, COLUMNS, WHERE, SORT, LIMIT and / or PORS syntax keywords; WITH means naming the entire query result, USING means using the data set result defined in WITH for recalculation, SELECT means a query, ROWS means dimension columns, COLUMNS means indicator columns, WHERE means filtering the COLUMNS indicator data part, SORT means sorting the returned data set, LIMIT means paging the returned data set, and PORS means the configuration properties of the query language for statistical indicators.

[0008] As an implementable method, converting the grammar in the Java grammar parsing code into a logical execution operator and defining the executor interface specification include: Use ANTLR4 to generate a Java syntax node access interface from the .g4 file, inherit the Java syntax node access interface, implement the visit method of different nodes of the syntax analysis tree, extract the syntax expression content from the Java syntax parsing code and parse it according to the syntax tree context parameters, perform syntax checking on the parsed data, and generate a logical syntax tree; According to the grammatical keywords, the generated logical syntax tree is converted into a logical execution operator; Define the actuator interface specification, and implement different platforms based on the actuator interface to obtain the platform actuator.

[0009] As an implementable method, the task manager is defined, the platform executor is identified and registered, the query grammar of the query language of the statistical indicator is parsed into a logical execution operator, divided into different execution units, the platform executor to be called by the statistical indicator is identified according to the configuration item, and the platform executor is called to obtain the intermediate data set IDS from the platform, including: Based on the statistical indicators of the query, the query syntax of the query language of the statistical indicators is parsed into logical execution operators, and then the indicator list is obtained according to the logical execution operator. The indicator list is grouped according to the platform executor, and the indicator list is divided into one or more task execution units. The task execution units are placed in the scheduling executor for execution, and one or more intermediate data set IDSs are obtained returned by the platform executor.

[0010] On the other hand, the present invention provides a medical data index query statement generation system based on statistical indexes, including an attribute definition module, a syntax parsing module, an actuator interface definition module, a platform adaptation module, an intermediate data set receiving module and an index data set generation module; The attribute definition module is used to define the attributes of statistical indicators; The grammar parsing module is used to define the query grammar of the query language of the statistical indicators, use ANTLR4 to represent the query grammar using a .g4 file, and generate a Java grammar parsing code from the .g4 file; The executor interface definition module is used to convert the syntax in the Java syntax parsing code into a logic execution operator, and define the executor interface specification, which includes executor resource initialization, indicator execution unit planning, whether the logic execution operator may sink, logic execution operator conversion, logic execution operator execution and executor resource destruction; The platform adapter module is used to implement the methods defined in the actuator interface specification on different platforms and encapsulate them into platform actuator plug-ins for each platform; The intermediate data set receiving module is used to define a task manager, identify and register a platform executor, parse the query syntax into a logical execution operator according to the query syntax of the indicator query language of the statistical indicator, divide it into different execution units, identify the platform executor to be called by the statistical indicator according to the configuration item, and call the platform executor to obtain the intermediate data set IDS from the platform; The indicator data set generation module is used to process the intermediate data set IDS, the corresponding statistical indicator attributes and the logical execution operator into a final indicator data set KDS.

[0011] As an implementable method, the attributes of the statistical indicators include business attributes, management attributes, data attributes, display attributes, and technical attributes; the business attributes include fields, business domains and business descriptions, the management attributes include management departments, responsible departments and control directions, the data attributes include statistical calibers, calculation formulas, conditions and data lineage relationships, the display attributes include display names, decimal places and conversion units, and the technical attributes include coding, development status, dependent topics, aggregation functions and data formulas.

[0012] As an implementable embodiment, the syntax keywords of the query syntax include WITH, USING, SELECT, ROWS, COLUMNS, WHERE, SORT, LIMIT and / or PORS syntax keywords; WITH means naming the entire query result, USING means using the data set result defined in WITH for recalculation, SELECT means a query, ROWS means dimension columns, COLUMNS means indicator columns, WHERE means filtering the COLUMNS indicator data part, SORT means sorting the returned data set, LIMIT means paging the returned data set, and PORS means the configuration properties of the query language for statistical indicators.

[0013] As an implementable method, converting the grammar in the Java grammar parsing code into a logical execution operator and defining the executor interface specification include: Use ANTLR4 to generate a Java syntax node access interface from the .g4 file, inherit the Java syntax node access interface, implement the visit method of different nodes of the syntax analysis tree, extract the syntax expression content from the Java syntax parsing code and parse it according to the syntax tree context parameters, perform syntax checking on the parsed data, and generate a logical syntax tree; According to the grammatical keywords, the generated logical syntax tree is converted into a logical execution operator; Define the actuator interface specification, and implement different platforms based on the actuator interface to obtain the platform actuator.

[0014] As an implementable method, a task manager is defined, a platform executor is identified and registered, the query syntax of the query language of the statistical indicator is parsed into a logical execution operator, and the query is divided into different execution units. The platform executor to be called by the statistical indicator is identified according to the configuration item, and the platform executor is called to obtain the intermediate data set IDS from the platform, including: Based on the statistical indicators of the query, the query syntax of the query language of the statistical indicators is parsed into logical execution operators, and then the indicator list is obtained according to the logical execution operator. The indicator list is grouped according to the platform executor, and the indicator list is divided into one or more task execution units. The task execution units are placed in the scheduling executor for execution, and one or more intermediate data set IDSs are obtained returned by the platform executor.

[0015] The beneficial effects of the present invention are as follows: the present invention provides a query statement directly based on the indicator, which is standardized and does not change with the change of the implementation platform, solving the problem that technicians need to adapt to different database dialects when writing SQL under the current circumstances or the problem that technicians need to implement programming; it clarifies the definition elements of statistical indicators, and expresses statistical requirements with indicator query statements, solving the problems of knowledge accumulation, reusability and understanding and communication of statistical requirements. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 The present invention is a flowchart of a method for generating a medical data indicator query statement based on statistical indicators in an embodiment of the present invention.

[0017] Figure 2 The present invention is a schematic diagram of a medical data index query statement generation system based on statistical indexes in an embodiment of the present invention. DETAILED DESCRIPTION

[0018] The present invention is further described in detail below in conjunction with specific embodiments.

[0019] It should be noted that these embodiments are only used to illustrate the present invention rather than to limit the present invention. Simple improvements to the method based on the concept of the present invention all fall within the scope of protection claimed by the present invention.

[0020] See also Figure 1 , which is a method for generating query statements of medical data indicators based on statistical indicators, including: S100. Define attributes of statistical indicators.

[0021] Among them, the attributes of statistical indicators include business attributes, management attributes, data attributes, display attributes, and technical attributes; the business attributes include field, business domain and business description, the management attributes include management department, responsible department and control direction, the data attributes include statistical caliber, calculation formula, conditions and data lineage, the display attributes include display name, decimal places and conversion units, and the technical attributes include coding, development status, dependent subject, aggregation function and data formula.

[0022] S200, define the query grammar of the query language of the statistical indicators, use ANTLR4 to represent the query grammar using a .g4 file, and generate a Java grammar parsing code from the .g4 file. Run the command antlr4 -Dlanguage=javaKpiGrammarRule.g4 to generate a Java language, and generate a grammar parsing code based on the Java language.

[0023] The syntax for defining the indicator query language includes: [WITH dataset name] [USING dataset name] SELECT [ROWS dimension expression list] COLUMNS indicator expression list WHERE filter expression [SORT (sort field list)] [LIMIT (paging parameter)] [PROS (property configuration list)].

[0024] Syntax keywords of the query syntax include WITH, USING, SELECT, ROWS, COLUMNS, WHERE, SORT, LIMIT, and / or PORS syntax keywords.

[0025] The following are explanations of the various parts of the grammar represented by the keywords: WITH dataset name: optional part. It means that the entire query result can be named as a name (dataset result). The name comes after the WITH keyword.

[0026] USING Dataset name: optional. Indicates using the data set result defined in WITH for recalculation.

[0027] SELECT: This is a keyword and a required part. It indicates that this is a query.

[0028] ROWS dimension expression: optional part. It indicates dimension column, i.e. data set. According to the row data expanded vertically, multiple dimension expressions can be written.

[0029] Dimension expressions can be accessed hierarchically using the execution operator "->" according to table relationships; dimensions can also use literal values ​​to express fixed values. The operator ":" can be used to call a function and further calculate the previous value through the function call.

[0030] COLUMNS indicator expression: a required part. It represents the indicator column, that is, the data set. According to the horizontally expanded column data, multiple indicator expressions can be written. The indicators in the indicator expression are represented by the code in the indicator technical attributes defined in S100, which is similar to the function name.

[0031] WHERE filter expression, a necessary part. It indicates filtering of the COLUMNS indicator data part, which plays the role of data screening.

[0032] The filter expression is a recursive call that uses logical operators (||, OR, &&, AND) to connect different filter expressions. It can filter dimension data or indicator values. The statistical caliber filter condition is essential.

[0033] SORT: sorting expression, optional part. Indicates the sorting of the returned data set.

[0034] LIMIT: data paging expression, optional part. Indicates paging of the returned data set.

[0035] PROS: Configuration item expression, optional part. Indicates the configuration properties of the indicator query statement, which can control the running process and execution results. For example, col_mode=h indicates the horizontal indicator column expansion display, and col_mode=v indicates the vertical indicator column expansion display.

[0036] Run the command antlr4 -Dlanguage=java KpiGrammarRule.g4 to generate the Java-based grammar parsing code. The parsing code includes: token stream: KpiGrammarRule.tokens, KpiGrammarRuleLexer.tokens, lexical Lexer: KpiGrammarRuleLexer.java, grammar Parser: KpiGrammarRuleParser.java, KpiGrammarRuleVisitor.java.

[0037] S300, convert the syntax in the Java syntax parsing code into a logic execution operator, define the executor interface specification, the executor interface specification includes executor resource initialization, indicator execution unit planning, whether the logic execution operator can sink the mark, logic execution operator conversion, logic execution operator execution and executor resource destruction.

[0038] This embodiment provides an implementable method: S301. Generate a Java syntax node access interface from the .g4 file using ANTLR4, inherit the Java syntax node access interface, implement the visit method of different nodes of the syntax analysis tree, extract the syntax expression content from the Java syntax parsing code and parse it according to the syntax tree context parameters, perform syntax check on the parsed data, and generate a logical syntax tree. For example, generate a binary tree from the filter expression, generate a linear table from the dimension expression, and generate a Map key-value pair from the attribute configuration (the configuration attribute of the query language of the statistical indicator expressed by the PROS keyword) expression.

[0039] Extract the syntax expression content and parse it, including: The content of the extracted syntax expression includes: the encoding of technical attributes, indicator calculation expressions, dimension expressions, filter conditions, attribute configuration, column aliases, etc.

[0040] According to the indicator code, the statistical indicator attributes are loaded from the data table to obtain the dependent subject, statistical caliber, etc. The original field information and table association relationship of the dependent subject table are parsed from the dimension expression ROWS, and the filtering dimension, used function, function parameter and logical operator are parsed from the filtering expression WHERR. Finally, the parsed data is syntax checked to generate a logical syntax tree.

[0041] S302, converting the generated logical syntax tree into a logical execution operator according to the syntax keywords; S303. Define an executor interface based on the logic execution operator, and implement it on different platforms to obtain a platform executor. The executor interface is used to define common rules for adapting to different execution platforms to ensure that different executor implementations can be recognized and called by the task manager. The methods for defining the executor interface include: resource initialization, indicator execution unit planning, logic execution operator sinkability marking, logic execution operator conversion, logic execution operator execution, resource destruction, and other methods.

[0042] S400, implementing each method defined in the executor interface specification in different platforms, and encapsulating them into a platform executor plug-in for each platform.

[0043] Data sources on different platforms, such as Hadoop-based big data platforms Apache Kylin, Presto / Trino, SQL Server OLAP, InterSystems IRIS, etc., have different connection methods, execution statements, and operator support levels, and need to be docked and adapted to the platform. After docking and adaptation, the executor of the platform is completed, and the implemented platform executor is encapsulated into a plug-in (defining the META-INF.services configuration file) for release to the running environment.

[0044] Execute the platform adaptation process (taking Apache Kylin platform as an example): S401. Implement a resource initialization method, in which the connection of the Kylin data source is obtained.

[0045] S402. Implement the indicator execution unit planning method, using the indicator theme, statistical caliber, and indicator filtering conditions as grouping units, and put the grouped indicator lists into one execution unit for execution.

[0046] S403. Implement a method for marking the sinkability of a logic execution operator, mark the function calls accessed in the dimension expression as non-sinkable, mark the configured fields that cannot be calculated as non-sinkable, etc.

[0047] S404. Implement the logic execution operator conversion method. For the indicator function logic execution operator, convert it into the call of SQL aggregation function, such as sum, count, max, etc.; for the dimension expression logic execution operator, it can be converted into SQL main table field or JOIN table field, and for the non-sinkable operator, it is converted into access to the main table field; the corresponding filtering condition can be converted into SQL WHERE expression.

[0048] S405, implement the logic execution operator execution method, assemble the converted logic execution operators in step S403 into a complete SQL query expression, call the data source connection in step S401 to generate a Statement, obtain a ResultSet, and encapsulate the ResultSet into an intermediate data set interface IDS.

[0049] S406: Implement the resource destruction method, call the close method of the Connection created in step S401 to close the data source connection.

[0050] S500. Define the task manager, identify and register the platform executor, parse the query syntax into logical execution operators according to the query syntax of the indicator query language of the statistical indicator, divide it into different execution units, identify the platform executor to be called by the statistical indicator according to the configuration items, and call the platform executor to obtain the intermediate data set IDS from the platform.

[0051] Scan the platform executor plug-in published in the running environment, initialize the platform executor and register it with the task manager. Based on the queried statistical indicators, parse the query syntax of the query language of the statistical indicators into logical execution operators, and then obtain the indicator list according to the logical execution operator. Group the indicator list according to the platform executor, divide the indicator list into one or more task execution units, put the task execution unit into the scheduling executor for execution, and obtain one or more intermediate data set IDS returned by the platform executor.

[0052] S600: Process the intermediate data set IDS, corresponding statistical indicator attributes and logical execution operators into a final indicator data set KDS.

[0053] The processing of the final indicator dataset KDS includes: Group the intermediate data set IDS into a data set InternalGroupDS according to the dimension field list; Collect the non-sinkable logical execution operators, recalculate them on InternalGroupDS, and generate GroupDS; According to the configuration in the syntax keyword PROS, determine to organize GroupDS into a horizontally expanded data set or a vertically expanded data set; If the data set column contains the same period and previous period, the date is recalculated and restored to the value of the statistical date interval; If the call of the target value is included, the target value function is called to calculate the target value of the indicator; If there are requirements for indicator data formatting, format the results according to the display attributes in the statistical indicator properties; Generate the final indicator dataset KDS.

[0054] Through the platform actuator registration strategy based on genetic algorithm, the configuration of actuators is automatically screened and optimized, so that each platform actuator can play the best performance in a specific task. The performance of the platform actuator is evaluated through the fitness function, and the optimization is continuously iterated through genetic operations. Using the neural network language model, we build a query parser that learns the structure and meaning of query statements through training to improve parsing speed and accuracy. We use the attention mechanism to focus on key information and reduce ambiguity in the parsing process. Apply reinforcement learning algorithms to adjust the matching relationship between tasks and executors in real time, and dynamically allocate resources according to the urgency of the task and the current load of the platform executors to minimize task completion time and resource waste; Combine time series analysis and machine learning algorithms to predict the future performance of platform actuators and adjust the task execution order in advance; A fault recovery strategy based on simulated annealing algorithm is designed to find alternative solutions and reschedule tasks when the platform executor fails.

[0055] See also Figure 2 , which is a medical data indicator query statement generation system based on statistical indicators, including an attribute definition module 100, a syntax parsing module 200, an actuator interface definition module 300, a platform adaptation module 400, an intermediate data set receiving module 500 and an indicator data set generation module 600.

[0056] The attribute definition module 100 is used to define attributes of statistical indicators.

[0057] The grammar parsing module 200 is used to define the query grammar of the query language of the statistical index, use ANTLR4 to represent the query grammar using a .g4 file, and generate a Java grammar parsing code from the .g4 file.

[0058] The executor interface definition module 300 is used to convert the syntax in the Java syntax parsing code into a logical execution operator and define the executor interface specification. The executor interface specification includes executor resource initialization, indicator execution unit planning, whether the logical execution operator can be marked as sinking, logical execution operator conversion, logical execution operator execution and executor resource destruction.

[0059] The platform adaptation module 400 is used to implement various methods defined in the executor interface specification in different platforms and encapsulate them into platform executor plug-ins for various platforms.

[0060] The intermediate data set receiving module 500 is used to define the task manager, identify and register the platform executor, parse the query syntax into logical execution operators according to the query syntax of the indicator query language of the statistical indicator, divide it into different execution units, identify the platform executor to be called by the statistical indicator according to the configuration items, and call the platform executor to obtain the intermediate data set IDS from the platform.

[0061] The indicator data set generation module 600 is used to process the intermediate data set IDS, the corresponding statistical indicator attributes and the logical execution operator into a final indicator data set KDS.

[0062] Among them, the attributes of statistical indicators include business attributes, management attributes, data attributes, display attributes, and technical attributes; the business attributes include field, business domain and business description, the management attributes include management department, responsible department and control direction, the data attributes include statistical caliber, calculation formula, conditions and data lineage, the display attributes include display name, decimal places and conversion units, and the technical attributes include coding, development status, dependent subject, aggregation function and data formula.

[0063] The query syntax keywords include WITH, USING, SELECT, ROWS, COLUMNS, WHERE, SORT, LIMIT and / or PORS syntax keywords.

[0064] WITH means naming the entire query result, USING means using the data set result defined in WITH for recalculation, SELECT means a query, ROWS means dimension columns, COLUMNS means indicator columns, WHERE means filtering the COLUMNS indicator data part, SORT means sorting the returned data set, LIMIT means paging the returned data set, and PORS means the configuration properties of the query language for statistical indicators.

[0065] Among them, based on the Java syntax parsing code, the syntax is converted into a logical execution operator, and the definition of the executor interface includes: Use ANTLR4 to generate a Java syntax node access interface from the .g4 file, inherit the Java syntax node access interface, implement the visit method of different nodes of the syntax analysis tree, extract the syntax expression content from the Java syntax parsing code and parse it according to the syntax tree context parameters, perform syntax checking on the parsed data, and generate a logical syntax tree; According to the grammatical keywords, the generated logical syntax tree is converted into a logical execution operator; Define the actuator interface specification, and implement different platforms based on the actuator interface to obtain the platform actuator.

[0066] Among them, the task manager is defined, the platform executor is identified and registered, the query syntax of the query language of the statistical indicator is parsed into a logical execution operator, divided into different execution units, the platform executor to be called by the statistical indicator is identified according to the configuration item, and the platform executor is called to obtain the intermediate data set IDS from the platform and calculate the final indicator data set, including: Scan the platform executor plug-in published in the running environment, initialize the platform executor and register it with the task manager. Based on the queried statistical indicators, parse the query syntax of the query language of the statistical indicators into logical execution operators, and then obtain the indicator list according to the logical execution operator. Group the indicator list according to the platform executor, divide the indicator list into one or more task execution units, put the task execution unit into the scheduling executor for execution, and obtain one or more intermediate data set IDS returned by the platform executor.

[0067] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described with reference to the preferred embodiments of the present invention, it should be understood by those skilled in the art that various changes may be made in form and details without departing from the spirit and scope of the present invention as defined in the appended claims.

Claims

1. A method for generating medical data index query statements based on statistical indicators, characterized in that: include: Define the attributes of statistical indicators; Define the query grammar of the query language for statistical indicators, use ANTLR4 to represent the query grammar in a .g4 file, and generate Java grammar parsing code from the .g4 file; Convert the syntax in the Java syntax parsing code into a logical execution operator and define the executor interface specification, which includes executor resource initialization, indicator execution unit planning, whether the logical execution operator can be marked as sinking, logical execution operator conversion, logical execution operator execution and executor resource destruction; Implement the methods defined in the executor interface specification on different platforms and encapsulate them into platform executor plug-ins for each platform. Define the task manager, identify and register the platform executor, parse the query syntax into logical execution operators according to the query syntax of the indicator query language of the statistical indicator, divide it into different execution units, identify the platform executor to be called by the statistical indicator according to the configuration items, and call the platform executor to obtain the intermediate data set IDS from the platform; The intermediate data set IDS, the corresponding statistical indicator attributes and the logical execution operator are processed into the final indicator data set KDS.

2. The method for generating a query statement of medical data indicators based on statistical indicators according to claim 1, characterized in that: The attributes of the statistical indicators include business attributes, management attributes, data attributes, display attributes, and technical attributes; the business attributes include field, business domain and business description, the management attributes include management department, responsible department and control direction, the data attributes include statistical caliber, calculation formula, conditions and data lineage, the display attributes include display name, decimal places and conversion units, and the technical attributes include coding, development status, dependent subject, aggregation function and data formula.

3. The method for generating medical data index query statements based on statistical indexes according to claim 1, characterized in that: The query syntax keywords include WITH, USING, SELECT, ROWS, COLUMNS, WHERE, SORT, LIMIT and / or PORS syntax keywords; WITH means naming the entire query result, USING means using the data set result defined in WITH for recalculation, SELECT means a query, ROWS means dimension columns, COLUMNS means indicator columns, WHERE means filtering the COLUMNS indicator data part, SORT means sorting the returned data set, LIMIT means paging the returned data set, and PORS means the configuration properties of the query language for statistical indicators.

4. The method for generating a query statement of medical data indicators based on statistical indicators according to claim 3, characterized in that: The conversion of the grammar in the Java grammar parsing code into a logical execution operator and the definition of the executor interface specification include: Use ANTLR4 to generate a Java syntax node access interface from the .g4 file, inherit the Java syntax node access interface, implement the visit method of different nodes of the syntax analysis tree, extract the syntax expression content from the Java syntax parsing code and parse it according to the syntax tree context parameters, perform syntax checking on the parsed data, and generate a logical syntax tree; According to the grammatical keywords, the generated logical syntax tree is converted into a logical execution operator; Define the actuator interface specification, and implement different platforms based on the actuator interface to obtain the platform actuator.

5. The method for generating a query statement of medical data indicators based on statistical indicators according to claim 1, characterized in that: The process of defining a task manager, identifying and registering a platform executor, parsing the query syntax of the query language of the statistical indicator into a logical execution operator according to the query syntax of the statistical indicator, dividing the query into different execution units, identifying the platform executor to be called by the statistical indicator according to the configuration item, and calling the platform executor to obtain the intermediate data set IDS from the platform includes: Based on the statistical indicators of the query, the query syntax of the query language of the statistical indicators is parsed into logical execution operators, and then the indicator list is obtained according to the logical execution operator. The indicator list is grouped according to the platform executor, and the indicator list is divided into one or more task execution units. The task execution units are placed in the scheduling executor for execution, and one or more intermediate data set IDSs are obtained returned by the platform executor.

6. A medical data index query statement generation system based on statistical indicators, characterized in that: It includes an attribute definition module, a syntax parsing module, an actuator interface definition module, a platform adaptation module, an intermediate data set receiving module and an indicator data set generation module; The attribute definition module is used to define the attributes of statistical indicators; The grammar parsing module is used to define the query grammar of the query language of the statistical indicators, use ANTLR4 to represent the query grammar using a .g4 file, and generate a Java grammar parsing code from the .g4 file; The executor interface definition module is used to convert the syntax in the Java syntax parsing code into a logic execution operator, and define the executor interface specification, which includes executor resource initialization, indicator execution unit planning, whether the logic execution operator can sink the mark, logic execution operator conversion, logic execution operator execution and executor resource destruction; The platform adapter module is used to implement the methods defined in the actuator interface specification on different platforms and encapsulate them into platform actuator plug-ins for each platform; The intermediate data set receiving module is used to define a task manager, identify and register a platform executor, parse the query syntax into a logical execution operator according to the query syntax of the indicator query language of the statistical indicator, divide it into different execution units, identify the platform executor to be called by the statistical indicator according to the configuration item, and call the platform executor to obtain the intermediate data set IDS from the platform; The indicator data set generation module is used to process the intermediate data set IDS, the corresponding statistical indicator attributes and the logical execution operator into a final indicator data set KDS.

7. The medical data index query statement generation system based on statistical index according to claim 6, characterized in that: The attributes of the statistical indicators include business attributes, management attributes, data attributes, display attributes, and technical attributes; the business attributes include field, business domain and business description, the management attributes include management department, responsible department and control direction, the data attributes include statistical caliber, calculation formula, conditions and data lineage, the display attributes include display name, decimal places and conversion units, and the technical attributes include coding, development status, dependent subject, aggregation function and data formula.

8. The medical data index query statement generation system based on statistical indexes according to claim 6, characterized in that: The query syntax keywords include WITH, USING, SELECT, ROWS, COLUMNS, WHERE, SORT, LIMIT and / or PORS syntax keywords; WITH means naming the entire query result, USING means using the data set result defined in WITH for recalculation, SELECT means a query, ROWS means dimension columns, COLUMNS means indicator columns, WHERE means filtering the COLUMNS indicator data part, SORT means sorting the returned data set, LIMIT means paging the returned data set, and PORS means the configuration properties of the query language for statistical indicators.

9. The medical data index query statement generation system based on statistical indexes according to claim 8, characterized in that: The conversion of the grammar in the Java grammar parsing code into a logical execution operator and the definition of the executor interface specification include: Use ANTLR4 to generate a Java syntax node access interface from the .g4 file, inherit the Java syntax node access interface, implement the visit method of different nodes of the syntax analysis tree, extract the syntax expression content from the Java syntax parsing code and parse it according to the syntax tree context parameters, perform syntax checking on the parsed data, and generate a logical syntax tree; According to the grammatical keywords, the generated logical syntax tree is converted into a logical execution operator; Define the actuator interface specification, and implement different platforms based on the actuator interface to obtain the platform actuator.

10. The medical data index query statement generation system based on statistical index according to claim 6, characterized in that: Define the task manager, identify and register the platform executor, parse the query syntax into logical execution operators according to the query syntax of the statistical indicator query language, divide it into different execution units, identify the platform executor to be called by the statistical indicator according to the configuration items, and call the platform executor to obtain the intermediate data set IDS from the platform, including: Based on the statistical indicators of the query, the query syntax of the query language of the statistical indicators is parsed into logical execution operators, and then the indicator list is obtained according to the logical execution operator. The indicator list is grouped according to the platform executor, and the indicator list is divided into one or more task execution units. The task execution units are placed in the scheduling executor for execution, and one or more intermediate data set IDSs are obtained returned by the platform executor.

Citation Information

Patent Citations

  • Cross-platform unified big data SQL query method

    CN110059103A

  • Unified SQL method, system, equipment, and medium

    CN113836164A

  • Unified calculation method and device for different fields of multiple social media platforms

    CN118245498A

  • SQL unification method, system, and device, and medium

    WO2021259367A1