Report data acquisition and display method

By optimizing SQL query statements using graph neural networks and Transformer models, the problem of query path optimization in complex multi-table join scenarios is solved, enabling intelligent report data acquisition and display, and improving query efficiency and system performance.

CN121743355APending Publication Date: 2026-03-27CHINA LIFE INSURANCE CO LTD HUBEI BRANCH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-23
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing methods for acquiring and displaying report data struggle to optimize query paths in complex multi-table scenarios, lacking intelligent analysis and automatic optimization capabilities, resulting in low query efficiency and limiting the performance and user experience of enterprise-level reporting systems.

Method used

A graph neural network is used to construct a data table relationship model. The graph structure is updated incrementally to generate the optimal table association path. The SQL query statement is optimized by combining the Transformer model and reinforcement learning algorithm to achieve intelligent report data acquisition and display.

Benefits of technology

It improves the intelligence of report data acquisition and query performance, realizes end-to-end automated report generation, and improves query efficiency and system response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121743355A_ABST
    Figure CN121743355A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of report data processing, and provides a report data acquisition and display method which comprises the following steps: constructing a data table relation model by adopting a graph neural network, encoding field constraint information to graph nodes, and outputting an optimal table association path through incremental updating; based on the association path, generating an initial SQL query statement by adopting a Transform model in combination with abstract syntax tree position coding and a timing constraint propagation algorithm; adopting a hierarchical reward mechanism reinforcement learning algorithm to optimize an SQL structure, including grammar correctness, execution efficiency and resource consumption rewards, and outputting an optimized SQL statement; executing the optimized SQL to obtain original data and preprocessing the original data into formatted data; performing aggregation calculation to obtain a report data structure; and performing visualization processing on the data structure, and outputting a final report. According to the method, the intelligence degree and query performance of report data acquisition are improved, and end-to-end automatic report generation is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of report data processing, and in particular to a report data acquisition and display method. BACKGROUND

[0002] Enterprise-level report systems are an important part of modern information management and are widely used in data analysis and decision support in various industries such as manufacturing, retail, logistics and distribution, and Internet services. The traditional report data acquisition and display process usually includes data source query, SQL statement writing, data processing, aggregation calculation, and visualization rendering. With the rapid growth of enterprise data size and the continuous improvement of business complexity, traditional report systems face challenges such as complex data source distribution, diverse table association relationships, low query performance, and low development efficiency. The key is how to intelligently construct multi-table association queries, automatically optimize SQL execution efficiency, and achieve high-quality data visualization display.

[0003] In the prior art, report data acquisition and display mainly use traditional relational database query methods and basic data processing techniques to achieve basic report generation functions. However, the existing methods lack consideration of query path optimization in complex multi-table association scenarios, making it difficult to organically combine constraint relationships between data tables and query performance optimization, lacking intelligent analysis and automatic optimization capabilities for SQL query statement structures, and resulting in the inability to adapt to high requirements for query efficiency and system response speed in large-scale data environments, limiting the overall performance and user experience of enterprise-level report systems. SUMMARY

[0004] Therefore, the present application provides a report data acquisition and display method, which solves the problem of the existing method lacking consideration of query path optimization in complex multi-table association scenarios, making it difficult to organically combine constraint relationships between data tables and query performance optimization, lacking intelligent analysis and automatic optimization capabilities for SQL query statement structures, and resulting in the inability to adapt to high requirements for query efficiency and system response speed in large-scale data environments, limiting the overall performance and user experience of enterprise-level report systems.

[0005] The technical solution of the present application is as follows: The present application provides a report data acquisition and display method, comprising the following steps: Receiving report generation requirements, constructing a data table relationship model using a graph neural network, the graph neural network encoding data table field constraint information into graph node features and updating the graph structure in an incremental manner to output an optimal table association path; Based on the optimal table association path, a Transformer model is used to generate an SQL query mode, the Transformer model uses position encoding of abstract syntax tree structure and time sequence constraint propagation algorithm, and outputs an initial SQL query statement; Based on the initial SQL query statement, a reinforcement learning algorithm with a hierarchical reward mechanism is used for structure optimization, the hierarchical reward mechanism includes syntax correctness reward, execution efficiency reward and resource consumption reward, and outputs an optimized SQL query statement; The optimized SQL query statement is executed to obtain raw data, and the raw data is preprocessed to output formatted data; Based on the formatted data, an aggregation calculation is performed to output a report data structure; The report data structure is visualized to output a final report.

[0006] On the basis of the above technical scheme, preferably, the report generation requirement is received, and a data table relationship model is constructed using a graph neural network, the graph neural network encodes data table field constraint information into graph node features, and updates the graph structure in an incremental manner to output an optimal table association path, comprising: The report generation requirement is received, and the target data table and query conditions in the report generation requirement are parsed to output a data table list and association requirement; Based on the data table list, an initial data table relationship graph is constructed, each data table is taken as a graph node, and the primary key and foreign key relationship between data tables is taken as a graph edge, and an initial relationship graph is outputted; Field constraint information of each data table in the data table list is extracted, the field constraint information includes primary key constraint, foreign key constraint, uniqueness constraint and non-empty constraint, the field constraint information is encoded into a constraint feature vector, and a constraint feature vector set is outputted; The constraint feature vector set is fused into the corresponding graph node of the initial relationship graph to obtain a constraint-aware data table relationship graph, and a constraint-aware relationship graph is outputted; The constraint-aware relationship graph is trained and learned using a graph neural network, when a data table structure change is detected, the corresponding graph node and graph edge are updated through incremental learning, and the optimal table association path is outputted.

[0007] On the basis of the above technical scheme, preferably, the field constraint information of each data table in the data table list is extracted, the field constraint information includes primary key constraint, foreign key constraint, uniqueness constraint and non-empty constraint, the field constraint information is encoded into a constraint feature vector, and a constraint feature vector set is outputted, comprising: The data dictionary information of each data table in the data table list is scanned, and field-level constraint rules are extracted, and a field constraint rule set is outputted; Classify the constraint rule set, mark the primary key constraint as the first type of constraint, mark the foreign key constraint as the second type of constraint, mark the uniqueness constraint as the third type of constraint, and mark the non-empty constraint as the fourth type of constraint, and output a classified constraint set; Set a constraint weight value for each type of constraint in the classified constraint set, and the constraint weight value is used to represent the influence degree of the constraint type on the table association path selection, and output a constraint weight mapping table; Based on the constraint weight mapping table, convert the constraint information of each data table into a fixed-dimensional numerical vector to obtain a constraint feature vector, and output a constraint feature vector set; The calculation formula for updating the corresponding graph node and graph edge through the incremental learning method is: ; Wherein, is the incremental update amount of the graph structure at the time t; is the incremental update amount of the graph structure at the time t; is the fusion balance factor of the new and old constraint information; is the modified data table set at the time t; is the constraint of the data table; is the gradient of the graph loss function ; is the constraint change sensitivity weight of the data table; is the constraint change sensitivity weight of the data table; is the newly added data table set at the time t; is the newly added data table set at the time t; is the constraint adaptability weight of the newly added data table; is the constraint adaptability weight of the newly added data table; is the constraint feature vector increment of the newly added data table.

[0008] On the basis of the above technical solutions, preferably, based on the optimal table association path, a Transformer model is used to generate an SQL query mode, the Transformer model uses a position encoding of an abstract syntax tree structure and a time sequence constraint propagation algorithm to output an initial SQL query statement, including: Based on the optimal table association path, parse the data table connection relationship and field mapping relationship in the optimal table association path, construct an initial structure of an SQL syntax tree, and output an SQL syntax tree framework; Perform position encoding of an abstract syntax tree structure on each syntax node in the SQL syntax tree framework, respectively assign different position encoding values to SQL keyword nodes, table name nodes, field name nodes and operator nodes, and output a position-encoded SQL syntax tree; ​Based on the position coding SQL syntax tree, a time-related field and a time sequence dependency relationship are identified, a time sequence constraint propagation algorithm is used to perform constraint checking and propagation calculation on the time sequence logic, and a time sequence constraint enhanced SQL syntax tree is output; The time sequence constraint enhanced SQL syntax tree is input into a Transformer model, a dependency relationship between syntax tree nodes is learned through a self-attention mechanism, a query statement sequence conforming to the SQL syntax specification is obtained, and an initial SQL query statement is output.

[0009] Based on the above technical solutions, preferably, the time sequence constraint propagation algorithm is used to perform constraint checking and propagation calculation on the time sequence logic, including: All field nodes in the position coding SQL syntax tree are scanned to identify time type fields and time-related query conditions, and a time sequence field set is output. Based on the time sequence field set, a time sequence dependency relationship between fields is analyzed, a same period relationship is marked as a first type of time sequence dependency, a period-on-period relationship is marked as a second type of time sequence dependency, and a cumulative relationship is marked as a third type of time sequence dependency, and a time sequence dependency graph is output. According to the time sequence dependency graph, time sequence logic conflicts and circular dependency problems are detected, constraint propagation correction is performed on the detected conflict nodes, and a corrected time sequence dependency graph is output. Constraint information in the corrected time sequence dependency graph is re-encoded into corresponding nodes of the SQL syntax tree, the time sequence constraint properties of the syntax tree are updated, and a time sequence constraint enhanced SQL syntax tree is output.

[0010] Based on the above technical solutions, preferably, based on the initial SQL query statement, a reinforcement learning algorithm with a hierarchical reward mechanism is used for structure optimization, the hierarchical reward mechanism includes syntax correctness reward, execution efficiency reward, and resource consumption reward, and an optimized SQL query statement is output, including: Based on the initial SQL query statement, a reinforcement learning optimization environment is constructed, the SQL query structure is taken as a state space, and the addition, deletion, and modification operations of the SQL statement are taken as an action space, and a reinforcement learning environment model is output. The initial SQL query statement is subjected to syntax correctness detection, and a syntax correctness reward value is calculated according to the detection result, and a syntax correctness reward is output. The initial SQL query statement is executed and the query execution time and resource occupation are measured, an execution efficiency reward value is calculated according to the execution time, a resource consumption reward value is calculated according to the resource occupation, and an execution efficiency reward and a resource consumption reward are output. The syntax correctness reward, the execution efficiency reward, and the resource consumption reward are weighted according to a preset weight, and a comprehensive reward value is output. Based on the comprehensive reward value, a reinforcement learning algorithm is used to iteratively optimize and adjust the SQL query structure until converging to an optimal structure, and an optimized SQL query statement is output.

[0011] On the basis of the above technical scheme, preferably, the syntax correctness reward, the execution efficiency reward and the resource consumption reward are weighted according to preset weights to output a comprehensive reward value, including: The values of the syntax correctness reward, the execution efficiency reward and the resource consumption reward are obtained, and the three reward values are normalized respectively to output a normalized reward value set; According to the business priority of SQL query optimization, reward weight parameters are set, the syntax correctness is set as the first priority weight, the execution efficiency is set as the second priority weight, and the resource consumption is set as the third priority weight, and a reward weight configuration is output; Each reward value in the normalized reward value set is weighted and calculated with the corresponding reward weight configuration to obtain a weighted reward component, and a weighted reward component set is output; All components in the weighted reward component set are summed to output a comprehensive reward value.

[0012] On the basis of the above technical scheme, preferably, the execution of the optimized SQL query statement obtains original data, and the original data is preprocessed to output formatted data, including: The optimized SQL query statement is executed, a query request is initiated to the database, an original data set returned by the query is obtained, data integrity detection and outlier identification are performed on the original data set, missing data records and abnormal data records are marked, and an original data set after quality detection is output; Based on the original data set after quality detection, data types are adaptively converted according to report display requirements, numerical data, text data and time data are respectively converted into a unified standard format, the marked missing data records are interpolated and completed, and the marked abnormal data records are modified or removed, and formatted data is output.

[0013] On the basis of the above technical scheme, preferably, the formatted data is used for aggregation calculation to output a report data structure, including: Based on the formatted data, the business attributes and data distribution characteristics of the data fields are analyzed, the aggregation dimension combination and the aggregation function type are determined according to the report requirements, the optimal aggregation calculation scheme is selected by using an adaptive aggregation strategy, the adaptive aggregation strategy dynamically adjusts the aggregation granularity according to the data size and the calculation complexity, and an aggregation calculation scheme is obtained. Based on the aforementioned aggregation calculation scheme, the formatted data is grouped according to the determined aggregation dimension combination, and the data within each group is calculated using the corresponding aggregation function to generate a data structure that includes aggregation results and metadata information, thus obtaining the report data structure.

[0014] Based on the above technical solutions, preferably, the step of visualizing the report data structure and outputting the final report includes: Based on the report data structure, the data dimension characteristics and numerical distribution patterns are analyzed. The visualization chart type is selected according to the data type and business scenario. An automatic mapping relationship between data fields and visualization elements is established. The automatic mapping relationship includes the mapping of numerical fields to coordinate axes, the mapping of category fields to legends, and the mapping of time fields to time axes, thus obtaining a visualization configuration scheme. Based on the aforementioned visualization configuration scheme, a responsive layout algorithm is used to adaptively arrange chart elements, dynamically adjusting the chart size and layout position according to the screen size and display device characteristics to generate a final report, which includes interactive functions and style definitions.

[0015] The method for acquiring and displaying report data according to the present invention has the following advantages over the prior art: (1) By integrating graph neural networks, Transformer models and reinforcement learning algorithms, the graph neural network encodes the data table field constraint information into the graph node features and constructs the optimal table association path. The abstract syntax tree position encoding and temporal constraint propagation algorithm of the Transformer model are combined to generate the initial SQL query statement. The reinforcement learning algorithm with hierarchical reward mechanism is used to automatically optimize the SQL structure, which improves the intelligence of report data acquisition and query performance. At the same time, the end-to-end automated report generation is realized through the complete data preprocessing, aggregation calculation and visualization processing flow. (2) By integrating graph neural networks and constraint awareness mechanisms, the primary key and foreign key relationships are transformed into graph structures using data table relationship graphs for table association modeling. The influence of constraint feature vectors is dynamically adjusted by combining the classification and weight mapping of field constraint information. The graph nodes and edges are incrementally learned and updated according to changes in the data table structure, which improves the accuracy of table association path selection and database structure awareness. At the same time, the quantitative expression and automated utilization of data table constraint information are realized through a complete constraint feature vector encoding mechanism. (3) By integrating the Transformer model and the abstract syntax tree position encoding technology, the SQL syntax tree framework is used to perform table relationship analysis and field mapping processing. The time-related fields and time-related dependencies are dynamically identified by the time-series constraint propagation algorithm. The time-series logical conflicts are corrected by constraint propagation based on the time-series dependency types such as year-on-year, month-on-month, and cumulative. This improves the accuracy of SQL query statement generation and the ability to handle time-series constraints. At the same time, through the complete position encoding and constraint enhancement mechanism, the automatic generation of query statements that conform to the SQL syntax specification is realized. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a flowchart of a method for acquiring and displaying report data according to the present invention. Detailed Implementation

[0018] The technical solutions of the present invention will be clearly and completely described below with reference to the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0019] Please see Figure 1 This invention provides a method for acquiring and displaying report data, comprising the following steps: Upon receiving a report generation request, a graph neural network is used to construct a data table relationship model. The graph neural network encodes the data table field constraint information into the graph node features and updates the graph structure incrementally to output the optimal table association path. Based on the optimal table association path, a Transformer model is used to generate an SQL query pattern. The Transformer model uses position encoding of an abstract syntax tree structure and a temporal constraint propagation algorithm to output an initial SQL query statement. Based on the initial SQL query statement, a reinforcement learning algorithm with a hierarchical reward mechanism is used for structural optimization. The hierarchical reward mechanism includes syntactic correctness reward, execution efficiency reward and resource consumption reward, and outputs an optimized SQL query statement. Execute the optimized SQL query statement to obtain raw data, preprocess the raw data, and output formatted data; Based on the formatted data, perform aggregation calculation, and output report data structure; Visualize the report data structure, and output the final report.

[0020] Specifically, the embodiment fuses graph neural network, Transformer model and reinforcement learning algorithm, encodes data table field constraint information into graph node features using graph neural network, constructs optimal table association path, generates initial SQL query statement combining abstract syntax tree position encoding of Transformer model and time sequence constraint propagation algorithm, and uses reinforcement learning algorithm with hierarchical reward mechanism to automatically optimize SQL structure. The embodiment solves the problems of complex multi-table association, low query efficiency and easy errors in manual SQL writing in traditional report system through comprehensive evaluation of syntax correctness reward, execution efficiency reward and resource consumption reward, improves the intelligent degree and query performance of report data acquisition, and realizes end-to-end automatic report generation through complete data preprocessing, aggregation calculation and visualization processing process.

[0021] The receiving report generation requirement adopts graph neural network to construct a data table relationship model, and the graph neural network encodes data table field constraint information into graph node features and updates the graph structure in an incremental manner to output an optimal table association path, including: Receiving report generation requirements, parsing target data tables and query conditions in the report generation requirements, and outputting a data table list and association requirements; Based on the data table list, an initial data table relationship graph is constructed, each data table is taken as a graph node, and the primary key-foreign key relationship between data tables is taken as a graph edge, and an initial relationship graph is outputted; Extract the field constraint information of each data table in the data table list, the field constraint information includes primary key constraint, foreign key constraint, uniqueness constraint and non-empty constraint, encode the field constraint information into constraint feature vectors, and output a constraint feature vector set; Fuse the constraint feature vector set into the corresponding graph nodes of the initial relationship graph to obtain a constraint-aware data table relationship graph, and output a constraint-aware relationship graph; Train and learn the constraint-aware relationship graph using graph neural network, update the corresponding graph nodes and graph edges in an incremental learning manner when detecting data table structure changes, and output the optimal table association path.

[0022] The step involves extracting field constraint information from each data table in the data table list. This field constraint information includes primary key constraints, foreign key constraints, uniqueness constraints, and NOT NULL constraints. The field constraint information is then encoded into constraint feature vectors, and a set of constraint feature vectors is output, including: Scan the data dictionary information of each data table in the data table list, extract field-level constraint rules, and output a set of field constraint rules; The set of field constraint rules is classified, with primary key constraints marked as first-class constraints, foreign key constraints as second-class constraints, uniqueness constraints as third-class constraints, and NOT NULL constraints as fourth-class constraints, and a set of classified constraints is output. For each type of constraint in the set of classification constraints, a constraint weight value is set. The constraint weight value is used to characterize the degree of influence of the constraint type on the selection of the table association path. Output the constraint weight mapping table. Based on the constraint weight mapping table, the constraint information of each data table is converted into a fixed-dimensional numerical vector to obtain the constraint feature vector, and the constraint feature vector set is output.

[0023] In one specific embodiment, the optimal table association path is selected by the following calculation formula: ; in, For data table To the data table The probability of the optimal associated path; For the first Path selection influencing factors of class constraints; For data table The Class constraint strength value; For data table The Class constraint strength value; For the first Class constraints in data tables and data table The degree of correlation and matching between them; For data table The constraint complexity index; For data table The constraint complexity index; This is a parameter for adjusting numerical stability; The topological distance decay function between tables; For data table and data table Topological distance between them; It is an exponential function.

[0024] Specifically, the optimal association path probability of the embodiment constructs a constraint-aware multi-level path optimization mechanism: first, through The four types of constraint collaborative evaluation are realized, and the product term of constraint strength Embodies the symmetric matching relationship of inter-table constraints, and the association matching degree Further quantifies the semantic similarity between constraints; then introduce constraint complexity normalization term Avoid path selection bias of high complexity table; finally, through the exponential function to amplify the path difference, and combine the topological distance decay function Consider the spatial proximity, form a dynamic path optimization strategy combining constraint awareness and topological awareness.

[0025] The embodiment fuses the four types of constraint collaborative evaluation mechanism and the topological distance decay function, uses the constraint strength symmetric matching and association matching quantization technology for multi-dimensional path evaluation, combines the constraint complexity normalization processing to dynamically adjust the path selection weight, and through the exponential function to enhance the path distinction and spatial proximity consideration, improves the accuracy and intelligent degree of data table association path selection, and through the complete constraint awareness evaluation system realizes the adaptive discovery and reliability guarantee of the optimal table association path.

[0026] The calculation formula for updating the corresponding graph node and graph edge through incremental learning is: ; Among them, is the incremental update amount of the graph structure at the moment; is the new and old constraint information fusion balance factor; is the modified data table set at the moment; is the constraint of the data table ; is the constraint change sensitivity weight of the data table ; is the newly added data table set at the moment; is the constraint adaptability weight of the newly added data table ; is the constraint feature vector increment of the newly added data table .

[0027] Specifically, the incremental update amount of the embodiment designs a differentiated constraint change awareness update strategy: through the balance factor Realize the adaptive fusion of new and old constraint information, avoid the catastrophic forgetting problem in traditional incremental learning; for the modified table set Adopting gradient-based precise update wherein the sensitivity weight According to the historical change frequency and importance of the table, dynamic adjustment is performed; for the newly added table set Adopting adaptive weight The product form of the constraint feature vector increment The gradual integration of new constraint information is realized; and a dual-path incremental learning mechanism combining gradient-driven update of the modified table and feature-driven update of the newly added table is formed.

[0028] The embodiment fuses the graph neural network and the constraint perception mechanism, converts the primary-foreign key relationship into a graph structure for table association modeling by using the data table relationship graph, dynamically adjusts the influence degree of the constraint feature vector by combining the classification processing and weight mapping of the field constraint information, and performs incremental learning update on the graph nodes and edges according to the data table structure change. The embodiment solves the problems of lack of intelligent guidance in the selection of the multi-table association path and the inability to effectively use the database constraint information in the traditional report system through the constraint-perceived relationship graph construction, improves the accuracy of the table association path selection and the database structure perception ability, and realizes the quantitative expression and automatic utilization of the data table constraint information through the complete constraint feature vector coding mechanism.

[0029] Based on the optimal table association path, a Transformer model is used to generate an SQL query mode, the Transformer model uses position encoding and time sequence constraint propagation algorithm of abstract syntax tree structure, and outputs an initial SQL query statement, including: Based on the optimal table association path, the data table connection relationship and the field mapping relationship in the optimal table association path are parsed, an initial structure of an SQL syntax tree is constructed, and an SQL syntax tree framework is output; Each syntax node in the SQL syntax tree framework is subjected to position encoding of abstract syntax tree structure, different position encoding values are respectively assigned to SQL keyword nodes, table name nodes, field name nodes and operator nodes, and a position-encoded SQL syntax tree is output; Based on the position-encoded SQL syntax tree, time-related fields and time sequence dependency relationships are identified, a time sequence constraint propagation algorithm is used to perform constraint checking and propagation calculation on the time sequence logic, and a time sequence constraint-enhanced SQL syntax tree is output; The time sequence constraint-enhanced SQL syntax tree is input into the Transformer model, the dependency relationships between the syntax tree nodes are learned through a self-attention mechanism, a query statement sequence conforming to the SQL syntax specification is obtained, and an initial SQL query statement is output.

[0030] The time sequence constraint propagation algorithm is used to perform constraint checking and propagation calculation on the time sequence logic, including: scan all field nodes in the position-encoding SQL syntax tree, identify time type fields and time-related query conditions, and output a time series field set; Based on the time series field set, analyze the time series dependency relationship between fields, mark the same period relationship as the first type of time series dependency, mark the ring period relationship as the second type of time series dependency, and mark the cumulative relationship as the third type of time series dependency. Output the time series dependency graph; According to the time series dependency graph, detect the time series logic conflict and the circular dependency problem, correct the detected conflict node by constraint propagation, and output the corrected time series dependency graph; Re-encode the constraint information in the corrected time series dependency graph into the corresponding nodes of the SQL syntax tree, update the time series constraint attribute of the syntax tree, and output the SQL syntax tree enhanced by time series constraints.

[0031] Specifically, the embodiment fuses the Transformer model and the abstract syntax tree position encoding technology, uses the SQL syntax tree framework to analyze table association relationship and field mapping processing, dynamically identifies time-related fields and time series dependency relationship by combining time series constraint propagation algorithm, and corrects time series logic conflict according to time series dependency types such as same period, ring period and cumulative. The embodiment solves the problems of inaccurate time series logic processing and lack of intelligent guidance of syntax structure in the traditional SQL generation method by using self-attention mechanism to learn the dependency relationship between syntax tree nodes, improves the accuracy of SQL query statement generation and time series constraint processing capability, and realizes automatic generation of query statements conforming to SQL syntax specifications through complete position encoding and constraint enhancement mechanism.

[0032] The initial SQL query statement is used to optimize the structure by using a hierarchical reward mechanism reinforcement learning algorithm, the hierarchical reward mechanism includes syntax correctness reward, execution efficiency reward and resource consumption reward, and the optimized SQL query statement is output, including: Based on the initial SQL query statement, a reinforcement learning optimization environment is constructed, the SQL query structure is taken as a state space, and the add, delete and modify operations of the SQL statement are taken as an action space, and a reinforcement learning environment model is output; Detect the syntax correctness of the initial SQL query statement, calculate the syntax correctness reward value according to the detection result, and output the syntax correctness reward; Execute the initial SQL query statement and measure the query execution time and resource occupation, calculate the execution efficiency reward value according to the execution time, calculate the resource consumption reward value according to the resource occupation, and output the execution efficiency reward and the resource consumption reward; The syntax correctness reward, execution efficiency reward and resource consumption reward are weighted according to the preset weight, and the comprehensive reward value is output; Based on the comprehensive reward value, a reinforcement learning algorithm is used to iteratively optimize and adjust the SQL query structure until converging to an optimal structure, and an optimized SQL query statement is output.

[0033] The syntax correctness reward, execution efficiency reward and resource consumption reward are weighted according to preset weights to output a comprehensive reward value, including: The values of the syntax correctness reward, execution efficiency reward and resource consumption reward are obtained, and the three reward values are normalized to output a set of normalized reward values. The reward weight parameters are set according to the business priority of SQL query optimization, the syntax correctness is set as the first priority weight, the execution efficiency is set as the second priority weight, and the resource consumption is set as the third priority weight, and a reward weight configuration is output. Each reward value in the set of normalized reward values is weighted and calculated with the corresponding reward weight configuration to obtain a weighted reward component, and a set of weighted reward components is output. All components in the set of weighted reward components are summed to output a comprehensive reward value.

[0034] Specifically, the embodiment fuses the reinforcement learning algorithm and the hierarchical reward mechanism, uses the syntax correctness reward, execution efficiency reward and resource consumption reward for multi-dimensional SQL query structure evaluation and iterative optimization, dynamically adjusts the influence degree of each reward component in combination with the business priority weight configuration, and automatically iteratively optimizes and adjusts the SQL query structure according to the comprehensive reward value. The embodiment solves the problems of lack of multi-dimensional performance evaluation and inability to realize intelligent structure adjustment in traditional SQL optimization methods through normalization processing and weighting calculation mechanism, and improves the execution efficiency and resource utilization rate of SQL query statements.

[0035] The execution of the optimized SQL query statement obtains the original data, and the original data is preprocessed to output formatted data, including: The optimized SQL query statement is executed, a query request is initiated to the database, an original data set returned by the query is obtained, data integrity detection and outlier identification are performed on the original data set, missing data records and abnormal data records are marked, and an original data set after quality detection is output.

[0036] In a specific embodiment, the data integrity detection and outlier identification on the original data set include: Each data record in the original data set is scanned to detect the data integrity status of each field, null fields are marked as missing marks, and values outside the preset range are marked as abnormal marks, and a data quality detection result is output. Based on the data quality detection result, the missing rate and the abnormal rate of each field are counted, a field with a missing rate exceeding a preset threshold is marked as a high-missing field, a field with an abnormal rate exceeding a preset threshold is marked as a high-abnormal field, and a field quality evaluation report is output; According to the field quality evaluation report, a quality mark vector is generated for each data record, the quality mark vector includes a missing mark bit and an abnormal mark bit, and an original data set after quality detection is output.

[0037] Based on the original data set after quality detection, data types are adaptively converted according to report display requirements, numerical data, text data and time data are respectively converted into a unified standard format, missing data records marked are interpolated and completed, and abnormal data records marked are corrected or removed, and formatted data is output.

[0038] In a specific embodiment, the adaptive conversion of data types according to the report display requirements and the correction or removal of the abnormal data records marked include: The data type characteristics of each field in the original data set after quality detection are analyzed, numerical data is uniformly converted into a standard numerical format, text data is uniformly converted into a standard character format, and time data is uniformly converted into a standard time format, and a data set with uniform types is output. For data records marked as missing in the data set with uniform types, numerical missing data is completed by using a mean interpolation method of similar data, and text and time missing data is completed by using a nearest neighbor interpolation method, and a data set with missing data completed is output. For data records marked as abnormal in the data set with missing data completed, it is judged whether to correct the numerical value or remove the record according to the abnormal degree, the data records corrected and the normal data records retained are combined, and formatted data is output.

[0039] Specifically, the embodiment fuses data quality detection and adaptive format conversion technology, uses data integrity detection and abnormal value identification mechanism to perform original data set quality evaluation and mark processing, dynamically generates a field quality evaluation report and a quality mark vector in combination with missing rate and abnormal rate statistics, and uniformly converts numerical, text and time data according to data type characteristics. The embodiment intelligently completes missing data by using a mean interpolation method and a nearest neighbor interpolation method, and solves the problems of incomplete data quality detection and lack of adaptive ability in format conversion in traditional data preprocessing by judging whether to correct the numerical value or remove the record according to the abnormal degree, thereby improving the quality and consistency of the original data.

[0040] The aggregated calculation based on the formatted data outputs a report data structure, including: Based on the formatted data, analyze the business attributes and data distribution characteristics of the data fields, determine the aggregation dimension combination and aggregation function type according to the report requirements, select the optimal aggregation calculation scheme by using an adaptive aggregation strategy, the adaptive aggregation strategy dynamically adjusts the aggregation granularity according to the data size and calculation complexity, and obtains the aggregation calculation scheme.

[0041] In a specific embodiment, the adaptive aggregation strategy is used to select the optimal aggregation calculation scheme, which includes: Scan the data size and field complexity of the formatted data, obtain the calculation cost and memory consumption of each aggregation dimension combination, and output the aggregation cost evaluation result; Based on the aggregation cost evaluation result, mark the aggregation method with a calculation cost lower than the preset threshold as an efficient aggregation method, and mark the aggregation method with a calculation cost higher than the preset threshold as a complex aggregation method, and output the aggregation method classification result; According to the aggregation method classification result and the current system resource status, preferentially select the efficient aggregation method, and automatically switch to the batch aggregation method when the data volume exceeds the memory limit, and output the aggregation calculation scheme.

[0042] Based on the aggregation calculation scheme, group the formatted data according to the determined aggregation dimension combination, calculate the data in each group using the corresponding aggregation function, generate a data structure including the aggregation result and metadata information, and obtain the report data structure.

[0043] In a specific embodiment, the calculation of the data in each group using the corresponding aggregation function includes: According to the aggregation dimension combination in the aggregation calculation scheme, construct a multi-dimensional grouping index for the formatted data, merge data records with the same dimension value into the same group, and output the grouping index structure; Based on the grouping index structure, calculate each data group using the corresponding aggregation function, the aggregation function includes sum function, average function, maximum function, minimum function and count function, and output the aggregation calculation result of each group; Combine the aggregation calculation result with the corresponding dimension information and statistical metadata, encapsulate the composite data structure containing data values, dimension identifiers and calculation metadata, and output the report data structure.

[0044] Specifically, the embodiment fuses the adaptive aggregation strategy and the multi-dimensional grouping index technology, performs calculation complexity and memory consumption analysis processing by using an aggregation cost evaluation mechanism, dynamically adjusts the aggregation granularity and the calculation scheme in combination with the data scale and the system resource status, and automatically switches the batch aggregation mode according to the classification results of the efficient aggregation mode and the complex aggregation mode. The embodiment solves the problems of lack of adaptive ability and low processing efficiency of large data in the traditional aggregation calculation by using the multi-dimensional grouping index construction and the composite data structure encapsulation, improves the execution efficiency and the resource utilization rate of the aggregation calculation, and realizes the automatic generation of the high-quality report data structure and the scalability guarantee by using a complete aggregation function calculation system and metadata information encapsulation.

[0045] The visualization processing of the report data structure and output of the final report include: Based on the report data structure, the data dimension characteristics and the value distribution law are analyzed, the visualization chart type is selected according to the data type and the business scenario, the automatic mapping relationship of the data field to the visualization element is established, the automatic mapping relationship includes the mapping of the numerical field to the coordinate axis, the mapping of the classification field to the legend and the mapping of the time field to the time axis, and the visualization configuration scheme is obtained.

[0046] In a specific embodiment, the automatic mapping relationship of the data field to the visualization element includes: The data field type and the value range in the report data structure are scanned, the continuous numerical field is marked as a measurement field, the discrete classification field is marked as a dimension field, and the time type field is marked as a time series field, and the field type classification result is output. Based on the field type classification result and the data magnitude characteristics, the most suitable visualization chart type is automatically selected by using a chart adaptation rule, the single-dimensional numerical data is mapped to a column chart type, the multi-dimensional associated data is mapped to a scatter chart type, and the time series data is mapped to a line chart type, and the chart type selection result is output. According to the chart type selection result, the corresponding relationship between the data field and the chart visual element is established, the measurement field is bound to the numerical coordinate axis, the dimension field is bound to the classification coordinate axis, and the time series field is bound to the time coordinate axis, and the visualization configuration scheme is output.

[0047] Based on the visualization configuration scheme, the chart elements are adaptively laid out by using a responsive layout algorithm, the chart size and the layout position are dynamically adjusted according to the screen size and the display device characteristics, and the final report is generated, the final report includes an interactive function and a style definition.

[0048] In a specific embodiment, the adaptive layout of the chart elements by using the responsive layout algorithm includes: Obtaining screen resolution and size parameters of a current display device, marking a large-screen device as a desktop mode, a medium-screen device as a tablet mode, and a small-screen device as a mobile mode according to a device type, and outputting a device adaptation mode; Based on the device adaptation mode and a visualization configuration scheme, calculating optimal display sizes and layout positions of each chart element, performing spatial allocation and position arrangement on multiple charts by using a grid layout algorithm, and outputting a layout calculation result; According to the layout calculation result, generating complete page code including chart rendering instructions, interactive event binding, and style attribute definition, and outputting a final report.

[0049] Specifically, the embodiment fuses automatic mapping relationship establishment and responsive layout algorithm, utilizes a field type classification mechanism to perform automatic identification and marking processing on measurement fields, dimension fields, and time series fields, dynamically selects a most suitable visualization chart type such as a column chart, a scatter chart, and a line chart according to a chart adaptation rule, and automatically switches display adaptation of a desktop mode, a tablet mode, and a mobile mode according to a device type and screen parameters. The embodiment solves the problems of complex manual configuration and insufficient cross-device display adaptation capability in traditional visualization processing by using a grid layout algorithm and a spatial allocation mechanism, improves the automation degree and user experience of report visualization, and simultaneously realizes adaptive generation of a high-quality final report by using a complete data field to visualization element mapping system and a responsive layout mechanism.

[0050] In a specific embodiment, in a business scenario of a certain company, a business personnel needs to generate a monthly comprehensive report containing policy information, customer information, and claim record. A traditional method needs to manually write a complex multi-table association SQL query statement, which is time-consuming and error-prone. The report data acquisition and display method of the embodiment has the following specific implementation process: Step 1: data table relationship model construction; The system receives a report generation requirement submitted by the business personnel: “generate a customer distribution and claim record statistical report of all valid policies in a specific time interval”. The system analyzes the requirement and identifies that the core data tables involved include a policy information table, a customer information table, and a claim record table.

[0051] The system automatically scans the data dictionary information of the three data tables and extracts field constraint rules. The policy information table contains a primary key constraint-PolicyID, a foreign key constraint-CustomerID associated with the customer table, and a non-empty constraint-policy status field; the customer information table contains a primary key constraint-CustomerID, a unique constraint-ID number, and a non-empty constraint-customer name; and the claim record table contains a primary key constraint-ClaimID and a foreign key constraint-PolicyID associated with the policy table.

[0052] The system marks the extracted constraint information as first-class constraints, second-class constraints, third-class constraints, and fourth-class constraints according to the primary key constraint, foreign key constraint, uniqueness constraint, and non-empty constraint, respectively, and sets weight values according to the influence degree of each type of constraint in the table association path selection. The system constructs an initial data table relationship graph, takes three data tables as graph nodes, and takes the primary key-foreign key relationship as a graph edge, and then fuses the constraint feature vector into the corresponding graph node to form a constraint-aware data table relationship graph.

[0053] Through graph neural network training and learning, the system identifies the optimal table association path as Customer→ Policy→ Claim, which can effectively cover the complete data chain of customer basic information, policy details, and claim records.

[0054] Step 2: Intelligent generation of SQL query statements; Based on the identified optimal table association path, the system parses the inter-table connection relationship and field mapping relationship to construct an initial structure of the SQL syntax tree. The system performs position coding on the abstract syntax tree structure of each syntax node in the SQL syntax tree, and assigns different position coding values to the SELECT keyword node, table name node, field name node, and JOIN operator node.

[0055] The system identifies time-related fields including policy effective time, claim application time, etc., and analyzes the time sequence dependency relationship between fields. Since the report demand involves time range filtering in a "specific time interval", the system marks it as the third type of time sequence dependency, and uses a time sequence constraint propagation algorithm to perform constraint checking on the time sequence logic to ensure the consistency of the time condition.

[0056] The SQL syntax tree enhanced with time sequence constraints is input into the Transformer model, which learns the dependency relationship between syntax tree nodes through self-attention mechanism, and finally generates an initial SQL query statement.

[0057] Step 3: SQL structure reinforcement learning optimization; The system constructs a reinforcement learning optimization environment, taking the structure of the initial SQL query statement as the state space, and taking the index addition, connection mode adjustment, and condition optimization operations of the SQL statement as the action space.

[0058] The system performs syntax correctness detection on the initial SQL query statement, and the detection result shows that the syntax is completely correct, with a syntax correctness reward value of 1.0. The execution of the SQL statement takes 8.5 seconds, and according to the preset execution time threshold of -5 seconds, the execution efficiency reward value is 0.6. The memory occupation is measured to be 450MB, and according to the system available memory, the resource consumption reward value is 0.8.

[0059] The system calculates the three reward values according to the preset weights, sets the syntax correctness weight to 0.4, the execution efficiency weight to 0.4, and the resource consumption weight to 0.2, and obtains a comprehensive reward value of 0.76. Based on the comprehensive reward value, the reinforcement learning algorithm suggests optimizing the SQL structure, including adding appropriate index hints and adjusting the JOIN order.

[0060] After 3 rounds of iterative optimization, the system outputs the optimized SQL query statement, the execution time is reduced to 3.2 seconds, the memory occupation is reduced to 280MB, and the comprehensive reward value is increased to 0.92.

[0061] Step 4: Data preprocessing and formatting; The system executes the optimized SQL query statement to obtain the original data set containing 15680 records. The system detects the data integrity of the original data set and finds that the customer area field has a missing rate of 3.2% and the claim amount field has an abnormal value of 0.8%.

[0062] The system uses the nearest neighbor interpolation method to complete the missing customer area information and adjusts the abnormal claim amount according to the average claim level of similar policies. At the same time, the system converts the numerical data to a standard numerical format and the time data to a "YYYY-MM-DD" standard time format, and outputs the formatted data containing 15680 complete records.

[0063] Step 5: Intelligent aggregation calculation; Based on the formatted data, the system analyzes the business attributes of the data fields and identifies the customer area and policy type as dimension fields and the claim frequency and claim amount as measurement fields. According to the report requirements, the system determines the aggregation dimension combination as [customer area, policy type] and the aggregation functions include SUM-claim amount aggregation, COUNT-claim frequency statistics, and AVG-average claim amount.

[0064] The system evaluates the cost and memory consumption of the aggregation calculation. Since the data volume is 15680, the calculation complexity is moderate, and the system selects the direct memory aggregation method. According to the determined aggregation dimension combination, the data is grouped and processed, and finally a report data structure containing 36 groups is generated, each group containing area name, policy type, claim frequency, claim total amount, and average claim amount.

[0065] Step 6: Responsive visual display; The system analyzes the dimension characteristics of the report data structure and marks the customer area as a dimension field and the claim amount and claim frequency as measurement fields. Based on the data characteristics, the system automatically selects a column chart to display the claim statistics of each area and a pie chart to display the proportion of claim amount for different policy types.

[0066] The system detects that the user uses a desktop device resolution of 1920x1080, and automatically switches to a desktop mode display adaptation. The column chart and pie chart are reasonably laid out by using a grid layout algorithm, the column chart occupies 70% of the left side of the page, and the pie chart occupies 30% of the right side.

[0067] Finally, the system generates a visual report containing interactive functions, and the user can view detailed data by clicking chart elements and adjust the time range and region range through the filtering control.

[0068] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for acquiring and displaying report data, characterized in that, Includes the following steps: Upon receiving a report generation request, a graph neural network is used to construct a data table relationship model. The graph neural network encodes the data table field constraint information into the graph node features and updates the graph structure incrementally to output the optimal table association path. Based on the optimal table association path, a Transformer model is used to generate an SQL query pattern. The Transformer model uses position encoding of an abstract syntax tree structure and a temporal constraint propagation algorithm to output an initial SQL query statement. Based on the initial SQL query statement, a reinforcement learning algorithm with a hierarchical reward mechanism is used for structural optimization. The hierarchical reward mechanism includes syntactic correctness reward, execution efficiency reward and resource consumption reward, and outputs an optimized SQL query statement. Execute the optimized SQL query to obtain the raw data, preprocess the raw data, and output formatted data; Based on the formatted data, perform aggregation calculations and output the report data structure; The report data structure is visualized, and the final report is output.

2. The method for acquiring and displaying report data as described in claim 1, characterized in that, The received report generation request employs a graph neural network to construct a data table relationship model. This graph neural network encodes data table field constraint information into graph node features and updates the graph structure incrementally, outputting the optimal table association path, including: Receive report generation requests, parse the target data tables and query conditions in the report generation requests, and output a list of data tables and related requirements; Based on the data table list, an initial data table relationship graph is constructed, with each data table as a graph node and the primary key and foreign key relationships between data tables as graph edges, and the initial relationship graph is output. Extract the field constraint information of each data table in the data table list. The field constraint information includes primary key constraints, foreign key constraints, uniqueness constraints, and NOT NULL constraints. Encode the field constraint information into constraint feature vectors and output a set of constraint feature vectors. The constraint feature vector set is fused into the corresponding graph node of the initial relationship graph to obtain a constraint-aware data table relationship graph, and the constraint-aware relationship graph is output. A graph neural network is used to train and learn the constraint-aware relationship graph. When a change in the data table structure is detected, the corresponding graph nodes and edges are updated through incremental learning, and the optimal table association path is output.

3. The method for acquiring and displaying report data as described in claim 2, characterized in that, The step involves extracting field constraint information from each data table in the data table list. This field constraint information includes primary key constraints, foreign key constraints, uniqueness constraints, and NOT NULL constraints. The field constraint information is then encoded into constraint feature vectors, and a set of constraint feature vectors is output, including: Scan the data dictionary information of each data table in the data table list, extract field-level constraint rules, and output a set of field constraint rules; The set of field constraint rules is classified, with primary key constraints marked as first-class constraints, foreign key constraints as second-class constraints, uniqueness constraints as third-class constraints, and NOT NULL constraints as fourth-class constraints, and a set of classified constraints is output. For each type of constraint in the set of classification constraints, a constraint weight value is set. The constraint weight value is used to characterize the degree of influence of the constraint type on the selection of the table association path. Output the constraint weight mapping table. Based on the constraint weight mapping table, the constraint information of each data table is converted into a fixed-dimensional numerical vector to obtain the constraint feature vector, and the constraint feature vector set is output. The formula for updating the corresponding graph nodes and edges through incremental learning is as follows: ; in, For the first Incremental update amount of the timeline structure; A balancing factor for the fusion of old and new constraint information; For the first A collection of data tables that are constantly being modified; To constrain graph loss function The gradient; For data table The weight of sensitivity to constraint changes; For the first The set of data tables added at any given time; For the new data table Constraint adaptive weights; For the new data table The constraint eigenvector increment.

4. The method for acquiring and displaying report data as described in claim 1, characterized in that, Based on the optimal table join path, a Transformer model is used to generate an SQL query pattern. The Transformer model employs positional encoding of an abstract syntax tree structure and a temporal constraint propagation algorithm to output an initial SQL query statement, including: Based on the optimal table association path, the data table connection relationship and field mapping relationship in the optimal table association path are parsed, the initial structure of the SQL syntax tree is constructed, and the SQL syntax tree framework is output. The positional encoding of each syntax node in the SQL syntax tree framework is performed on the abstract syntax tree structure. Different positional encoding values ​​are assigned to SQL keyword nodes, table name nodes, field name nodes and operator nodes respectively, and the positional encoded SQL syntax tree is output. Based on the position-encoded SQL syntax tree, time-related fields and temporal dependencies are identified. A temporal constraint propagation algorithm is used to perform constraint checks and propagation calculations on the temporal logic, and outputs a temporal constraint-enhanced SQL syntax tree. The time-constrained enhanced SQL syntax tree is input into the Transformer model, and the dependencies between syntax tree nodes are learned through the self-attention mechanism to obtain a sequence of query statements that conform to the SQL syntax specification, and the initial SQL query statement is output.

5. The method for acquiring and displaying report data as described in claim 4, characterized in that, The step of using a timing constraint propagation algorithm to perform constraint checks and propagation calculations on timing logic includes: Scan all field nodes in the location-encoded SQL syntax tree, identify time-type fields and time-related query conditions, and output a set of time-series fields; Based on the aforementioned time series field set, the time series dependencies between the fields are analyzed. Year-on-year relationships are labeled as the first type of time series dependency, month-on-month relationships as the second type of time series dependency, and cumulative relationships as the third type of time series dependency. A time series dependency graph is then output. Based on the temporal dependency graph, temporal logic conflicts and circular dependency problems are detected, constraint propagation correction is performed on the detected conflict nodes, and the corrected temporal dependency graph is output. The constraint information in the modified temporal dependency graph is re-encoded into the corresponding nodes of the SQL syntax tree, the temporal constraint attributes of the syntax tree are updated, and the SQL syntax tree with enhanced temporal constraints is output.

6. The method for acquiring and displaying report data as described in claim 1, characterized in that, The algorithm uses a hierarchical reward mechanism, including syntactic correctness rewards, execution efficiency rewards, and resource consumption rewards, to perform structural optimization based on the initial SQL query statement. The optimized SQL query statement is output as follows: Based on the initial SQL query statement, a reinforcement learning optimization environment is constructed, with the SQL query structure as the state space and the SQL statement's add, delete, and modify operations as the action space, and a reinforcement learning environment model is output. Perform a syntax correctness check on the initial SQL query statement, calculate the syntax correctness reward value based on the check results, and output the syntax correctness reward. Execute the initial SQL query statement and measure the query execution time and resource consumption. Calculate the execution efficiency reward value based on the execution time and the resource consumption reward value based on the resource consumption. Output the execution efficiency reward and the resource consumption reward. The grammatical correctness reward, execution efficiency reward, and resource consumption reward are weighted according to preset weights, and a comprehensive reward value is output. Based on the comprehensive reward value, a reinforcement learning algorithm is used to iteratively optimize and adjust the SQL query structure until it converges to the optimal structure, and the optimized SQL query statement is output.

7. The method for acquiring and displaying report data as described in claim 6, characterized in that, The step of weighting the syntax correctness reward, execution efficiency reward, and resource consumption reward according to preset weights and outputting a comprehensive reward value includes: Obtain the values ​​of the syntax correctness reward, execution efficiency reward, and resource consumption reward, normalize the three reward values ​​respectively, and output the set of normalized reward values. Set reward weight parameters based on the business priority of SQL query optimization, setting syntax correctness as the first priority weight, execution efficiency as the second priority weight, and resource consumption as the third priority weight, and output the reward weight configuration. The reward values ​​in the normalized reward value set are weighted and calculated with their corresponding reward weights to obtain the weighted reward components, and the weighted reward component set is output. The summation operation is performed on all components in the weighted reward component set to output the comprehensive reward value.

8. The method for acquiring and displaying report data as described in claim 1, characterized in that, The process of executing the optimized SQL query to obtain raw data, preprocessing the raw data, and outputting formatted data includes: Execute the optimized SQL query statement, initiate a query request to the database, obtain the original dataset returned by the query, perform data integrity detection and outlier identification on the original dataset, mark missing data records and abnormal data records, and output the original dataset after quality detection. Based on the original dataset after quality inspection, the data types are adaptively converted according to the report display requirements. Numerical data, text data, and time data are converted into a unified standard format. Missing data records are filled by interpolation, and abnormal data records are corrected or removed. Formatted data is then output.

9. The method for acquiring and displaying report data as described in claim 1, characterized in that, The aggregation calculation based on the formatted data, and the output report data structure, include: Based on the formatted data, the business attributes and data distribution characteristics of the data fields are analyzed. According to the report requirements, the combination of aggregation dimensions and the type of aggregation function are determined. An adaptive aggregation strategy is adopted to select the optimal aggregation calculation scheme. The adaptive aggregation strategy dynamically adjusts the aggregation granularity according to the data volume and computational complexity to obtain the aggregation calculation scheme. Based on the aforementioned aggregation calculation scheme, the formatted data is grouped according to the determined aggregation dimension combination, and the data within each group is calculated using the corresponding aggregation function to generate a data structure that includes aggregation results and metadata information, thus obtaining the report data structure.

10. The method for acquiring and displaying report data as described in claim 1, characterized in that, The visualization processing of the report data structure to output the final report includes: Based on the report data structure, the data dimension characteristics and numerical distribution patterns are analyzed. The visualization chart type is selected according to the data type and business scenario. An automatic mapping relationship between data fields and visualization elements is established. The automatic mapping relationship includes the mapping of numerical fields to coordinate axes, the mapping of category fields to legends, and the mapping of time fields to time axes, thus obtaining a visualization configuration scheme. Based on the aforementioned visualization configuration scheme, a responsive layout algorithm is used to adaptively arrange chart elements, dynamically adjusting the chart size and layout position according to the screen size and display device characteristics to generate a final report, which includes interactive functions and style definitions.