Report Generation Method, Device, Electronic Device and Computer Readable Medium
By comparing the differences between the original data table and the wide table, determining the connected data table and generating reports, the problems of high cost and long period of report generation in the existing technology are solved, and flexible configuration and rapid response are achieved.
Patent Information
- Application Number
- CN202110837380.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-23
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2041-07-23
AI Technical Summary
The existing report generation methods have high development costs, long cycles and slow responses due to large changes in demand and poor flexibility.
By comparing the difference between the original data table and the pre-designed wide table, determine the original data table that needs to be connected, and query the field information of the target field from the connected data table, write it to the wide table, and generate reports using data analysis tools and visualization tools.
It realizes flexible configuration and rapid response of reports, reduces development costs and improves development efficiency.
Smart Images

Figure CN113485781B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of big data technology, and in particular, to a report generation method, device, electronic device, and computer-readable medium. Background Art
[0002] Reports are an important part of enterprise management systems, which can be used to display management results, expose problems in the management process, and achieve the digital transformation of enterprises. The existing report generation method uses a traditional software development architecture, which is divided into a front-end, a back-end, and a scheduling program. The front-end encapsulates tools for visualization, and the back-end is developed independently. However, due to the characteristics of large demand changes, flexible requirements, and the need for rapid response in reports, the traditional software development method requires writing a large amount of code, has high costs, a long development cycle, and slow response to demand changes. Summary of the Invention
[0003] In view of this, embodiments of the present invention provide a report generation method, device, electronic device, and computer-readable medium. The method determines the original data tables that need to be connected by comparing the differences between the original data tables and a pre-designed wide table, and then queries the field information of the target fields from the connected data tables and writes it into the wide table, so that subsequent data can be quickly and flexibly extracted from the wide table according to the instructions of a report generation request, and the corresponding report can be generated, realizing the flexible configuration and rapid response of reports.
[0004] To achieve the above object, according to one aspect of the embodiments of the present invention, a report generation method is provided.
[0005] A report generation method according to an embodiment of the present invention includes: obtaining at least one corresponding original data table from a data source according to the file path recorded in the configuration information, and then analyzing the differences between the original data table and the pre-designed wide table to determine the original data tables that need to be connected; calling a data analysis tool to connect the determined multiple original data tables to query the field information of the target fields that meet the set connection conditions, and then writing the field information into the corresponding positions of the wide table according to the field names of the wide table; receiving a report generation request, calling a visualization tool to extract the target column data indicated by the report generation request from the wide table, and inserting the target column data into a configured report template to generate the corresponding report.
[0006] Optionally, the method further includes: quantifying the business analysis requirements for a business theme into corresponding business indicators, and determining the business dimensions required to calculate the business indicators; determining the business fields that need to be included in the wide table corresponding to the business theme according to the business dimensions; filling the business fields into a data table file with a set first cell layout to generate the wide table; wherein, one cell of the data table file corresponds to one business field.
[0007] Optionally, analyzing the differences between the original data table and the pre-designed wide table to determine the original data tables that need to be joined includes: comparing the attribute fields of the original data table with the business fields of the wide table for similarities and differences; and when there are attribute fields in the original data table that match the field names of the business fields, regarding the original data table as the original data table that needs to be joined.
[0008] Optionally, joining the determined multiple original data tables includes: using join fields to join the determined multiple original data tables according to a set joining method; wherein, the join fields are the same attribute fields in the multiple original data tables.
[0009] Optionally, extracting the target column data indicated by the report generation request from the wide table includes: dynamically concatenating a corresponding query statement according to the target column data indicated by the report generation request, and using the query statement to query the corresponding target column data from the wide table.
[0010] Optionally, the report template includes a graphic template; inserting the target column data into the configured report template includes: inserting the target column data into the graphic template according to the graphic template indicated by the report generation request.
[0011] Optionally, after the step of obtaining the corresponding at least one original data table from the data source, the method further includes: invoking a distributed framework to perform distributed storage on the at least one original data table.
[0012] Optionally, after the step of determining the original data tables that need to be joined, the method further includes: using stream computing to load the originally data tables stored distributively into an in-memory database table for real-time calculation.
[0013] Optionally, loading the originally data tables stored distributively into an in-memory database table for real-time calculation includes: loading the originally data tables stored distributively into an in-memory database table; and using multi-threading and a set data processing logic to concurrently calculate the data to be calculated in the in-memory database table.
[0014] Optionally, invoking the data analysis tool includes: determining to invoke the data analysis tool after satisfying the trigger condition of the timing task configured in the task scheduler; wherein, the timing task includes the invocation information of the data analysis tool.
[0015] Optionally, the method further includes: configuring data items required for the report template according to the set data item requirement information; filling the data items into an intermediate file with a set second cell layout to generate the report template; wherein one cell of the intermediate file corresponds to one of the data items.
[0016] Optionally, the inserting the target column data into the configured report template to generate a corresponding report includes: inserting the target column data into a cell of the report template; and processing the target column data in the cell according to the data processing format set for the cell to obtain a corresponding report.
[0017] To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a report generation apparatus.
[0018] A report generation apparatus according to an embodiment of the present invention includes: a data extraction module, configured to obtain at least one corresponding original data table from a data source according to a file path recorded in configuration information, and then analyze the difference between the original data table and a pre-designed wide table to determine the original data tables that need to be connected; a query writing module, configured to call a data analysis tool to connect the determined multiple original data tables to query field information of target fields that meet set connection conditions, and then write the field information to corresponding positions of the wide table according to the field names of the wide table; a report generation module, configured to receive a report generation request, call a visualization tool to extract target column data indicated by the report generation request from the wide table, and insert the target column data into a configured report template to generate a corresponding report.
[0019] Optionally, the apparatus further includes: a wide table generation module, configured to quantify business analysis requirements for a business theme into corresponding business metrics, and determine business dimensions required for calculating the business metrics; determine business fields required for a wide table corresponding to the business theme according to the business dimensions; fill the business fields into a data table file with a set first cell layout to generate the wide table; wherein one cell of the data table file corresponds to one of the business fields.
[0020] Optionally, the data extraction module is further configured to compare similarities and differences between attribute fields of the original data table and business fields of the wide table; and use the original data table as an original data table that needs to be connected when there are attribute fields in the original data table that match the field names of the business fields.
[0021] Optionally, the query writing module is further configured to use connection fields to establish connections for the determined multiple original data tables according to a set connection manner; wherein, the connection fields are the same attribute fields in the multiple original data tables.
[0022] Optionally, the report generation module is further configured to dynamically splice a corresponding query statement according to the target column data indicated by the report generation request, so as to query the corresponding target column data from the wide table using the query statement.
[0023] Optionally, the report template includes a graphic template; the report generation module is further configured to insert the target column data into the graphic template according to the graphic template indicated by the report generation request.
[0024] Optionally, after the step of obtaining at least one corresponding original data table from the data source, the apparatus further includes: a storage module, configured to call a distributed framework to perform distributed storage on the at least one original data table.
[0025] Optionally, after the step of determining the original data tables that need to be connected, the apparatus further includes: a real-time calculation module, configured to use streaming calculation to load the originally data tables stored distributively into an in-memory database table for real-time calculation.
[0026] Optionally, the real-time calculation module is further configured to load the originally data tables stored distributively into an in-memory database table; and use multi-threading and a set data processing logic to concurrently calculate the data to be calculated in the in-memory database table.
[0027] Optionally, the query writing module is further configured to determine to call a data analysis tool after meeting the trigger condition of the timing task according to the timing task configured in the task scheduler; wherein, the timing task includes the call information of the data analysis tool.
[0028] Optionally, the apparatus further includes: a template generation module, configured to configure data items required for the report template according to set data item requirement information; and fill the data items into an intermediate file with a set second cell layout to generate the report template; wherein, one cell of the intermediate file corresponds to one data item.
[0029] Optionally, the report generation module is further configured to insert the target column data into a cell of the report template; and process the target column data in the cell according to the data processing format set for the cell to obtain a corresponding report.
[0030] To achieve the above object, according to another aspect of the embodiments of the present invention, an electronic device is provided.
[0031] An electronic device according to an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement a report generation method according to an embodiment of the present invention.
[0032] To achieve the above object, according to another aspect of the embodiments of the present invention, a computer-readable medium is provided.
[0033] A computer-readable medium according to an embodiment of the present invention has a computer program stored thereon, and when the program is executed by a processor, it implements a report generation method according to an embodiment of the present invention.
[0034] One embodiment of the above invention has the following advantages or beneficial effects: By comparing the differences between the original data table and the pre-designed wide table, the original data tables to be joined are determined, and then the field information of the target fields is queried from the joined data table and written into the wide table, so that subsequently, according to the indication of the report generation request, data can be quickly and flexibly extracted from the wide table, and the corresponding report can be generated, realizing the flexible configuration and quick response of the report.
[0035] The further effects of the above non-conventional optional manner will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The drawings are used to better understand the present invention and do not constitute an improper limitation to the present invention. Among them:
[0037] Figure 1 is a schematic diagram of the main steps of a report generation method according to an embodiment of the present invention;
[0038] Figure 2 is a schematic diagram of the system architecture for implementing the report generation method according to an embodiment of the present invention;
[0039] Figure 3 is a schematic diagram of the architecture of a big data platform for implementing the report generation method according to an embodiment of the present invention;
[0040] Figure 4 is a schematic diagram of the main process of a report generation method according to an embodiment of the present invention;
[0041] Figure 5 is a schematic diagram of the main modules of a report generation device according to an embodiment of the present invention;
[0042] Figure 6 is an exemplary system architecture diagram to which an embodiment of the present invention can be applied;
[0043] Figure 7It is a schematic structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present invention. Detailed implementation manners
[0044] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings. Various details of the embodiments of the present invention are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0045] Figure 1 It is a schematic diagram of the main steps of a report generation method according to an embodiment of the present invention.
[0046] As Figure 1 shown, the report generation method of the embodiment of the present invention mainly includes the following steps:
[0047] Step S101: According to the file path recorded in the configuration information, obtain at least one corresponding original data table from the data source, and then analyze the differences between the original data table and a pre-designed wide table to determine the original data tables that need to be connected. The data source stores original data tables recorded in various ways, such as recorded in an enterprise management system, an office system, a database, or manually recorded in the form of an Excel table, comma-separated values (CSV), etc.
[0048] The file path of the original data table to be obtained (i.e., the download path of the original data table) is pre-configured in the configuration information to facilitate subsequent acquisition of the original data table under this file path. Since there are usually multiple obtained original data tables, in order to improve the query speed, a wide table needs to be pre-designed according to the business theme. The wide table records the business fields to be analyzed according to business requirements. It can be understood that at this time, the wide table only contains the field names of the business fields and no specific field information. Among them, a wide table usually refers to a database table in which indicators, dimensions, and attributes related to the business theme are associated together.
[0049] After designing the wide table and obtaining the original data table, compare the attribute fields of the original data table with the business fields of the wide table. If there are attribute fields in the original data table that match the field names of the business fields, the original data table is used as the original data table that needs to be connected. Among them, the matching of field names means that the business fields of the wide table and the attribute fields of the original data table represent the same object.
[0050] Step S102: Invoke a data analysis tool to establish connections among the determined multiple original data tables, so as to query the field information of the target fields that meet the set connection conditions, and then write the field information to the corresponding positions of the wide table according to the field names of the wide table. Invoke a data analysis tool to splice a query statement, so as to use the query statement to establish connections among the determined multiple original data tables and simultaneously query the field information of the target fields that meet the set connection conditions.
[0051] Exemplarily, the query statement includes the target fields to be queried and connection conditions. The target fields are one or more business fields of the wide table, and the connection conditions are the conditions that need to be met for connecting multiple original data tables. In the embodiment, the query statement can be a join query statement, and the connection conditions include connection fields and operators. After querying the field information of the target fields, write the field information to the business fields in the wide table with the same field names as the target fields to obtain a wide table containing specific field information.
[0052] Step S103: Receive a report generation request, and invoke a visualization tool to extract the target column data indicated by the report generation request from the wide table, and insert the target column data into a configured report template to generate a corresponding report. The report generation request is used to indicate the target column data required for generating a report. After receiving the report generation request, invoke a visualization tool to dynamically splice a corresponding query statement according to the target column data indicated by the report generation request, and then use the query statement to query the corresponding target column data from the wide table.
[0053] Insert the queried target column data into the configured report template to achieve automatic report generation. In the embodiment, components that can visually display the target column data in forms such as graphs and tables are set in the report template.
[0054] Figure 2 It is a schematic diagram of the system architecture for implementing the report generation method of the embodiment of the present invention. As Figure 2 shown, the report generation method of the embodiment of the present invention is jointly implemented by a data source, a big data platform, a data warehouse, and a BI tool. Among them, the data source can be an enterprise management system (ERP system), an office system (OA system), a database (such as an Oracle database, a MySQL database), or manual data (such as Excel, CSV, etc.). The big data platform is used to perform processing such as data extraction, cleaning, integration, and storage on data. The data warehouse can be an enterprise-level data warehouse and a wide table. The enterprise-level data warehouse is, for example, an EDW (Enterprise Data Warehouse) database. The BI tool is a visualization tool for report presentation. The full English name of BI is Business Intelligence, which refers to business intelligence.
[0055] Figure 3 It is a schematic diagram of the architecture of a big data platform for implementing the report generation method according to the embodiments of the present invention. As Figure 3 shown, the big data platform according to the embodiments of the present invention includes a data extraction tool (such as DataX), a distributed data storage system (such as HDFS), a data query and analysis tool (including the Hive tool for batch extraction and / or real-time stream computing), an analytical database, and a task scheduler.
[0056] Among them, the processing logic of the big data platform is as follows: Use the data extraction tool to obtain the original data table from the data source, and then the obtained original data table can be distributedly stored. Then, according to the field names of the business fields of the wide table, call the data analysis tool to query the corresponding field information from the original data table, and write the field information to the corresponding position of the wide table. The task scheduler is used for the configured scheduled tasks to realize the scheduled call of the data analysis tool.
[0057] Figure 4 It is a schematic diagram of the main steps of the report generation method according to the embodiments of the present invention. As Figure 4 shown, the report generation method according to the embodiments of the present invention mainly includes the following steps:
[0058] Step S401: Generate a corresponding wide table for the business theme according to the data analysis requirements of the business theme. Different business themes may have different data analysis requirements, and the business indicators and business dimensions used for analysis are usually also different. Therefore, in the embodiments, one or more wide tables are designed for the same business theme. One business theme corresponds to one data analysis field. For example, the business theme can be sales data analysis, loan data analysis, etc.
[0059] The implementation process of this step can be: Quantify the business analysis requirements of the business theme into corresponding business indicators, and determine the business dimensions required to calculate the business indicators; then, according to the business dimensions, determine the business fields that the wide table corresponding to the business theme needs to include; finally, fill the business fields into the data table file with a set first cell layout to generate the wide table. Among them, one cell of the data table file corresponds to one business field.
[0060] Taking the business theme of sales data analysis as an example, the business indicator can be the total sales amount of each salesperson in the past month. The business dimensions required to calculate this business indicator are the salesperson, the sales amount, and the sales time. Then, these business dimensions can be used as the business fields of the wide table, and filling the business fields into the data table file can generate the wide table. In the embodiments, the data table file can be a table file containing multiple rows and multiple columns.
[0061] In an embodiment, the wide table may include a data entity table and a data relationship table. The data entity table records actual object information, such as salesperson information and sales product information; the data relationship table records the relationships between data tables, such as the relationship table indicating which products a salesperson has specifically sold.
[0062] Step S402: According to the file path recorded in the configuration information, obtain at least one corresponding original data table from the data source, and call the distributed framework to perform distributed storage on the obtained original data table. Use a data extraction tool, such as DataX (an offline synchronization tool for heterogeneous data sources), to obtain the original data table from the data source regularly or in real time.
[0063] The configuration information of DataX includes two configuration items, setting and content. Among them, setting describes the information of the task itself, and content describes the information of the source end (reader) and the destination end (writer). The file path from which data needs to be read can be configured in the reader to obtain the corresponding original data table from this file path. The extracted original data table can be distributedly stored through the distributed framework to avoid storage pressure. In an embodiment, the distributed framework may be HDFS (Hadoop Distributed File System).
[0064] Step S403: Analyze the differences between the original data table and the pre-designed wide table to determine the original data tables that need to be connected. This step is used to compare the similarities and differences between the attribute fields of the original data table and the business fields of the wide table. When there are attribute fields in the original data table that match the field names of the business fields, the original data table is regarded as the original data table that needs to be connected.
[0065] Among them, the field name matching may mean that the field name of the business field is exactly the same as the field name of the attribute field; it may also mean that although the two field names are different, they represent the same object. For example, in the original data table, the field name "salesperson" is used, and in the wide table, the field name "salesman" is used, but both represent the object of the salesman.
[0066] Step S404: Call the data analysis tool to connect the determined multiple original data tables to query the field information of the target fields that meet the set connection conditions. In an embodiment, the data analysis tool may be Hive. Hive is a data warehouse tool based on Hadoop, used for data extraction, transformation, and loading, which is a mechanism for storing, querying, and analyzing large-scale data stored in Hadoop.
[0067] Specifically, call the Hive tool and use the join method to establish connections between multiple original data tables, and query the field information of the target fields that meet the set connection conditions at the same time. The join method includes multiple connection methods, namely inner join, left join, and right join. Connections can usually be established in the from clause or where clause of the select statement, and the syntax format is: from join_table join_type join_table [on (join_condition)].
[0068] Among them, join_table is the table name participating in the join operation; join_type is the connection method; on (join_condition) is the connection condition, which can be composed of columns in the connected tables (i.e., join fields), comparison operators, logical operators, etc. In the embodiment, the target fields to be queried are defined in the select statement, and the connection method and connection conditions (including join fields) are defined in the from clause. According to this connection method, multiple determined original data tables can be established connections using the join fields.
[0069] Optionally, the join fields can be the same attribute fields in multiple original data tables. The sameness here can mean that the field names of the attribute fields are the same; or the field names are different, but they represent the same attribute field. After establishing the connections of the original data tables in this step, then query the field information of the target fields, which improves the query performance and ensures the query accuracy at the same time.
[0070] In a preferred embodiment, in order to achieve the automatic generation of reports, the data analysis tool can be called regularly. Specifically, according to the scheduled tasks configured in the task scheduler (such as Azkaban), after determining that the trigger conditions of the scheduled tasks are met, call the data analysis tool. Among them, the scheduled tasks include the call information of the data analysis tool, such as the tool name and trigger conditions. The trigger conditions are used to indicate the conditions for triggering the execution of the scheduled tasks, such as executing the scheduling once every 1 hour.
[0071] Step S405: Write the field information to the corresponding positions of the wide table according to the field names of the wide table. This step is to write the field information of the queried target fields to the business fields in the wide table that have the same field names as the target fields, and obtain a wide table containing specific field information. Thus, the business data is stored in the wide table according to the business theme.
[0072] Step S406: Receive a report generation request, call the visualization tool to extract the target column data indicated by the report generation request from the wide table, and insert the target column data into the configured report template to generate and display the corresponding report. The report template can be defined according to requirements. For example, it can be a graphic template or a template with a set cell layout.
[0073] Taking the graphical template as an example, the visualization tool is a BI tool. The user uses the BI tool to select the business fields of the wide table and the graphical template, triggering a report generation request (the request carries the field names of the business fields selected by the user through methods such as dragging and dropping, and the graphical template). Then, the BI tool dynamically splices the corresponding SQL query statement according to the report generation request to query the corresponding target column data from the wide table using the SQL query statement (i.e., the data in the column corresponding to the field name of the selected business field), and inserts the target column data into the graphical template (such as pie chart, column chart, line chart, etc.), and then the report can be generated.
[0074] Taking the template with a set cell layout as an example, after receiving the report generation request, the request carries the field names of the business fields that need to be inserted into the report template. The visualization tool is called to extract the target column data from the wide table (i.e., the data in the column corresponding to the field name of the business field carried in the request), insert the target column data into the cells of the report template, and then process the target column data in the cells according to the data processing format set for the cells, and then the corresponding report can be obtained.
[0075] The data processing format is the basis for processing the data filled in the cells of the report template. In the embodiment, the data processing format can be a data conversion format to realize the conversion between different format data; the data processing format can also be a function formula to realize the function operation of the filled data in the cell; the data processing format can also be a graphic conversion format to realize the conversion of the corresponding graph of the data according to the filled data in the cell, realizing the graphical expression of the data.
[0076] The template with a set cell layout includes multiple cells that can be filled with data. Its generation process can be: according to the set data item requirement information, configure the data items required for the report template, and then fill the data items into an intermediate file with a set second cell layout to generate the report template. One cell of the intermediate file corresponds to one data item.
[0077] In a preferred embodiment, in order to prevent users from viewing reports beyond their authority, viewing permissions can be set for users. Specifically, viewing permissions at the report level and data level can be set. The viewing permission at the report level forms a permission table between the user and the menu through the association relationship between the hiding and display of the menu and the user; the permission at the data level is realized by forming a permission table between the user and the data column through the association relationship between the user and the data column.
[0078] In another preferred embodiment, in order to realize real-time processing of data with high real-time requirements, after step S402, stream computing can be used to load the original data table of distributed storage into the memory database table for real-time calculation to obtain valuable information. In the embodiment, stream computing can be implemented based on Flum. The specific implementation of real-time calculation can be: loading the original data table of distributed storage into the memory database table, and then using multi-threading and set data processing logic to concurrently calculate the data to be calculated in the memory database table. Among them, the data processing logic can be a mathematical operation on the data, such as addition, subtraction, multiplication and division.
[0079] The above embodiment refers to a set of packaged tools that can directly operate the database. The front end dynamically splices SQL query data according to the business fields of the wide table selected by the user, and passes the query results to the graphic template selected by the user, which can cope with the rapid changes in demand, realize flexible configuration of reports, and improve report generation efficiency. At the same time, it can process data volumes at the big data level and support real-time calculations.
[0080] Figure 5 Schematic diagram of main modules of the report generating device according to an embodiment of the present invention.
[0081] like Figure 5 As shown, the report generation device 500 of the embodiment of the present invention mainly includes:
[0082] The data extraction module 501 is used to obtain at least one corresponding original data table from the data source according to the file path recorded in the configuration information, and then analyze the difference between the original data table and the pre-designed wide table to determine the original data table that needs to be connected. The data source stores the original data table recorded in various ways, such as recorded in an enterprise management system, an office system, a database, or manually recorded in Excel tables, CSV, etc.
[0083] Pre-configure the file path of the original data table to be obtained in the configuration information (i.e., the download path of the original data table), so as to facilitate the subsequent acquisition of the original data table under the file path. Since there are usually multiple original data tables obtained, in order to improve the query speed, it is necessary to design a wide table in advance according to the business theme. The wide table records the business fields to be analyzed according to business needs. It is understandable that the wide table at this time only contains the field names of the business fields, and there is no specific field information. Among them, a wide table usually refers to a database table that associates indicators, dimensions, and attributes related to a business theme.
[0084] After designing the wide table and obtaining the original data table, compare the attribute fields of the original data table with the business fields of the wide table to find the similarities and differences. When there are attribute fields in the original data table that match the field names of the business fields, use the original data table as the original data table that needs to establish a connection. Here, a matching field name means that the business field of the wide table and the attribute field of the original data table represent the same object.
[0085] The query writing module 502 is used to call the data analysis tool to establish connections for the determined multiple original data tables, query the field information of the target fields that meet the set connection conditions, and then write the field information to the corresponding positions in the wide table according to the field names of the wide table. Call the data analysis tool to splice the query statement to establish connections for the determined multiple original data tables using the query statement, and at the same time query the field information of the target fields that meet the set connection conditions.
[0086] After querying the field information of the target fields, write the field information to the business field in the wide table with the same field name as the target field to obtain a wide table containing specific field information.
[0087] The report generation module 503 is used to receive a report generation request, call the visualization tool to extract the target column data indicated by the report generation request from the wide table, and insert the target column data into the configured report template to generate the corresponding report. The report generation request is used to indicate the target column data required for generating the report. After receiving the report generation request, call the visualization tool to dynamically splice the corresponding query statement according to the target column data indicated by the report generation request, and then use the query statement to query the corresponding target column data from the wide table.
[0088] Insert the queried target column data into the configured report template to realize the automatic generation of the report. In the embodiment, the report template is provided with components that can visually display the target column data in the form of graphics, tables, etc.
[0089] In addition, the report generation 500 of the embodiment of the present invention may further include: a wide table generation module, a storage module, a real-time calculation module, and a template generation module ( Figure 5 not shown in the figure). Among them, the wide table generation module is used to quantify the business analysis requirements of the business theme into corresponding business indicators, determine the business dimensions required for calculating the business indicators; according to the business dimensions, determine the business fields that the wide table corresponding to the business theme needs to include; fill the business fields into a data table file with a set first cell layout to generate the wide table; where one cell of the data table file corresponds to one business field.
[0090] A storage module for invoking a distributed framework to perform distributed storage on the at least one original data table. A real-time computing module for loading the original data tables stored distributively into an in-memory database table for real-time computing by using stream computing. A template generation module for configuring data items required for the report template according to set data item requirement information; filling the data items into an intermediate file with a set second cell layout to generate the report template; wherein one cell of the intermediate file corresponds to one of the data items.
[0091] As can be seen from the above description, by comparing the differences between the original data tables and a pre-designed wide table, the original data tables to be joined are determined, and then the field information of the target fields is queried from the joined data tables and written into the wide table, so that subsequently, according to the indication of a report generation request, data can be quickly and flexibly extracted from the wide table and corresponding reports can be generated, realizing flexible configuration and fast response of reports.
[0092] Figure 6 An exemplary system architecture 600 is shown to which the report generation method or report generation device according to embodiments of the present invention can be applied.
[0093] As Figure 6 shown, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 is used to provide a medium for a communication link between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0094] Users can use the terminal devices 601, 602, 603 to interact with the server 605 through the network 604 to receive or send messages, etc. Various communication client applications may be installed on the terminal devices 601, 602, 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0095] The terminal devices 601, 602, 603 may be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers, etc.
[0096] The server 605 may be a server providing various services, such as a background management server that provides support for report generation requests sent by users using the terminal devices 601, 602, 603. The background management server may perform data extraction according to a report generation request, insert the extracted data into a report template, generate reports, etc., and feedback the processing results (such as reports) to the terminal devices.
[0097] It should be noted that the report generation method provided by the embodiments of the present invention is generally executed by the server 605. Correspondingly, the report generation device is generally disposed in the server 605.
[0098] It should be understood that Figure 6 the numbers of the terminal devices, networks, and servers in
[0099] According to an embodiment of the present invention, the present invention also provides an electronic device and a computer-readable medium.
[0100] The electronic device of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement a report generation method according to an embodiment of the present invention.
[0101] The computer-readable medium of the present invention stores a computer program thereon, and when the program is executed by a processor, it implements a report generation method according to an embodiment of the present invention.
[0102] Next, refer to Figure 7 , which shows a schematic structural diagram of a computer system 700 of an electronic device suitable for implementing the embodiments of the present invention. Figure 7 The terminal device shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.
[0103] As Figure 7 shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 702 or the program loaded from the storage section 708 into the random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, ROM 702, and RAM 703 are connected to each other through a bus 704. The input / output (I / O) interface 705 is also connected to the bus 704.
[0104] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as required. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is installed on the drive 710 as required so that a computer program read therefrom is installed into the storage section 708 as required.
[0105] Specifically, according to an embodiment disclosed by the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment disclosed by the present invention includes a computer program product which includes a computer program carried on a computer-readable medium, and the computer program includes program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 709, and / or installed from the removable medium 711. When the computer program is executed by a central processing unit (CPU) 701, the above functions defined in the system of the present invention are executed.
[0106] It should be noted that the computer-readable medium shown in the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0107] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram can represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks can occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and the combination of blocks in a block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0108] The modules involved in the embodiments of the present invention can be implemented in software or in hardware. The described modules can also be provided in a processor. For example, it can be described as: a processor includes a data extraction module, a query writing module, and a report generation module. Among them, the names of these modules do not constitute a limitation to the module itself in some cases. For example, the data extraction module can also be described as "a module that obtains at least one corresponding original data table from a data source according to the file path recorded in the configuration information, and then analyzes the difference between the original data table and a pre-designed wide table to determine the original data tables that need to be connected."
[0109] As another aspect, the present invention also provides a computer-readable medium. This computer-readable medium can be included in the device described in the above embodiments; it can also exist alone without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by the device, the device includes: obtaining at least one corresponding original data table from a data source according to the file path recorded in the configuration information, and then analyzing the difference between the original data table and a pre-designed wide table to determine the original data tables that need to be connected; calling a data analysis tool to establish connections for the determined multiple original data tables to query the field information of the target fields that meet the set connection conditions, and then writing the field information to the corresponding positions of the wide table according to the field names of the wide table; receiving a report generation request, calling a visualization tool to extract the target column data indicated by the report generation request from the wide table, and inserting the target column data into a configured report template to generate a corresponding report.
[0110] According to the technical solution of the embodiments of the present invention, by comparing the differences between the original data table and the pre-designed wide table, the original data tables that need to be connected are determined, and then the field information of the target fields is queried from the connected data tables and written into the wide table, so that subsequent data can be quickly and flexibly extracted from the wide table according to the indication of the report generation request, and a corresponding report can be generated, realizing the flexible configuration and quick response of the report.
[0111] The above specific embodiments do not constitute a limitation to the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
Claims
1. A report generation method, characterized in that, Including: Obtain at least one corresponding original data table from the data source according to the file path recorded in the configuration information, and then analyze the differences between the original data table and the pre-designed wide table to determine the original data tables that need to be connected; wherein, quantify the business analysis requirements of the business theme into corresponding business indicators, and determine the business dimensions required for calculating the business indicators; according to the business dimensions, determine the business fields that the wide table corresponding to the business theme needs to include; fill the business fields into a data table file with a set first cell layout to generate the wide table; wherein, one cell of the data table file corresponds to one business field. Call the data analysis tool to connect the determined multiple original data tables to query the field information of the target fields that meet the set connection conditions, and then write the field information to the corresponding positions of the wide table according to the field names of the wide table. Receive a report generation request, call the visualization tool to extract the target column data indicated by the report generation request from the wide table, and insert the target column data into the configured report template to generate a corresponding report.
2. The method according to claim 1, wherein The step of analyzing the differences between the original data table and the pre-designed wide table to determine the original data tables that need to be connected includes: Compare the similarities and differences between the attribute fields of the original data table and the business fields of the wide table. In the case where there are attribute fields in the original data table that match the field names of the business fields, use the original data table as the original data table that needs to be connected.
3. The method according to claim 1, wherein The step of connecting the determined multiple original data tables includes: Use the connection fields to connect the determined multiple original data tables according to the set connection method; wherein, the connection fields are the same attribute fields in the multiple original data tables.
4. The method according to claim 1, characterized in that The step of extracting the target column data indicated by the report generation request from the wide table includes: Dynamically splice the corresponding query statement according to the target column data indicated by the report generation request, and use the query statement to query the corresponding target column data from the wide table.
5. The method according to claim 4, characterized in that, The report template includes a graphic template. The step of inserting the target column data into the configured report template includes: Insert the target column data into the graphic template according to the graphic template indicated by the report generation request.
6. The method according to claim 1, wherein After the step of obtaining at least one corresponding original data table from the data source, the method further includes: Call the distributed framework to perform distributed storage on the at least one original data table.
7. The method according to claim 6, wherein After the step of determining the original data tables that need to be connected, the method further includes: Use stream computing to load the originally data tables stored distributively into the in-memory database table for real-time calculation.
8. The method according to claim 7, wherein The step of loading the originally data tables stored distributively into the in-memory database table for real-time calculation includes: Load the originally data tables stored distributively into the in-memory database table. Use multi-threading and the set data processing logic to concurrently calculate the data to be calculated in the in-memory database table.
9. The method according to claim 1, characterized in that, The step of calling the data analysis tool includes: After determining that the triggering condition of the scheduled task is met according to the scheduled task configured in the task scheduler, call the data analysis tool; wherein, the scheduled task includes the call information of the data analysis tool.
10. The method according to any one of claims 1-4, 6-9, characterized in that, The method further includes: Configure the data items required for the report template according to the set data item requirement information. Fill the data items into an intermediate file with a set second cell layout to generate the report template; wherein, one cell of the intermediate file corresponds to one data item.
11. The method according to claim 10, wherein The inserting the target column data into the configured report template to generate a corresponding report includes: Insert the target column data into the cells of the report template. Process the target column data in the cell according to the data processing format set for the cell to obtain a corresponding report.
12. A report generation device, characterized in that, It includes: A data extraction module, configured to obtain at least one corresponding original data table from a data source according to the file path recorded in the configuration information, and then analyze the differences between the original data table and a pre-designed wide table to determine the original data tables that need to be connected; wherein, quantify the business analysis requirements of the business theme into corresponding business indicators, determine the business dimensions required to calculate the business indicators; according to the business dimensions, determine the business fields that the wide table corresponding to the business theme needs to include; fill the business fields into a data table file with a set first cell layout to generate the wide table; wherein, one cell of the data table file corresponds to one business field. A query writing module, configured to call a data analysis tool to connect the determined multiple original data tables to query the field information of the target fields that meet the set connection conditions, and then write the field information to the corresponding positions of the wide table according to the field names of the wide table. A report generation module, configured to receive a report generation request, call a visualization tool to extract the target column data indicated by the report generation request from the wide table, insert the target column data into the configured report template, and generate a corresponding report.
13. An electronic device, characterized in that, It includes: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-11.
14. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method according to any one of claims 1-11.
Citation Information
Patent Citations
Wide table generation method and device
CN110928879A
General report generation method and device and computer readable storage medium
CN111428458A