Report generation method, electronic device, and computer-readable storage medium

CN122415773BActive Publication Date: 2026-08-28ZHEJIANG DAHUA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610894800.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-22
Publication Date
2026-08-28
Estimated Expiration
2046-06-22

AI Technical Summary

Technical Problem

然而,传统的数据报表生成流程往往依赖人工确定报表所需的数据以及数据所匹配的图表,导致报表生成较为不便

Benefits of technology

[0007]The beneficial effects of this application are as follows: Unlike existing technologies, this application obtains a report framework after converting the report generation description. By converting the report generation description, it automatically generates the report framework and its chapters, and obtains a pre-built data indicator library and chart interface library. The data indicator library distinguishes data indicators by statistical indicators and statistical methods, while the chart interface library distinguishes chart interfaces by display format. The report framework includes at least one chapter and the corresponding statistical requirements for that chapter. These statistical requirements are related to statistical indicators and statistical methods. A large language model is used to obtain target data indicators matching the statistical requirements from the data indicator library, thereby automatically identifying the target data indicators required for each chapter and determining the result protocol for the target data indicators. The result protocol is related to the statistical method. Based on the result protocol and the chart interface display protocol, the target chart interface matching the target data indicators is automatically obtained from the chart interface library by matching the two protocols. The display protocol is related to the display format. The target data indicators and target chart interfaces for each chapter in the report framework are obtained, and the statistical results corresponding to the target data indicators are displayed using the target chart interfaces. This allows each chapter to be concisely displayed in chart form, generating the target report and improving the convenience of report generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122415773B_ABST
    Figure CN122415773B_ABST
Patent Text Reader

Abstract

The application discloses a report generation method, an electronic device and a computer readable storage medium, comprising: obtaining a report framework converted from a report generation description, and a pre-constructed data index library and a chart interface library; distinguishing data indexes according to statistical indexes and statistical methods, and distinguishing chart interfaces according to display forms; the report framework comprises at least one chapter and statistical requirements of the chapter, the statistical requirements are related to the statistical indexes and the statistical methods; a target data index matched with the statistical requirements is obtained from the data index library by using a large language model, and a result protocol of the target data index is determined; the result protocol is related to the statistical method; a target chart interface matched with the target data index is obtained from the chart interface library based on a display protocol of the result protocol and the chart interface; the display protocol is related to the display form; and a target report is generated based on the target data index and the target chart interface of each chapter in the report framework. The above scheme can improve the convenience of report generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a report generation method, electronic device, and computer-readable storage medium. Background Technology

[0002] With the advent of the data era, various business systems have accumulated massive amounts of data. How to concisely display the required data using data reports has become a crucial aspect. However, traditional data report generation processes often rely on manually determining the data required for the report and the corresponding charts, making report generation inconvenient. Therefore, improving the ease of report generation has become an urgent problem to be solved. Summary of the Invention

[0003] The main technical problem addressed by this application is to provide a report generation method, electronic device, and computer-readable storage medium that can improve the ease of report generation.

[0004] To address the aforementioned technical problems, this application provides a report generation method, comprising: obtaining a report framework derived from a report generation description conversion, and a pre-built data indicator library and chart interface library; wherein, data indicators are distinguished by statistical indicators and statistical methods, and chart interfaces are distinguished by display format; the report framework includes at least one chapter and the statistical requirements of the chapter, the statistical requirements being related to the statistical indicators and the statistical methods; using a large language model to obtain target data indicators matching the statistical requirements from the data indicator library, and determining a result protocol for the target data indicators; wherein, the result protocol is related to the statistical methods; based on the result protocol and the display protocol of the chart interfaces, obtaining a target chart interface matching the target data indicators from the chart interface library; wherein, the display protocol is related to the display format; and generating a target report based on the target data indicators and the target chart interfaces of each chapter in the report framework.

[0005] To address the aforementioned technical problems, a second aspect of this application provides an electronic device comprising: a memory and a processor coupled to each other, wherein the memory stores program data, and the processor invokes the program data to execute the method described in the first aspect.

[0006] To address the aforementioned technical problems, a third aspect of this application provides a computer-readable storage medium storing program data thereon, wherein the program data, when executed by a processor, implements the method described in the first aspect.

[0007] The beneficial effects of this application are as follows: Unlike existing technologies, this application obtains a report framework after converting the report generation description. By converting the report generation description, it automatically generates the report framework and its chapters, and obtains a pre-built data indicator library and chart interface library. The data indicator library distinguishes data indicators by statistical indicators and statistical methods, while the chart interface library distinguishes chart interfaces by display format. The report framework includes at least one chapter and the corresponding statistical requirements for that chapter. These statistical requirements are related to statistical indicators and statistical methods. A large language model is used to obtain target data indicators matching the statistical requirements from the data indicator library, thereby automatically identifying the target data indicators required for each chapter and determining the result protocol for the target data indicators. The result protocol is related to the statistical method. Based on the result protocol and the chart interface display protocol, the target chart interface matching the target data indicators is automatically obtained from the chart interface library by matching the two protocols. The display protocol is related to the display format. The target data indicators and target chart interfaces for each chapter in the report framework are obtained, and the statistical results corresponding to the target data indicators are displayed using the target chart interfaces. This allows each chapter to be concisely displayed in chart form, generating the target report and improving the convenience of report generation. Attached Figure Description

[0008] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein: Figure 1 This is a flowchart illustrating one implementation method of the report generation method of this application; Figure 2 This is a flowchart illustrating another implementation of the report generation method of this application; Figure 3 This is a schematic diagram illustrating an application scenario of one embodiment of the description template in this application; Figure 4 This is a schematic diagram illustrating an application scenario of one implementation of the report framework of this application; Figure 5 This is a schematic diagram illustrating an application scenario of one implementation method of the data indicator library of this application; Figure 6 This is a schematic diagram illustrating an application scenario of one embodiment of the graphic interface library in this application; Figure 7 This is a logical topology diagram of one implementation of the result protocol of this application; Figure 8 This is a schematic diagram illustrating an application scenario of one implementation method for generating the target report in this application; Figure 9This is a schematic diagram illustrating an application scenario of one embodiment of the diagram rendering method described in this application; Figure 10 This is a schematic diagram of the structure of one embodiment of the electronic device of this application; Figure 11 This is a schematic diagram of one embodiment of the computer-readable storage medium of this application. Detailed Implementation

[0009] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments, and different implementation methods can be adaptively combined. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0010] In this paper, the terms "system" and "network" are often used interchangeably. The term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this paper means two or more.

[0011] The report generation method provided in this application is used to automatically generate data reports, and the corresponding execution subject is a processing unit capable of data processing.

[0012] Please see Figure 1 , Figure 1 This is a flowchart illustrating one embodiment of the report generation method of this application, which includes: S101: Obtain the report framework obtained by converting the report generation description, as well as the pre-built data indicator library and chart interface library; wherein, the data indicators are distinguished by statistical indicators and statistical methods, and the chart interfaces are distinguished by display format. The report framework includes at least one chapter and the statistical requirements of the chapter. The statistical requirements are related to the statistical indicators and statistical methods.

[0013] Specifically, the report framework is obtained after converting the report generation description, and then the report framework and the chapters within the report framework are automatically generated by converting the report generation description.

[0014] In addition, a pre-built data indicator library and chart interface library are obtained. The data indicator library distinguishes data indicators according to statistical indicators and statistical methods, and the chart interface library distinguishes chart interfaces according to display format. The report framework includes at least one chapter and the statistical requirements of the corresponding chapter. The statistical requirements are related to the statistical indicators and statistical methods.

[0015] In one implementation, a report generation description is obtained, the corresponding requirement semantics are determined, a report framework is generated based on the requirement semantics, and the chapters within the report framework and the statistical requirements corresponding to each chapter are determined. The requirement semantics are obtained by a text encoder, which is pre-trained.

[0016] In one implementation, a report generation description is obtained and input into a large language model to obtain a report framework output by the large language model, along with the statistical requirements corresponding to each chapter included in the report framework. The large language model is then fine-tuned using the report generation requirement text.

[0017] It is understandable that a report framework typically includes multiple chapters; however, a simple report may only include one chapter. Furthermore, in addition to chapters, a report framework may also include other framework nodes such as topics and conclusions; this application does not impose specific restrictions on this.

[0018] In some implementation scenarios, the report generation description is input using a preset description template. The description template includes input requirements set for each chapter, so that after obtaining the report generation description, the requirement semantics related to the chapter can be obtained. The report framework is generated based on the requirement semantics, and the input requirements are standardized and transformed to obtain the statistical requirements for each chapter.

[0019] In some implementation scenarios, report generation descriptions are used to provide hints to the large language model. The report generation description includes an overall framework description and chapter descriptions. By inputting the report generation description into the large language model, the output report framework and the statistical requirements corresponding to each chapter included in the report framework are obtained.

[0020] It should be noted that the data indicator library is pre-built, constructed according to different statistical methods such as quantity statistics, distribution statistics, and ranking statistics for the required business areas. The data indicator library includes multiple data indicators, each of which can obtain corresponding data, and statistically analyzes the corresponding data according to the statistical method to obtain statistical results. The result protocol of each data indicator is used to characterize the output logic corresponding to the statistical method when outputting the statistical results. Among them, the statistical indicators are associated with specific business areas, such as road condition statistical indicators and sales performance statistical indicators.

[0021] In addition, the chart interface library is pre-built, which summarizes various statistical result presentation formats in data statistics scenarios and extracts various chart interfaces such as text, tables, pie charts, line charts, bar charts, dot maps, line maps, and regional maps to form a chart interface library. The chart interface is also the user interface (UI) used to display data. The display protocol of each chart interface is used to characterize the display logic corresponding to the display method when displaying statistical results.

[0022] S102: Use a large language model to obtain target data indicators that match statistical needs from the data indicator library, and determine the result protocol for the target data indicators; wherein, the result protocol is related to the statistical method.

[0023] Specifically, a large language model is used to obtain target data indicators that match statistical needs from a data indicator library, thereby automatically identifying the target data indicators required for each chapter and determining the result protocol for the target data indicators, wherein the result protocol is related to the statistical method.

[0024] In one embodiment, indicator prompt text is constructed based on statistical requirements. The indicator prompt text is used to instruct the large language model to extract the data indicator with the highest matching degree to the statistical requirements from the data indicator library. The indicator prompt text is input into the large language model to obtain the target data indicator that matches the statistical requirements output by the large language model, and the result protocol corresponding to the target data indicator is determined.

[0025] In one embodiment, indicator prompt text is constructed based on statistical requirements. The indicator prompt text is used to instruct the large language model to determine the target statistical indicators and target statistical methods corresponding to the statistical requirements. Data indicators corresponding to the target statistical indicators and target statistical methods are obtained from the data indicator library. The indicator prompt text is input into the large language model to obtain the target data indicators that match the statistical requirements output by the large language model, and the result protocol corresponding to the target data indicators is determined.

[0026] It should be noted that the large language model is obtained by fine-tuning sample data from relevant business domains. The sample data is constructed based on data indicators in the data indicator library, so that after obtaining the statistical requirements of each chapter, the target data indicator with the highest matching degree with the statistical requirements can be accurately identified.

[0027] Optionally, the large language model may include, but is not limited to, deep neural networks (DNNs), convolutional neural networks (CNNs), recurrent neural networks (RNNs), long short-term memory networks (LSTM), and generative pre-trained Transformer models, etc. No specific restrictions are placed on the specific construction and deployment of the large language model.

[0028] S103: Based on the result protocol and the display protocol of the chart interface, the target chart interface matching the target data indicator is obtained from the chart interface library; wherein, the display protocol is related to the display format.

[0029] Specifically, based on the result protocol and the display protocol of the chart interface, the target chart interface that matches the target data indicator is automatically obtained from the chart interface library by matching the two protocols. The display protocol is related to the display format.

[0030] In one embodiment, the protocol semantics corresponding to the result protocol and the display protocol are obtained, semantic matching is performed based on the protocol semantics corresponding to the result protocol and the display protocol, and the chart interface corresponding to the display protocol with the highest matching degree is taken as the target chart interface.

[0031] In one embodiment, the protocol nodes and their corresponding protocol fields in the result protocol and the display protocol are obtained. Based on the protocol nodes and their corresponding protocol fields at the same level in the result protocol and the display protocol, the protocol similarity between the result protocol and the display protocol is determined. The chart interface corresponding to the display protocol with the highest protocol similarity is taken as the target chart interface.

[0032] It is understandable that the result protocol and the display protocol correspond to their respective protocol logics. By matching between the protocols, the target chart interface with the best matching degree between the data output logic and the chart display logic can be selected from the chart interface library for the target data metric.

[0033] S104: Generate the target report based on the target data metrics and target chart interfaces of each chapter in the report framework.

[0034] Specifically, the target data indicators and target chart interfaces for each chapter in the report framework are obtained, and the statistical results corresponding to the target data indicators are displayed using the target chart interfaces, so that each chapter can be displayed in a concise chart form to generate the target report and improve the convenience of report generation.

[0035] In one implementation, the display content corresponding to all framework nodes in the report framework is obtained, the target data indicators and target chart interfaces corresponding to each chapter are extracted, the statistical results corresponding to the target data indicators are imported into the target chart interface to generate display charts, and the display charts are integrated into the corresponding chapters to generate the target report.

[0036] In one implementation, the display content corresponding to each frame node is generated sequentially based on the order of the report framework. When the frame node is a chapter, the statistical results corresponding to the target data indicator are imported into the target chart interface to generate the display chart of the corresponding chapter, until all frame nodes of the report framework are traversed to generate the target report.

[0037] Understandably, each frame node within the report framework can be generated automatically, the corresponding display content of the frame node is used to explain the frame node, and the display charts in each chapter can concisely and intuitively display the data.

[0038] The above solution obtains a report framework after transforming the report generation description. This framework and its chapters are then automatically generated through the transformation of the report generation description. A pre-built data indicator library and chart interface library are also obtained. The data indicator library categorizes data indicators by statistical metrics and methods, while the chart interface library categorizes chart interfaces by display format. The report framework includes at least one chapter and its corresponding statistical requirements, which are related to the statistical indicators and methods. A large language model is used to retrieve target data indicators matching the statistical requirements from the data indicator library, automatically identifying the target data indicators needed for each chapter and determining the result protocol for these indicators. The result protocol is related to the statistical method. Based on the result protocol and the chart interface display protocol, the target chart interface matching the target data indicators is automatically retrieved from the chart interface library by matching the two protocols. The display protocol is related to the display format. The target data indicators and target chart interfaces for each chapter in the report framework are obtained. The target chart interfaces are used to display the statistical results corresponding to the target data indicators, enabling each chapter to be concisely displayed in chart form, generating the target report and improving the ease of report generation.

[0039] Please see Figure 2 , Figure 2 This is a flowchart illustrating another embodiment of the report generation method of this application, the method including: S201: Obtain the report framework obtained by converting the report generation description, as well as the pre-built data indicator library and chart interface library; wherein, the data indicators are distinguished by statistical indicators and statistical methods, and the chart interfaces are distinguished by display format. The report framework includes at least one chapter and the statistical requirements of the chapter. The statistical requirements are related to the statistical indicators and statistical methods.

[0040] Specifically, the process involves obtaining a report generation description, converting it into a report framework, and using a pre-built data indicator library and chart interface library. The data indicator library categorizes data indicators by statistical metrics and methods, while the chart interface library categorizes chart interfaces by display format. The report framework includes at least one chapter and the corresponding statistical requirements for that chapter, with the statistical requirements related to the statistical metrics and methods.

[0041] In one embodiment, obtaining the report framework derived from the report generation description includes: obtaining the report generation description and its matching description template; extracting the topic description, all chapter descriptions, and the requirement description corresponding to each chapter description from the description template; for each chapter description, determining the statistical requirement description related to the statistical indicators and statistical methods based on the topic description, chapter description, and their corresponding requirement description; generating a framework node that matches the topic description and chapter description based on the description template; performing a structured transformation on the topic description, all chapter descriptions, and their corresponding statistical requirement descriptions; adding them to the framework node to obtain the report framework.

[0042] Specifically, the report generation description is matched with a description template, which is used to limit the input requirements of the report generation description in order to obtain the necessary description content. The necessary description content includes at least the topic, chapter, and the requirements corresponding to the chapter. The topic description, all chapter descriptions, and the requirement descriptions corresponding to each chapter description are extracted from the description template.

[0043] Furthermore, for each chapter description, based on the topic description, chapter description, and the corresponding requirement description, multiple dimensions of description content are integrated to determine the statistical requirement description related to statistical indicators and statistical methods, thus ensuring the accuracy of the statistical requirement description.

[0044] Understandably, the framework nodes that match the topic description and chapter description are generated based on the description template, so that at least the topic node and the corresponding chapter node are obtained in the report framework. The topic description, all chapter descriptions and their corresponding statistical requirement descriptions are structurally transformed to standardize the topic description, chapter description and statistical requirement description. The transformed description content is added to the corresponding framework nodes to clarify the topic of the report framework and the statistical requirements of each chapter.

[0045] For easier understanding, please refer to Figure 3 , Figure 3This is a schematic diagram illustrating an application scenario of one implementation of the description template in this application. Taking an event description template as an example, the event description template includes a report title, a chapter title, and statistical content. The report title specifies the time and region of the report, and the time and region are formatted for easy and accurate extraction, such as "

[2025] [City] Event Source Tracing Report." The chapter title summarizes the statistical content of the current chapter, such as "Overview of Historical Events." The statistical content specifies the required statistical data for this section, clearly stating the presentation requirements of the statistical data, including key information such as time, location, and statistical indicators. The time is optional; if not filled in, it directly inherits the time from the report title. The location is also optional; if not filled in, it directly inherits the location from the report title. Therefore, combining the topic description, chapter description, and the corresponding requirement description of the chapter description can most accurately determine the statistical requirements of the chapter. Each time input is made, the number of chapters and the specific statistical requirements within each chapter can be customized; this application does not impose specific restrictions on this.

[0046] Please see Figure 4 , Figure 4 This is a schematic diagram illustrating an application scenario of one implementation of the report framework of this application. It involves structurally transforming the topic description, all chapter descriptions, and their corresponding statistical requirements, and adding the transformed descriptions to the corresponding framework nodes to clarify the topic of the report framework and the statistical requirements of each chapter. For example, Figure 4 As shown, topic descriptions starting with ## are converted to the title field of the first level of the data report framework. Chapter descriptions starting with ### are also converted and placed under the sections array field of the first level of the data report framework, serving as the title field of a specific item in the array. There can be multiple chapters; each time a chapter is identified, the sections array adds an item. Statistical requirement descriptions are converted and placed under the contents field of the corresponding chapter's JSON data in the report framework, serving as the content field of a specific item in the contents array. Each chapter can have multiple contents; each time a chapter is identified, the contents array adds an item.

[0047] It should be noted that the data indicator library is constructed based on the following steps: acquiring multiple statistical methods, constructing multiple data indicators based on the statistical indicators matched under each statistical method; among them, the data indicators can be used to acquire the data corresponding to the data indicators, and to perform statistics on the acquired data according to the corresponding statistical methods to obtain statistical results; generating indicator descriptions for the data indicators based on the statistical indicators and statistical methods, generating result protocols for the data indicators based on the statistical methods; and obtaining the data indicator library based on all data indicators and their corresponding indicator descriptions and result protocols.

[0048] Specifically, please refer to Figure 5 , Figure 5This is a schematic diagram illustrating an application scenario of one implementation method of the data indicator library of this application. The data indicators in the data indicator library are influenced by both statistical indicators and statistical methods. Combining different statistical methods with corresponding statistical indicators can yield multiple data indicators, for example... Figure 5 The statistical methods shown are not limited to any specific method; various other specific statistical methods can be set in different scenarios. The data metrics can be used to obtain the data corresponding to the data metrics and to perform statistical analysis on the obtained data according to the corresponding statistical methods to obtain statistical results. Therefore, the execution logic of the data metrics can be an executable code program, a structured query language (SQL) statement connecting to the data source, or a callable data interface.

[0049] Furthermore, based on statistical indicators and methods, indicator descriptions are generated for each data indicator. These descriptions explain the corresponding data indicators to facilitate matching. Based on the statistical methods, result protocols for the data indicators are generated to clarify the output logic of the statistical results. A data indicator library is obtained based on all data indicators, their corresponding descriptions, and result protocols, ensuring the library's completeness.

[0050] Optionally, each data indicator can be passed in indicator parameters, thereby determining the statistical range of the statistical results corresponding to the data indicator through the indicator parameters. The indicator parameters include, but are not limited to, time, region, and characteristics.

[0051] For ease of understanding, taking event ranking statistics as an example, the indicator parameters can include time period (e.g., 2025), region (e.g., a city), and characteristics (e.g., area and type). An example indicator description: Query the ranking of the number of events occurring in different regions within the current area based on the time period. The indicator execution logic can be implemented based on SQL statements. The result protocol includes three protocol nodes: the ranking statistics set, the region to which the event belongs, and the number of events occurring. The node for the ranking statistics set is located above the nodes for the region to which the event belongs and the number of events occurring.

[0052] It should be noted that the data metric library is matched with a scheduling execution engine. The data corresponding to the data metric is obtained from the data source. The scheduling execution engine is used to authenticate the request to obtain the target data metric, and after the authentication is successful, it schedules the target data metric to obtain the data from the corresponding data source.

[0053] Specifically, such as Figure 5As shown, the data metric library is matched with a scheduling execution engine. Each data metric cannot run independently; it must rely on the scheduling execution engine to complete pre-processing tasks such as authentication before it can be scheduled for execution and result output. The scheduling execution engine can be configured with accessible data sources for the data metrics to use. The data sources specifically provide data tables and data interfaces to interface with the data metrics. The scheduling execution engine is also used to authenticate requests to retrieve target data metrics, and after successful authentication, it schedules the target data metrics to retrieve data from the corresponding data source, ensuring the standardization and security of the data metric library.

[0054] Optionally, executable code scheduling, SQL execution scheduling, and API calls can be encapsulated into a unified execution service configuration within the scheduling execution engine.

[0055] In addition, the chart interface library is built based on the following steps: obtaining multiple chart interfaces, determining the interface description and display protocol corresponding to each chart interface, and building the chart interface library based on all chart interfaces and their corresponding interface descriptions and display protocols.

[0056] Specifically, please refer to Figure 6 , Figure 6 This is a schematic diagram illustrating an application scenario of one implementation of the graphical interface library of this application, such as... Figure 6 As shown, this application provides various chart interfaces, including line charts, bar charts, pie charts, data tables, text charts, heatmaps, dot maps, and regional maps. Multiple other specific chart interfaces can be set in different scenarios, and this application does not impose any specific limitations on them. Each chart interface is configured with an interface description and display protocol. For example, the interface description for a line chart includes "displaying statistical data in the form of a line chart," thus clearly describing the chart interface. The display protocol for a line chart includes two protocol nodes: data category items and the corresponding data value items for each data category.

[0057] S202: Construct indicator prompt text based on statistical needs, input the indicator prompt text into the large language model, and obtain the target data indicator and its corresponding indicator parameters selected from the data indicator library by the large language model output; wherein, the indicator parameters are used to determine the statistical range of the statistical results corresponding to the target data indicator.

[0058] Specifically, based on statistical needs, indicator prompt text is constructed to prompt the large language model to match data indicators. The indicator prompt text is input into the large language model to obtain the target data indicator selected from the data indicator library and its corresponding indicator parameters, thereby clarifying the statistical scope through the indicator parameters.

[0059] Understandably, a large language model, after fine-tuning, can adapt to tasks that define target data indicators and indicator parameters, and can more flexibly and accurately select suitable target data indicators for the statistical needs of each chapter.

[0060] In some implementation scenarios, the large language model is fine-tuned based on the following steps: construct at least one example sample corresponding to the data indicator based on the data indicator and its corresponding indicator description, and set data indicator labels and indicator parameter labels for the example sample; wherein, at least some example samples also include domain labels of the data indicators; and fine-tune the large language model using the example sample and its corresponding data indicator labels and indicator parameter labels.

[0061] Specifically, data metrics are obtained from the data metric library. Based on the full set of data metric names and with reference to the corresponding metric descriptions, example samples with the same semantics but different expressions are expanded through methods such as synonym substitution and sentence transformation. Data metric labels and metric parameter labels are set for each example sample to obtain the example sample set for training.

[0062] To facilitate understanding, let's take a specific example sample and set the prompt text as "Identify the data indicators that each statistical requirement in the data report wants to call and extract the indicator parameters that need to be passed in when calling the data indicators", and bind the input and output to form an example sample that can be used by a large language model.

[0063] Optionally, to better adapt the large language model to specific domains, at least some example samples also include domain labels for data metrics. This incorporates domain information into the prompt text within the example samples, identifying the domain corresponding to the current statistical requirement based on its meaning. Specifically, when data metrics have domain labels, the domain scope of the data metrics is first determined based on the domain labels before further identifying the data metrics and extracting their parameters. The target data metric is then queried within this domain scope.

[0064] Understandably, large language models can be fine-tuned using example samples and their corresponding data indicator labels and indicator parameter labels, enabling them to effectively adapt to tasks that determine target data indicators and indicator parameters based on statistical requirements. Specifically, low-rank adaptation techniques can be used to fine-tune the large language model. By inputting example samples and their corresponding labels, the large language model can be fine-tuned according to instructions, allowing it to adapt to data indicator recognition and parameter extraction tasks in specific domains.

[0065] S203: Protocol for obtaining the result corresponding to the target data indicator from the data indicator library.

[0066] Specifically, the data indicator library stores the result protocols corresponding to the data indicators during construction. The result protocol corresponding to the target data indicator is obtained from the data indicator library so that the result protocol can be used for protocol matching.

[0067] S204: A display protocol based on the result protocol and the chart interface, which obtains the target chart interface matching the target data indicator from the chart interface library; wherein, the display protocol is related to the display format.

[0068] Specifically, the result protocol includes nodes at multiple levels and their corresponding first fields, and the display protocol includes nodes at multiple levels and their corresponding second fields. Based on the nodes at each level in the result protocol and their corresponding first fields, and the nodes at each level in the display protocol and their corresponding second fields, the target chart interface matching the target data indicator is obtained from the chart interface library.

[0069] Understandably, based on the nodes and their corresponding first fields at each level of the result protocol, and the nodes and their corresponding second fields at each level of the display protocol, the result protocol is matched with the display protocol of each chart interface in the chart interface library. The target chart interface matching the target data metric is then obtained from the chart interface library. In one embodiment, based on the result protocol and the display protocol of the chart interface, a target chart interface matching the target data indicator is obtained from the chart interface library, including: for the same level in the result protocol and each display protocol, based on the first field and the second field corresponding to the nodes at the same level; in response to at least one set of protocol similarities exceeding a first threshold, the chart interface corresponding to the display protocol with the highest protocol similarity is taken as the target chart interface; in response to none of the protocol similarities exceeding the first threshold, a reference similarity is determined based on the first path set connecting all nodes in the result protocol and the second path set connecting all nodes in the display protocol, as well as all the first field and all the second field, and the target chart interface is obtained from the chart interface library using the reference similarity.

[0070] Specifically, the result protocol is matched with each display protocol separately. The nodes and their corresponding fields at the same level in the result protocol and the display protocol are compared level by level. The protocol similarity is determined based on the first and second fields of all the same level.

[0071] Please see Figure 7 , Figure 7 This is a logical topology diagram of one embodiment of the result protocol of this application. The result protocol can represent the output logic of the output display nodes. Each level includes corresponding nodes, and each node has corresponding fields. The fields of the nodes correspond to data attributes. Figure 7The root node is the output node. Nodes connected to the root node by solid lines are nodes in the protocol. Each node corresponds to a specific field. Nodes connected by dashed lines contain the field description text. For example, Dates is the field corresponding to a node, Array and Date are the field description text, Accident is the field corresponding to a node, Object and Historical Events are the field description text, the Event corresponds to the Values ​​node field, and Array and Number of Events are the field description text.

[0072] Similarly, the presentation protocol also has nodes at each level and their corresponding fields according to the presentation logic. The result protocol and the presentation protocol can be viewed as two sets of protocol trees, where the keys are nodes and the values ​​are fields. Let the protocol tree corresponding to the result protocol be... The protocol tree corresponding to the displayed protocol is Let V be the set of nodes and E be the set of parent-child edges. The process of determining protocol similarity can be represented by the following formula: (1) in, Indicates protocol similarity. , This indicates that similarity is calculated, and the node set includes nodes and their corresponding fields.

[0073] Furthermore, when the similarity of at least one set of protocols exceeds the first threshold, the chart interface corresponding to the display protocol with the highest protocol similarity is taken as the target chart interface. In this way, the consistency of the nodes and their corresponding fields of the two sets of protocols is judged by protocol similarity. When the protocol similarity exceeds the first threshold, the target chart interface matching the target data indicator can be determined with a high-precision matching method.

[0074] Furthermore, when the protocol similarity does not exceed the first threshold, the first path set connecting all nodes in the result protocol and the second path set connecting all nodes in the display protocol are obtained. Based on the first path set and the second path set, as well as all first fields and all second fields, the reference similarity for the result protocol and the display protocol is re-determined so that the reference similarity is positively correlated with the overlap between paths in the two sets of protocols and the semantic association between fields. Thus, the target chart interface is obtained from the chart interface library based on the reference similarity, increasing the probability of extracting a suitable target chart interface for the target data indicator when the protocol similarity is lower than the first threshold.

[0075] In some implementation scenarios, the first field corresponds to a first field description text, and the second field corresponds to a second field description text. Based on the set of first paths connecting all nodes in the result protocol and the set of second paths connecting all nodes in the display protocol, as well as all first fields and all second fields, a reference similarity is determined, including: obtaining path similarity based on the first path set, the second path set, and the path intersection between them; wherein, the paired first and second paths in the path intersection have the same hierarchical structure; obtaining field similarity based on the semantics of the first field description text corresponding to all first fields and the semantics of the second field description text corresponding to all second fields; and determining the reference similarity based on path similarity and field similarity.

[0076] Specifically, a connectable path is obtained by taking the last level node as the basis and continuing until the root node is reached. The intersection of paths with the same hierarchical structure in the first path set and the second path set is obtained, thereby determining the number of paths with the same hierarchical structure in the two path sets.

[0077] Furthermore, the quantified accurate path similarity is obtained based on the ratio of the number of path sets to the number of the first and second path sets. Specifically, the path similarity can be determined based on the ratio of the number of path sets to the number of intersections between the first and second path sets, or it can be determined based on the ratio of the number of path sets to the number of maximum values ​​in the first and second path sets.

[0078] In a specific implementation scenario, let the first path set be... The second path set is ,get , Path similarity It can be calculated based on the following formula: (2) in, The first path in the first path set. This is the second path in the second path set.

[0079] It should be noted that, in order to determine field similarity, the semantics corresponding to the description text of the first field and the description text of the second field are obtained. The semantics corresponding to each description text of the first field are compared with the semantics corresponding to all description texts of the second field. The highest semantic similarity between the first field and all the second fields is determined. The semantics corresponding to each description text of the second field are compared with the semantics corresponding to all description texts of the first field. The highest semantic similarity between the second field and all the first fields is determined. Using the first semantic similarity of all the first fields and the second semantic similarity of all the second fields, the similarity between all the first fields and the second fields is calculated to obtain the field similarity. Thus, through bidirectional matching, the field similarity is determined, improving the accuracy of field similarity.

[0080] Optionally, semantic similarity is determined based on the word vector cosine algorithm, thereby performing semantic similarity analysis between fields.

[0081] In a specific implementation scenario, let the set corresponding to all the first field description texts be . The set corresponding to all the description text of the second field is To calculate the semantic similarity of a single field between two sets, the field descriptions are first converted into word vectors. and ,in, for The vector, for The vector, the single-field matching similarity is: (3) Where d is the word vector dimension, for The kth component.

[0082] Furthermore, the similarity between the two field sets is calculated. After obtaining the similarity of all individual fields, the set similarity is calculated using a bidirectional optimal matching algorithm. That is, for each field in L1, the field with the highest semantic similarity is found in L2, and simultaneously for each field in L2, the field with the highest semantic similarity is found in L1. The average of the two is then taken. The first semantic similarity between L1 and L2 is then calculated. for: Calculate the second semantic similarity between L2 and L1. for: Calculate the field similarity between the two field sets L1 and L2. for: .

[0083] It should be noted that the reference similarity is determined by combining path similarity and field similarity, thereby improving the accuracy of the reference similarity and ensuring the overlap between the reference similarity and the paths in the two sets of protocols, as well as the positive correlation between the semantic relationships between the fields. Based on the reference similarity, the target chart interface corresponding to the target data indicator is selected from the chart interface library.

[0084] Optionally, the reference similarity is determined by the product of path similarity and field similarity, thus obtaining the reference similarity through the joint constraint of similarity in two dimensions.

[0085] In some implementation scenarios, when at least one set of reference similarities exceeds a second threshold, where the second threshold is less than the first threshold, the chart interface corresponding to the display protocol with the highest reference similarity is used as the target chart interface to ensure the accuracy of the target chart interface.

[0086] Furthermore, when the reference similarity does not exceed the second threshold, a protocol matching prompt text is constructed based on the result protocol. The protocol matching prompt text, the result protocol, and the display protocol are input into the large language model to obtain the display protocol of the result protocol output by the large language model. The chart interface of the corresponding display protocol is used as the target chart interface. Thus, the large language model provides a safety net for the matching process between data indicators and chart interfaces, ensuring that the target data indicator can obtain the target chart interface.

[0087] S205: Generate the target report based on the target data metrics and target chart interfaces of each chapter in the report framework.

[0088] Specifically, the target data metrics and target chart interfaces for each chapter in the report framework are obtained, and the statistical results corresponding to the target data metrics are displayed using the target chart interfaces, so that each chapter can be concisely displayed in chart form to generate the target report.

[0089] In one embodiment, a target report is generated based on the target data metrics and target chart interfaces of each chapter in the report framework, including: rendering the report framework and generating matching display content for each frame node of the report framework; importing the statistical results corresponding to the target data metrics of each chapter into the target chart interface and rendering the display chart corresponding to each chapter; and combining the display chart corresponding to each chapter with the corresponding display content to generate the target report.

[0090] Specifically, the report framework is rendered, generating display content that matches each framework node. This allows the display content to explain the framework nodes, clarifying the content to be displayed for each node. The statistical results corresponding to the target data indicators for each chapter are imported into the target chart interface, ensuring the results are displayed according to the interface's format, thus generating charts for confirmation of each chapter's chart display.

[0091] Furthermore, the charts and graphs corresponding to each chapter are combined with the corresponding content so that the content can briefly explain the charts and graphs can concisely display the statistical results, thereby generating the target report and improving the ease of report generation.

[0092] Please see Figure 8 , Figure 8 This is a schematic diagram of an application scenario for generating a target report according to one implementation method of this application. Based on the frame structure of the report framework, a realistic report framework display effect is rendered. The framework nodes are parsed and converted into text content according to the format of titles and chapters. The target data indicators in each chapter are parsed in turn, the corresponding target data indicators are executed to obtain statistical results, and the result data is passed to the paired target chart interface to render the display chart. The display chart is then filled into the corresponding chapters in the report framework in turn to complete the assembly and display of the data report.

[0093] It should be noted that after generating the target report based on the target data indicators and target chart interfaces of each chapter in the report framework, the process also includes: responding to the indicator adjustment information corresponding to the target data indicators, redetermining the target data indicators and their corresponding indicator parameters based on the indicator adjustment information; wherein, the updated target data indicators and indicator parameters are used to construct supplementary samples for the large language model; responding to the interface adjustment information corresponding to the target chart interfaces, redetermining the target chart interfaces based on the interface adjustment information; and generating the target report based on the latest target data indicators and target chart interfaces of each chapter in the report framework.

[0094] Specifically, when the indicator adjustment information corresponding to the target data indicator is obtained, the indicator prompt text is adjusted based on the indicator adjustment information, and the target data indicator and its corresponding indicator parameters are re-determined using the adjusted indicator prompt text, so that the target data indicator and its corresponding indicator parameters are adjusted according to the latest instructions.

[0095] Understandably, the updated target data indicators and indicator parameters are used to construct supplementary samples for the large language model, thereby feeding back the adjustments to the target data indicators to the large language model and obtaining supplementary samples for the large language model. As diverse statistical content is continuously adjusted and corrected, the positive supplementary samples will become increasingly abundant, so that the indicator identification and parameter extraction effects of the large language model will become more and more accurate.

[0096] Furthermore, once the interface adjustment information corresponding to the target chart interface is obtained, the target chart interface is reselected for the target data indicator based on the interface adjustment information, so that the target chart interface can be adjusted according to the latest instructions, ensuring the accuracy of the target chart interface.

[0097] Understandably, once the latest target data metrics and target data interface are obtained, the statistical results corresponding to the target data metrics of each chapter are imported into the target chart interface so that the statistical results are displayed in the manner shown in the target chart interface, resulting in a display chart. The target report is then updated so that the target report can be adjusted according to the adjustment requirements.

[0098] Please see Figure 9 , Figure 9 This is a schematic diagram illustrating an application scenario of one embodiment of chart rendering in this application. The chart rendering is accompanied by a chart debugging interface. The chart debugging interface is designed to receive and parse the target data indicators and their corresponding target image decoding output from the previous steps, complete the assembly and rendering of the displayed chart, and provide a visual interface that allows users to verify the running effect of the report. If the requirements are not met, secondary adjustments can be made. The indicator adjustment information and interface adjustment information are obtained from the options or input content of the chart debugging interface to improve the flexibility of chart rendering.

[0099] Please see Figure 10 , Figure 10 This is a schematic diagram of an embodiment of the electronic device of this application. The electronic device 30 includes a memory 301 and a processor 302 coupled to each other. The memory 301 stores program data (not shown in the figure). The processor 302 calls the program data to implement the method in any of the above embodiments. For the description of the relevant content, please refer to the detailed description of the above method embodiments, which will not be repeated here.

[0100] Please see Figure 11 , Figure 11 This is a schematic diagram of a computer-readable storage medium according to an embodiment of the present application. The computer-readable storage medium 40 stores program data 400. When the program data 400 is executed by a processor, it implements the method in any of the above embodiments. For a detailed description of the relevant content, please refer to the detailed description of the above method embodiments, which will not be repeated here.

[0101] It should be noted that the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0102] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0103] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0104] The above description is merely an embodiment of this application and does not limit the scope of protection of this application. Any equivalent structural or procedural transformations made based on the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of protection of this application.

Claims

1. A report generation method, characterized in that, include: Obtain the report framework obtained by converting the report generation description, as well as the pre-built data indicator library and chart interface library; wherein, the data indicators are distinguished by statistical indicators and statistical methods, and the chart interfaces are distinguished by display format. The report framework includes at least one chapter and the statistical requirements of the chapter, and the statistical requirements are related to the statistical indicators and the statistical methods. The target data indicators matching the statistical requirements are obtained from the data indicator library using a large language model, and the result protocol of the target data indicators is determined; wherein, the result protocol is related to the statistical method. Based on the result protocol and the display protocol of the chart interface, a target chart interface matching the target data indicator is obtained from the chart interface library; wherein, the display protocol is related to the display format, the result protocol includes multiple levels of nodes and their corresponding first fields, and the display protocol includes multiple levels of nodes and their corresponding second fields; for the same level in the result protocol and each of the display protocols, the protocol similarity is determined based on the first field and the second field corresponding to the nodes at the same level; in response to at least one set of protocol similarities exceeding a first threshold, the chart interface corresponding to the display protocol with the highest protocol similarity is taken as the target chart interface; in response to none of the protocol similarities exceeding the first threshold, a reference similarity is determined based on the first path set connecting all nodes in the result protocol and the second path set connecting all nodes in the display protocol, as well as all the first fields and all the second fields, and the target chart interface is obtained from the chart interface library using the reference similarity; A target report is generated based on the target data metrics and target chart interfaces of each chapter in the report framework.

2. The report generation method according to claim 1, characterized in that, The process of obtaining the report framework obtained by converting the report generation description includes: Obtain the report generation description and its matching description template, and extract the topic description, all chapter descriptions, and the requirement description corresponding to each chapter description from the description template; For each chapter description, based on the topic description, the chapter description and its corresponding requirement description, determine the statistical requirement description related to the statistical indicators and the statistical methods; Based on the description template, a framework node matching the topic description and the chapter description is generated. The topic description, all chapter descriptions and their corresponding statistical requirement descriptions are structurally transformed and added to the framework node to obtain the report framework.

3. The report generation method according to claim 2, characterized in that, The generation of the target report based on the target data metrics and target chart interface of each chapter in the report framework includes: The report framework is rendered, and matching display content is generated for each of the framework nodes of the report framework; Import the statistical results corresponding to the target data indicators of each chapter into the target chart interface, and render the display chart corresponding to each chapter; The target report is generated by combining the display charts and corresponding display content for each chapter.

4. The report generation method according to claim 1, characterized in that, The data indicator library was constructed based on the following steps: Multiple statistical methods are acquired, and multiple data indicators are constructed based on the statistical indicators matched under each statistical method; wherein, the data indicators can be used to acquire the data corresponding to the data indicators, and statistical results are obtained by performing statistics on the acquired data according to the corresponding statistical methods; Based on the statistical indicators and the statistical methods, an indicator description for the data indicators is generated, and based on the statistical methods, a result protocol for the data indicators is generated. The data indicator library is obtained based on all the data indicators, their corresponding indicator descriptions, and the result protocols.

5. The report generation method according to claim 4, characterized in that, The large language model is fine-tuned based on the following steps: Based on the data metrics and their corresponding metric descriptions, at least one example sample corresponding to the data metrics is constructed, and data metric labels and metric parameter labels are set for the example samples; wherein, at least some of the example samples also include domain labels for the data metrics; The large language model is fine-tuned using the example samples and their corresponding data indicator labels and indicator parameter labels.

6. The report generation method according to claim 4, characterized in that, The data indicator library is matched with a scheduling execution engine. The data corresponding to the data indicator is obtained from the data source. The scheduling execution engine is used to authenticate the request to obtain the target data indicator, and after the authentication is passed, it schedules the target data indicator to obtain data from the corresponding data source.

7. The report generation method according to claim 1, characterized in that, The step of using a large language model to obtain the target data indicators matching the statistical needs from the data indicator library and determining the result protocol of the target data indicators includes: Based on the statistical requirements, an indicator prompt text is constructed. The indicator prompt text is input into the large language model to obtain the target data indicator and its corresponding indicator parameters selected from the data indicator library by the large language model. The indicator parameters are used to determine the statistical range of the statistical results corresponding to the target data indicator. The result protocol corresponding to the target data indicator is obtained from the data indicator library.

8. The report generation method according to claim 7, characterized in that, After generating the target report based on the target data metrics and target chart interface of each chapter in the report framework, the method further includes: In response to obtaining the indicator adjustment information corresponding to the target data indicator, the target data indicator and its corresponding indicator parameters are re-determined based on the indicator adjustment information; wherein, the updated target data indicator and indicator parameters are used to construct supplementary samples for the large language model; In response to obtaining the interface adjustment information corresponding to the target chart interface, the target chart interface is redefined based on the interface adjustment information. Based on the latest target data metrics and target chart interfaces for each chapter in the report framework, a target report is generated.

9. The report generation method according to claim 1, characterized in that, The first field corresponds to a first field description text, and the second field corresponds to a second field description text; The determination of reference similarity based on the first set of paths connecting all nodes in the result protocol and the second set of paths connecting all nodes in the display protocol, as well as all the first fields and all the second fields, includes: Based on the first path set, the second path set, and the path intersection between them, the path similarity is obtained; wherein, the first path and the second path paired in the path intersection have the same hierarchical structure. Based on the semantics of the first field description text corresponding to all the first fields, and the semantics of the second field description text corresponding to all the second fields, the field similarity is obtained; The reference similarity is determined based on the path similarity and the field similarity.

10. An electronic device, characterized in that, include: A memory and a processor are coupled to each other, wherein the memory stores program data, and the processor invokes the program data to perform the method as described in any one of claims 1-9.

11. A computer-readable storage medium storing program data thereon, characterized in that, When the program data is executed by the processor, the method as described in any one of claims 1-9 is implemented.

Citation Information

Patent Citations

  • Report generation method and device, computer device and storage medium

    CN110335009A

  • Report generation method and device, computer equipment and readable storage medium

    CN121117089A