Data card generation method and system
Patent Information
- Application Number
- CN202610909573.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-23
- Publication Date
- 2026-09-18
AI Technical Summary
[0003]相关技术中,企业开展数据分析与决策支持工作,主要依靠人工完成图表组件配置与页面布局编排,部分工具虽支持拖拽式编辑操作,但整体流程仍高度依赖专业技术人员,需由技术人员需依次完成需求解读、指标筛选、图表选型、布局设计、样式调试等一系列操作
本申请提供的方案,当接收到用户的业务描述信息时,通过LLM模型从卡片模板库中确定与业务描述信息匹配的目标卡片模板;目标卡片模板的配置参数包括数据显示规则,业务描述信息以自然语言形式呈现;通过NL2SQL智能体将业务描述信息转换为SQL语句;采用SQL语句,从目标数据库中获取与业务描述信息匹配的查询结果;根据数据显示规则,将查询结果中的各业务数据分别填充至目标卡片模板中的相应区域,得到目标数据卡片;向用户展示目标数据卡片。本申请通过将LLM模型的语义理解能力、NL2SQL智能体的数据查询能力、数据卡片的可视化呈现能力有机结合,实现数据卡片的智能化、自动化、个性化的生成,从而大幅降低数据分析门槛,显著降低人力成本与企业运营成本,极大提升企业数据分析与决策效率。
Smart Images

Figure CN122777599A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of natural language processing technology, and in particular to a method and system for generating data cards. Background Technology
[0002] As enterprises deepen their digital transformation, various types of business data are constantly being collected within the enterprise, gradually forming massive data indicators, analysis models, and data application systems to meet the data analysis needs of various business departments.
[0003] In related technologies, enterprises primarily rely on manual configuration of chart components and page layout for data analysis and decision support. While some tools support drag-and-drop editing, the overall process still heavily depends on technical personnel, who must sequentially complete a series of operations including requirements interpretation, indicator selection, chart selection, layout design, and style debugging. This highly manual approach exposes numerous unavoidable technical flaws in practical applications, severely hindering the efficiency of enterprise data analysis and the realization of data value. Summary of the Invention
[0004] To address or partially address the problems existing in related technologies, this application provides a data card generation method and system that can significantly lower the threshold for data analysis, substantially reduce labor costs and enterprise operating costs, and greatly improve the efficiency of enterprise data analysis and decision-making.
[0005] The first aspect of this application provides a method for generating data cards, including: When the user's business description information is received, the target card template that matches the business description information is determined from the card template library through the LLM model; the configuration parameters of the target card template include data display rules, and the business description information is presented in natural language form; The business description information is converted into SQL statements using the NL2SQL agent; Using the SQL statement, retrieve query results from the target database that match the business description information; According to the data display rules, each business data in the query results is filled into the corresponding area of the target card template to obtain the target data card; The target data card is displayed to the user.
[0006] In one embodiment, the card template library stores multiple preset card templates, each of which includes a corresponding adaptation scenario and adaptation rules; the step of determining the target card template matching the business description information from the card template library using an LLM model includes: Semantic features are extracted from the business description information using an LLM model; The LLM model is used to calculate the matching degree between the semantic features and the corresponding adaptation scenarios and adaptation rules of each preset card template. Select the preset card template with the highest matching degree from the multiple preset card templates as the target card template.
[0007] In one embodiment, the method further includes: When there are at least two preset card templates with the highest matching degree, obtain the user profile information of the user and the group profile information of the group to which the user belongs; Based on the user profile information and the group profile information, at least two candidate card templates are prioritized; the candidate card template is the preset card template with the highest matching degree. Select the candidate card template with the highest priority from the at least two candidate card templates as the target card template.
[0008] In one embodiment, converting the business description information into SQL statements using an NL2SQL agent includes: Read the schema information of the target database using the NL2SQL agent; The NL2SQL agent identifies the query intent for the business description information. The NL2SQL agent generates SQL statements based on the schema information and the query intent.
[0009] In one embodiment, the configuration parameters of the target card template further include layout rules and style rules; the step of filling each business data in the query result into the corresponding area of the target card template according to the data display rules to obtain the target data card includes: Based on the layout rules, the component types of each area in the target card template are determined; the component types include chart components, information components, and filter components. According to the data display rules, each business data in the query results is bound to the component type of the corresponding area in the target card template to render a visual component and obtain an initial data card. According to the style rules, the initial data card is beautified to obtain the target data card.
[0010] In one embodiment, the configuration parameters of the target card template further include nesting rules, and the method further includes: When the nesting rule indicates that the target card template supports nested sub-cards, according to the data display rule, each business data in the query result is filled into the corresponding area of the corresponding sub-card to obtain multiple target sub-cards; According to the nesting position and number of nesting as indicated by the nesting rules, the multiple target sub-cards are nested to obtain target data cards with a tree-like hierarchical structure.
[0011] In one embodiment, displaying the target data card to the user includes: Identify the device type of the requesting party; the requesting party is the terminal device that initiated the service description information. Based on the device type, the target data card is adapted for rendering and output for display.
[0012] In one embodiment, the method further includes: In response to a user's sharing request at the requesting end, the target data card is pushed to the receiving end indicated by the sharing request. In response to a collaboration request from a user at the receiving end or the requesting end, a collaborative editing operation is performed on the target data card.
[0013] In one embodiment, the method further includes: When an update event is detected in the target data card, an update notification is pushed to the target user's terminal device; the target user is a user who is following the target data card, and the update notification is used to remind the target user that the content of the target data card has been updated.
[0014] A second aspect of this application provides a data card generation system, comprising: The template recommendation module is used to determine a target card template that matches the user's business description information from the card template library using an LLM model when the user's business description information is received. The configuration parameters of the target card template include data display rules, and the business description information is presented in natural language. The SQL generation module is used to convert the business description information into SQL statements through the NL2SQL agent; The data acquisition module is used to retrieve query results that match the business description information from the target database using the SQL statement; The card generation module is used to fill the corresponding areas of the target card template with each business data in the query results according to the data display rules, so as to obtain the target data card; The card display module is used to display the target data card to the user.
[0015] A third aspect of this application provides an electronic device, comprising: Processor; and A memory that stores executable code, which, when executed by the processor, causes the processor to perform the method described above.
[0016] A fourth aspect of this application provides a computer-readable storage medium having executable code stored thereon, which, when executed by a processor of an electronic device, causes the processor to perform the method described above.
[0017] The technical solution provided in this application may include the following beneficial results: The solution provided in this application, upon receiving a user's business description information, determines a target card template matching the business description information from a card template library using an LLM model. The target card template's configuration parameters include data display rules, and the business description information is presented in natural language. An NL2SQL agent converts the business description information into SQL statements. Using these SQL statements, query results matching the business description information are retrieved from the target database. Based on the data display rules, each business data point from the query results is filled into the corresponding area of the target card template to obtain the target data card. The target data card is then displayed to the user. This application organically combines the semantic understanding capabilities of the LLM model, the data query capabilities of the NL2SQL agent, and the visualization capabilities of the data card to achieve intelligent, automated, and personalized generation of data cards. This significantly lowers the threshold for data analysis, substantially reduces labor and operational costs, and greatly improves the efficiency of enterprise data analysis and decision-making.
[0018] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0019] The above and other objects, features and advantages of this application will become more apparent from the more detailed description of exemplary embodiments thereof in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components in the exemplary embodiments thereof.
[0020] Figure 1 This is a flowchart illustrating the data card generation method in an embodiment of this application; Figure 2 This is another schematic flowchart illustrating the data card generation method in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of the data card generation system shown in the embodiments of this application; Figure 4 This is a schematic diagram of the structure of an electronic device shown in an embodiment of this application. Detailed Implementation
[0021] Embodiments of this application will now be described in more detail with reference to the accompanying drawings. While embodiments of this application are shown in the drawings, it should be understood that this application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to make this application more thorough and complete, and to fully convey the scope of this application to those skilled in the art.
[0022] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0023] It should be understood that although the terms "first," "second," "third," etc., may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0024] In related technologies, enterprises primarily rely on manual configuration of chart components and page layout for data analysis and decision support. While some tools support drag-and-drop editing, the overall process still heavily depends on technical personnel (such as developers, IT staff, and data analysis teams). These personnel must sequentially complete a series of tasks, including requirements interpretation, indicator selection, chart selection, layout design, and style debugging. This highly manual approach exposes numerous unavoidable technical flaws in practical applications (see the four common problems listed below), severely hindering the efficiency of enterprise data analysis and the release of data value.
[0025] (1) There is a problem of low collaboration efficiency in related technologies: When faced with the same source data, the data analysis results obtained by different business positions and different departments are often inconsistent due to differences in business cognition and analysis perspective. At the same time, there is a lack of standardized results reuse mechanism among project teams. The same or similar data analysis functions and data applications are repeatedly developed, resulting in a serious waste of human resources, computing power and other resources. In addition, the traditional data service model is limited to the request initiator to view and use it alone (i.e. "whoever makes the request can see the data"), lacking a wide sharing and collaboration mechanism, and the scope of data circulation is narrow.
[0026] (2) There is a high threshold for data analysis in related technologies: technical personnel must participate in all aspects of requirements docking, solution design, function development, testing and launch. This requires not only solid technical skills, but also a deep understanding of the business logic of each field. This places extremely high demands on the comprehensive quality and business understanding of technical personnel, resulting in high labor costs. In addition, the traditional development process chain is long and inflexible, and it cannot quickly respond to the diverse and frequently changing data analysis needs of the business side, resulting in insufficient adaptability.
[0027] (3) There is a problem of low data retrieval efficiency in related technologies: At present, business personnel cannot complete the data extraction work independently and must rely on technical personnel to assist in data retrieval. However, technical personnel often lack sufficient business background knowledge, which leads to frequent submission of change requests during the process of demand communication and data acquisition. This iterative communication mode greatly prolongs the data acquisition cycle and seriously affects the overall decision-making efficiency of the enterprise.
[0028] (4) There are problems with insufficient operation and user experience in related technologies: the traditional data reporting and visualization content update mechanism is lagging behind, making it difficult to synchronize the latest business data in real time and failing to meet the needs of business personnel to view dynamic information; the functions of data products are fixed, lacking personalized configuration and interactive capabilities, and the participation of business departments is low; at the same time, the displayed content is mostly in a fixed form, which cannot support flexible interaction and content sharing, making it difficult to stimulate user enthusiasm.
[0029] To address the aforementioned issues, this application provides a data card generation method that organically combines the semantic understanding capabilities of the LLM model, the data query capabilities of the NL2SQL agent, and the visualization capabilities of the data card. This enables the intelligent, automated, and personalized generation of data cards, thereby solving problems such as low collaboration efficiency, high data analysis threshold, low data retrieval efficiency, and insufficient operation and user experience in related technologies. It significantly lowers the threshold for data analysis, democratizes data and enables intelligent operation, thereby improving the efficiency of data-driven decision-making and cross-departmental collaboration for enterprises.
[0030] The technical solutions of the embodiments of this application are described in detail below with reference to the accompanying drawings.
[0031] Figure 1 This is a flowchart illustrating the data card generation method in an embodiment of this application.
[0032] See Figure 1 The data card generation method of this application may include: S110: When the user's business description information is received, the target card template that matches the business description information is determined from the card template library through the LLM model; the configuration parameters of the target card template include data display rules, and the business description information is presented in natural language.
[0033] Large Language Models (LLMs) belong to the category of large AI models. Large AI models refer to artificial intelligence models with a large number of parameters and complex network structures, typically based on deep learning techniques, with hundreds of millions or even trillions of parameters. These models, trained on massive amounts of data, can capture complex patterns and deep-level features, thus exhibiting powerful performance in multiple fields such as natural language processing, image recognition, and speech synthesis. Large models possess strong generalization and transfer learning capabilities, adapting to various task scenarios and representing one of the core directions of artificial intelligence development.
[0034] The embodiments of this application can pre-train the LLM model. In a specific implementation, business experts and design experts first configure a large number of preset card templates for different business scenarios. Each business scenario corresponds to one or more preset card templates. Then, corresponding user question descriptions are configured for the preset card templates. The LLM model is trained using these preset card templates and their corresponding user question descriptions so that the LLM model can learn the mapping relationship between user question descriptions and preset card templates.
[0035] In this embodiment, a large number of preset card templates obtained by the above configuration can be stored in the card template library of the data card generation system (hereinafter referred to as "this system"), and the LLM model trained above can be deployed in this system.
[0036] In practical applications, this system can receive business description information input by users (such as business personnel) through the application interface of terminal devices (such as PCs / mobile devices / tablets / large screens). Input methods support multiple forms, including text input boxes and voice input. The business description information can be data analysis needs or questions raised by users in natural language. For example, a business description could be a single sentence: "Show the sales and user activity trends for each region last month," or "I want to see the user retention rate of product A in the past week." Alternatively, it could be multiple sentences: "I want to see the user activity trend for last quarter, compare the conversion rates of each channel, and finally provide a comprehensive evaluation." This system can preprocess the input business description information, such as by word segmentation and stop word removal, to improve the semantic analysis accuracy of the LLM model. The system can then call a pre-trained LLM model to perform semantic analysis on the preprocessed business description information. Based on the learned mapping relationships, the LLM model determines the target card template that matches the business description information from the card template library.
[0037] S120 uses the NL2SQL agent to convert business description information into SQL statements.
[0038] This system allows business description information to be input into a pre-configured NL2SQL (Natural Language to SQL) agent. The NL2SQL agent is an intelligent agent built on an LLM model. After training, it accurately understands the business description information in natural language and converts it into standard SQL (Structured Query Language) statements for the target database. For example, assuming the business description information is "last month's sales," the NL2SQL agent can convert it into the SQL statement: `SELECT SUM(sales_amount) FROM sales_table WHERE month = 'last_month'`. The NL2SQL agent can handle various complex queries, including aggregation, filtering, and sorting.
[0039] It should be noted that the NL2SQL agent can be implemented using the Prompt Engineering method based on the LLM model, or it can use the RAG (Retrieval-Augmented Generation) method, which uses historical excellent SQL cases as retrieval knowledge to enhance the quality of generation.
[0040] It should be noted that an SQL statement may consist of one or more statements. For example, when business description information involves multiple different data sources, or when it is necessary to query primary and secondary indicators separately, the NL2SQL agent will convert it into multiple SQL statements.
[0041] S130 uses SQL statements to retrieve query results from the target database that match the business description information.
[0042] In addition to maintaining a card template library, this system also maintains a target database. The target database type can include, but is not limited to, MySQL (an open-source lightweight relational database), PostgreSQL (an open-source advanced relational database), ClickHouse (an open-source columnar real-time analytical database), Doris (an open-source distributed columnar analytical database), and Hive (a data warehouse tool based on Hadoop). The target database stores a large amount of business data (such as sales data, sales trend data, etc.), and each type of business data includes a field name, data type, and specific value.
[0043] This system can execute the SQL statements obtained from the above transformation in the target database. After being queried and processed by the target database execution engine, the system returns query results corresponding to the business description information. The query results can be returned in tables, JSON, or other structured formats.
[0044] It should be noted that when there are multiple SQL statements, this system can execute these SQL statements separately, and the target database will eventually return multiple query results. This system can merge or process the multiple query results separately.
[0045] S140, according to the data display rules, fill the corresponding areas of the target card template with the business data from the query results to obtain the target data card.
[0046] The configuration parameters of the target card template include data display rules. These rules describe which business data from the query results is bound to which data dimension (such as X-axis, Y-axis, series, numerical values, etc.) of which area and component within the target card template. Therefore, this system can bind each piece of business data from the query results to the corresponding component type (such as line chart, bar chart, pie chart, indicator card, map, etc.) within the target card template based on these display rules. This allows the system to populate the corresponding business data into the bound components; for example, sales data is bound to and populated into the indicator card, and sales trend data is bound to and populated into the line chart. When all business data from the query results has been populated into the target card template, an intuitive, aesthetically pleasing target data card with rich visualization effects is obtained.
[0047] S150 displays the target data card to the user.
[0048] This system can output target data cards to the application interface of the requesting end (the terminal device that initiates the business description information, such as PC / mobile / tablet / large screen) for display.
[0049] Data cards (such as the target data card that is ultimately displayed) are essentially a collection of information. They are presented in a graphic and textual format and combined with user scenarios to deliver personalized information content. This helps users quickly obtain key information and perform operations within the application interface, thereby empowering decision-makers, improving the overall data-driven decision-making efficiency of the enterprise, promoting cross-departmental information sharing and collaboration, enhancing team synergy efficiency, and effectively reducing enterprise operating costs.
[0050] It should be noted that the embodiments of this application are applicable to multiple data-intensive application scenarios such as enterprise-level business intelligence, intelligent operation, financial risk control, and market analysis.
[0051] As can be seen from this example, the solution provided in this application organically combines the semantic understanding capability of the LLM model, the data query capability of the NL2SQL agent, and the visualization capability of the data card to achieve intelligent, automated, and personalized generation of data cards, thereby significantly reducing the threshold for data analysis, significantly reducing labor costs and enterprise operating costs, and greatly improving the efficiency of enterprise data analysis and decision-making.
[0052] Figure 2 This is another flowchart illustrating the data card generation method shown in this application.
[0053] See Figure 2 The data card generation method of this application may include: S210, when the user's business description information is received, semantic features are extracted from the business description information through the LLM model; the business description information is presented in natural language form, and the card template library stores multiple preset card templates, each of which includes the corresponding adaptation scenario and adaptation rules.
[0054] This system maintains a card template library, which stores a large number of preset card templates pre-configured for different business scenarios. Each preset card template includes corresponding configuration parameters, which may include, but are not limited to: template identifier, adaptation scenario, adaptation rules, layout rules, data display rules, style rules, data format, interaction method, time rules, alarm rules, nesting rules, etc.
[0055] The template identifier can be a template name or template number; the adaptation scenario describes the business scenario to which the preset card template is applicable, such as "monthly management operation report", "daily active user monitoring of the operations team", and "regional performance comparison of the sales department"; the adaptation rules describe the applicable conditions and constraints of the preset card template, such as "suitable for displaying 3-8 indicators", "suitable for trend analysis of time series data", and "not suitable for geospatial data"; the layout rules describe the overall layout of the preset card template, including the layout structure and component type combination. The layout structure describes the grid layout of the preset card template, such as a three-column layout. Three-row, three-column two-row, two-column four-row, single-column flow, etc., component type combinations are used to describe the component types specified in each area of the preset card template (such as chart components (including indicator cards, line charts, bar charts, pie charts, etc.)). For example, the upper left area of the preset card template is a KPI (indicator) card, the upper right area is a line chart, and the lower area is a bar chart, etc.; data display rules are used to describe which business data in the query results is bound to which data dimension (such as X-axis, Y-axis, series, numerical, etc.) of which component in which area of the preset card template; style rules are used to describe the visual effects of the preset card template, including the global size (such as 19). 20×1080, 3840×2160, adaptive aspect ratio, etc.); background settings (such as background image, video background, dynamic background); margins and grid spacing (such as page edge margins, module spacing, alignment rules); color scheme (such as primary color, secondary color, background color); font settings (such as font type, font size, text color); bar / line color, etc.; data format describes the quantity units (such as ten thousand, hundred million, etc.), decimal places (such as 0, 2, etc.), percentage (%), ..., prefix, suffix, etc. supported by the preset card template; interaction method describes the interactive operations supported by the preset card template, including global filter types (as follows). Features include: dropdown menus, date selection, time range filtering, tree selection, search box; drill-down on charts, linking charts to other charts, hover tooltips, and data export; time rules describe the time granularity (e.g., day, month, year) and default time (today, this month) supported by the preset card template; alarm rules describe alarm triggering conditions (e.g., greater than, less than, range, year-on-year / month-on-month anomalies), alarm levels (e.g., alert, warning, severe), and alarm display methods (e.g., color change, pop-up, sound, scrollbar); nesting rules describe whether the preset card template supports nested sub-cards, and the nesting position and number of sub-cards.
[0056] When the system receives business description information input by the user in natural language, it can call a pre-trained LLM model to perform deep semantic understanding and analysis of the business description information in order to extract semantic features from the business description information. Semantic features include, but are not limited to: key business intent, types of indicators involved, data dimensions, time range, comparison objects, etc.
[0057] S220 uses an LLM model to calculate the matching degree between semantic features and the corresponding adaptation scenarios and rules of each preset card template.
[0058] During the training phase, the LLM model learns the mapping relationship between user question descriptions and preset card templates. This mapping relationship is a complex one between user question descriptions, suitable scenarios, adaptation rules, and the best card template. Therefore, in practical applications, when receiving business description information from users, the LLM model analyzes the business description information and the learned suitable scenarios and adaptation rules to intelligently determine and recommend the best card template from the card template library, such as recommending the best card template with a three-column, three-row or three-column, two-row layout.
[0059] In its implementation, the LLM model calculates the matching degree between the extracted semantic features and the adaptation scenarios and rules of each preset card template in the card template library, thereby obtaining the matching degree of each preset card template. The matching degree can be calculated by a weighted combination of semantic similarity score and rule matching score.
[0060] S230: Select the preset card template with the highest matching degree from multiple preset card templates as the target card template; the configuration parameters of the target card template include data display rules.
[0061] The LLM model outputs the most matching target card template and its configuration parameters (such as data display rules, layout structure, component type combination, color scheme, interaction method, etc.) by semantic matching and rule reasoning of the semantic features of business description information with the adaptation scenarios and adaptation rules of each preset card template.
[0062] Specifically, after the LLM model outputs the matching degree of each preset card template, this system can select the preset card template with the highest matching degree as the target card template (i.e., the best card template) and obtain the configuration parameters of the target card template. The configuration parameters include, but are not limited to: template identifier, adaptation scenario, adaptation rules, layout rules (such as layout structure, component type combination), data display rules, style rules (such as color scheme, font and text style, line and fill style, coordinate axis and grid line, legend and data label, chart layout and margin), data format, interaction method (such as drill-down, jump, linkage), time rules, alarm rules, nesting rules, etc.
[0063] In one example, assuming the user inputs a business description that reads "show the sales trend and year-on-year growth of each product line over the past three months," the LLM model analyzes the business description and identifies features such as time-series data, multi-dimensional comparisons, and growth rates, as well as the corresponding complete dataset (e.g., product sales details). It then matches the preset card template 'Sales Analysis Dashboard' (layout of three columns and two rows, including line charts, indicator cards + percentage indicators, 3D bar charts, area charts, 3D horizontal bar charts, radar charts, water globe charts, rose charts, polar coordinate bar charts, and a business blue color scheme). Therefore, this preset card template is recommended as the target card template.
[0064] In one embodiment, the method may further include: When there are at least two preset card templates with the highest matching degree, obtain the user profile information and the group profile information of the user's group; based on the user profile information and the group profile information, prioritize the at least two candidate card templates; the candidate card template is the preset card template with the highest matching degree; select the candidate card template with the highest priority from the at least two candidate card templates as the target card template.
[0065] As mentioned earlier, each business scenario corresponds to one or more preset card templates. Therefore, the preset card template with the highest matching degree may be one or at least two. When there is only one preset card template with the highest matching degree, the system can directly use that preset card template as the target card template. When there are at least two preset card templates with the highest matching degree, the system can prioritize these preset card templates based on industry and platform user profiles, user profiles, behavioral preference data analysis, etc., so as to prioritize recommending the target card template that users are most likely to be interested in.
[0066] In its implementation, this system pre-records each user's historical question descriptions and viewing records. Based on these records, the system can create user profiles for each user and group profiles for each group (user groups with the same organizational structure or roles). In practical applications, when at least two preset card templates with the highest matching degree exist (for ease of description, the preset card template with the highest matching degree is defined as a candidate card template), the system can obtain the pre-built user profile information belonging to that user and the group profile information belonging to that user. Using these user profile and group profile information, the system can prioritize these candidate card templates to obtain the priority of each candidate card template. The candidate card template that best matches the user profile and group profile information has the highest priority. Therefore, the system can select the candidate card template with the highest priority from these candidate card templates as the target card template.
[0067] It should be noted that the embodiments of this application provide a feedback-driven optimization function for continuously optimizing the template recommendation accuracy of the LLM model and the SQL statement generation quality of NL2SQL. Specifically, after showing the target card template to the user (i.e., step S270), the system can collect user feedback on the target card template (such as satisfaction rating, user suggestions for specific modifications to the target card template, etc.) and the user's new template requirements, so as to conduct comprehensive analysis based on the feedback and new template requirements, and continuously optimize and expand the preset card templates in the card template library. Simultaneously, the LLM model is used as an agent (intelligent agent) to learn policies under limited supervision (such as user satisfaction ratings and adoption / rejection). The core idea is: the LLM agent outputs a "recommended target card template" → the user provides a reward (adoption / modification / rejection) → the agent improves through policy optimization (e.g., using ReAct (reasoning and action framework) as the agent's basic policy framework, and then optimizing the policy through reward tuning). Based on this idea, this system continuously collects historical use cases, including user question descriptions, the final selected template, user feedback, etc., and automatically uses these cases as training data to fine-tune the LLM agent, continuously improving the accuracy of the LLM model's recommended target card templates. The NL2SQL agent is an intelligent agent built on the LLM model; therefore, as the LLM model is optimized, the NL2SQL agent is also optimized accordingly.
[0068] S240 uses the NL2SQL agent to convert business description information into SQL statements.
[0069] This step can be found in the description in S120, and will not be repeated here.
[0070] In one implementation, converting business description information into SQL statements using an NL2SQL agent may include: The NL2SQL agent reads the schema information of the target database; identifies the query intent of the business description information; and generates SQL statements based on the schema information and query intent.
[0071] The NL2SQL agent can load metadata information of the target database, including table structure, field definitions, inter-table relationships, data types, etc., to construct a semantic representation of the target database schema (database and table structure) and obtain the schema information of the target database.
[0072] The NL2SQL agent performs semantic parsing on business description information (in natural language form) to identify the query intent. The query intent covers the metrics to be queried (such as sales revenue, number of users), dimensions (such as time, region, product line), filtering conditions (such as the last three months, East China region), aggregation methods (such as summation, average, year-on-year comparison), etc.
[0073] The NL2SQL agent generates one or more executable SQL statements based on query intent and schema information. Scenarios that support generating multiple SQL statements include: when business description information involves multiple different data sources, or when it is necessary to query primary and secondary metrics separately.
[0074] In addition, the NL2SQL agent can perform syntax validation on the generated SQL statements and optimize performance, such as adding index hints and optimizing subquery structures.
[0075] It should be noted that the NL2SQL agent is an intelligent agent built on an LLM model. Therefore, when generating SQL statements, the NL2SQL agent is constrained by the target card template. This means that the NL2SQL agent no longer generates generalized, arbitrary queries, but rather precise queries constrained by the template. Specifically, the NL2SQL agent identifies the relevant data tables, dimensions, and metrics (set A) based on the business description information (in natural language). Each component of the target card template (such as chart components, information components, and filter components) is constrained by its required time dimensions, non-time dimensions, and metrics. Based on the time dimensions, non-time dimensions, and metrics required by each component, the NL2SQL agent finds suitable data tables, dimensions, and metrics in set A, and then further generates the SQL statement.
[0076] S250 uses SQL statements to retrieve query results from the target database that match the business description information.
[0077] This step can be found in the description in S130, and will not be repeated here.
[0078] It should be noted that if the SQL statement fails to execute or returns an empty result, the NL2SQL agent will automatically analyze the cause and attempt to correct the SQL statement and re-execute it, or provide feedback to the user and request clarification.
[0079] S260, according to the data display rules, fill the corresponding areas of the target card template with the business data from the query results to obtain the target data card.
[0080] This step can be found in the description in S140, and will not be repeated here.
[0081] In one embodiment, the configuration parameters of the target card template further include layout rules and style rules; according to the data display rules, each business data in the query results is filled into the corresponding area of the target card template to obtain the target data card, which may include: Based on the layout rules, determine the component types for each area in the target card template; the component types include chart components, information components, and filter components; based on the data display rules, bind each business data in the query results to the corresponding component types in the target card template to render and form a visual component, thus obtaining the initial data card; based on the style rules, beautify the initial data card to obtain the target data card.
[0082] As mentioned earlier, the configuration parameters of each preset card template include layout rules, data display rules, and style rules. Therefore, this system can extract the corresponding layout rules, data display rules, and style rules from the configuration parameters of the target card template.
[0083] The layout rules include layout structure and component type combinations. This system can determine the number of areas (e.g., 9 areas in 3 columns and 3 rows) and the position and size of each area in the target card template based on the layout structure. It can also determine the component types specified for each area in the target card template based on the component type combinations. Component types include chart components, information components, and filter components. Chart components include, but are not limited to: bar charts, horizontal bar charts, comparison bar charts, stacked bar charts, bar-and-line charts, 3D bar charts, 3D horizontal bar charts, line charts, area charts, scatter plots, pie charts, donut charts, rose pie charts, radar charts, dot maps, area maps, flyline maps, cross tables, grouped tables, detail tables, water globe charts, indicator cards (used to display single key performance indicators (KPIs), such as sales revenue, user activity, etc., presented in the form of large numbers and trend arrows), percentage indicators, indicator dashboards, word clouds, etc. Information components include, but are not limited to: lines, text, images, web, tab cards, real-time time, etc. Filter components include, but are not limited to: year, year-month, date, year-month range, date range, text dropdown, etc.
[0084] The data display rules define which type of business data in the query results is bound to which data dimension (such as X-axis, Y-axis, series, numerical, etc.) of which area and component in the preset card template. Therefore, this system can bind various business data in the query results to the corresponding component types (chart components / information components / filter components) in the target card template according to the data display rules of the target card template. For example, sales data is bound to the indicator card, and sales trend data is bound to the line chart. This system can call chart rendering engines (such as ECharts (open source front-end data visualization chart framework), AntV G2 (open source front-end data visualization graphics syntax library), D3.js (Data-DrivenDocuments), etc.) to render the bound data (business data and corresponding bound components) into visualization components (such as visualization chart components). For easy differentiation, the data card before beautification is defined as the initial data card.
[0085] This system can beautify the initial data card according to the visual effects defined by the style rules, including background, border, shadow, animation effects, etc. For easy differentiation, the beautified data card is defined as the target data card.
[0086] In one embodiment, the configuration parameters of the target card template further include nested rules, and the method may further include: When the nesting rule indicates that the target card template supports nested sub-cards, according to the data display rules, each business data in the query results is filled into the corresponding area of the corresponding sub-card to obtain multiple target sub-cards; according to the nesting position and number of nesting indicated by the nesting rule, the multiple target sub-cards are nested to obtain the target data card with a tree-like hierarchical structure.
[0087] As mentioned earlier, each preset card template's configuration parameters include nested rules, so this system can extract the corresponding nested rules from the target card template's configuration parameters.
[0088] The nesting rules define whether the preset card template supports nested sub-cards, as well as the nesting position and number of sub-cards. Therefore, this system can determine whether the internal structure of the target card template supports hierarchical nesting based on the nesting rules of the target card template. If it does not support nesting, it will directly proceed to step S270; if it does support nesting, the target data card can be nested before proceeding to step S270.
[0089] In its implementation, when the nesting rule indicates that the target card template supports nested sub-cards, this system can recursively execute step S260 for each sub-card. That is, according to the data display rules, each business data point in the query results is filled into the corresponding area of the sub-card, resulting in multiple target sub-cards. Following the nesting position and number of nesting points indicated by the nesting rules, the multiple target sub-cards are nested to obtain a tree-structured target data card. For example, a "Group Business Overview" card can nest sub-cards such as "East China Business Card" and "South China Business Card," and each sub-card can further nest more granular cards, forming a tree-structured hierarchical structure.
[0090] The final generated target data cards have the following characteristics, including but not limited to: a target data card is a visual information collection composed of chart components (supporting various chart types such as indicator cards (presenting key indicators in an intuitive way), line charts, bar charts, pie charts, scatter plots, heatmaps, and maps), information components, and filter components; target data cards support rich chart types, custom layouts, and interactive functions; various sub-cards can be nested within target data cards; target data cards support presentation formats including data dashboards (such as full-screen displays and dynamic carousels), thematic dashboards (such as multi-card combinations and topic focus), and web reports (such as paginated displays and printability). Therefore, target data cards can lower the threshold for data analysis in an intuitive and efficient way, supporting strategic and tactical decision-making.
[0091] S270 displays the target data card to the user.
[0092] This step can be found in the description in S150, and will not be repeated here. In one implementation, displaying the target data card to the user may include: Identify the device type of the requesting party; the requesting party is the terminal device that initiated the business description information; based on the device type, adapt and render the target data card and output it for display.
[0093] The generated target data cards can be flexibly output and adapted to display on different terminal devices, ensuring the best visual and interactive experience across various devices, including but not limited to: PC browser applications, mobile apps, tablet applications, or large-screen display applications (such as conference room screens). Specifically, the PC browser application supports large-screen display with a full layout, supporting mouse hover interaction, right-click menus, and data export; the mobile app uses a responsive layout, automatically adjusting to a single-column or two-column flow layout, with charts adaptively shrinking and supporting touch swipes and pinch-to-zoom gestures; the tablet application uses a medium layout, supports stylus interaction, and chart sizes between PC and mobile; and the large-screen display application uses a full-screen immersive layout, supporting high-resolution rendering, dynamic effects, and multi-screen interaction.
[0094] For the adaptation and display of the requesting end (the terminal device that initiates the business description information), this system can obtain the device type of the requesting end through User-Agent or device capability negotiation (supporting device types such as PC, mobile, tablet, and large screen). Based on the characteristics of the device type (such as screen size, resolution, and interaction characteristics), the system adapts and renders the target data card (such as layout adaptation and interaction adaptation) and outputs it to the application interface of the requesting end for display, so that the user of the requesting end can obtain the best visual and interactive experience.
[0095] In one embodiment, the method may further include: In response to a user's sharing request, the target data card is pushed to the receiving end indicated by the sharing request; in response to a user's collaboration request at the receiving end or the requesting end, collaborative editing operations are performed on the target data card.
[0096] This application provides a collaborative sharing function that supports the sharing and collaborative editing of target data cards. Specifically, users can share target data cards with other users or departments through the sharing control on the requesting application interface. In response to the user's sharing request, the system pushes the target data card to the receiving end indicated by the sharing request, allowing the receiving user to see the same card content. Users on both the receiving and requesting ends can perform operations such as commenting, annotating, and secondary editing based on the target data card. The system can also respond to collaborative requests from users on either the receiving or requesting ends to perform collaborative editing operations on the target data card.
[0097] It should be noted that "sharing" refers to the ability of the creator of the target data card (i.e., the requesting user) to share the target data card with a designated group of users within the enterprise or with specific individuals (i.e., the receiving users), facilitating the efficient application of the target data card within the enterprise. "Commenting" refers to users accessing the target data card submitting comments on aspects such as data accuracy, card layout, and aesthetic appeal, enabling the technical team to continuously improve the AI algorithms related to data card generation.
[0098] It should be noted that the target data card is displayed in the same way on the receiving end as it is on the requesting end. That is, when this system pushes the target data card to the receiving end, it can adapt and render the target data card according to the device type of the receiving end and output the display, so that the user on the receiving end can get the best visual and interactive experience.
[0099] In one embodiment, the method may further include: When an update event is detected for the target data card, an update notification is pushed to the target user's terminal device. The target user is the user who is following the target data card, and the update notification is used to remind the target user that the content of the target data card has been updated.
[0100] This application provides a content management function that supports content updates and push notifications for target data cards. Specifically, each user can follow the data cards they need. Taking a target data card as an example, the system can record the target users who have followed the target data card (such as the requesting user, the receiving user, etc.). When an update event is detected for the target data card, the system can generate an update notification and push it to the target user's terminal device, enabling the target user to be informed of the update status of the target data card in a timely manner. Update events may include, but are not limited to: reaching a set update time; switching filter conditions such as time range, region, and product category.
[0101] To facilitate understanding of the overall workflow of the embodiments of this application, the following scenario examples are provided for explanation: Scenario Name: Monthly Management Operational Report S1, the CEO (Chief Executive Officer) enters business description information on the PC: "Generate last month's business overview, including total revenue, total cost, profit margin, performance ranking of each business unit, and year-on-year and month-on-month trends."
[0102] S2, This system calls the LLM model to analyze the business description information and identifies it as a strategic-level decision-making requirement involving the summarization of multiple indicators, ranking comparison, and trend analysis. Therefore, it matches the target card template of the "Business Overview Dashboard" (layout structure: three columns and three rows; component type combination: 4 KPI cards + 2 line charts + 1 bar chart + 1 pie chart + 1 table; color scheme: dark business style; interaction method: supports clicking to drill down to the business unit).
[0103] S3, this system calls the NL2SQL agent to convert the business description information (in natural language form) into multiple executable SQL statements, including: aggregate SQL for querying total revenue and total cost, SQL for ranking each business group, and SQL for year-on-year and month-on-month calculation.
[0104] S4. This system executes multiple SQL statements in the target database to obtain multiple query results, including: monthly summary data, business unit detailed data, and year-on-year and month-on-month calculation results.
[0105] S5. This system fills in the data according to the data display rules of the target card template to obtain the target data card. For example, the KPI card displays total revenue, total cost, profit margin and trend arrows, the line chart displays the trend over the past 12 months, the bar chart displays the business unit ranking, the pie chart displays the revenue share of each business unit, and the table displays detailed data to obtain the target data card.
[0106] S6, this system renders the target data card into a large data screen format and outputs it to the PC for full-screen display.
[0107] In S7, the CEO can share the target data card with the CFO (Chief Financial Officer) and general managers of various business units. These users can see the adapted card content on their respective terminal devices (such as PCs or mobile devices) and comment and discuss it.
[0108] As can be seen from this example, the solution provided in this application has the following beneficial effects and technical advantages: (1) Intuitive and efficient, greatly reducing the threshold for use: The target data cards intelligently generated in this application present complex data in a graphical way, so that non-technical personnel can quickly understand the business situation, reduce the dependence on technical personnel (such as IT or data analysis teams), and realize data democratization.
[0109] (2) Significant synergistic benefits: The embodiments of this application are based on the LLM model to drive the recommendation of target card templates, which is essentially a mapping from semantics to display structure. The NL2SQL agent built based on the LLM model solves the mapping from structure to data. The NL2SQL agent is no longer a generalized random query, but a precise query generated after being constrained by the template. The rendering layer completes the landing of data into expression. After the data is returned, it is automatically filled according to the template. The core modules in this system are not loosely coupled, but form a unified mapping of semantics, data structure and visual structure, reducing information mismatch. The embodiments of this application transform the multi-step process of data card construction that originally relied on human experience into a unified link that can be executed by machines, which greatly shortens the data retrieval cycle for business personnel, reduces the dependence on developers and interaction costs, improves the response speed of data services, significantly reduces labor costs and enterprise operating costs, and improves business efficiency.
[0110] (3) Enhanced collaboration and sharing: The embodiments of this application support multi-terminal adaptation rendering on PC, mobile, tablet and large screen, realizing cross-device and cross-scenario information sharing and collaboration. The unified data card format and intelligent recommendation mechanism help various business departments form a consistent understanding of the data, break down information silos, avoid redundant development, and promote cross-departmental information sharing and interactive collaboration.
[0111] (4) Support for strategic and tactical decision-making: Data cards support the free combination and nesting of various components such as chart components, information components, and filtering components, and support various presentation formats such as data dashboards, thematic dashboards, and web reports to meet the different decision-making needs of the strategic and tactical levels. For example, for the strategic level, this embodiment uses chart components such as trend analysis and market comparison to assist senior managers in making long-term planning decisions; for the tactical level, this embodiment uses information components such as real-time monitoring and anomaly warning to guide business personnel in optimizing daily operations and responding quickly.
[0112] (5) Enhanced user experience and operational effectiveness: The embodiments of this application intelligently recommend personalized content, provide rich and cool visual effects, support interaction and sharing, and improve the participation of business departments and their perception of data value. The card template library can be continuously trained and optimized by the LLM model based on historical cases, and new business description information can be dynamically analyzed by the LLM model to recommend the most suitable target card template, which has good adaptive expansion capabilities.
[0113] Corresponding to the aforementioned application function implementation method embodiments, this application also provides a data card generation system, an electronic device, and corresponding embodiments.
[0114] Figure 3 This is a schematic diagram of the structure of a data card generation system shown in an embodiment of this application.
[0115] See Figure 3 The data card generation system of this application may include a template recommendation module 303, an SQL generation module 304, a data acquisition module 305, a card generation module 306, and a card display module 307, wherein: The template recommendation module 303 is used to determine the target card template that matches the business description information from the card template library through the LLM model when the user's business description information is received. The configuration parameters of the target card template include data display rules, and the business description information is presented in natural language. SQL generation module 304 is used to convert business description information into SQL statements through NL2SQL intelligent agent; The data acquisition module 305 is used to retrieve query results that match the business description information from the target database 308 using SQL statements; The card generation module 306 is used to fill the corresponding areas of the target card template with the business data in the query results according to the data display rules, so as to obtain the target data card. The card display module 307 is used to display target data cards to users.
[0116] In one embodiment, the system may further include a user interface module 301, wherein: User interface module 301 is used to receive business description information input by the user through the requesting application, and supports multiple forms such as text input box and voice input.
[0117] In one embodiment, the system may further include a template management module 302, wherein: The template management module 302 is used to maintain the card template library. The card template library stores multiple preset card templates, and each preset card template includes corresponding adaptation scenarios and adaptation rules.
[0118] In one embodiment, the system may further include a target database 308, wherein: The target database 308 is used to store business data for various entities.
[0119] In one embodiment, the template recommendation module 303 may include: The semantic understanding submodule is used to extract semantic features from business description information through an LLM model; The semantic matching submodule is used to calculate the matching degree between semantic features and the corresponding adaptation scenarios and adaptation rules of each preset card template using the LLM model. The target card template determination submodule is used to select the preset card template with the highest matching degree from multiple preset card templates as the target card template.
[0120] In one embodiment, the system may further include a portrait construction module 309, wherein: The profile building module 309 is used to record the user profile information of each user and the group profile information of the group to which they belong.
[0121] In one embodiment, the target card template determination submodule can also be used for: When there are at least two preset card templates with the highest matching degree, obtain the user profile information and the group profile information of the user's group. Based on the user profile information and the group profile information, at least two candidate card templates are prioritized; the candidate card template is the preset card template with the highest matching degree. Select the candidate card template with the highest priority from at least two candidate card templates as the target card template.
[0122] In one embodiment, the SQL generation module 304 may include: The Schema Understanding submodule is used to read the schema information of the target database through the NL2SQL agent; The intent recognition submodule is used to identify the query intent of business description information through the NL2SQL agent; The SQL generation submodule is used to generate SQL statements based on schema information and query intent using the NL2SQL agent.
[0123] In one embodiment, the SQL generation module 304 may further include: The SQL validation and optimization submodule is used to check the syntax correctness and semantic rationality of SQL statements, check whether they match the table structure of the target database, and perform query rewriting, index optimization, etc., to ensure that the generated SQL statements are executable and efficient.
[0124] In one embodiment, the configuration parameters of the target card template further include layout rules and style rules; the card generation module 306 may include: The layout determination submodule is used to determine the component types of each area in the target card template according to the layout rules; the component types include chart components, information components, and filter components. The component rendering submodule is used to bind each business data in the query results with the corresponding component type in the target card template according to the data display rules, so as to render a visual component and obtain the initial data card; The card beautification submodule is used to beautify the initial data cards according to style rules to obtain the target data cards.
[0125] In one embodiment, the configuration parameters of the target card template further include nesting rules, and the card generation module 306 may further include: The sub-card generation submodule is used to fill the corresponding areas of the corresponding sub-cards with the business data in the query results according to the data display rules when the nesting rule indicates that the target card template supports nested sub-cards, so as to obtain multiple target sub-cards. The sub-card nesting submodule is used to nest multiple target sub-cards according to the nesting position and number of nesting rules to obtain target data cards with a tree-like hierarchical structure.
[0126] Among them, the target sub-cards of the target data card can be directly embedded into the specified column area of the parent data card, and the parent data card can also open the sub-page or display the target sub-card through a jump interaction.
[0127] In one embodiment, the card display module 307 may include: The device type identification submodule is used to identify the device type of the requesting end; the requesting end is the terminal device that initiates the service description information. The Adaptation and Display submodule is used to adapt, render, and output the target data card according to the device type.
[0128] In one embodiment, the system may further include a collaboration and sharing module 310, wherein: The collaboration sharing module 310 is used to push the target data card to the receiving end indicated by the sharing request in response to the sharing request from the user at the requesting end; and to perform collaborative editing operations on the target data card in response to the collaboration request from the user at the receiving end or the requesting end.
[0129] In one embodiment, the system may further include a content management module 311, wherein: The content management module 311 is used to push an update notification to the target user's terminal device when an update event is detected in the target data card. The target user is a user who is interested in the target data card, and the update notification is used to remind the target user that the content of the target data card has been updated.
[0130] As can be seen from this example, the solution provided in this application organically combines the semantic understanding capability of the LLM model, the data query capability of the NL2SQL agent, and the visualization capability of the data card to achieve intelligent, automated, and personalized generation of data cards, thereby significantly reducing the threshold for data analysis, significantly reducing labor costs and enterprise operating costs, and greatly improving the efficiency of enterprise data analysis and decision-making.
[0131] Regarding the system in the above embodiments, the specific ways in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated further here.
[0132] Figure 4 This is a schematic diagram of the structure of an electronic device shown in an embodiment of this application.
[0133] See Figure 4 The electronic device 400 includes a memory 410 and a processor 420.
[0134] The processor 420 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. Memory 410 may include various types of storage units, such as system memory, read-only memory (ROM), and permanent storage devices. ROM may store static data or instructions required by processor 420 or other modules of the computer. Permanent storage devices may be read-write storage devices. Permanent storage devices may be non-volatile storage devices that retain stored instructions and data even when the computer is powered off. In some embodiments, permanent storage devices use mass storage devices (e.g., magnetic or optical disks, flash memory) as permanent storage devices. In other embodiments, permanent storage devices may be removable storage devices (e.g., floppy disks, optical drives). System memory may be a read-write storage device or a volatile read-write storage device, such as dynamic random access memory. System memory may store some or all of the instructions and data required by the processor during operation. Furthermore, memory 410 may include any combination of computer-readable storage media, including various types of semiconductor memory chips (e.g., DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), and disks and / or optical disks may also be used. In some embodiments, memory 410 may include a removable storage device that is readable and / or writable, such as a laser disc (CD), a read-only digital multifunction optical disc (e.g., DVD-ROM, dual-layer DVD-ROM), a read-only Blu-ray disc, an ultra-high density optical disc, a flash memory card (e.g., SD card, mini SD card, Micro-SD card, etc.), a magnetic floppy disk, etc. Computer-readable storage media do not contain carrier waves or transient electronic signals transmitted wirelessly or via wired connections.
[0135] The memory 410 stores executable code, which, when processed by the processor 420, can cause the processor 420 to execute part or all of the methods described above.
[0136] Furthermore, the method according to this application can also be implemented as a computer program or computer program product, which includes computer program code instructions for performing some or all of the steps in the method described above.
[0137] Alternatively, this application may be implemented as a computer-readable storage medium (or a non-transitory machine-readable storage medium or a machine-readable storage medium) storing executable code (or computer program or computer instruction code) that, when executed by a processor of an electronic device (or server, etc.), causes the processor to perform part or all of the steps of the methods described above according to this application.
[0138] This application also provides a computer program product, which includes computer instructions that, when executed by a processor, implement the method described above.
[0139] The various embodiments of this application have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for generating data cards, characterized in that, include: When the user's business description information is received, the target card template that matches the business description information is determined from the card template library using the LLM model; The configuration parameters of the target card template include data display rules, and the business description information is presented in natural language. The business description information is converted into SQL statements using the NL2SQL agent; Using the SQL statement, retrieve query results from the target database that match the business description information; According to the data display rules, each business data in the query results is filled into the corresponding area of the target card template to obtain the target data card; The target data card is displayed to the user.
2. The method according to claim 1, characterized in that, The card template library stores multiple preset card templates, each including a corresponding adaptation scenario and adaptation rules; the step of determining the target card template matching the business description information from the card template library using an LLM model includes: Semantic features are extracted from the business description information using an LLM model; The LLM model is used to calculate the matching degree between the semantic features and the corresponding adaptation scenarios and adaptation rules of each preset card template. Select the preset card template with the highest matching degree from the multiple preset card templates as the target card template.
3. The method according to claim 2, characterized in that, The method further includes: When there are at least two preset card templates with the highest matching degree, obtain the user profile information of the user and the group profile information of the group to which the user belongs; Based on the user profile information and the group profile information, at least two candidate card templates are prioritized; the candidate card template is the preset card template with the highest matching degree. Select the candidate card template with the highest priority from the at least two candidate card templates as the target card template.
4. The method according to claim 1, characterized in that, The step of converting the business description information into SQL statements using an NL2SQL agent includes: Read the schema information of the target database using the NL2SQL agent; The NL2SQL agent identifies the query intent for the business description information. The NL2SQL agent generates SQL statements based on the schema information and the query intent.
5. The method according to claim 1, characterized in that, The configuration parameters of the target card template also include layout rules and style rules; the step of filling the corresponding areas of the target card template with each business data in the query results according to the data display rules to obtain the target data card includes: Based on the layout rules, the component types of each area in the target card template are determined; the component types include chart components, information components, and filter components. According to the data display rules, each business data in the query results is bound to the component type of the corresponding area in the target card template to render a visual component and obtain an initial data card. According to the style rules, the initial data card is beautified to obtain the target data card.
6. The method according to claim 1, characterized in that, The configuration parameters of the target card template also include nesting rules, and the method further includes: When the nesting rule indicates that the target card template supports nested sub-cards, according to the data display rule, each business data in the query result is filled into the corresponding area of the corresponding sub-card to obtain multiple target sub-cards; According to the nesting position and number of nesting as indicated by the nesting rules, the multiple target sub-cards are nested to obtain target data cards with a tree-like hierarchical structure.
7. The method according to claim 1, characterized in that, The step of displaying the target data card to the user includes: Identify the device type of the requesting party; the requesting party is the terminal device that initiated the service description information. Based on the device type, the target data card is adapted for rendering and output for display.
8. The method according to claim 7, characterized in that, The method further includes: In response to a user's sharing request at the requesting end, the target data card is pushed to the receiving end indicated by the sharing request. In response to a collaboration request from a user at the receiving end or the requesting end, a collaborative editing operation is performed on the target data card.
9. The method according to claim 1, characterized in that, The method further includes: When an update event is detected in the target data card, an update notification is pushed to the target user's terminal device; the target user is a user who is following the target data card, and the update notification is used to remind the target user that the content of the target data card has been updated.
10. A data card generation system, characterized in that, include: The template recommendation module is used to determine the target card template that matches the business description information from the card template library through an LLM model when the user's business description information is received. The configuration parameters of the target card template include data display rules, and the business description information is presented in natural language. The SQL generation module is used to convert the business description information into SQL statements through the NL2SQL agent; The data acquisition module is used to retrieve query results that match the business description information from the target database using the SQL statement; The card generation module is used to fill the corresponding areas of the target card template with each business data in the query results according to the data display rules, so as to obtain the target data card; The card display module is used to display the target data card to the user.