Statistical index-based medical data index query statement generation method and system
By defining query syntax and generating Java syntax parsing code, which is then converted into logical execution operators, the problem of repetitive query statement design caused by different database platforms is solved. This achieves cross-platform query statement standardization and reusability, and improves statistical analysis efficiency.
Patent Information
- Application Number
- CN202411893524.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-12-20
AI Technical Summary
In existing technologies, the differences between different database platforms require repeated design of query statements, and the statistical analysis workload is large, lacking standardization and reusability.
A query statement generation method based on statistical indicators is adopted. The query syntax is defined using ANTLR4, Java syntax parsing code is generated, which is converted into logical execution operators, and the executor interface specification is defined to realize cross-platform query statement generation, including attribute definition, syntax parsing, executor interface definition, platform adaptation, and dataset generation.
It achieves cross-platform query standardization, solves the problem of duplicate query design caused by different database platforms, and improves the reusability and efficiency of statistical analysis.
Smart Images

Figure CN119781771B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical system data processing technology, specifically to a method and system for generating medical data indicator query statements based on statistical indicators. Background Technology
[0002] In statistical query scenarios, OLAP calculations are the primary method. For example, to statistically analyze the number of visits to a specific branch of a medical institution over a period of time, technicians first need to analyze which database tables are used, what relationships exist between the tables, determine which table to use as the driving table, then determine which field of the database table to use as the statistical criterion, and which field and calculation function to use to obtain the number of visits during this period. Finally, based on the database product used, they need to write SQL dialects specific to the platform or write code line by line using programming languages such as Python, Java, or Go to complete the final data for the above statistical scenario.
[0003] Based on the above process, the workload for each project in statistical analysis is substantial. Therefore, how to standardize and reusable this statistical analysis, overcome the differences between different database platforms and specific execution processes, etc., are problems that current technical solutions need to address. Summary of the Invention
[0004] To address the shortcomings of the existing technologies, this invention aims to provide a method and system for generating medical data indicator query statements based on statistical indicators, thereby solving the problem that query statements need to be redesigned due to differences in execution processes caused by different database platforms.
[0005] To solve the above problems, the present invention adopts the following technical solution:
[0006] On one hand, this invention provides a method for generating medical data indicator query statements based on statistical indicators, including:
[0007] Define the attributes of statistical indicators;
[0008] The query syntax of the query language for statistical indicators is defined, and ANTLR4 is used to represent the query syntax using .g4 files. The .g4 files are then used to generate Java syntax parsing code.
[0009] The syntax in the Java syntax parsing code is converted into logical execution operators, and the executor interface specification is defined. 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.
[0010] Implement the methods defined in the executor interface specification on different platforms and encapsulate them into platform executor plugins for each platform.
[0011] Define a task manager, identify and register platform executors, parse the query syntax into logical execution operators according to the query syntax of the statistical indicator query language, divide them into different execution units, identify the platform executor to be called by the statistical indicators according to the configuration items, and call the platform executor to obtain the intermediate dataset IDS from the platform.
[0012] The intermediate dataset IDS, the corresponding statistical indicator attributes, and the logical execution operators are processed into the final indicator dataset KDS.
[0013] As one possible implementation, the attributes of the statistical indicators include business attributes, management attributes, data attributes, display attributes, and technical attributes; the business attributes include domain, business area, and business description; the management attributes include management department, responsible department, and control direction; the data attributes include statistical scope, calculation formula, conditions, and data lineage; the display attributes include display name, decimal places retained, and conversion unit; and the technical attributes include coding, development status, dependent topics, aggregate functions, and data formulas.
[0014] As one possible implementation, the syntax keywords of the query syntax include WITH, USING, SELECT, ROWS, COLUMNS, WHERE, SORT, LIMIT and / or PORS syntax keywords;
[0015] WITH indicates that the entire query result is named, USING indicates that the dataset results defined in WITH are used for further calculation, SELECT indicates a query, ROWS indicates dimension columns, COLUMNS indicates indicator columns, WHERE indicates filtering of the COLUMNS indicator data portion, SORT indicates sorting of the returned dataset, LIMIT indicates pagination of the returned dataset, and PORS indicates the configuration property of the query language for statistical indicators.
[0016] As one possible implementation, the process of converting the syntax in the Java syntax parsing code into logical execution operators and defining the executor interface specification includes:
[0017] Using ANTLR4, a Java syntax node access interface is generated from the .g4 file. This interface is inherited and the visit method of different nodes in the syntax analysis tree is implemented. Based on the syntax tree context parameters, the syntax expression content is extracted from the Java syntax parsing code and parsed. The parsed data is then subjected to syntax checking to generate a logical syntax tree.
[0018] Based on the syntax keywords, the generated logical syntax tree is converted into logical execution operators;
[0019] Define the executor interface specification, and implement it on different platforms based on the executor interface to obtain the platform executor.
[0020] As one possible implementation, the defined task manager identifies and registers platform executors, parses the query syntax into logical execution operators based on the query syntax of the statistical indicator's query language, divides them into different execution units, identifies the platform executor to be called based on configuration items, and calls the platform executor to obtain the intermediate dataset IDS from the platform, including:
[0021] Based on the query-based statistical metrics, the query syntax of the query language of the statistical metrics is parsed into logical execution operators. Then, a list of metrics is obtained according to the logical execution operators. The list of metrics is grouped according to the platform executor, and the list of metrics is divided into one or more task execution units. The task execution units are placed in the scheduler executor for execution, and one or more intermediate datasets (IDS) are returned by the platform executor.
[0022] On the other hand, the present invention provides a medical data indicator query statement generation system based on statistical indicators, including an attribute definition module, a syntax parsing module, an executor interface definition module, a platform adaptation module, an intermediate dataset receiving module, and an indicator dataset generation module.
[0023] The attribute definition module is used to define the attributes of statistical indicators;
[0024] The syntax parsing module is used to define the query syntax of the query language for statistical indicators, use ANTLR4 to represent the query syntax using a .g4 file, and generate Java syntax parsing code from the .g4 file;
[0025] The executor interface definition module is used to convert the syntax in the Java syntax parsing code into logical execution operators, and to define the executor interface specification. The executor interface specification includes executor resource initialization, indicator execution unit planning, whether the logical execution operator can be sunk, logical execution operator conversion, logical execution operator execution, and executor resource destruction.
[0026] The platform adaptation module is used to implement the methods defined in the executor interface specification on different platforms and encapsulate them into platform executor plugins for each platform.
[0027] The intermediate dataset receiving module 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 statistical indicator query language, divide them 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 dataset IDS from the platform.
[0028] The indicator dataset generation module is used to process the intermediate dataset IDS, the corresponding statistical indicator attributes, and the logical execution operators into the final indicator dataset KDS.
[0029] As one possible implementation, the attributes of the statistical indicators include business attributes, management attributes, data attributes, display attributes, and technical attributes; the business attributes include domain, business area, and business description; the management attributes include management department, responsible department, and control direction; the data attributes include statistical scope, calculation formula, conditions, and data lineage; the display attributes include display name, decimal places retained, and conversion unit; and the technical attributes include coding, development status, dependent topics, aggregate functions, and data formulas.
[0030] As one possible implementation, the syntax keywords of the query syntax include WITH, USING, SELECT, ROWS, COLUMNS, WHERE, SORT, LIMIT and / or PORS syntax keywords;
[0031] WITH indicates that the entire query result is named, USING indicates that the dataset results defined in WITH are used for further calculation, SELECT indicates a query, ROWS indicates dimension columns, COLUMNS indicates indicator columns, WHERE indicates filtering of the COLUMNS indicator data portion, SORT indicates sorting of the returned dataset, LIMIT indicates pagination of the returned dataset, and PORS indicates the configuration property of the query language for statistical indicators.
[0032] As one possible implementation, the process of converting the syntax in the Java syntax parsing code into logical execution operators and defining the executor interface specification includes:
[0033] Using ANTLR4, a Java syntax node access interface is generated from the .g4 file. This interface is inherited and the visit method of different nodes in the syntax analysis tree is implemented. Based on the syntax tree context parameters, the syntax expression content is extracted from the Java syntax parsing code and parsed. The parsed data is then subjected to syntax checking to generate a logical syntax tree.
[0034] Based on the syntax keywords, the generated logical syntax tree is converted into logical execution operators;
[0035] Define the executor interface specification, and implement it on different platforms based on the executor interface to obtain the platform executor.
[0036] As one possible implementation, a task manager is defined to identify and register platform executors. Based on the query syntax of the statistical indicator's query language, the query syntax is parsed into logical execution operators, divided into different execution units, and the platform executor to be invoked by the statistical indicators is identified based on configuration items. The platform executor is then invoked to retrieve the intermediate dataset (IDS) from the platform, including:
[0037] Based on the query-based statistical metrics, the query syntax of the query language of the statistical metrics is parsed into logical execution operators. Then, a list of metrics is obtained according to the logical execution operators. The list of metrics is grouped according to the platform executor, and the list of metrics is divided into one or more task execution units. The task execution units are placed in the scheduler executor for execution, and one or more intermediate datasets (IDS) are returned by the platform executor.
[0038] The beneficial effects of this invention are as follows: This invention provides a query statement directly based on indicators. This query statement is standardized and does not change with the implementation platform. It solves the problem that technicians need to adapt to different database dialects when writing SQL or that technicians need to implement it through programming. It clarifies the definition elements of statistical indicators and expresses statistical needs using indicator query statements, thus solving the problems of knowledge accumulation, reusability, and understanding and communication of statistical needs. Attached Figure Description
[0039] Figure 1 This is a flowchart of a method for generating medical data indicator query statements based on statistical indicators in an embodiment of the present invention.
[0040] Figure 2 This is a schematic diagram of a medical data indicator query statement generation system based on statistical indicators in an embodiment of the present invention. Detailed Implementation
[0041] The present invention will be further described in detail below with reference to specific embodiments.
[0042] It should be noted that these embodiments are only used to illustrate the present invention and are not intended to limit the present invention. Simple improvements to the method under the premise of the present invention are all within the scope of protection claimed by the present invention.
[0043] See Figure 1 This is a method for generating medical data indicator query statements based on statistical indicators, including:
[0044] S100, Define the attributes of statistical indicators.
[0045] The attributes of statistical indicators include business attributes, management attributes, data attributes, display attributes, and technical attributes. The business attributes include domain, business area, 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 unit. The technical attributes include coding, development status, dependent topics, aggregate functions, and data formulas.
[0046] S200. Define the query syntax for the query language of statistical indicators, use ANTLR4 to represent the query syntax using a .g4 file, and generate Java syntax parsing code from the .g4 file. Run the command antlr4 -Dlanguage=javaKpiGrammarRule.g4 to generate Java language and generate Java-based syntax parsing code.
[0047] The syntax for defining the indicator query language includes:
[0048] [WITH Dataset Name] [USING Dataset Name] SELECT [ROWS Dimension Expression List] COLUMNS Metric Expression List WHERE Filter Expression [SORT(Sort Field List)] [LIMIT(Pagination Parameter)] [PROS(Attribute Configuration List)].
[0049] The syntax keywords for query syntax include WITH, USING, SELECT, ROWS, COLUMNS, WHERE, SORT, LIMIT, and / or PORS.
[0050] The syntax for keyword representation is explained as follows:
[0051] WITH dataset_name: Optional. Indicates that the entire query result can be named (dataset result), and the name follows the WITH keyword.
[0052] USING Dataset Name: Optional. Indicates that the results of the dataset defined in WITH are used for further calculations.
[0053] SELECT: This is a keyword and a required part. It indicates that this is a query.
[0054] ROWS Dimension Expression: Optional. Represents the dimension columns, i.e., the rows of data in the dataset, expanded vertically. Multiple dimension expressions can be written.
[0055] Dimension expressions can be accessed hierarchically using the -> operator based on table relationships; dimensions can also be expressed as fixed values using literal values. The colon ":" operator can then be used to call a function, allowing further calculations to be performed on the preceding values.
[0056] COLUMNS Indicator Expression: Required part. Represents the indicator column, i.e., the dataset. Multiple indicator expressions can be written according to the horizontally expanded column data. The indicators in the indicator expression are represented using the codes in the indicator technical attributes defined in S100, which are similar to function names.
[0057] The WHERE clause is a filter expression, a necessary part. It indicates the filtering of the COLUMNS indicator data, serving as a data selection tool.
[0058] A filter expression is a recursive call that connects different filter expressions using logical operators (||, OR, &&, AND). It can filter dimensional data or indicator values. Statistical filtering conditions are also essential.
[0059] SORT: The sorting expression, optional. Indicates the sorting of the returned dataset.
[0060] LIMIT: Data pagination expression, optional. Indicates pagination of the returned dataset.
[0061] PROS: Configuration expression, optional. Represents the configuration attributes of the indicator query statement, controlling the execution process and results. For example, col_mode=h indicates expanded display of horizontal indicator columns, and col_mode=v indicates expanded display of vertical indicator columns.
[0062] Running the command `antlr4 -Dlanguage=java KpiGrammarRule.g4` generates Java-based parsing code. The parsing code includes: token streams: `KpiGrammarRule.tokens` and `KpiGrammarRuleLexer.tokens`, a lexical lexer: `KpiGrammarRuleLexer.java`, and a parser: `KpiGrammarRuleParser.java` and `KpiGrammarRuleVisitor.java`.
[0063] S300. Convert the syntax in the Java syntax parsing code into logical execution operators, 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.
[0064] This embodiment provides an implementable approach:
[0065] S301. Using ANTLR4, generate a Java syntax node access interface from the .g4 file. Inherit the Java syntax node access interface and implement the visit method for different nodes of the syntax analysis tree. Based on the syntax tree context parameters, extract and parse the grammar expression content from the Java syntax parsing code. Perform syntax checking on the parsed data and generate a logical syntax tree. For example, generate a binary tree from a filter expression, a linear list from a dimension expression, and a Map key-value pair from an attribute configuration (configuration attributes of the query language for statistical indicators expressed by the PROS keyword).
[0066] Extract and parse the content of the syntactic expression, including:
[0067] Extracting syntax expression content includes: technical attribute encoding, indicator calculation expression, dimension expression, filtering conditions, attribute configuration, column aliases, etc.
[0068] Based on the indicator code, statistical indicator attributes are loaded from the data table to obtain dependent topics, statistical definitions, etc. The original field information and table relationships of the dependent topic table are parsed from the dimension expression ROWS. The filter dimension, used function, function parameters, and logical operators are parsed from the filter expression WHERR. Finally, the parsed data is syntax-checked to generate a logical syntax tree.
[0069] S302. Based on the syntax keywords, convert the generated logical syntax tree into logical execution operators;
[0070] S303. Define an executor interface based on logical execution operators and implement it for different platforms to obtain platform executors. The executor interface is used to define general rules for adapting to different execution platforms, ensuring that different executor implementations can be recognized and called by the task manager. The methods defined in the executor interface include: resource initialization, indicator execution unit planning, logical execution operator sinkability marking, logical execution operator conversion, logical execution operator execution, resource destruction, etc.
[0071] S400: Implement the methods defined in the executor interface specification on different platforms and encapsulate them into platform executor plugins for each platform.
[0072] Data sources from different platforms, such as Apache Kylin, Presto / Trino, SQL Server OLAP, and InterSystems IRIS based on Hadoop big data platforms, have different connection methods, execution statements, and operator support levels. Platform integration and adaptation are required. After integration and adaptation, the executor for that platform is completed. The implemented platform executor is then packaged into a plugin (defined in the META-INF.services configuration file) for deployment to the runtime environment.
[0073] The adaptation process for the execution platform (taking the Apache Kylin platform as an example):
[0074] S401. Implement the resource initialization method, in which the Kylin data source connection (Connection) is obtained.
[0075] S402. Implement the indicator execution unit planning method, grouping indicators by their respective themes, statistical definitions, and indicator filtering conditions, and then placing the grouped indicator lists into one execution unit for simultaneous execution.
[0076] S403. Implement a method for marking the sinkability of logical execution operators, marking function calls accessed in dimension expressions as non-sinkable, and marking configured fields that cannot be calculated as non-sinkable, etc.
[0077] S404. Implement a method for converting logical execution operators. For indicator function logical execution operators, convert them into SQL aggregate function calls, such as SUM, COUNT, MAX, etc. For dimension expression logical execution operators, convert them into SQL main table fields or JOIN table fields. For non-sinkable operators, convert them into accessing main table fields. Corresponding filtering conditions can be converted into SQL WHERE expressions.
[0078] S405. Implement the logical execution operator execution method, assemble the logical execution operators transformed 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 dataset interface IDS.
[0079] S406. Implement the resource destruction method. The Connection created in step S401 calls the close method to close the data source connection.
[0080] S500 defines a task manager, identifies and registers platform executors, parses the query syntax into logical execution operators based on the query syntax of the statistical indicator query language, divides them into different execution units, identifies the platform executor to be called by the statistical indicators based on the configuration items, and calls the platform executor to obtain the intermediate dataset IDS from the platform.
[0081] Scan the platform executor plugins released in the runtime environment, initialize the platform executor and register it in the task manager. Based on the query statistics, parse the query syntax of the statistical metric query language into logical execution operators, then obtain the metric list according to the logical execution operators, group the metric list according to the platform executor, divide the metric list into one or more task execution units, put the task execution units into the scheduler executor for execution, and obtain one or more intermediate datasets (IDS) returned by the platform executor.
[0082] S600. The intermediate dataset IDS, the corresponding statistical indicator attributes, and the logical execution operators are processed into the final indicator dataset KDS.
[0083] The processing of the final KDS indicator dataset includes:
[0084] The intermediate dataset IDS is grouped and merged into a single dataset InternalGroupDS based on the list of dimension fields.
[0085] Collect non-sinkable logical execution operators, recompile them on InternalGroupDS, and generate GroupDS;
[0086] Based on the configuration in the syntax keyword PROS, determine whether GroupDS will be organized into a horizontally expanded dataset or a vertically expanded dataset;
[0087] If the dataset column contains the same period and previous period, the dates will be recalculated to restore the values of the statistical date range;
[0088] If a call to a target value is included, then the target value function is called to calculate the target value of the indicator;
[0089] If there are requirements for formatting indicator data, format the results according to the displayed attributes in the statistical indicator's properties;
[0090] Generate the final index dataset KDS.
[0091] By adopting a platform executor registration strategy based on genetic algorithms, the configuration of executors is automatically screened and optimized, so that each platform executor can perform at its best in a specific task. The performance of the platform executor is evaluated by a fitness function and continuously optimized through genetic operations.
[0092] By utilizing a neural network language model, a query parser is constructed. Through training, the parser learns the structure and meaning of query statements, thereby improving parsing speed and accuracy. An attention mechanism is employed to focus on key information and reduce ambiguity during the parsing process.
[0093] By applying reinforcement learning algorithms, the matching relationship between tasks and executors is adjusted in real time, and resources are dynamically allocated according to the urgency of the tasks and the current load of the platform executors, so as to minimize task completion time and resource waste.
[0094] By combining time series analysis and machine learning algorithms, the future performance of the platform executor can be predicted, and the task execution order can be adjusted in advance.
[0095] Design a fault recovery strategy based on simulated annealing algorithm to find alternative solutions and reschedule tasks when the platform executor fails.
[0096] See Figure 2 This 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 executor interface definition module 300, a platform adaptation module 400, an intermediate dataset receiving module 500, and an indicator dataset generation module 600.
[0097] The attribute definition module 100 is used to define the attributes of statistical indicators.
[0098] The syntax parsing module 200 is used to define the query syntax of the query language for statistical indicators. It uses ANTLR4 to represent the query syntax using a .g4 file and generates Java syntax parsing code from the .g4 file.
[0099] The executor interface definition module 300 is used to convert the syntax in the Java syntax parsing code into logical execution operators 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, logical execution operator conversion, logical execution operator execution, and executor resource destruction.
[0100] The platform adaptation module 400 is used to implement the methods defined in the executor interface specification on different platforms and encapsulate them into platform executor plugins for each platform.
[0101] The intermediate dataset 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 statistical indicator query language, divide them 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 dataset IDS from the platform.
[0102] The indicator dataset generation module 600 is used to process the intermediate dataset IDS, the corresponding statistical indicator attributes, and the logical execution operators into the final indicator dataset KDS.
[0103] The attributes of statistical indicators include business attributes, management attributes, data attributes, display attributes, and technical attributes. The business attributes include domain, business area, 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 unit. The technical attributes include coding, development status, dependent topics, aggregate functions, and data formulas.
[0104] The query syntax keywords include WITH, USING, SELECT, ROWS, COLUMNS, WHERE, SORT, LIMIT, and / or PORS.
[0105] WITH indicates that the entire query result is named, USING indicates that the dataset results defined in WITH are used for further calculation, SELECT indicates a query, ROWS indicates dimension columns, COLUMNS indicates indicator columns, WHERE indicates filtering of the COLUMNS indicator data portion, SORT indicates sorting of the returned dataset, LIMIT indicates pagination of the returned dataset, and PORS indicates the configuration property of the query language for statistical indicators.
[0106] Among them, based on Java syntax parsing code, the syntax is converted into logical execution operators, and the executor interface is defined as follows:
[0107] Using ANTLR4, a Java syntax node access interface is generated from the .g4 file. This interface is inherited and the visit method of different nodes in the syntax analysis tree is implemented. Based on the syntax tree context parameters, the syntax expression content is extracted from the Java syntax parsing code and parsed. The parsed data is then subjected to syntax checking to generate a logical syntax tree.
[0108] Based on the syntax keywords, the generated logical syntax tree is converted into logical execution operators;
[0109] Define the executor interface specification, and implement it on different platforms based on the executor interface to obtain the platform executor.
[0110] This includes defining a task manager, identifying and registering platform executors, parsing query syntax into logical execution operators based on the query language of statistical indicators, dividing them into different execution units, identifying the platform executor to be called by the statistical indicators based on configuration items, calling the platform executor to obtain the intermediate dataset IDS from the platform, and calculating the final indicator dataset, including:
[0111] Scan the platform executor plugins released in the runtime environment, initialize the platform executor and register it in the task manager. Based on the query statistics, parse the query syntax of the statistical metric query language into logical execution operators, then obtain the metric list according to the logical execution operators, group the metric list according to the platform executor, divide the metric list into one or more task execution units, put the task execution units into the scheduler executor for execution, and obtain one or more intermediate datasets (IDS) returned by the platform executor.
[0112] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described with reference to preferred embodiments, those skilled in the art should understand that various changes in form and detail can be made without departing from the spirit and scope of the invention as defined in the appended claims.
Claims
1. A method for generating medical data indicator query statements based on statistical indicators, characterized in that, include: Define the attributes of statistical indicators; The query syntax of the query language for statistical indicators is defined, and ANTLR4 is used to represent the query syntax using .g4 files. The .g4 files are then used to generate Java syntax parsing code. The syntax in the Java syntax parsing code is converted into logical execution operators, and the executor interface specification is defined. 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. Implement the methods defined in the executor interface specification on different platforms and encapsulate them into platform executor plugins for each platform. Define a task manager, identify and register platform executors, parse the query syntax into logical execution operators according to the query syntax of the statistical indicator query language, divide them into different execution units, identify the platform executor to be called by the statistical indicators according to the configuration items, and call the platform executor to obtain the intermediate dataset IDS from the platform. The intermediate dataset IDS, the corresponding statistical indicator attributes, and the logical execution operators are processed into the final indicator dataset KDS.
2. The method for generating medical data indicator query statements 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 domain, business area, and business description; the management attributes include management department, responsible department, and control direction; the data attributes include statistical scope, calculation formula, conditions, and data lineage; the display attributes include display name, decimal places retained, and conversion unit; and the technical attributes include coding, development status, dependent topics, aggregate functions, and data formulas.
3. The method for generating medical data indicator query statements based on statistical indicators according to claim 1, characterized in that, The syntax keywords of the query syntax include WITH, USING, SELECT, ROWS, COLUMNS, WHERE, SORT, LIMIT and / or PORS syntax keywords; WITH indicates that the entire query result is named, USING indicates that the dataset results defined in WITH are used for further calculation, SELECT indicates a query, ROWS indicates dimension columns, COLUMNS indicates indicator columns, WHERE indicates filtering of the COLUMNS indicator data portion, SORT indicates sorting of the returned dataset, LIMIT indicates pagination of the returned dataset, and PORS indicates the configuration property of the query language for statistical indicators.
4. The method for generating medical data indicator query statements based on statistical indicators according to claim 3, characterized in that, The process of converting the syntax in Java syntax parsing code into logical execution operators and defining the executor interface specification includes: Using ANTLR4, a Java syntax node access interface is generated from the .g4 file. This interface is inherited and the visit method of different nodes in the syntax analysis tree is implemented. Based on the syntax tree context parameters, the syntax expression content is extracted from the Java syntax parsing code and parsed. The parsed data is then subjected to syntax checking to generate a logical syntax tree. Based on the syntax keywords, the generated logical syntax tree is converted into logical execution operators; Define the executor interface specification, and implement it on different platforms based on the executor interface to obtain the platform executor.
5. The method for generating medical data indicator query statements based on statistical indicators according to claim 1, characterized in that, The defined task manager identifies and registers platform executors, parses the query syntax into logical execution operators based on the query language of statistical indicators, divides them into different execution units, identifies the platform executor to be called by the statistical indicators based on configuration items, and calls the platform executor to obtain the intermediate dataset IDS from the platform, including: Based on the query-based statistical metrics, the query syntax of the query language of the statistical metrics is parsed into logical execution operators. Then, a list of metrics is obtained according to the logical execution operators. The list of metrics is grouped according to the platform executor, and the list of metrics is divided into one or more task execution units. The task execution units are placed in the scheduler executor for execution, and one or more intermediate datasets (IDS) are returned by the platform executor.
6. A system for generating medical data indicator query statements based on statistical indicators, characterized in that, It includes an attribute definition module, a syntax parsing module, an executor interface definition module, a platform adaptation module, an intermediate dataset receiving module, and an indicator dataset generation module; The attribute definition module is used to define the attributes of statistical indicators; The syntax parsing module is used to define the query syntax of the query language for statistical indicators, use ANTLR4 to represent the query syntax using a .g4 file, and generate Java syntax parsing code from the .g4 file; The executor interface definition module is used to convert the syntax in the Java syntax parsing code into logical execution operators, and to 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. The platform adaptation module is used to implement the methods defined in the executor interface specification on different platforms and encapsulate them into platform executor plugins for each platform. The intermediate dataset receiving module 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 statistical indicator query language, divide them 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 dataset IDS from the platform. The indicator dataset generation module is used to process the intermediate dataset IDS, the corresponding statistical indicator attributes, and the logical execution operators into the final indicator dataset KDS.
7. The medical data indicator query statement generation system based on statistical indicators 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 domain, business area, and business description; the management attributes include management department, responsible department, and control direction; the data attributes include statistical scope, calculation formula, conditions, and data lineage; the display attributes include display name, decimal places retained, and conversion unit; and the technical attributes include coding, development status, dependent topics, aggregate functions, and data formulas.
8. The medical data indicator query statement generation system based on statistical indicators according to claim 6, characterized in that, The syntax keywords of the query syntax include WITH, USING, SELECT, ROWS, COLUMNS, WHERE, SORT, LIMIT and / or PORS syntax keywords; WITH indicates that the entire query result is named, USING indicates that the dataset results defined in WITH are used for further calculation, SELECT indicates a query, ROWS indicates dimension columns, COLUMNS indicates indicator columns, WHERE indicates filtering of the COLUMNS indicator data portion, SORT indicates sorting of the returned dataset, LIMIT indicates pagination of the returned dataset, and PORS indicates the configuration property of the query language for statistical indicators.
9. The medical data indicator query statement generation system based on statistical indicators according to claim 8, characterized in that, The process of converting the syntax in Java syntax parsing code into logical execution operators and defining the executor interface specification includes: Using ANTLR4, a Java syntax node access interface is generated from the .g4 file. This interface is inherited and the visit method of different nodes in the syntax analysis tree is implemented. Based on the syntax tree context parameters, the syntax expression content is extracted from the Java syntax parsing code and parsed. The parsed data is then subjected to syntax checking to generate a logical syntax tree. Based on the syntax keywords, the generated logical syntax tree is converted into logical execution operators; Define the executor interface specification, and implement it on different platforms based on the executor interface to obtain the platform executor.
10. The medical data indicator query statement generation system based on statistical indicators according to claim 6, characterized in that, Define a task manager, identify and register platform executors, parse the query syntax into logical execution operators based on the query language of statistical indicators, divide them into different execution units, identify the platform executor to be called by the statistical indicators based on configuration items, and call the platform executor to obtain intermediate datasets (IDS) from the platform, including: Based on the query-based statistical metrics, the query syntax of the query language of the statistical metrics is parsed into logical execution operators. Then, a list of metrics is obtained according to the logical execution operators. The list of metrics is grouped according to the platform executor, and the list of metrics is divided into one or more task execution units. The task execution units are placed in the scheduler executor for execution, and one or more intermediate datasets (IDS) are 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