Report generation method and device, equipment and storage medium
By parsing the report generation instructions and generating plans, and combining multi-level granular templates and knowledge bases, semantically related data templates are dynamically matched or generated. This solves the problems of configuration complexity and static generation in existing technologies, realizes the automation and flexibility of report generation, and improves the adaptability and efficiency of reports.
Patent Information
- Application Number
- CN202511657506.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-12
- Publication Date
- 2026-02-17
AI Technical Summary
Existing report generation technologies suffer from high configuration complexity and limited content generation capabilities, which are limited to static filling and weak intelligent typesetting capabilities. This results in poor system agility and a lack of flexibility and dynamic adaptability in the generated reports.
By parsing report generation instructions to generate report generation plans, and combining multi-level granular templates and preset knowledge bases, semantically related data templates are dynamically matched or generated, realizing automatic conversion from instructions to templates and improving the flexibility and adaptability of report generation.
It automates and standardizes the report generation process, reduces the complexity of manual configuration, improves the dynamic adaptability and generation efficiency of report content, and ensures the clarity of report structure and logical coherence.
Smart Images

Figure CN121543568A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information technology, and in particular to a report generation method, apparatus, device, and storage medium. Background Technology
[0002] In departments related to enterprise digitalization, business reports play a crucial role in supporting key decisions such as customer service, order management, and user needs analysis. As the enterprise's digitalization process progresses, the business side needs to regularly generate various types of reports. The creation of these reports requires the integration of various relevant data from different business scenarios.
[0003] To improve report generation efficiency, companies are using standardized templates combined with data adaptation to automate report generation. Existing common methods require pre-setting report templates with corresponding identifiers, configuring relevant rules, and manually establishing the correspondence between data sources and template identifiers. During report generation, data is extracted according to preset rules, and the corresponding identifiers in the template are replaced, thus completing the report production.
[0004] However, this method can only fill existing data into the specified positions in the template in a fixed way, making the generated report content lack flexibility. Summary of the Invention
[0005] This application provides a report generation method, apparatus, device, and storage medium to address the problem of automatically generated report content lacking dynamic adaptability.
[0006] Firstly, this application provides a report generation method applied to an electronic device. The subject executing this method can be an electronic device, a component or device applied to the electronic device (e.g., a processor, chip, or chip system), or a logic module or software capable of implementing all or part of the functions of the electronic device, including: Obtain the report generation instructions, which include the report content data and report generation requirements; Generate a report generation plan based on the report generation instructions. The report generation plan is used to indicate the process operations required to generate the report. Generate semantically related data templates that conform to the preset data structure according to the report generation plan; Execute the semantically related data template to obtain a report.
[0007] In the first aspect, the report generation instruction is first parsed to generate a report generation plan, clarifying the user's needs into specific process operations. Secondly, based on the report generation plan, a semantically related data template is generated, realizing the transformation from requirements to templates. Finally, the report is generated by executing the semantically related data template. In this way, the user instruction is transformed into an executable generation process. The synergy between the plan and the template allows the report content and structure to accurately respond to the report generation requirements in the instruction, breaking the static and rigid production model and improving the dynamic adaptability of the report.
[0008] In conjunction with the first aspect, in one possible implementation, before generating the report generation plan according to the report generation instructions, the method further includes: Determine if a target template matching the report generation instruction exists in the stored preset templates; If the target template is not determined, a template conforming to the preset data structure is generated according to the report generation instructions.
[0009] In this implementation, the target template is first matched against preset templates; a new template is dynamically generated only if the match fails. A template generation mechanism combining static matching and dynamic generation is introduced. This enables template reuse and on-demand creation of new templates. Template reuse improves report generation efficiency and ensures the standardization of output reports, while dynamic template generation ensures the report's adaptability to different report generation needs, achieving a balance between report generation efficiency and report content flexibility.
[0010] In conjunction with the first aspect, in one possible implementation, the stored templates include multi-level granular templates, which include atomic templates, combined templates, and report templates.
[0011] In this implementation, the stored preset templates consist of multi-level granularity templates, including atomic templates, combined templates, and report templates. This multi-level granularity division of templates provides modular support for different levels of report content, allowing the report generation process to adapt to varying granularity requirements. This makes the report generation process more flexible and configurable.
[0012] In conjunction with the first aspect, in one possible implementation, when the target template is not determined, a template conforming to a preset data structure is generated according to the report generation plan, including: In the absence of a target template, the report components required for generating the report are determined based on a pre-defined knowledge base. Generate a template based on the report's constituent elements.
[0013] In this implementation, the report's constituent elements are determined based on a pre-defined knowledge base when generating the template. This knowledge base guides the content generation of the template, ensuring the rationality and completeness of the generated template's constituent elements and improving the quality of the generated report.
[0014] In conjunction with the first aspect, in one possible implementation, determining whether a target template matching the report generation instruction exists in the stored preset templates includes: The report generation instructions are broken down into multi-level granularity report generation sub-instructions; Sub-instructions generated from multi-level granular reports match the target template in the stored preset initial template.
[0015] In this implementation, the report generation instruction is broken down into multi-level granularity sub-instructions, providing precise input for subsequent accurate matching of target templates. This design parses the report generation instruction into hierarchical sub-instructions, enabling report generation to accurately match corresponding atomic templates, combined templates, or report templates according to different granularity requirements. This improves the targeting of instruction processing, thereby ensuring that the final generated semantically related data template and even the report generation plan have a good hierarchical structure, resulting in a clear and logically structured report content.
[0016] In conjunction with the first aspect, in one possible implementation, the multi-level granularity report generation sub-instruction includes at least one of the following: Chapter instructions, paragraph instructions, or atomic instructions.
[0017] In this implementation, multi-level granularity report generation sub-instructions include chapter instructions, paragraph instructions, or atomic instructions. The granularity of the instructions covers everything from the overall structure to the local structure. This achieves comprehensive control over the report generation process, from the macro framework to the micro content.
[0018] In conjunction with the first aspect, in one possible implementation, a report generation plan is generated based on the report generation instructions, including: Parse the report generation instructions; Reasoning is performed based on the analysis results using a pre-defined knowledge base; Generate data solutions based on the reasoning results; Data-driven report generation plan.
[0019] In this implementation, by parsing the report generation instructions and combining them with a pre-set knowledge base for reasoning, the system can automatically identify and associate the data elements and logic required to generate the report. Based on the reasoning results, a structured data solution is generated and further transformed into an executable report generation plan. This process achieves automatic mapping from instructions to machine-executable plans, significantly reducing the complexity of manual configuration and improving the accuracy and completeness of the generated reports.
[0020] In conjunction with the first aspect, in one possible implementation, the semantically related data template includes semantic nodes, data nodes, and display nodes that have mapping relationships; Semantic nodes are used to indicate business objectives that match the report generation plan; Data nodes are used to indicate data generation rules that match the report generation plan; The display node is used to indicate how the report will be presented.
[0021] In this implementation, a three-element binding mechanism for business objectives, data rules, and presentation formats is established by structuring semantically related data templates into semantic nodes, data nodes, and display nodes with mapping relationships. This solution enables independent management and flexible combination of business semantics, data logic, and display styles based on a unified template structure, thereby improving the standardization and controllability of the report generation process.
[0022] In conjunction with the first aspect, in one possible implementation, a semantically related data template is executed to obtain a report, including: Execute the semantically related data template to obtain data that matches the report generation requirements; The report content is generated based on data that matches the report generation requirements. The report content includes at least one of the following: analytical text, tables, or reference figures. Format the report content; The formatted report content is converted to a different file format to obtain the final report, which matches the report generation requirements.
[0023] This implementation automates information input by retrieving data through semantically related data templates. During report generation, the data is automatically converted into different report formats. Content layout is automatically handled through typesetting. Finally, the final document is automatically output through file format conversion. This achieves fully automated output from data to a complete, formatted report document, significantly reducing manual intervention.
[0024] In conjunction with the first aspect, in one possible implementation, the analyzed text is generated by a text generation model based on a preset cue word framework; The prompt framework includes role declaration, task objective, and output constraints; The character declaration is used to indicate the perspective from which the text is generated; The task objective is used to indicate the structure and content type of the generated text; Output constraints are used to indicate the rules that text generation should follow.
[0025] In this implementation, a pre-defined prompt word framework guides the text generation model, establishing standardized input specifications for the generation of analytical text. This framework effectively guides the reasoning and creation process of the text generation model, ensuring that the generated analytical text meets pre-defined requirements in terms of perspective, content, and format, thereby improving the quality and structural standardization of the generated report content.
[0026] In conjunction with the first aspect, one possible implementation method for formatting the report content includes: Test report page space status; Adjust the layout of the report content based on the report page's spatial status.
[0027] This implementation includes detecting the spatial state of the report page and adjusting the layout of the report content based on this state. This achieves automatic adjustment of the report page, improving the quality of report generation.
[0028] Secondly, this application provides a report generation apparatus, comprising: The instruction processing module is used to obtain report generation instructions, which include report content data and report generation requirements. The plan generation module is used to generate a report generation plan based on the report generation instructions. The report generation plan is used to indicate the process operations required to generate the report. The template generation module is used to generate semantically related data templates that conform to a preset data structure based on the report generation plan. The report execution module is used to execute semantically related data templates and generate reports.
[0029] In conjunction with the second aspect, in one possible implementation, the template generation module is further configured to determine whether a target template matching the report generation instruction exists in the stored preset templates before generating a report generation plan according to the report generation instruction; if no target template is determined, a template conforming to the preset data structure is generated according to the report generation instruction.
[0030] In conjunction with the second aspect, in one possible implementation, the stored templates include multi-level granular templates, which include atomic templates, combined templates, and report templates.
[0031] In conjunction with the second aspect, in one possible approach, the template generation module is also used to determine the report components required for generating the report based on a preset knowledge base when the target template has not been determined; and to generate a template based on the report components.
[0032] In conjunction with the second aspect, in one possible implementation, the instruction processing module is also used to decompose the report generation instruction to obtain multi-level granularity report generation sub-instructions.
[0033] In conjunction with the second aspect, in one possible implementation, the template generation module is also used to generate sub-instructions based on multi-level granularity reports to match the target template in a stored preset initial template.
[0034] In conjunction with the second aspect, in one possible implementation, the multi-level granularity report generation sub-instructions include at least one of the following: chapter instructions, paragraph instructions, or atomic instructions.
[0035] In conjunction with the second aspect, in one possible implementation, the plan generation module is also used to parse the report generation instruction; reason about the parsing result based on a preset knowledge base; generate a data solution based on the reasoning result; and generate a report generation plan based on the data solution.
[0036] In conjunction with the second aspect, in one possible implementation, the semantically related data template includes semantic nodes, data nodes, and display nodes that have mapping relationships; Semantic nodes are used to indicate business objectives that match the report generation plan; Data nodes are used to indicate data generation rules that match the report generation plan; The display node is used to indicate how the report will be presented.
[0037] In conjunction with the second aspect, in one possible implementation, the report execution module is also used to execute a semantically related data template to obtain data that matches the report generation requirements; generate report content based on the data that matches the report generation requirements, the report content including at least one of the following: analytical text, tables, or reference figures; format the report content; convert the formatted report content into a file format to obtain a report, the file format of which matches the report generation requirements.
[0038] In conjunction with the second aspect, in one possible implementation, the analyzed text is generated by a text generation model based on a preset cue word framework; The prompt framework includes role declaration, task objective, and output constraints; The character declaration is used to indicate the perspective from which the text is generated; The task objective is used to indicate the structure and content type of the generated text; Output constraints are used to indicate the rules that text generation should follow.
[0039] In conjunction with the second aspect, in one possible implementation, the report execution module is also used to: detect the report page space status when formatting the report content; and adjust the report content layout based on the report page space status.
[0040] Thirdly, this application provides an electronic device comprising: a processor and a memory; the memory storing processor-executable instructions; when the processor is configured to execute the instructions, causing the electronic device to implement the method of the first aspect described above.
[0041] Fourthly, this application provides a computer-readable storage medium comprising: computer software instructions; which, when executed in an electronic device, cause the electronic device to implement the method described in the first aspect.
[0042] Fifthly, this application provides a computer program product comprising a computer program; when the computer program is run in an electronic device, it causes the electronic device to implement the method described in the first aspect.
[0043] The beneficial effects of the second to fifth aspects mentioned above are described in the corresponding description of the first aspect and will not be repeated here. Attached Figure Description
[0044] Figure 1 This is a schematic diagram illustrating the application environment of a report generation method provided in an embodiment of this application; Figure 2 A schematic diagram of a report generation system provided in an embodiment of this application; Figure 3 A flowchart illustrating a report generation method provided in an embodiment of this application; Figure 4 A schematic diagram of a report generation instruction breakdown process provided in this application embodiment; Figure 5 A schematic diagram illustrating the generation process of a report generation plan provided in this application embodiment; Figure 6 This application provides a schematic diagram of a triplet binding process in an embodiment of the present application. Figure 7 A schematic diagram of a triplet storage structure provided in an embodiment of this application; Figure 8 A schematic diagram of a report content generation and output process provided in this application embodiment; Figure 9 This is a schematic diagram of the composition of a report generation device provided in an embodiment of this application; Figure 10 This is a schematic diagram of the composition of an electronic device provided in an embodiment of this application. Detailed Implementation
[0045] The following is a detailed description of a call detail record (CDR) data recording method provided in this application, with reference to the accompanying drawings.
[0046] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0047] The terms "first" and "second," etc., used in the specification and drawings of this application are used to distinguish different objects or to distinguish different treatments of the same object, rather than to describe a specific order of objects.
[0048] Furthermore, the terms "comprising" and "having," and any variations thereof, used in the description of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus.
[0049] It should be noted that in the embodiments of this application, the words "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of the words "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0050] To facilitate a clear description of the technical solutions of the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish the same or similar items with essentially the same function and effect. Those skilled in the art can understand that the terms "first" and "second" are not intended to limit the quantity or execution order.
[0051] In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0052] In a company's digital transformation department, business domain (B domain) reports support core decision-making functions such as customer operations, order analysis, and user behavior insights. With the company's comprehensive digital transformation, business departments need to generate dozens of reports each month, such as "High-Value Customer Churn Warning Report," "Omnichannel Order Conversion Analysis," and "Package Migration Benefit Assessment." Report compilation requires integrating multi-source heterogeneous data from multiple business systems, including customer relationship management (CRM) systems, billing systems, and online order platforms. This data encompasses both structured data (such as user attributes and order records) and unstructured data (such as customer service ticket texts).
[0053] To improve report generation efficiency, enterprises use template-based and data-filling technologies to automate report generation. One mainstream approach requires pre-creating a report template containing data substitutes, each corresponding to different data structures (e.g., single-value, multi-value, composite). Then, a rule set is configured, manually binding and mapping the query statements from the data source (e.g., database, Excel spreadsheet) to the substitutes in the template. When generating the report, the process queries data based on the rule set parameters and replaces the marked fields in the template, thus generating the document. However, this approach is cumbersome to configure; any change to a field or data source requires redefining the entire set of rules. Furthermore, it is essentially statically populated and cannot dynamically generate analytical text or smart charts based on context.
[0054] To enhance flexibility, another approach introduces a tag and expression engine. This approach uses mail merge fields as tags in documents and supports embedded expressions (e.g., {{sales}). 1.2}}), and uses an engine (such as Apache POI combined with Aviator) for parsing and computation. Its core lies in constructing an abstract syntax tree (AST) through a recursive descent algorithm for intelligent syntax analysis, and employing a template caching mechanism to optimize performance. Although it supports operators and some logical control, the approach is still limited by the strong dependency of tags on the document structure; format changes can easily lead to parsing failures. Furthermore, this method still lacks context awareness and cannot generate relevant conclusions based on the content of other parts of the report (such as referencing previous data).
[0055] In summary, existing automatic report generation technologies face the following technical bottlenecks: Firstly, the configuration complexity and maintenance costs are high: existing solutions rely on manually predefined and static mapping rules for template tags and data fields. This process is cumbersome, error-prone, and the templates are tightly coupled with the underlying data model. When the business data source structure changes (e.g., a "customer satisfaction index" field is added to a database table) or the business calculation logic is adjusted, technical personnel must manually intervene to modify and test the mapping rules of all affected templates, resulting in poor system agility and high maintenance costs. Furthermore, template reusability is extremely low. When generating reports with similar business objectives but different data dimensions for different departments, the entire set of mapping rules must be repeatedly configured, making knowledge accumulation and reuse impossible.
[0056] Secondly, content generation capabilities are limited to static filling: existing technologies can only mechanically fill pre-stored data into preset placeholders in templates, resulting in static and rigid content. It cannot dynamically generate logical analytical text based on the characteristics of the data returned by the query (e.g., automatically identifying product categories experiencing sales declines from sales data and analyzing their potential causes), nor does it possess context-aware capabilities (e.g., referencing data from previously generated tables to form coherent analytical conclusions). Furthermore, chart generation relies entirely on predefined templates and cannot intelligently recommend and generate the most suitable visualization based on the characteristics of the data itself (e.g., number of dimensions, data distribution, comparison type) (e.g., automatically using line charts for time series data, and pie charts or donut charts for percentage analysis).
[0057] Thirdly, the intelligent typesetting capabilities are weak: existing solutions generally lack the ability to sense the remaining space on the page when inserting tables and charts into documents. Their linear fill mechanism easily leads to a series of typesetting problems, such as broken tables across pages resulting in missing headers on subsequent pages, charts overflowing page boundaries, and disordered text and image arrangement. These problems must be manually checked and adjusted later, accounting for a significant proportion of the total report generation time and becoming the "last mile" bottleneck in the automation process.
[0058] To address the aforementioned technical problems, this application provides a report generation method, apparatus, device, and storage medium. The approach involves: parsing report generation instructions to generate a report generation plan, thus clarifying user needs into specific process operations. Based on the report generation plan, a semantically related data template is generated, realizing the transformation from needs to templates. The report is generated by executing the semantically related data template. By transforming user instructions into an executable generation process, and leveraging the synergy of the plan and template, the report content and structure can accurately respond to the report generation requirements in the instructions, breaking the static and rigid production model and improving the dynamic adaptability of the report.
[0059] The embodiments provided in this application will now be described in detail with reference to the accompanying drawings.
[0060] In one embodiment, the report generation method provided in this application can be applied to, for example... Figure 1 The application environment shown.
[0061] like Figure 1 As shown, the application environment may include terminal device 100 and server 101.
[0062] Terminal device 100 includes a client application 102 that supports report generation. This client provides users with an interface for generating reports, which can be a World Wide Web (Web) page accessed through a browser or a native application that needs to be downloaded and installed. The terminal is specifically user equipment (UE), and its types include, but are not limited to, smartphones, tablets, laptops, desktop computers, Internet of Things (IoT) terminals, and vehicle-to-everything (V2X) terminals. The terminal accesses the access network via a wireless air interface and has the capability to carry voice services, data transmission services, and multimedia services. It can also achieve direct communication between different terminals based on device-to-device (D2D) direct connection technology or V2X technology.
[0063] The report generation method provided in this application can be applied to server 101. Server 101 runs an application 102 that supports report generation. This application is responsible for processing requests sent by clients and executing core logic such as acquiring, calculating, generating, and storing report data.
[0064] In one alternative embodiment, the terminal device 100 and the server 101 can be interconnected via a wired or wireless network.
[0065] Server 101 includes a first memory and a first processor. The first memory stores a report generation program; the report generation program is invoked and executed by the first processor to implement the report generation method provided in this application. The first memory may include, but is not limited to, the following: random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), and electrically erasable programmable read-only memory (EEPROM). The first processor may consist of one or more integrated circuit chips. Optionally, the first processor may be a general-purpose processor, such as a central processing unit (CPU) or a network processor (NP). Optionally, the first processor may implement the report generation method provided in this application by running programs or code.
[0066] The report generation method provided in this application can be executed by server 101. Server 101 provides background services for the target use case system of terminal device 100. Optionally, server 101 undertakes the main computing work, and terminal device 100 undertakes the secondary computing work; or, server 101 undertakes the secondary computing work, and terminal device 100 undertakes the main computing work; or, server 101 and terminal device 100 perform collaborative computing using a distributed computing architecture. Server 101 can be a single server, a server cluster consisting of multiple servers, or a cloud computing service center. Optionally, server 101 includes a second memory and a second processor. The second memory stores a report generation program; the report generation program is called by the second processor to implement the report generation method provided in this application. Optionally, the second memory can include, but is not limited to, the following: RAM, ROM, PROM, EPROM, EEPROM. Optionally, the second processor can be a general-purpose processor, such as a CPU or NP.
[0067] This application embodiment also provides a report generation system, which can be set on a server (such as the server 101 mentioned above), such as... Figure 2 As shown, the report generation system 200 may include: Instruction Classifier 201: As the entry point of the report generation system, it receives and parses the report generation instructions input by the user, and parses them into chapter instructions, paragraph instructions or atomic instructions.
[0068] Dynamic Template Engine 202: Manages a pre-built three-level template library, including: chapter templates, combination templates, and report templates. It performs static template matching based on instructions. If matching fails, it dynamically assembles and generates a target template based on report requirements using knowledge graph reasoning. It receives the report generation plan. By querying the metadata directory, it performs data lineage binding, mapping logical indicators in the plan to physical data sources, and generates the final executable structured query language statements, style rules, etc., outputting a complete, executable, semantically related data template.
[0069] Semantic parser 203: Receives the target template and performs deep semantic parsing and business reasoning. It utilizes a business knowledge graph to parse out the data metrics, dimensions, computational logic, and relationships required to complete the report, outputting a structured report generation plan.
[0070] Content Generator 204: Used to execute semantically related data templates, complete data queries, and dynamically generate analytical text, tables, and charts using large language models and rule engines.
[0071] Layout Engine 205: Used to receive multimodal content blocks output by the content generator, and employs spatial awareness algorithms for intelligent layout and pagination decisions.
[0072] Document Generator 206: Used to convert the content structure processed by the typesetting engine into a document in the target format.
[0073] It should be noted that the system architecture described in the embodiments of this application is for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and does not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the evolution of system architecture, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0074] It should be noted that the system architecture described in the embodiments of this application is for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and does not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the evolution of system architecture, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0075] See Figure 3 This is a flowchart illustrating a report generation method provided in an embodiment of this application. Figure 3As shown, the report generation method provided in this application can be implemented through the aforementioned server, specifically including the following steps S300~S303.
[0076] S300, server retrieves report generation instructions.
[0077] The server can obtain report generation instructions from the terminal. Specifically, when a user needs to generate a report, they can submit a request through a terminal client (such as computer software, a web browser, a mobile device, or a storage medium app). The user can fill in parameters such as report type, data range, and output format, or select a preset template to supplement their personalized requirements. After receiving the request, the terminal converts it into a structured instruction that the server can recognize, containing information such as instruction identifier, parameter configuration, data source identifier, and user identity, thus obtaining the report generation instruction. Subsequently, the terminal sends the report generation instruction to the server, and the server receives and receives the report generation instruction, thus achieving the acquisition of the report generation instruction.
[0078] A report generation instruction includes report content data and report generation requirements. A report generation instruction is a user request to initiate the report generation process. Report content data refers to the raw data required to generate the report. Report generation requirements refer to the user's specifications regarding the report's objectives, format, scope, or content. The report content data and report generation requirements together constitute the report generation instruction. The report content data provides the report's raw materials, while the report generation requirements specify the final form of these materials. Together, they define the complete input conditions for the report to be generated.
[0079] S301. The server generates a report generation plan based on the report generation instructions.
[0080] Based on the parsed instructions, the server generates an executable blueprint, i.e., a report generation plan. This blueprint is a deep semantic parsing and visualization of the instructions, binding abstract report generation requirements with specific data sources, calculation rules, and execution logic, outputting an executable structure. This is a detailed, executable plan that clearly defines the complete processing steps from raw data to the final report, the execution logic of each step, and the dependencies.
[0081] S302. The server generates a semantically related data template that conforms to the preset data structure according to the report generation plan.
[0082] A predefined data structure refers to a standardized data structure defined in advance to describe and carry all elements of a report, such as JavaScript object notation (JSON). This structure ensures the template's standardization and executability through predefined key fields. A semantically related data template is a data structure that meets the report generation requirements; its content and framework are determined according to the report generation plan. This template, through predefined key fields, carries the data source, calculation logic, display style, and semantic relationships between content units in the report.
[0083] S303. The server executes the semantic association data template and obtains a report.
[0084] Executing a semantically related data template means performing a series of operations such as data querying, content calculation, and format rendering according to the data acquisition path, content processing logic, and presentation rules defined in the template, and finally outputting a complete document that meets the report generation requirements.
[0085] The server can send the obtained report to the terminal for user use.
[0086] In this embodiment, firstly, the report generation instruction is parsed to generate a report generation plan, clarifying the user's needs into specific process operations. Secondly, a semantically related data template is generated based on the report generation plan, realizing the transformation from needs to templates. Finally, the report is generated by executing the semantically related data template. In this way, the user instruction is transformed into an executable generation process. The synergy between the plan and the template allows the report content and structure to accurately respond to the report generation requirements in the instruction, breaking the static and rigid production model and improving the dynamic adaptability of the report.
[0087] In one embodiment, the report generation method provided in this application may further include: S304. Determine whether a target template matching the report generation instruction exists in the stored preset templates.
[0088] If the target template is not determined, a template conforming to the preset data structure is generated according to the report generation instructions.
[0089] The search engine matches the results in a pre-defined multi-level granularity template library to determine if a directly reusable target template exists. The core matching logic is as follows: the report generation requirement in the report generation instruction is used as a search feature and matched against the metadata descriptions of atomic templates, combined templates, and report templates in the template library. If a match is successful, it is identified as the target template. Template matching is determined according to the report generation instruction, and the specific details will be explained in step S3042. If the match fails, a template conforming to a pre-defined data structure will be generated; the specific details of the generated template will be explained in step S3041.
[0090] In one possible implementation, the stored templates include templates of multi-level granularity, such as atomic templates, combined templates, and report templates.
[0091] In one possible implementation, this scheme uses the Elasticsearch search engine to match within a pre-defined template library to determine the target template.
[0092] In one possible implementation, the template is a JSON structure.
[0093] An atomic template corresponds to the smallest indivisible business unit template, which corresponds to a specific business metric (such as "refund rate" or "order volume") or a basic display element (such as a descriptive text or a basic chart).
[0094] The JSON structure of an atomic template contains the following key fields: Identifier (id): A globally unique identifier, using the format "AT_metric_name" (e.g., AT_return_rate) for easy retrieval.
[0095] Type: Fixed to atomic, used to declare this JSON structure as an atomic template.
[0096] Metadata: Includes creator, version, description, and a pointer (kg_node) to the corresponding metric entity in the business knowledge graph.
[0097] Parameters: Defines the dynamic parameters required for the template to run (such as time_range, region).
[0098] Data solution: Define the formula for calculating the metrics, the data sources, and the filters.
[0099] Style rules: Define the display type, chart type, and conditional format of this indicator.
[0100] Dependencies: External dependencies, such as the physical data tables they depend on.
[0101] A composite template is composed of one or more atomic templates, encapsulating a complete business scenario analysis (such as "channel performance analysis").
[0102] Its JSON structure is an extension of the atomic template: Identifier (id): A globally unique identifier that uses the naming pattern "CT_scene_name_version" (e.g., CT_channel_efficiency_V2) for easy management and retrieval.
[0103] Type: Fixed to "composite", used to declare this JSON structure as a composite template.
[0104] Children: An array that lists the unique identifiers (ids) of the atomic templates or other composite templates it contains, which clearly define which basic or composite units constitute the business scenario.
[0105] Cross-dimensions: An array that declares the business dimensions (such as "channel type" or "user level") used when performing cross-analysis.
[0106] Derived metrics: An array used to define composite metrics calculated further based on the metrics in the sub-templates. Each derived metric is an object containing a metric name and a calculation formula, for example, {"name":"conversion rate","formula":"signatures / applications"}.
[0107] Business rules (business_rules): An array containing rules used to verify the data integrity and logical rationality of this business scenario.
[0108] The report template defines the overall framework of the report, consisting of chapters, each referencing a combined template or an atomic template. Key fields include: Identifier (id): A globally unique identifier that uses the naming pattern "RT_report type_version" (e.g., RT_broadband_operation_V1).
[0109] Type: Fixed to "report", used to declare this JSON structure as a report template.
[0110] Sections: An array used to define the top-level structure of the report. This array not only defines the order of the sections (e.g., "Executive Summary", "Channel Analysis", "Quality Analysis", "Conclusion"), but also specifies a unique identifier (id) for the specific template (atomic template or combined template) corresponding to each section.
[0111] Global style (global_style): An object that centrally defines the visual style specifications applicable to the entire report, such as default font families, font sizes, color schemes, and paragraph spacing.
[0112] Section dependencies: An array used to declare data flow or logical dependencies between different sections. For example, you can declare that the "Risk Warning" section requires the calculation results of the "Channel Analysis" section as input, thereby ensuring the correct timing and logical consistency of the report content generation.
[0113] The following is a sample configuration model for a financial contract conversion analysis in JSON format: This composite model is specifically designed for financial contract user conversion analysis. It links to knowledge graph nodes of the financial scenario conversion funnel to align with business logic, supports dynamically configured time ranges, and defaults to focusing on the East China and North China regions. The core metrics are financial contract application volume, approval volume, and contract signing volume. Data is cross-splitting based on channel type and user level, and the conversion rate is automatically calculated using "contract signing volume / application volume." The analysis results are presented in a funnel chart format, with data sorted in descending order of application volume. If the conversion rate is below 0.3, the system will automatically highlight it with a red background. The normal operation of the model depends on the data support of the above three basic metrics. A model example is shown below: { "id": "CT_Financial Contract Conversion Funnel_202508", "type": "composite", "metadata": { "generated_by": "dynamic_engine", "goal": "Financial Contract User Conversion Analysis", "kg_node": "KG_Scene_FinanceFunnel" }, "parameters": { / / Add parametric design "time_range": "{{date}}", / / Dynamic parameter slot "region": ["East China", "North China"] / / Default value }, "data_solution": { "children": ["AT_Financial Contract Applications", "AT_Financial Contract Approvals", "AT_Financial Contract Signings"], "cross_dimensions": ["channel type", "user level"], "derived_metrics": [ {"name": "Conversion Rate", "formula": "Number of Contracts / Number of Applications"} ] }, "style_rules": { "primary_chart": "funnel", "conditional_format": [ {"metric": "conversion rate", "condition": "<0.3", "action": "red_background"} ], "sort_rule": "Application Quantity DESC" }, "dependencies": ["AT_Financial Contract Applications", "AT_Financial Contract Approvals", "AT_Financial Contract Signings"] } The system first matches the target template against preset templates; a new template is dynamically generated only if a match fails. This introduces a template generation mechanism that combines static matching and dynamic generation. It enables template reuse and on-demand creation of new templates. Template reuse improves report generation efficiency and ensures the standardization of output reports, while dynamic template generation ensures the report's adaptability to different report generation needs, achieving a balance between report generation efficiency and report content flexibility.
[0114] The preset templates consist of multi-level granularity templates, including atomic templates, combined templates, and report templates. This multi-level granularity division provides modular support for different levels of report content, allowing the report generation process to adapt to varying granularity requirements. This makes the report generation process more flexible and configurable.
[0115] In one embodiment, S3041 may include: S30411, In the absence of a target template, determine the report components required to generate the report based on a preset knowledge base.
[0116] By querying a pre-defined knowledge base, vague report generation requirements are deconstructed into specific and actionable report generation elements (such as business metrics, analysis dimensions, physical data source addresses, and derived metrics).
[0117] S30412, Generate a template based on the report's constituent elements.
[0118] The scattered elements identified in S30411 are organized into an executable template structure with a complete business logic framework, data solutions, and presentation rules. The entire process follows a progressive principle from atomic units to business scenario modules and then to complete report chapters, ensuring the template's reusability and structure.
[0119] The following example further illustrates how to generate templates based on report components: Based on the business entities (e.g., "gigabit package penetration rate") in the report generation instructions, the complete elements required to achieve the analysis objectives are inferred from the business knowledge graph through the SPARQL protocol and RDF query language (SPARQL protocol and resource description framework query language). These elements include basic business metrics (e.g., "number of gigabit users" and "total number of users"), analysis dimensions (e.g., "channel type" and "school"), physical data source addresses (e.g., "user contract data table of business support system"), and recommended derived metrics (e.g., "month-on-month growth rate"). The business knowledge graph is a pre-defined knowledge base.
[0120] First, atomic templates are generated: This approach iterates through the list of basic metrics derived from the business knowledge graph, checking one by one whether a corresponding template exists in the atomic template library. For metrics not found in the library, this approach creates a new atomic template based on the complete definition of the metric in the business knowledge graph, including the calculation formula, data source address, and default analysis dimension. The newly created atomic template is immediately and persistently stored in the template library.
[0121] Next, the combined template is constructed: This solution logically combines relevant atomic templates according to the business scenario described in the instructions. Taking the scenario of "5G network (5G) package penetration rate analysis" as an example, this solution creates a combined template, which includes atomic templates such as "number of 5G users", "total number of users", and "penetration rate", and injects cross-analysis dimensions (such as "customer level" and "region") and derived indicator calculation logic (such as "monthly growth rate") obtained from business knowledge graph reasoning.
[0122] Finally, the report template is assembled: For chapter-level instructions, this solution determines the standard chapter framework based on the report type. Taking the operational analysis report as an example, this solution will establish standard chapters such as "Execution Summary," "Business Analysis," and "Conclusions and Recommendations," and fill the combined templates generated in the previous steps into the corresponding chapters according to business logic, while also establishing data flow dependency declarations between chapters.
[0123] All newly generated templates are persistently stored in JSON format, forming an executable template structure that includes a complete business logic skeleton, data solutions, and presentation rules.
[0124] When generating the template, the report's components are determined based on a pre-defined knowledge base. This knowledge base guides the template's content generation, ensuring the rationality and completeness of the generated template's components and improving the quality of the generated report.
[0125] In one embodiment, the report generation method provided in this application may further include: S3042. Decompose the report generation instruction to obtain multi-level granularity report generation sub-instructions; Sub-instructions generated from multi-level granular reports match the target template in the stored preset initial template.
[0126] Report generation sub-instructions refer to task units with different operational scopes and execution granularities generated after parsing report generation instructions. Sub-instructions of different granularities constitute a clear task division relationship. This division of sub-instructions can be achieved based on business keyword matching and a lightweight intent recognition model. The lightweight intent recognition model includes a bidirectional encoder representations from transformers classifier (BERT classifier).
[0127] In one possible implementation, the report generation instructions are natural language instructions.
[0128] In one possible implementation, the multi-level granularity report generation sub-instruction includes at least one of the following: Chapter instructions, paragraph instructions, or atomic instructions.
[0129] Figure 4 This is a schematic diagram of the breakdown process of a report generation instruction, such as... Figure 4 As shown: S30420, Report generation instruction.
[0130] The report generation command, as input to the breakdown process, can be implemented based on business keyword matching and a lightweight intent recognition model.
[0131] S30421. The report generation instruction contains keywords.
[0132] During the decomposition process, it checks whether the instruction contains keywords such as "generate" or "report," and whether the generated target is a complete report document. When the instruction contains keywords, it is decomposed into a document instruction. When the instruction does not contain keywords, structural word analysis is performed.
[0133] S30422, Disassemble to obtain chapter instructions.
[0134] When the report generation instruction contains keywords such as "generate" or "report" and the report requirement is a complete report document (e.g., "Generate 2025 Q3 Broadband Order Operation Analysis Report"), the server is configured to initiate the full-process generation and call the report template to build the report framework.
[0135] S30423, Structural word analysis.
[0136] During the decomposition process, if the instruction does not contain keywords such as "generate" or "report," and the report requirement is not a complete report document, the system checks whether the instruction contains verbs such as "insert" or "add" and specifies a position within the document. If the instruction contains structural words, it is decomposed into paragraph instructions. If the instruction does not contain structural words, it is decomposed into atomic instructions.
[0137] S30424, Disassemble to obtain paragraph instructions.
[0138] When the report generation instruction contains verbs such as "insert" or "add" and specifies a location in the document (e.g., "insert a return order statistics table in the 'Mid-Platform Quality Analysis' section"), the server is configured to process the specified section and call a combined template or an atomic template.
[0139] S30425, Disassemble to obtain atomic instructions.
[0140] When the report generation instruction does not meet the keyword and structural word criteria, it is broken down into atomic instructions. For update operations on a single component in the report (such as "update the cancellation rate calculation formula"), the server is configured to directly locate and modify the corresponding atomic template.
[0141] By breaking down the report generation instructions, multi-level granularity sub-instructions for report generation are obtained, providing precise input for subsequent accurate matching of target templates. This design parses the report generation instructions into hierarchical sub-instructions, enabling report generation to accurately match corresponding atomic templates, combined templates, or report templates according to different granularity requirements. This improves the targeting of instruction processing, thereby ensuring that the final generated semantically related data template and even the report generation plan have a good hierarchical structure, resulting in a clear and logically structured report content.
[0142] Multi-level granularity report generation sub-instructions include chapter instructions, paragraph instructions, or atomic instructions. The granularity of these instructions covers everything from the overall structure to the local structure, enabling comprehensive control over the report generation process from the macro-framework to the micro-content.
[0143] In one embodiment, S301 may include: As one possible approach, a report generation plan can be generated by parsing report generation instructions and performing deep semantic empowerment on a given template (whether it is generated through preset matching or newly generated), binding specific data sources and execution rules.
[0144] Figure 5 This is a schematic diagram of the report generation process, such as... Figure 5 As shown: S3010, Parse the report generation command.
[0145] The purpose of parsing the report generation instructions is to identify and standardize the processing of business entities.
[0146] In one possible implementation, parsing the report generation instructions includes: Using a large language model (LLaMA-3) finely tuned on a business domain corpus, named entity recognition (NER) and relation extraction are performed on instructions to accurately identify entities such as business metrics, business objects (e.g., "gigabit package"), calculation dimensions (e.g., "province points"), time ranges (e.g., "2025Q3"), location anchors (e.g., "Chapter 4"), and style instructions (e.g., "highlighted in red"), and these entities are converted into a unified standardized format within the system.
[0147] For example, the natural language instruction "return rate greater than 5%" is standardized into a machine-readable structure {"field":"return_rate", "op": ">", "value": 0.05}; and "highlight in red" is converted to {"action": "font_color_red"}.
[0148] S3011. Reasoning is performed on the parsing results based on a preset knowledge base.
[0149] The business knowledge graph reasoning is performed on the instruction parsing results, with the aim of reasoning out other indicators, dimensions, data sources, and derived indicator recommendations needed to achieve business goals.
[0150] In one possible implementation, reasoning based on the parsing results using a pre-defined knowledge base includes: By querying the operator's knowledge graph using SPARQL, the business knowledge graph includes all business entities and their relationships. It can return complete basic metrics, supported dimensions, physical data source addresses, and recommended derived metrics based on query conditions.
[0151] The following is a schematic diagram of a SPARQL query statement: First, identify the business target entity with the business objective of "analyzing campus market penetration rate" in the business knowledge graph. Next, by parsing the semantic relationships between the business target entity and the indicator entity, deduce one or more basic indicators required to complete the campus market penetration rate analysis business objective. Then, for each basic indicator, obtain the analysis dimensions that support multi-dimensional campus market analysis of that indicator by traversing the dimensional semantic relationships. Simultaneously, determine the physical data source address that provides the data for each indicator by parsing the "has data source" semantic relationship. Finally, based on the predefined campus market business rules and relationships in the business knowledge graph, deduce and generate the calculation path for the recommended derivative indicators for the campus market scenario, and combine the obtained basic indicators, analysis dimensions, physical data source addresses, and recommended derivative indicators to output a complete campus market business analysis solution in structured data form. The statement structure is illustrated below: SELECT ?metric ?dimension ?datasource WHERE { ?goal :hasObjective :AnalyzePenetrationRate. ?goal :requiresMetric ?metric. ?metric :hasDimension ?dimension. ?metric :hasDataSource ?datasource. ?dimension :recommendedFor "campus market". } S3012. Generate a data solution based on the reasoning results.
[0152] Data solutions are used to transform the business metrics and logic in the inference results into specific, executable data acquisition and integration instructions, thereby realizing the connection between business and data.
[0153] In one possible implementation, the data generation solution based on the reasoning results includes: The system performs data lineage binding on the inference results, queries the metadata directory, maps business metrics to specific physical data sources, and automatically generates data acquisition logic. For metrics requiring cross-table joins, it automatically infers table join conditions based on field name similarity, data type matching, and predefined primary and foreign key relationships. Combined with filter parameters in user commands (such as "time" and "region"), it constructs complete and executable structured query language (SQL) query statement fragments.
[0154] The following provides a data solution structure diagram, demonstrating a specific implementation of translating the report generation instruction "Analyze the penetration rate of gigabit packages in the campus market" into a machine-executable structured query language. This data solution includes: a data source definition unit, used to identify and configure contract tables from business support systems (BSS) and user profile tables from the CRM system, specifying the fields to be extracted from each table; a table join condition unit, which automatically generates table relationships based on the similarity of user identifier (ID) fields and the consistency of business logic; and a filter condition unit, which constructs corresponding filter conditions based on the specific business parameters in the user instruction, including: filtering "gigabit package" business records based on the product type field, filtering "campus market" user groups based on the market segmentation field, and determining the time range for statistical analysis based on the contract signing time field. The data solution structure diagram is as follows: "data_solution": { "sources": [ { "system": "BSS", "table": "contract_table", "fields": ["user_id", "product_type", "sign_date"] }, { "system": "CRM", "table": "user_profile", "fields": ["user_id", "market_segment"] } ], "join_conditions": [ "contract_table.user_id = user_profile.user_id" ], "filters": [ "contract_table.product_type = 'Gigabit Package'", "user_profile.market_segment = 'Campus Market'", "contract_table.sign_date BETWEEN '2025-07-01' AND '2025-09-30'" ] } S3013, Data-based report generation plan.
[0155] The data solution clarifies how to acquire data; this step, based on that, develops an executable blueprint to guide the complete generation of the report, namely the report generation plan.
[0156] In one possible implementation, the report generation plan based on the data solution includes: Finally, an executable structure is generated, integrating the results of entity recognition, knowledge graph reasoning, and data lineage binding into a machine-executable task description. The system binds parameters in user commands to template parameter slots, standardizes business objectives obtained from knowledge graph reasoning, generates detailed calculation logic for each indicator, automatically identifies and analyzes dimensions and their levels, and integrates default styles from the knowledge graph with user-specified visualization rules, ultimately outputting an execution plan in JSON format.
[0157] The data structure of the generated report generation plan includes: Business objective: Standardized expression of user commands.
[0158] Binding parameters: Specific parameter values provided by the user.
[0159] Indicator calculation logic: The calculation formula, data source, and filtering conditions for each indicator.
[0160] Dimensional information: Analyze dimensions and their hierarchical relationships.
[0161] Presentation rules: Visualization requirements such as chart type and conditional formatting.
[0162] The report generation plan features an instantiated blueprint, containing complete business objectives, data source targets, and style requirements, providing structured input for the subsequent dynamic template engine.
[0163] The following is a report generation plan instruction for generating a "Gigabit Package Campus Penetration Rate Analysis" report. First, key parameters such as "2025Q3," "Jiangsu," and "Zhejiang" are extracted through entity recognition and bound to template parameter slots. Knowledge graph reasoning standardizes the user instruction into the explicit business objective of "Gigabit Package Campus Penetration Rate Analysis." This then generates specific data calculation logic and sources for the core indicator of "touchpoint conversion rate." Simultaneously, the system automatically identifies "channel type" as the core analysis dimension and constructs a hierarchical analysis structure of "province → city → campus." Finally, the system integrates preset default styles and user rules from the knowledge graph to generate a presentation rule that uses bar charts as the primary chart type and adds a red warning when the penetration rate is below 15%. An example of the report generation plan is shown below: { "execution_plan": { "business_semantic":"Analysis of Gigabit Package Campus Penetration Rate", "required_metrics": ["touchpoint conversion rate"], "required_dimensions": ["channel type"], "bound_parameters": { "time_range": "2025Q3", "region": ["Jiangsu", "Zhejiang"] }, "data_solution": [] / / Same data lineage, "dimensions": [ { "name": "school", "hierarchy": ["province", "city", "campus"] } ], "presentation_rules": { "default_chart": "bar", "conditional_format": [ { "metric": "penetration rate", "condition": "value<0.15", "action": "red_font" } ] } } } In one embodiment, step S302 may include: Generate semantically related data templates that conform to the preset data structure according to the report generation plan.
[0164] Based on the report generation plan, the template is bound with a triplet of business semantics, data logic, and presentation rules to generate a semantically related data template.
[0165] The semantically related data template includes semantic nodes, data nodes, and display nodes with mapping relationships. Semantic nodes indicate business objectives matching the report generation plan, such as business metrics and key performance indicators. Data nodes indicate data generation rules matching the report generation plan, such as data schemes and calculation logic. The display nodes indicate the presentation format of the report, such as visual rules and narrative templates.
[0166] Figure 6 This is a schematic diagram of a triple binding process, such as... Figure 6 As shown: S3020, Semantic Node Registration.
[0167] This solution extracts key business elements from business semantic descriptions and binding parameters, and creates corresponding semantic nodes in a graph database. These nodes are used to store the core definitions and parameter contexts of business objectives.
[0168] S3021, Data Node Construction.
[0169] This solution analyzes the data solution structure, generates executable data query statements based on specific binding parameters, and creates corresponding data nodes in the graph database, recording the complete data acquisition scheme and physical implementation path.
[0170] S3022, Present node synthesis.
[0171] This solution integrates user-specified style requirements with default display rules in the business knowledge graph to generate the final presentation strategy, and creates presentation nodes in the graph database to define the way the content is visualized.
[0172] S3023, Ternary persistence.
[0173] This solution establishes the relationship between semantic nodes, data nodes, and presentation nodes in the graph database, forming a complete business semantic-data-presentation binding chain. This binding relationship supports global reuse and full-link lineage tracing.
[0174] For example, Figure 7 This is a schematic diagram of a triplet storage structure, such as... Figure 7 As shown: The semantic node (business_semantic) is responsible for maintaining the core definition of business objectives. The primary key (PK) `semantic_id` is a unique identifier for the semantic node's business requirements. The string `business_objective` represents the specific business objective, such as "analyze the penetration rate of gigabit packages in the campus market". The string `key_metrics` is an array of key metrics that need to be focused on to achieve this objective, such as ["number of gigabit users", "total number of users", "penetration rate"].
[0175] The data node (data_solution) is responsible for recording the physical layer implementation scheme, and its primary key, solution_id, is the scheme identifier for the data node. The string data_sources indicates the data solution from which the data comes, such as a specific database table name or interface. The string calculation_logic indicates the specific calculation logic, such as an SQL query statement or calculation formula.
[0176] The presentation node is responsible for defining display rules and style requirements; its primary key, `presentation_id`, is the presentation identifier for the presentation node. `visual_rules` are visual rules defined in JSON format, such as chart type (bar chart, pie chart), color, and conditional formatting (values greater than 10% are highlighted in red). `narrative_template` is a narrative template defined in JSON format, guiding the large language model on how to generate analytical text based on the data.
[0177] S3024, Semantic Relationship Data Template.
[0178] This solution integrates the unique identifier of the triple, the executable data query statement, and the final style rules, assembling them into a directly executable instantiated JSON template, namely a semantically related data template.
[0179] The following is a schematic diagram of a semantically related data template structure: This template is applied to the "touchpoint conversion analysis" scenario. The `id` and `type` fields at the top level of the template clearly indicate that it is a combined template type. The `lineage` field precisely links the persisted semantic nodes, data nodes, and presentation nodes through references, ensuring the traceability of the generation process. In the `execution_plan` section, the template contains directly executable structured query language statements, clarifying the specific logic for retrieving information from the data source. Meanwhile, its `style_rules` define the visualization details of the report content. For example, when the "conversion rate" metric meets the condition "<0.3", a "red background" style action will be triggered, and the default is to use a "horizontal bar chart" for data display. The schematic diagram of the semantically related data template structure is as follows: { "id": "CT_Contact Conversion Analysis_202508", "type": "composite", "lineage": { "business_semantic": "BS_202507_001", "data_solution": "DS_202507_001", "presentation": "PR_202507_001" }, "execution_plan": { "sql": "SELECT channel_type, COUNT(order_success) as success_count,COUNT(touches) as touch_count, COUNT(order_success) / COUNT(touches) asconversion_rate FROM BSS.channel_touches LEFT JOIN CRM.order_success ON ...WHERE ... GROUP BY channel_type", "style_rules": { "conditional_format": [ {"metric": "conversion_rate", "condition": "<0.3", "action": "red_background"} ], "chart_config": { "type": "horizontal_bar", "x_axis": "channel_type", "y_axis": "conversion_rate } } } } This solution establishes a three-element binding mechanism for business objectives, data rules, and presentation formats by structuring semantically related data templates into semantic nodes, data nodes, and display nodes with mapping relationships. Based on a unified template structure, this solution enables independent management and flexible combination of business semantics, data logic, and display styles, thereby improving the standardization and controllability of the report generation process.
[0180] In one embodiment, step 303 may include: Figure 8 This is a schematic diagram of a report content generation and output process, such as... Figure 8 As shown: S3030: Execute the semantic association data template to obtain data that matches the report generation requirements.
[0181] Executing the semantically related data template is the starting point for content generation. By executing the data query logic pre-set in the template, the raw structured data required to generate the report is obtained from the specified data source.
[0182] In a possible implementation, the report content is generated through the following steps: First, perform the data acquisition operation: This solution parses the data_solution part of the report generation plan, generates a complete SQL query statement (e.g., SELECT channel_type, COUNT(order_success) / COUNT(touches) AS conversion_rate FROM BSS.channel_touches), connects to the data warehouse, executes the query, and obtains the structured dataset.
[0183] S3031. Generate report content based on data that matches the report generation requirements.
[0184] Based on the acquired data, a report will be automatically generated. The report content will include at least one of the following: analytical text, tables, or reference figures.
[0185] In one possible implementation, the analyzed text is generated by a text generation model based on a preset cue word framework.
[0186] In one possible implementation, the text generation model generates a large language model.
[0187] The prompt framework includes role declaration, task objective, and output constraints.
[0188] The role declaration indicates the perspective from which the generated text is viewed. The task objective indicates the structure and content type of the generated text. Output constraints indicate the rules that the text generation should follow. The cue word framework structure is illustrated below: Role: Senior Business Analyst for Carriers Task: Analyze broadband order conversion based on {data}, and output a three-part text consisting of data, analysis, and suggestions. constraint: - Data references must include location anchors (e.g., Table X, Figure Y). - The analysis paragraph must include a year-on-year calculation: ((current value - historical value) / historical value) 100 - Use a whitelist of terms (such as "conversion rate" or "refund rate"). Data: {dataset} For example, when the input dataset shows "Campus channel conversion rate 38%", the following is automatically generated: "Outstanding performance of campus channels (conversion rate 38%, see Table X), mainly benefiting from... It is recommended to expand campus promotion efforts." The output text strictly follows the rules: data citations must be marked with location anchors (such as "see Table X", where X is the table number), and the analysis paragraphs must include year-on-year calculations (automatically calling (current value - historical value) / historical value).
[0189] During the table generation process, the system performs the following processing based on the SQL query results and presentation rules: The SQL result set is converted into a two-dimensional matrix structure. Fields are sorted according to dimension priority. If aggregation is required, Online Analytical Processing (OLAP) aggregation operators are invoked to perform subtotals, totals, year-on-year comparisons, and month-on-month comparisons, and the results are appended to the end of the matrix. The conditional_format array in the presentation rules is read, the conditional expressions are parsed item by item and compiled into bytecode, and then the matrix cells are scanned row by row; if a cell value triggers the condition, the font color, background color, or icon set is injected into the StyleEntry of that cell.
[0190] For example, construct a two-dimensional table: convert the SQL result set into a row-column matrix, and dynamically sort the fields according to style rules (priority: province > channel > number of users reached). Intelligently generate table headers: automatically add unit of measurement descriptions (e.g., display "Refund Rate (%)" in the refund rate column header), identify numeric columns based on field data type, and add summary rows (SUM or AVG). Render conditional formatting: scan data row by row to trigger style rules; when "Refund Rate > 5%" is detected, inject OpenXML style code. <w:color w:val="FF0000" / > .
[0191] One possible implementation is to output the report in Word format.
[0192] During the chart generation process, the system automatically determines the optimal chart type using a decision tree algorithm: Select a suitable chart format based on data characteristics (such as time dimension, number of dimensions, geographic information, etc.). Aggregate and format the raw data to generate vector charts and embed relevant metadata information.
[0193] Finally, the system integrates the generated text, tables, and charts according to a unified standard to form a complete report. After determining the chart type, the engine calls panel data (PANDA) for data aggregation and formatting, and then uses a plotting library (such as Matplotlib) to generate scalable vector graphics (SVG). Chart titles, footnotes, and data source descriptions are directly written into the enhanced metafile (EMF) metadata of the vector graphics using extensible markup language (XML), avoiding re-formatting within Word.
[0194] S3032. Format the report content.
[0195] The report's layout is based on content priority and layout rules, automatically adjusting the position of content blocks and pagination to ensure that the layout conforms to the standards.
[0196] In one possible implementation, formatting the report content includes: detecting the report page space status; and adjusting the report content layout based on the report page space status.
[0197] For example, report content layout can be achieved using a spatial computing model that maintains a two-dimensional occupancy map with millimeter-level precision. For instance, when the report page is A4 standard size (210mm × 297mm), the map resolution is 10dpi, sufficient to cover discrete points on the A4 sheet. The two-dimensional occupancy map's data structure uses quadtree compression, with occupied and available areas determined by pixel color: black pixels represent occupied areas, and white pixels represent available areas.
[0198] When the content packet to be inserted arrives, the spatial computing model first performs a fast collision detection on the two-dimensional occupancy map. It calculates the bounding rectangle of the content block and determines whether it intersects with any already occupied areas in the bitmap. If the detection result indicates no intersection, the content block is placed in the currently available space; if an intersection is detected, a content rearrangement algorithm is triggered.
[0199] The space occupied by the content package is determined based on the content type. The height of text content is estimated based on the total number of characters, the number of lines, and the line height. The height of table content is estimated based on the number of rows, the line height, and the additional space between the table header and summary rows. The height of chart content is obtained by reading the range data of the enhanced metafile to get its original size. After obtaining the basic height of each type of content, the total height occupied by the content package is calculated by combining the paragraph spacing and page margin settings of the document.
[0200] The content rearrangement algorithm employs a pagination algorithm combining a greedy strategy and a backtracking mechanism. First, based on the greedy strategy, it attempts to place the content package sequence sequentially into the current page. If the remaining vertical space on the current page is insufficient to accommodate subsequent content packages, the algorithm backtracks to the nearest pagination boundary and attempts to adjust the priority and layout order of the content blocks. When the backtracking adjustment cannot meet the space constraints, a forced pagination operation is performed. After pagination is completed, the system automatically inserts a section break before the new page and synchronously updates the page number field of the report document.
[0201] As another example, the spatial computing model may include the following specific schemes: Core configuration parameters of the spatial computing model: Page layout constraint parameters: The page size is A4 standard (210mm × 297mm). The header area occupies 15mm of top space, and the footer area occupies 10mm of bottom space. The content safety margin is set to 20mm on both the left and right sides.
[0202] Real-time status tracking parameters: Record the coordinates of the current editing position (e.g., record the Y-axis offset of 120mm). The coordinates of the bounding box of the laid-out elements (e.g., coordinates of table A: [x1=25, y1=80, x2=185, y2=130]). The anchor point relationships between floating elements and document content (e.g., establishing a relationship between a chart and its corresponding paragraph).
[0203] When typesetting is performed based on the above parameter configuration, the spatial calculation model can work according to the following specific process: The storage space occupied by the content package is determined based on the content type, including the following specific schemes: The height occupied by text paragraphs is calculated as the product of 0.2mm per character and the total number of rows. The height occupied by tables is calculated based on a basic model of 5mm per row, plus an 8mm header space. Chart elements are scaled proportionally to their original size data.
[0204] Collision detection includes the following specific solutions: Calculate the geometric intersection of the proposed placement area and existing elements. If a table requires a height of 50mm but the current page only has 40mm of space remaining, then the required height of the content does not match the remaining space on the page.
[0205] Pagination decisions include the following specific options: Try rearranging the tables in descending order of importance (e.g., importance of abstract > importance of figures and tables > importance of detailed tables).
[0206] Dynamic pagination is performed when a re-layout cannot meet the requirements. During pagination, a continuation table header is automatically inserted for tables spanning multiple pages, while maintaining continuous row numbering.
[0207] S3033. Convert the file format of the formatted report content.
[0208] The report is obtained, and its file format matches the report generation requirements. The intermediate formatted content is then converted into the final document format that meets the report generation requirements.
[0209] One possible implementation is to convert the report format to docx format.
[0210] For example, a document renderer converts the report into a docx format document conforming to the OpenXML standard. The renderer achieves high-precision document generation by directly manipulating the underlying OpenXML document structure. Its processing includes serializing business data into multiple XML components with a predetermined structure and finally encapsulating them into a complete docx document package.
[0211] The docx documentation package contains the following core components: The first part is the main document component ( / word / document.xml), which is configured to define the logical structure of the document by sequentially writing paragraph elements ( <w:p>), table elements ( <w:tbl>) and drawing elements ( <w:drawing>This is used to carry text content, tabular data, and chart objects, where the position information of each content block is determined by the layout coordinates output during the content generation stage.
[0212] The second part is the style component ( / word / styles.xml), which is configured to declare the visual presentation rules of the document by deserializing the style rules in the dynamic template engine into standard OpenXML style elements. <w:style>Each style element is assigned a unique identifier that maps consistently to style references within the content bundle.
[0213] The third part is the theme component ( / word / theme / theme1.xml), which is configured to define the global visual theme of the document, including the color scheme and font set.
[0214] The fourth part is the numbering component ( / word / numbering.xml), which is configured to implement a multi-level numbering system. When a report structure containing multi-level headings is detected, an abstract numbering definition is created ( <w:abstractnum>) and specific numbering examples ( <w:num>To establish hierarchical numbering rules.
[0215] The fifth part is the resource component collection ( / word / media / and its associated components), which is configured to store embedded resources, store the image objects output by the chart generation engine as image components, and establish a mapping relationship between resource identifiers and storage paths in the relational components.
[0216] Part 6 includes the header component ( / word / header) .xml) and the footer component ( / word / footer) The .xml file is configured to carry page-level metadata and automatically generate headers and footers by writing document metadata (including report title, company identifier, and page number fields).
[0217] Part 7 is the relational component ( / _rels / ) The .rels file is configured to maintain the reference relationships between different parts of a document.
[0218] Once all components are generated, the renderer performs a consistency check on the document package. If the check passes, it outputs the final docx format document.
[0219] By executing a report generation plan to acquire data, automatic information input is achieved. During the report content generation process, the data is automatically transformed into different report formats based on data characteristics and preset rules. Content layout is automatically handled through typesetting. The final document output is completed automatically through file format conversion. This achieves fully automated output from data to a complete, formatted report document, greatly reducing manual intervention.
[0220] By using a pre-defined prompt framework to guide the text generation model, a standardized input specification is established for the generation of analytical text. This framework effectively guides the reasoning and creation process of the text generation model, ensuring that the generated analytical text meets the pre-defined requirements in terms of perspective, content, and format, thereby improving the quality and structural standardization of the generated report content.
[0221] The layout includes detecting the spatial status of the report page and adjusting the layout of the report content accordingly. This enables automatic adjustment of the report page, improving the quality of the generated report.
[0222] As can be seen, the above mainly describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the above functions, the embodiments of this application provide corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, in conjunction with the modules and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this invention.
[0223] This application embodiment can divide the report generation device into functional modules according to the above method example. For example, each function can be divided into its own functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. Optionally, the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0224] In one embodiment, this application also provides a report generation apparatus.
[0225] Figure 9 This is a schematic diagram illustrating the composition of a report generation apparatus provided in an embodiment of this application. Figure 9 As shown, the report generation device 400 includes: an instruction processing module 401, a plan generation module 402, a template generation module 403, and a report execution module 404.
[0226] The instruction processing module 401 is used to obtain the report generation instruction, which includes report content data and report generation requirements.
[0227] In one embodiment, the instruction processing module 401 is further configured to decompose the report generation instruction to obtain multi-level granularity report generation sub-instructions.
[0228] In one embodiment, the multi-level granularity report generation sub-instruction includes at least one of the following: chapter instruction, paragraph instruction, or atomic instruction.
[0229] The plan generation module 402 is used to generate a report generation plan based on the report generation instructions. The report generation plan is used to indicate the process operations required to generate the report.
[0230] In one embodiment, the plan generation module 402 is further configured to parse the report generation instruction, perform reasoning based on the parsing results using a preset knowledge base, generate a data solution based on the reasoning results, and generate a report generation plan based on the data solution.
[0231] The template generation module 403 is used to generate semantically related data templates that conform to a preset data structure according to the report generation plan.
[0232] In one embodiment, the template generation module 403 is further configured to determine whether there is a target template matching the report generation instruction in the stored preset templates before generating a report generation plan according to the report generation instruction.
[0233] In one embodiment, the template matching module 403 is further configured to match the target template in a stored preset initial template based on the report generation sub-instruction of multi-level granularity.
[0234] In one embodiment, the stored templates include multi-level granular templates, which include atomic templates, combined templates, and report templates.
[0235] In one embodiment, the template generation module 403 is further configured to generate a template conforming to a preset data structure according to the report generation plan when the target template has not been determined.
[0236] In one embodiment, the template generation module 403 is further configured to determine the report components required for generating the report based on a preset knowledge base when the target template has not been determined; and generate a template based on the report components.
[0237] The report execution module 404 is used to execute the semantically related data template and obtain a report.
[0238] In one embodiment, the semantic association data template includes semantic nodes, data nodes, and display nodes that have a mapping relationship; Semantic nodes are used to indicate business objectives that match the report generation plan; Data nodes are used to indicate data generation rules that match the report generation plan; The display node is used to indicate how the report will be presented.
[0239] In one embodiment, the report execution module 404 is further configured to execute a semantically related data template to obtain data that matches the report generation requirements; generate report content based on the data that matches the report generation requirements, the report content including at least one of the following: analytical text, tables, or reference figures; format the report content; convert the formatted report content into a file format to obtain a report, the file format of which matches the report generation requirements.
[0240] In one embodiment, the analyzed text is generated based on a preset cue word framework using a text generation model; The prompt framework includes role declaration, task objective, and output constraints; The character declaration is used to indicate the perspective from which the text is generated; The task objective is used to indicate the structure and content type of the generated text; Output constraints are used to indicate the rules that text generation should follow.
[0241] In one embodiment, the report execution module 404 is further configured to, when formatting the report content, specifically: detect the report page space status; and adjust the report content layout based on the report page space status.
[0242] In implementing the functions of the integrated modules described above, this embodiment of the invention provides a possible structural schematic diagram of the electronic device involved in the above embodiments. For example... Figure 10 As shown, the electronic device 500 includes: a processor 502, a communication interface 503, and a bus 504. Optionally, the electronic device 500 may also include a memory 501.
[0243] Processor 502 may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 502 may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 502 may also be a combination that implements computing functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0244] Communication interface 503 is used to connect to other devices via a communication network. This communication network can be Ethernet, wireless access network, wireless local area network (WLAN), etc.
[0245] The memory 501 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto.
[0246] In one possible implementation, the memory 501 can exist independently of the processor 502. The memory 501 can be connected to the processor 502 via a bus 504 and is used to store instructions or program code. When the processor 502 calls and executes the instructions or program code stored in the memory 501, it can implement the report generation method provided in this embodiment of the invention.
[0247] In another possible implementation, the memory 501 can also be integrated with the processor 502.
[0248] Bus 504 can be an extended industry standard architecture (EISA) bus, etc. Bus 504 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 10 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0249] Through the above description of the implementation methods, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the service calling device can be divided into different functional modules to complete all or part of the functions described above.
[0250] This application also provides a computer-readable storage medium. All or part of the processes in the above method embodiments can be executed by computer instructions instructing related hardware. The program can be stored in the aforementioned computer-readable storage medium, and when executed, it can include the processes of the above method embodiments. The computer-readable storage medium can be any of the foregoing embodiments or memory. The aforementioned computer-readable storage medium can also be an external storage device of the aforementioned service invocation device, such as a plug-in hard drive, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the aforementioned service invocation device. Further, the aforementioned computer-readable storage medium can include both internal storage units of the aforementioned service invocation device and external storage devices. The aforementioned computer-readable storage medium is used to store the aforementioned computer program and other programs and data required by the aforementioned service invocation device. The aforementioned computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
[0251] This application also provides computer instructions. All or part of the processes in the above method embodiments can be executed by computer instructions to instruct related hardware (such as computers, processors, network devices, and terminals). The program can be stored in the aforementioned computer-readable storage medium.
[0252] This application also provides a computer program product that, when run on a computer, causes the above-described method embodiments to be executed.
[0253] This application also provides a chip system. The chip system may be composed of chips or may include chips and other discrete devices, without limitation. The chip system includes a processor and a transceiver. All or part of the processes in the above method embodiments can be completed by this chip system, such as the chip system being used to implement the functions performed by the network devices or terminals in the above method embodiments.
[0254] In one possible design, the chip system further includes a memory for storing program instructions and / or data. When the chip system is running, the processor executes the program instructions stored in the memory to enable the chip system to perform the functions performed by the network device or terminal in the above method embodiments.
[0255] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.< / w:num> < / w:abstractnum> < / w:style> < / w:drawing> < / w:tbl> < / w:p>
Claims
1. A report generation method characterized by, The method comprises the following steps: obtaining a report generation instruction, wherein the report generation instruction comprises report content data and report generation requirements; generating a report generation plan according to the report generation instruction, wherein the report generation plan is used to indicate a process operation required for generating a report; generating a semantic association data template conforming to a preset data structure according to the report generation plan; executing the semantic association data template to obtain a report.
2. The method of claim 1, wherein, Before the step of generating a report generation plan according to the report generation instruction, the method further comprises the following steps: determining whether a target template matching the report generation instruction exists in a stored preset template; in a case where the target template is not determined, generating the template conforming to the preset data structure according to the report generation instruction.
3. The method of claim 2, wherein, The stored template comprises a multi-level granularity template, and the multi-level granularity template comprises an atomic template, a combined template and a report template.
4. The method of claim 2, wherein, In a case where the target template is not determined, the step of generating the template conforming to the preset data structure according to the report generation plan comprises the following steps: in a case where the target template is not determined, determining a report constituent element required for generating a report according to a preset knowledge base; and generating the template according to the report constituent element.
5. The method of claim 2, wherein, The step of determining whether a target template matching the report generation instruction exists in a stored preset template comprises the following steps: disassembling the report generation instruction to obtain a multi-level granularity report generation sub-instruction; matching the target template in the stored preset initial template according to the multi-level granularity report generation sub-instruction.
6. The method of claim 5, wherein, The multi-level granularity report generation sub-instruction comprises at least one of the following: a chapter instruction, a paragraph instruction or an atomic instruction.
7. The method of claim 1, wherein, The step of generating a report generation plan according to the report generation instruction comprises the following steps: analyzing the report generation instruction; reasoning an analysis result based on a preset knowledge base; generating a data solution according to a reasoning result; generating the report generation plan based on the data solution.
8. The method of claim 1, wherein, The semantic association data template comprises semantic nodes, data nodes and display nodes having a mapping relationship; the semantic nodes are used to indicate a business target matching the report generation plan; the data nodes are used to indicate a data generation rule matching the report generation plan; the display nodes are used to indicate a presentation form of the report.
9. The method of claim 1, wherein, The step of executing the semantic association data template to obtain a report comprises the following steps: executing the semantic association data template to obtain data matching the report generation requirements; generating report content based on the data matching the report generation requirements, wherein the report content comprises at least one of the following: an analysis text, a table or a reference graph; typesetting the report content; performing file format conversion on the typeset report content to obtain the report, wherein a file format of the report matches the report generation requirements.
10. The method of claim 9, wherein, The analysis text is generated based on a preset prompt word framework through a text generation model; the prompt word framework comprises a role declaration, a task target and an output constraint; the role declaration is used to indicate a perspective of generating a text; the task target is used to indicate a structure and a content type of generating a text; The output constraint is used to indicate a rule followed by the text generation.
11. The method of claim 9, wherein, The typesetting of the report content includes: Detecting a report page space state; Adjusting the report content layout based on the report page space state.
12. A report generating apparatus characterized by comprising: Comprise: An instruction processing module, configured to acquire a report generation instruction, the report generation instruction comprising report content data and report generation requirements; A plan generation module, configured to generate a report generation plan according to the report generation instruction, the report generation plan being used to indicate a process operation required for generating a report; A template generation module, configured to generate a semantic association data template conforming to a preset data structure according to the report generation plan; A report execution module, configured to execute the semantic association data template to obtain a report.
13. An electronic device, comprising: Comprise a processor and a memory, the processor being coupled with the memory; the memory is used to store computer instructions, the computer instructions are loaded and executed by the processor to make the computer equipment realize the report generation method as claimed in any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, The computer readable storage medium comprises computer execution instructions, when the computer execution instructions run on the computer, make the computer execute the report generation method as claimed in any one of claims 1 to 11.
15. A computer program product, characterised in that, The computer program product comprises a computer program, when the computer program runs on the electronic equipment, make the electronic equipment execute the report generation method as claimed in any one of claims 1 to 11.