Data visualization method and related device
By receiving users' natural language query requests, transforming historical query data, and parsing with large language models, standardized query requests for multiple business scenarios and massive amounts of data in the banking industry are generated. This solves the problems of low efficiency and insufficient accuracy of traditional data visualization methods, and achieves simultaneous improvement in efficiency, accuracy, and security of banking data visualization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-29
- Publication Date
- 2026-03-10
AI Technical Summary
Traditional data visualization methods rely on manual operation, which is complex and inefficient. Natural language-driven data visualization generates visualization results that are not accurate enough in complex query tasks, making it difficult to cope with the diverse business scenarios and massive amounts of business data in banks.
By receiving users' natural language query requests, converting historical query data into standardized query requests, combining large language models for scenario and topic analysis, obtaining analysis types and data tables, constructing query statements and generating visualization results, and using scenario-topic mapping to provide semantic constraints for table retrieval, the risk of illusion in complex query scenarios is reduced, and access control and visualization explanation mechanisms are implemented.
It improves the efficiency and accuracy of data visualization, supports the visualization processing of multiple business scenarios and massive amounts of business data in banks, and achieves simultaneous improvement in efficiency, accuracy and security.
Smart Images

Figure CN121636693A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of big data, and in particular to a data visualization method and related device. BACKGROUND
[0002] Bank data visualization technology is widely used in real-time monitoring, business analysis, risk management, customer insight and other scenarios. With the digital development of banking business, banks have accumulated massive customer transaction data, risk indicators, product performance and other data. Business personnel need to quickly locate problems, analyze trends and assist decision-making through intuitive charts.
[0003] Traditional data visualization mainly relies on self-service business intelligence tools, but this approach relies on manual operation, has a complex process, and is low in data visualization efficiency.
[0004] With the development of artificial intelligence technology, large language models (LLM) are also used to realize natural language-driven data visualization. However, the accuracy of the visualization results generated by this approach in complex query tasks is insufficient, and this approach mainly visualizes single business scenarios and specific business data, making it difficult to cope with multiple business scenarios and massive business data within banks. SUMMARY
[0005] The embodiments of the present application provide a data visualization method and related device to improve the efficiency and accuracy of data visualization and support the visualization processing of multiple business scenarios and massive business data in banks.
[0006] In a first aspect, the embodiments of the present application provide a data visualization method, comprising:
[0007] receiving a query request based on natural language of a user;
[0008] converting the query request based on historical query data to obtain a standardized query request;
[0009] parsing the standardized query request to obtain a target scenario and a target topic corresponding to the standardized query request; wherein, if the standardized query request includes multiple independent business topics or analysis dimensions, the target scenario and the target topic include the scenario and the topic corresponding to each business topic or analysis dimension after the standardized query request is split;
[0010] based on the target scenario and the target topic, obtaining an analysis type and a data table corresponding to the standardized query request;
[0011] based on the analysis type, obtaining a query statement template, and constructing a query statement according to the query statement template and the standardized query request;
[0012] execute the query statement to obtain a data set result from the data table;
[0013] generate a visualization result according to the data set result.
[0014] In some embodiments, the converting the query request into a standardized query request based on historical query requests comprises:
[0015] associating a pronoun in the query request to an entity in a historical dialogue and replacing the pronoun according to the entity;
[0016] checking the integrity of the query request and supplementing missing parameters based on historical parameters if the query request is missing parameters;
[0017] generating a fuzzy intent clarification prompt according to the mandatory parameters if the query request after the missing parameter supplement is still missing mandatory parameters;
[0018] supplementing the mandatory parameters based on the user's feedback to the fuzzy intent clarification prompt to obtain the standardized query request.
[0019] In some embodiments, the parsing the standardized query request to obtain a target scene and a target theme corresponding to the standardized query request comprises:
[0020] constructing a first prompt word based on a scene theme directory and the standardized query request; wherein the scene theme directory comprises a mapping relationship between scenes and themes, and description information of scenes and themes;
[0021] using the scene theme directory, the standardized query request and the first prompt word as input of a large language model, and using the large language model to parse the standardized query request to obtain a target scene and a target theme corresponding to the standardized query request;
[0022] If the standardized query request includes multiple independent business themes or analysis dimensions, the first prompt word includes a multi-path query splitting prompt word; the multi-path query splitting prompt word is used to instruct the large language model to split the standardized query request into multiple independent sub-tasks for parsing, and output the scene and theme corresponding to each sub-task respectively.
[0023] In some embodiments, the obtaining an analysis type and a corresponding data table corresponding to the standardized query request based on the target scene and the target theme comprises:
[0024] performing table retrieval in a database corresponding to the target scene and the target theme based on a preset retrieval strategy to obtain multiple candidate tables;
[0025] determine at least one target candidate table from the plurality of candidate tables based on scene fitting degrees, timeliness, and centralities of the candidate tables in a correlation network;
[0026] construct a second prompt word according to the summary information of the target candidate table and the standardized query request;
[0027] input the standardized query request, the second prompt word, and the target candidate table into a large language model, process the standardized query request by using the large language model, and obtain the data table and the analysis type.
[0028] In some embodiments, the obtaining of the query statement template based on the analysis type and the construction of the query statement according to the query statement template and the standardized query request include:
[0029] obtaining a corresponding query statement template from a template library based on the analysis type;
[0030] obtaining a business rule corresponding to the target scene and the target topic;
[0031] constructing a third prompt word based on the business rule, the query statement template, and a query statement processing rule;
[0032] inputting the third prompt word, the query statement template, and the standardized query request into a large language model, and constructing the query statement by using the large language model.
[0033] In some embodiments, the generating of the visualization result according to the data set result includes:
[0034] generating a field combination according to a data feature of the data set result;
[0035] obtaining a corresponding visualization strategy from a strategy library based on the field combination;
[0036] if the visualization strategy corresponding to the field combination does not exist in the strategy library, generating the visualization strategy by using a large language model based on the standardized query request;
[0037] performing visualization processing on the data set result based on the visualization strategy, and obtaining the visualization result.
[0038] In some embodiments, the method further includes:
[0039] obtaining a data feature in the data set result; the data feature includes at least one of a field type, a cardinality, a numerical range, a numerical trend, and an abnormal point;
[0040] The data features are processed by using a large language model to obtain an analysis conclusion corresponding to the query request.
[0041] In a second aspect, the present application provides an electronic device, comprising: a processor, a transceiver, and a memory; the processor is in communication connection with the transceiver and the memory respectively;
[0042] The memory is used for storing computer programs; the transceiver is used for communicating with external devices; and the processor is used for running computer instructions stored in the memory to realize the method of any one of the first aspect.
[0043] In a third aspect, the present application provides a computer readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to realize the method of any one of the first aspect.
[0044] In a fourth aspect, the present application provides a computer program product comprising a computer program, wherein the computer program is executed by a processor to realize the method of any one of the first aspect.
[0045] The data visualization method and related device provided by the embodiments of the present application receive a user's query request based on natural language; convert the query request based on historical query data to obtain a standardized query request; analyze the standardized query request to obtain a target scene and a target topic corresponding to the standardized query request; based on the target scene and the target topic, obtain an analysis type and a data table corresponding to the standardized query request; based on the analysis type, obtain a query statement template, and construct a query statement according to the query statement template and the standardized query request; execute the query statement to obtain a data set result from the data table; and generate a visualization result according to the data set result. The above method provides semantic constraints for table retrieval through scene topic mapping, reduces the illusion risk of large language models in complex query scenarios through query statement templates, and jointly constructs a trusted analysis environment through permission control and visualization explanation mechanisms, thereby realizing the synchronous improvement of bank business analysis in the three dimensions of efficiency, accuracy, and security. BRIEF DESCRIPTION OF DRAWINGS
[0046] Figure 1 Flowchart of a data visualization method provided by the embodiments of the present application Figure 1 ;
[0047] Figure 2 Flowchart of a data visualization method provided by the embodiments of the present application Figure 2 ;
[0048] Figure 3 Flowchart of a data visualization method provided by the embodiments of the present application Figure 3 ;
[0049] Figure 4 A structural schematic diagram of a data visualization device provided in an embodiment of the present application is shown in FIG. 1.
[0050] Figure 5 A structural schematic diagram of an electronic device provided in an embodiment of the present application is shown in FIG. 2. DETAILED DESCRIPTION
[0051] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in connection with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0052] In the embodiments of the present application, the terms “first”, “second”, and the like are used to distinguish the same or similar items with substantially the same functions and effects, and do not limit the order. Those skilled in the art can understand that the terms “first”, “second”, and the like do not limit the number and execution order, and the terms “first”, “second”, and the like do not necessarily mean different.
[0053] It should be noted that in the embodiments of the present application, the words “exemplary” or “for example” are used to represent examples, illustrations, or descriptions. Any embodiment or design solution described as “exemplary” or “for example” in the present application should not be interpreted as more preferred or more advantageous than other embodiments or design solutions. Rather, the words “exemplary” or “for example” are used to present the relevant concepts in a specific manner.
[0054] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure, and application of the relevant data all comply with the relevant laws, regulations, and standards of the relevant countries and regions, take necessary security measures, do not violate public order and good customs, and provide corresponding operation portals for users to choose authorization or refusal.
[0055] And the present application relates to the big data analysis of user information (including but not limited to personal biological characteristics, identity data, consumption data, asset data, electronic terminal operation data, etc.), and adopts artificial intelligence technology to make automatic decision, makes technical scheme based on automatic decision result to have important influence on personal rights and interests decision, provides corresponding operation entrance for user, user selects to agree or refuse automatic decision result; if user selects to refuse, enter expert decision process.
[0056] As before, traditional data visualization mainly relies on self-service business intelligence (BI) tools, manually selects suitable data tables from massive bank data, completes data processing processes such as data cleaning, key field extraction and index calculation, and forms wide table data covering multiple indexes; based on experience, select visualization chart type (such as trend analysis using line chart display, and pie chart display for proportion analysis), manually adjust coordinate axis, color, label, legend and other elements of visualization chart. This method relies on manual operation throughout the process, and the process is complex, and the efficiency of data visualization is low.
[0057] With the development of artificial intelligence technology, natural language driven data visualization is also realized by using large language model (LLM). For example, through intent recognition, the natural language query input by the user is mapped to the data source, the chart type and the parameter, a query statement is generated and the chart library is called to output the result. However, this method relies on single-round intent recognition, lacks the inheritance of context parameters such as time range, business entity and index in historical queries across rounds, and has limited ability to analyze bank business terms and colloquial queries, which affects the semantic mapping accuracy of complex queries, thereby resulting in insufficient accuracy of the generated visualization result.
[0058] Therefore, the embodiments of the present application provide a data visualization method and related device, which converts the ambiguous natural language query into a standardized and semantically complete query request by maintaining the context of the user's historical query and dynamically generating personalized clarification prompts based on the user portrait. At the same time, based on the scene-theme-table association graph, the query is mapped to a specific business scenario, and complex analysis logic is encapsulated through a query statement template library, and a query statement conforming to the business semantics is generated by combining a scenario-based rule engine, thereby effectively improving the accuracy of the visualization result.
[0059] The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described again in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.
[0060] Figure 1 Flowchart of a data visualization method provided by an embodiment of the present application Figure 1 AsFigure 1 As shown, comprising:
[0061] S101, receiving a user's natural language based query request.
[0062] The execution subject of the embodiments of the present application can be a computing platform, a server, etc. with specific data processing capability. Hereinafter, the computing platform is taken as an example for description.
[0063] In some embodiments, the computing platform is provided with an interactive interface, and the computing platform can interact with the user based on the interactive interface. For example, receiving the user's input instructions, files, etc., outputting the calculation results to the user, etc.
[0064] In some embodiments, the natural language can refer to the language used by humans in daily life.
[0065] In some embodiments, the user can input the natural language based query request to the computing platform based on the interactive interface. The query request can be input in a literal way, or in a voice way.
[0066] Optionally, the query request input by the user can be referred to as an original query request.
[0067] S102, converting the query request based on the historical query data to obtain a standardized query request.
[0068] In some embodiments, the standardized query request can refer to a complete query request without missing necessary parameters and conforming to the standard format.
[0069] The historical query data can include the original query request, the rewritten standardized complete query request, and the key parameters such as business entities, time parameters, dimensions, and indicators in the query of the user's recent N rounds (such as 3 rounds) of queries.
[0070] In some embodiments, the query request can be converted into a standardized query request based on the historical query data, such as anaphora association mapping, intelligent semantic completion, and fuzzy intent clarification, etc.
[0071] For example, the anaphora in the query request is associated with the entity in the historical dialogue, and the anaphora is replaced according to the entity; the completeness of the query request is checked, and in the case that the query request has missing parameters, the missing parameters are supplemented based on the historical parameters; if the query request after the missing parameter supplement still lacks the mandatory parameters, a fuzzy intent clarification prompt is generated according to the mandatory parameters; based on the feedback result of the user to the fuzzy intent clarification prompt, the mandatory parameters are supplemented to obtain the standardized query request.
[0072] For example, the ambiguity of the pronoun in the original query request can be resolved by parsing the pronoun and associating it with a specific entity in the historical data. For example, the pronoun in the original query request is "this product", and the corresponding entity in the historical data is "mortgage". Then, "mortgage" is used to replace "this product" in the original query request.
[0073] The semantic integrity of the original query request is checked by the verification algorithm, and the absence of mandatory parameters such as business entities, time, and indicators in the original query is detected. If there are missing parameters, the missing parameters are supplemented based on historical query data. For example, if the original query is missing the time parameter, and there is a recent time parameter in the historical query, then the time parameter is inherited. If there is no recent time parameter, then the default time is automatically filled according to the default rules.
[0074] After semantic completion, the query request is further checked. If there are still missing mandatory parameters, a fuzzy intent clarification prompt is generated according to the combination of parameter absence, and the fuzzy intent clarification prompt is output to the user. So that the user inputs the corresponding parameters based on the fuzzy intent clarification prompt to complete the query request.
[0075] In some embodiments, the user portrait can be combined to generate recommended information, which is integrated into the fuzzy intent clarification prompt to provide personalized specific prompt options to the user.
[0076] For example, when the business entity is missing, the user's affiliated department is obtained according to the user portrait, and the recommended scene theme is obtained from the department mapping table to get the scene theme commonly used by the department, and a clarification prompt with business examples is generated. For example, "Please specify the type of business you need to query, such as credit card and mortgage business in the retail risk scenario."
[0077] For example, the original query is "the delinquent situation at the end of last month", the user belongs to the risk department, and the original query is missing the business entity parameter. The risk department recommends the scene theme of the retail risk scenario, and generates a clarification prompt "Please specify the type of business you need to query, such as credit card and mortgage in the retail risk scenario."
[0078] In some embodiments, the source of user portrait data is the user's affiliated department, the top N data high-frequency dashboard of the department in the last N months, and the top M indicators of the high-frequency dashboard in the last N months. The data is stored in the system and updated daily.
[0079] In some embodiments, if there are no missing mandatory parameters in the query, a standardized complete query containing business entities, time, and indicators is output. For example, the original query is "B region situation", and the complete query "B region credit card balance at the end of last month" is output after semantic completion.
[0080] In a possible implementation, a multi-step reasoning chain prompt can be constructed based on the above-mentioned pronoun association mapping, semantic completion, and fuzzy intent clarification process. The prompt is sent to a large language model to enable the large language model to rewrite and complete the original query request according to historical data in steps, and output a rewritten standardized complete query.
[0081] For example, a multi-step reasoning chain prompt can be as follows:
[0082] prompt="""
[0083] # Task Description
[0084] You are a data analysis and question answering domain dialogue processor, and you will strictly follow the steps to complete the following operations:
[0085] Step 1. Pronoun association mapping: If the current query request contains pronouns, associate the pronouns with specific entities in the latest query in the historical query, rewrite the current query request, and return it. If the current query request does not contain pronouns, return the current query request.
[0086] Step 2. Semantic completion (strictly follow the following steps step by step):
[0087] (1) First, according to the query request returned in Step 1, identify whether it contains time, index, and other mandatory parameters, and identify whether it contains business entities (such as credit cards, mortgages); strictly distinguish between point indicators and period indicators, and if the query involves taking point indicators within a time period, strictly convert it to take endpoint values of the time period, such as "4-month overdue rate" to "4-month-end overdue rate".
[0088] (2) Second, if the query request returned in Step 1 is missing time or index and other mandatory parameters, obtain the latest parameters from the historical query; if the business entity is missing, obtain the latest business entity from the historical query; if the historical query does not contain time, index, and other historical parameters, do not inherit them, and add time, index, and other parameters according to the default processing rules.
[0089] (3) Again, according to the reasoning results of Steps 2(1) and 2(2), rewrite the query request returned in Step 1, and return the rewritten query request.
[0090] Step 3. Fuzzy intent clarification:
[0091] (1) First, for the rewritten query request returned in Step 2, identify whether there are time, index, and other mandatory parameters, that is, whether there are missing parameters missing_params, and identify whether it contains business entities (such as credit cards and mortgage businesses);
[0092] (2) Secondly, if the missing time indicator parameter or the missing business entity is judged, the intent clarification prompt clarification_question is generated. If only the time is missing, the intent clarification prompt clarification_question "Please specify the time range of the query" is generated; if the indicator is missing, the intent clarification prompt clarification_question "Please specify the indicator of the query, such as {default_metric}" is generated; if the business entity is missing, the intent clarification prompt clarification_question "Please specify the business type of the query, and the recommended scenario topic is recommended [recommended scenario topic]" is generated according to
recommended scenario topic
[0093] Step 4. If the rewritten query request returned by
step 2
[0094] # Input data
[0095] Current query request: {current_query}
[0096] History query: {history_summary}
[0097] Recommended scenario topic: {recommended_scenario_business}
[0098] Default indicator: {default_metric}
[0099] Mandatory parameters: {required_params}
[0100] # Default processing rules
[0101] - Default indicator:
step 2
history query
[0102] - Default Time: In Step 2, when detecting missing time and finding no time information in the historical query, it's necessary to clearly distinguish between a point-in-time indicator and a cumulative indicator over a time period, depending on the business scenario. If it's a point-in-time indicator, the default time is "end of last month"; if it's a cumulative indicator over a time period, the default time is "last month". (Current time is {current_date}).
[0103] # Output requirements, please pay special attention:
[0104] 1. Ensure that all required fields are included, including "rewritten_query", "inherited_params", "time_range", "dimensions", "metrics", "business", "missing_params", and "clarification_question".
[0105] 2. Strings must be enclosed in double quotes.
[0106] 3. The output must strictly adhere to the following JSON format; no other irrelevant content or comments are allowed:
[0107] {{"rewritten_query":"A complete query containing all required parameters and business entities","inherited_params":{{"time_range":"Time","dimensions":["Dimensions"],"metrics":["Metrics"]}},"business":["Business entity name"],"missing_params":["Required parameter name"],"clarification_question":"Intent clarification hint (left blank if none)"}}
[0108] """
[0109] S103. Parse the standardized query request to obtain the target scenario and target topic corresponding to the standardized query request.
[0110] In some embodiments, a scenario may include multiple themes. For example, the "Retail Risk Assessment" scenario may include the themes of "Credit Cards" and "Debit Cards," etc.
[0111] For example, semantic parsing can be performed on standardized query requests, and the target scenario and target topic corresponding to the standardized query request can be found from the scenario topic directory based on the semantic parsing results.
[0112] The scene and theme directory includes the mapping relationship between scenes and themes, as well as descriptive information about scenes and themes.
[0113] In some embodiments, if multiple independent business topics are involved in the standardized query request, the multiple independent business topics are split, and the target scene and the target topic are queried for each independent business topic.
[0114] For example, the standardized query request is "compare the bad rate of credit cards and mortgages", which is split into independent sub-tasks "credit card bad rate" and "mortgage bad rate", corresponding to the credit card topic and the mortgage topic respectively.
[0115] In some embodiments, based on the scene topic directory and the standardized query request, a first prompt word can be constructed, and a large language model is used to analyze the standardized query request to obtain the target scene and the target topic corresponding to the standardized query request.
[0116] S104, based on the target scene and the target topic, obtaining the analysis type and the data table corresponding to the standardized query request.
[0117] In some embodiments, the analysis type can refer to the type of analysis processing task required by the query request. For example, same period comparison, moving average, cumulative calculation, etc.
[0118] In some embodiments, candidate tables (candidate data tables) included in the target scene and the target topic can be filtered from the database. Based on the keywords included in the standardized query request, the corresponding data table is filtered from the candidate table.
[0119] After the corresponding data table is filtered, the summary information of the data table can be generated based on the description of the data table. The large language model is used to process the table summary information and the standardized query request to obtain the analysis type corresponding to the standardized query request.
[0120] S105, based on the analysis type, obtaining a query statement template, and constructing a query statement according to the query statement template and the standardized query request.
[0121] In some embodiments, the query statement template corresponding to the analysis type can be obtained from the template library. Based on the target scene and the target topic, the corresponding business rule is obtained from the rule library.
[0122] In some embodiments, the large language model can be used to generate the corresponding query statement based on the query statement template, the business rule, and the query statement processing rule.
[0123] For example, based on the business rule, the query statement template and the query statement processing rule, the prompt word of the large language model is constructed, so that the large language model modifies and fills the query statement template based on the prompt word to generate the corresponding query statement.
[0124] S106, executing the query statement to obtain the data set result from the data table.
[0125] In some embodiments, the query statement is executed in the obtained data table to obtain a corresponding data set result (also referred to as a result data set) from the data table.
[0126] S107, generating a visualization result according to the data set result.
[0127] In some embodiments, a predefined visualization rule can be matched based on a field combination in the data set result. The data set result is visualized based on the matched visualization rule to generate a corresponding visualization result.
[0128] The data visualization method provided by the embodiments of the present application receives a user's query request based on natural language; converts the query request based on historical query data to obtain a standardized query request; parses the standardized query request to obtain a target scene and a target topic corresponding to the standardized query request; obtains an analysis type and a data table corresponding to the standardized query request based on the target scene and the target topic; obtains a query statement template based on the analysis type, and constructs a query statement according to the query statement template and the standardized query request; executes the query statement to obtain a data set result from the data table; and generates a visualization result according to the data set result. The above method provides semantic constraints for table retrieval through scene topic mapping, reduces the illusion risk of complex query scene large language models through query statement templates, and jointly constructs a trusted analysis environment through permission control and visualization interpretation mechanisms, ultimately realizing the synchronous improvement of bank business analysis in the three dimensions of efficiency, accuracy and security.
[0129] On the basis of the above embodiments, the following will be combined Figure 2 The process of obtaining the analysis type and the data table corresponding to the standardized query request by the embodiments of the present application is further described.
[0130] Figure 2 The flowchart of a data visualization method provided by the embodiments of the present application Figure 2 As shown in Figure 2 , it includes:
[0131] S201, constructing a first prompt word based on a scene topic directory and a standardized query request; wherein the scene topic directory includes a mapping relationship between a scene and a topic, and description information of the scene and the topic.
[0132] In some embodiments, the scene topic directory can also be referred to as a scene-topic-data dashboard directory, which can be constructed based on business scene labels and topic labels.
[0133] For example, obtain the metadata information of the business scenario tag, topic tag, etc. of the dashboard. For data dashboards with a visit frequency of more than 80 percentile points in the past 6 months, extract the dashboard metadata, such as the business line to which the dashboard belongs, the dashboard creator, the dashboard tag, the dashboard name, the dashboard description, the visualization chart title, the business entity involved in the visualization chart, and the underlying SQL of the visualization chart. Based on the data dashboard metadata information, use a large language model to generate a business analysis description for each data dashboard, and based on the business analysis description, classify each data dashboard by scene in one level and by theme in two levels to obtain a scene-theme-data dashboard directory.
[0134] In some embodiments, a scene recognition prompt word (i.e., a first prompt word) can be constructed based on the constructed scene theme directory and the standardized query request. For example, the first prompt word can be "recognize the input scene theme directory and standardized query request to identify the target scene and target theme corresponding to the standardized query request from the scene theme directory".
[0135] In some embodiments, if the standardized query request includes multiple independent business themes or analysis dimensions, the first prompt word includes a multi-path query splitting prompt word. The multi-path query splitting prompt word is used to instruct the large language model to split the standardized query request into multiple independent sub-tasks for parsing and output the scene and theme corresponding to each sub-task, respectively.
[0136] For example, the standardized query request is "compare the delinquency rates of credit cards and mortgages". The splitting word included in the constructed first prompt word can be "split the multiple different businesses included in the query request and process them independently".
[0137] S202, use the large language model to parse the standardized query request by taking the scene theme directory, the standardized query request, and the first prompt word as inputs of the large language model, to obtain the target scene and target theme corresponding to the standardized query request.
[0138] In some embodiments, the large language model maps the query request to a specific scene and theme according to the first prompt word and the query semantics. For example, "2024 credit card delinquency rate" is mapped to the "retail risk assessment" scene and the "credit card" theme.
[0139] In some embodiments, if the large model detects that the query request includes multiple independent business themes or analysis dimensions, the large model splits the query request into independent sub-tasks for parallel processing based on the splitting prompt word, implements complex query decomposition processing, and maintains the original structure for single-theme queries. For example, the multi-path user query "compare the delinquency rates of credit cards and mortgages" is split into independent sub-tasks "credit card delinquency rate" and "mortgage delinquency rate", which correspond to the credit card theme and the mortgage theme, respectively.
[0140] S203, based on the preset retrieval strategy, table retrieval is performed in the database corresponding to the target scene and the target topic to obtain a plurality of candidate tables.
[0141] In some embodiments, after constructing the scene-topic catalog, a scene-topic-table association graph can also be constructed, and table retrieval is performed based on the association graph.
[0142] For example, constructing the scene-topic-table association graph can include the following steps:
[0143] Step 1: Analyzing the underlying query statements (such as SQL statements) of each data dashboard under the scene topic to obtain the underlying data tables they depend on, obtaining table ID, business scene label (such as retail risk), topic label (such as credit card), query frequency of the table under the scene topic, associated tables of the table, and JOIN association frequency.
[0144] Step 2: Establishing an association weight matrix for the table, which stores the associated table ID and the association weight. Each element in the matrix represents the association weight between two tables, and the weight is calculated according to the JOIN association frequency between the two tables in historical queries.
[0145] Step 3: Constructing a table association graph with edge weights wherein, is the co-occurrence frequency of the two tables in historical queries, reflecting the association strength of the two tables; is the total number of times it is used alone in historical queries, representing the independent use frequency of the table; is and table is the geometric mean of the independent use frequency. The main logic is to standardize the co-occurrence frequency, and by taking the geometric mean of the denominator, the original co-occurrence frequency is converted into a relative association strength. When both tables are high-frequency tables, the denominator increases, suppressing the weight expansion of accidental co-occurrence; when a table is a low-frequency table, the denominator decreases, preserving its true association signal. For example, table A is queried 1000 times, table B is queried 100 times, and the two tables co-occur 50 times, then the weight , indicating that although the co-occurrence frequency is high in absolute value, the actual association strength is moderate due to the high frequency of table A.
[0146] Step 4: Establishing a scene-topic-table association graph, including scene nodes L1, topic nodes L2, and table nodes L3. The edge weight between the scene nodes and the topic nodes is 0.8 by default, and the edge weight between the topic nodes and the tables is calculated based on the historical query co-occurrence frequency, formula: , is the query frequency of the table under the scene topic, is the maximum query frequency within the scene topic.
[0147] In some embodiments, the target scene and the corresponding table under the target theme can be taken as a retrieval database, and a hybrid retrieval strategy combining keyword retrieval and vector retrieval can be used to obtain multiple candidate tables from the database.
[0148] For example, the table business name, table description, field alias, enumeration value Chinese interpretation, calculated column name, synonym, and other information are integrated into a text description as the reference data for searching, and one document stores the text description of a single data table. An embedding model is used to convert the document into a vectorized representation, a vector embedding table is constructed, the vectorized representation of the document is stored, and is used for vector retrieval (semantic retrieval). A keyword index table is constructed, and the standardized keywords (i.e., lowercasing / stemming) of the document, the weight of the keyword, and the position of the keyword in the original text are stored to support fast keyword matching.
[0149] First, the user query is converted into a vectorized representation using an embedding model, the cosine similarity between the user query vector and the document vector is calculated, and the document ID with a similarity score greater than a threshold value is obtained; then the user query is disassembled into multiple keywords, and the BM25 algorithm is used to search the keyword index table to match the keywords involved in the user query to obtain the document ID containing the core keywords. Among them, the table that matches in strict mode can be selected as the core table A, and the strict mode refers to a similarity > 0.85 and containing all core keywords, and if no match is found in the strict mode, a loose mode matching is used, i.e., a table with a similarity > 0.7 and covering at least one core keyword is taken as the core table A, which can ensure the precision of table retrieval. For example, the query "credit card overdue rate trend in 2025" extracts the core keywords credit card, overdue rate, and trend, and retrieves the credit_risk_monitor table (business description: credit card overdue monitoring) in the bank retail risk scene credit card theme with a similarity of 0.92, and the loan_summary table (business description: loan summary) with a similarity of 0.68, and determines the core table A as credit_risk_monitor.
[0150] After determining the core table, the core table is expanded through graph search to obtain multiple candidate tables. For example, the core table A is added to the search queue, and the level is marked as 0; an improved breadth-first search (BFS) is used, only high-quality associations with an association weight > 0.7 are retained during each level expansion, the initial maximum level threshold max_depth is set to 2, and when the number of expanded tables is less than 5, the maximum level threshold max_depth is increased by 1 until 5 candidate tables are found; the termination condition of the graph search is to reach the maximum level threshold max_depth or the number of candidate tables is greater than or equal to 5, to avoid excessive expansion. This step can ensure the recall rate of table retrieval.
[0151] S204, determine at least one target candidate table from the plurality of candidate tables based on the scene fitting degree, the timeliness, and the association network centrality of the candidate tables.
[0152] In some embodiments, the scene fitting degree can refer to a matching score of each candidate table with the current scene. For example, the scene fitting degree can include path matching degree (path matching score) and semantic similarity.
[0153] For example, the path matching degree can be determined by the following method:
[0154] Input the current scene and the theme , the candidate table Calculate its shortest path in the scene-theme-table association graph , where d is the path length from the scene to the table, is the edge weight on the path.
[0155] The semantic similarity can be determined by the following method:
[0156] Use the Sentence-BERT model to convert the table description and the scene theme description into vector representation, and calculate the cosine similarity between the two embedding vectors.
[0157] The scene fitting degree ( ) can be determined by the following method:
[0158] The semantic similarity, and finally normalize the score to the range of 0-1.
[0159] In some embodiments, the timeliness can refer to the table update time frequency. For example, the frequently updated table has a weight of 0.9, and the non-updated table has a weight of 0.1.
[0160] In some embodiments, the association network centrality can refer to the importance of the table in the association graph, which can be determined by using a related algorithm (such as PageRank algorithm).
[0161] For example, in the context of data table association, the importance of a table depends not only on how many tables are associated with it, but also on the importance of these associated tables and the association strength. If multiple important tables (high PR value) are associated with a table through high weight, the PR value of the table will be higher. Therefore, the PageRank value of each table depends on the PageRank of other tables pointing to it and the association weight between them.
[0162] The association network centrality (PageRank value ) of the candidate table satisfies the following formula:
[0163]
[0164] in, ln( ); This is the data table currently being calculated. The PageRank value; d is the damping coefficient, set to 0.85, representing the transmission strength of inter-table associations; N is the total number of nodes in the graph, which is also the total number of data tables; ln( ) points to All tables (i.e., those with edges pointing to) (the set of nodes); Indicates from table arrive The weight of the edge may represent the strength of the association between the two tables; OutSum( (Referring to table) The sum of the weights of all outgoing edges, i.e. Points to the total weight of other tables.
[0165] In some embodiments, the quality score of each candidate table can be determined based on its scenario fit, timeliness, and correlation network centrality.
[0166] For example, the quality score = 0.4 × scenario fit + 0.3 × timeliness coefficient + 0.3 × PageRank value.
[0167] Candidate tables with quality scores lower than a preset threshold (e.g., 0.65) are eliminated to obtain at least one target candidate table.
[0168] For example, to query "Quarterly Comparison of Non-Performing Loan Rates for Small and Micro Enterprises in Region A", the candidate table screening process is as follows: Extract keywords from the query, including A, small and micro enterprise loans, non-performing loan rate, and quarterly comparison; in the core table positioning stage, the small and micro enterprise loan risk monitoring table sme_loan_risk has a matching degree of 0.89, and the regional economic analysis table region_analysis has a matching degree of 0.82; in the graph search expansion stage, sme_loan_risk is expanded by 2 layers to obtain the L1 layer customer_profile association weight of 0.85 and the L2 layer industry_risk association weight of 0.78; region_analysis is expanded by 1 layer to obtain the L1 layer macro_economic association weight of 0.91; determine the candidate table set, including sme_loan_risk, region_analysis, customer_profile, industry_risk, and macro_economic; quality filtering, because the scenario fit is <0.6, industry_risk is removed; finally, a total of 4 candidate tables are obtained.
[0169] In some embodiments, when a user query contains multiple independent business topics, the processing method is to independently filter the candidate tables for each subtask under each independent business topic, and the final candidate table set is the union of the candidate tables of each subtask.
[0170] S205. Based on the summary information of the target candidate table and the standardized query request, construct the second suggestion words.
[0171] S206. Take the standardized query request, the second prompt word, and the target candidate table as input to the large language model, and use the large language model to process the standardized query request to obtain the data table and analysis type.
[0172] In some embodiments, candidate table knowledge can be extracted from the table knowledge base and field indexes can be constructed. A summary of the candidate table can then be obtained based on the extracted candidate table knowledge and indexes. For example, the extracted candidate table knowledge and field indexes include the table business name, table description, table usage frequency, table historical relationships, the theme of the table's scenario, original field aliases, original field semantics (such as indicator / organization dimension / customer group dimension / time dimension / product dimension), original field description, Chinese definitions of field enumeration values, synonyms (including abbreviations, acronyms, and business terms corresponding to the Chinese definitions of the field and enumerations), and Chinese names of calculated columns, etc.
[0173] Machine learning models (such as the T5 model) can be used to compress candidate table knowledge and field indexes to obtain candidate table summaries that retain key semantic information of the candidate tables.
[0174] In some embodiments, prompt words can be constructed based on summary information and standardized query requests. A large language model can be used in conjunction with candidate table summaries to recommend an accurate matching data table from the target candidate table for the standardized query request, and all relevant original fields and calculated columns in the table can be recommended.
[0175] Optionally, a sub-table priority rule can be injected into the prompt words. That is, when there is field overlap between the sub-table and the cross-section table or overview table, if the user query involves the main indicators or key fields in the description of the cross-section table or overview table, the cross-section table / overview table will be used; otherwise, the sub-table will be preferred.
[0176] In some embodiments, prompt words can be constructed based on the analysis type detection logic and the standardized query request, and a large language model can be used to determine the analysis type involved in the standardized query request. For example, complex analysis type detection logic can be injected into the prompt words, instructing the large language model to determine whether the standardized query request involves complex analysis, such as year-on-year, month-on-month, cumulative calculation, percentage, ranking, moving average, recursive query, etc.
[0177] In some embodiments, the prompt words of the data table and the prompt words of the analysis type can be fused, and the fused prompt words (i.e., second prompt words) are sent to the large language model to instruct the large language model to accurately match the data table and the recommended field and the calculation column for the standardized query request, and the complex analysis type involved in the standardized query request.
[0178] In summary, the visual method provided by the embodiments of the present application maps the user query to a specific scene and theme based on the pre-constructed scene theme directory and the semantic analysis and reasoning capability of the large model during the scene theme mapping process, supports automatic processing of bank multi-business scene data visualization tasks. According to the scene theme involved in the user query, the data table is filtered out, a table mixed retrieval strategy of semantic coarse screening and keyword matching precise arrangement is provided, a strict mode is set as a priority, the recall accuracy of the core table is improved; when the core table is missing, the tables under the related scene theme and the data tables with high correlation degree are taken as candidate tables, the subsequent retrieval success rate is guaranteed, and the system robustness is enhanced; the BFS algorithm is improved to realize table association weight threshold control and search depth adaptive adjustment, the depth is automatically expanded only when the number of candidate tables is too small, the fullness rate of candidate tables is improved, and the performance problem caused by excessive expansion of search is avoided; the table quality evaluation model of scene theme fitness degree, timeliness coefficient and correlation network center degree is fused to effectively filter low-quality invalid tables; the large language model matches the data table from the candidate table according to the query semantics, the above table retrieval method improves the fullness rate and positioning accuracy of the table as a whole, supports accurate matching of cross-scene and cross-theme data tables, and reduces the processing load and Token consumption of the large language model through the table structure abstraction compression technology in the table retrieval process.
[0179] On the basis of the above-mentioned embodiments, the following will be combined Figure 3 The process of constructing a query statement and visualization according to the embodiments of the present application will be further described.
[0180] Figure 3 The flowchart of a data visualization method provided by the embodiments of the present application Figure 3 As Figure 4 shown, it includes:
[0181] S301, based on the analysis type, acquiring the corresponding query statement template from the template library, and acquiring the business rules corresponding to the target scene and the target theme.
[0182] For example, the query statement template library defines multiple types of complex analysis query statement templates such as recursive query, year-on-year, month-on-month, moving average, cumulative calculation, proportion, ranking, and the like. According to the complex analysis type involved in the query request, a corresponding query statement template is found from the query statement template library. For example, the independent subtask "2024 credit card delinquency rate month-on-month situation" belongs to "month-on-month calculation", and a month-on-month calculation query statement template is extracted from the query statement template library.
[0183] For example, the user query "credit card issuance amount and delinquency" is mapped to the credit card theme in the retail risk assessment scenario, and the business rule "the user query involves issuance indicators, and the maximum observation day indicator data should be forcibly taken" under the scenario theme is obtained.
[0184] S302, based on the business rule, the query statement template, and the query statement processing rule, a third prompt word is constructed.
[0185] In some embodiments, the query statement processing rule includes a query statement core rule and a query statement checking rule.
[0186] For example, taking the query statement as an SQL statement, the core rule includes an SQL error prevention mechanism, time processing requirements, indicator calculation requirements, enumeration value matching methods, SQL syntax specifications, SQL syntax prohibited areas, SQL output field constraints, and the like.
[0187] For example, the rule "SELECT COALESCE(numerator,0) / NULLIF(denominator,0)" automatically adds COALESCE(numerator,0) to avoid null value operations and automatically adds NULLIF(denominator,0) to avoid division by zero errors; for example, by multiplying 1.0000 uniformly when dividing to control floating point precision; for example, requiring to clearly distinguish between point indicators and period indicators in combination with the scene, when the user query involves taking point indicators within a time period, strictly converting to take indicators at each time point within the time period, and clearly distinguishing between time indicators such as "balance" and period indicators such as "issuance amount" in calculation logic; for example, requiring to strictly output fields in order: ranking field > date > condition field > dimension / grouping field > indicator.
[0188] The query statement checking rule is used to check whether the generated SQL has errors, and the SQL must be corrected after an error is found.
[0189] For example, checking whether it conforms to the SQL syntax specification, date field selection, date field data type identification, date format identification, whether the use of date field processing functions is correct, whether the fields are strictly output according to the constraints, and whether the SQL logic must be consistent with the business rule, table information, and user query intent.
[0190] For example, the third prompt word can be as follows:
[0191] prompt ="""
[0192] # Task Description
[0193] You are a data analysis expert in the field of banking {business scenario}. Based on the following information, generate accurate SQL and translate the passed SQL into business understandable data retrieval logic:
[0194] **User Query**
[0195] {query}
[0196] **Table Information**
[0197] {table_descs}
[0198] **Computed Columns**
[0199] Direct use of computed columns is prohibited. Must be dynamically calculated according to technical definitions
[0200] **Business Rules**
[0201] {business_principle}
[0202] **Core Rules**
[0203] 1. Error-proof mechanism
[0204] - Denominator must use NULLIF(denominator, 0), or uniformly add 0.0001 to the denominator
[0205] - Numerator uses COALESCE(numerator, 0)
[0206] - Must use multiplication * 1.0000 to ensure floating point operations
[0207] 2. Time processing:
[0208] - When the user query does not explicitly mention specific years, months or dates, the maximum year, month and date in the data table are the default respectively
[0209] 3. Point-in-time indicators and period indicators calculation:
[0210] - Must be strictly distinguished between point-in-time indicators and period indicators according to the scene: point-in-time indicators are specific time point values, such as overdue rate, loan balance, current user number, which are point-in-time indicators; Period indicators are cumulative or change amount within a period of time, which need to aggregate data for a period of time, such as access times, new user number, which are period indicators
[0211] - When the user's query involves retrieving point-in-time metrics within a time period, it must be strictly converted to retrieving metrics for each time point within the time period. For example, "April delinquency rate" must be converted to retrieving "delinquency rate for each time point in April", "second-quarter non-performing rate" must be converted to retrieving "non-performing rate for each time point in the second quarter", and "2025 delinquency rate trend" must be converted to "delinquency rate for each time point in 2025"
[0212] - When calculating point-in-time metrics, aggregation in the time dimension is prohibited, and instead, the metric value for a specific time point should be obtained
[0213] 4. Enumeration value matching method:
[0214] - When the table information does not maintain the specified enumeration value, use like fuzzy matching more often
[0226] -- Field semantics involve ratio / ratio, strictly in percentage format, and field alias adds (percentage) suffix, such as CONCAT(ROUND(rate*100.00, 2), '%') AS "xx indicator (percentage)"
[0227] -- Must be based on user query intent, must output the fields the user needs
[0228] -- Correct example: query the sales ranking of each province, SELECT RANK() OVER (ORDER BY sales_amount DESC) AS "ranking", province as "province", sales_amount as "sales" FROM regional_sales;
[0229] - Output fields must include:
[0230] -- Rank type query uses RANK() to achieve ranking, must output the "ranking" field to show the ranking position of each row
[0231] -- When querying dimensions, the dimension field must be output
[0232] -- When querying point indicators, the time field must be output
[0233] -- When calculating composite indicators, the base fields must be split and retained, such as querying the order value distribution, SELECT order_count as "order amount", total_amount as "total sales", total_amount*1.0000 / NULLIF(order_count,0) AS "single order value" FROM user_orders
[0234] -- When SQL contains GROUP BY, HAVING, WHERE clauses, the GROUP BY grouping fields, HAVING condition fields, WHERE time condition fields must be output
[0235] - The order of field output is strictly: ranking field > date > condition field > dimension / grouping field > indicator
[0236] **Template reference**
[0237] {sql_muban}
[0238] **Must check after generating SQL**
[0239] Check if the generated SQL has errors, and correct the SQL if errors are found:
[0240] 1. Whether it meets the SQL syntax
[0241] 2. Date processing, including date field selection, date field data type identification, date format identification, and correct use of date field processing functions
[0242] 3. Whether to strictly output fields according to constraints
[0243] 4. SQL logic must strictly comply with business rules, table information and user query intent.
[0244] **SQL translation**:
[0245] Translate the SQL that passes the check into a business logic description that business personnel can understand, avoiding technical terms, and translating the English names of tables and fields in SQL into Chinese names according to table information.
[0246] **Output requirements**
[0247] Return JSON strictly following the following structure:
[0248] {{
[0249] "sql": "complete WITH or SELECT statement",
[0250] "business_logic": "business data retrieval logic description (non-technical language)",
[0251] "fields": [
[0252] {{"name": "field name", "comment": "field Chinese name", "type": "data type"}} ]
[0254] }}
[0255] """
[0256] S303, input the third prompt word, query statement template and standardized query request into the large language model, and use the large language model to construct a query statement.
[0257] In some embodiments, the large language model generates SQL based on the prompt word, translates the SQL that passes the check into a business logic description that business personnel can understand, and strictly outputs the SQL, business data retrieval logic description, and SQL dataset output field attributes in JSON structure.
[0258] In some embodiments, if the user query involves independent sub-tasks, a prompt word for multi-query merging should be constructed according to the user's overall query target, each independent sub-task, the corresponding subject of the sub-task, the corresponding data extraction logic, the corresponding generated SQL, and the SQL dataset output field information, and the prompt word should be sent to the large language model to instruct the large language model to analyze the purpose of each sub-task, the structure of each sub-task SQL dataset (number of fields, data type, and alias semantic consistency), determine the SQL dataset merging method (row merging / column merging) according to the user's overall query target, and generate the complete SQL and result set after merging to ensure semantic correctness.
[0259] If the SQL dataset structure of each sub-task is the same, the row merging method is adopted, that is, the UNION ALL operation is used to merge the SQL statements, and a business tag field is added to mark the result set source, for example, the A branch in May 2024 each product's defect amount and defect rate; if the SQL dataset structures are different, but the dimension fields are the same and the time filtering conditions are consistent, the JOIN operation is used to merge multiple business indicator data by row; if the SQL dataset is derived from the same business subject and each SQL dataset returns only a single indicator value, the SQL dataset is merged by column through subquery; if multiple SQL datasets are different in structure and derived from different business subjects, they are not forced to be merged.
[0260] In some embodiments, when the SQL statement is obtained, a row data filtering clause WHERE condition can also be injected into the complete SQL according to the data authority control rule to obtain a complete SQL that meets the requirements of authority control, so as to meet the data security requirements.
[0261] In some embodiments, for multiple independent tasks, multiple independent sub-task SQLs are merged into a complete SQL.
[0262] S304, execute the query statement to obtain a dataset result from the data table.
[0263] S305, generate a field combination according to the data characteristics of the dataset result, and obtain a corresponding visualization strategy from a strategy library based on the field combination.
[0264] In some embodiments, the data characteristics include field characteristics and numerical value characteristics.
[0265] The field characteristics include field types (including numerical type, classification type, and time series type) and the number of fields under each type.
[0266] The numerical features include calculating the minimum value, maximum value, and average value of the numerical value field, listing and counting the unique values of the statistical classification field, calculating the date range of the time series field, and identifying the semantics through the keyword of the numerical field name. In the field type inference of the result dataset, the integer (int) or floating point (float) field is inferred as a numerical type, the string (string) field with a unique value count less than or equal to 50 is inferred as a category type, and the date time (datetime) field or the field name containing keywords such as year, month, day, and quarter is inferred as a time series type. The unique value count of the statistical classification field is determined as a low base field in the present application if the unique value count is less than 15. The semantics can be identified through the keyword of the numerical field name, such as the "overdue rate" field which can be identified as a percentage.
[0267] In some embodiments, the visualization chart type and specific visualization configuration rules, i.e., visualization strategies, can be matched from the strategy library according to the field combination information of the result dataset.
[0268] For example, when the field combination of the result dataset contains 1 classification field (low base), 1 numerical field, and a time series field, a line chart is recommended for display. The time series field is configured as the X-axis field, the numerical field is configured as the Y-axis field, and the classification field is configured as the legend field. The minimum value and maximum value of the Y-axis scale can be configured according to the minimum value and maximum value of the numerical field, and the Y-axis label can be configured in the percentage format according to the semantics of the numerical field name.
[0269] S306, if the visualization strategy corresponding to the field combination does not exist in the strategy library, a visualization strategy is generated based on the standardized query request and using a large language model.
[0270] In some embodiments, when the field combination of the result dataset matches the configuration strategy in the visualization rule library, the predefined visualization strategy is directly applied. When the configuration strategy is not hit, a prompt word containing the data features and the user query request is constructed, and a large language model is called to generate a visualization strategy.
[0271] S307, based on the visualization strategy, the dataset result is visualized to obtain a visualization result.
[0272] In some embodiments, in determining the visualization strategy, a visualization code can be generated based on the visualization strategy, and the visualization code is executed to visualize the dataset result and obtain the visualization result. The result dataset and its visualization result are output through an interactive interface.
[0273] In some embodiments, to improve the use efficiency of the user, the corresponding analysis conclusion can also be output at the same time as the visualization result.
[0274] Exemplarily, data features in the data set result are acquired; the data features include at least one of a field type, a cardinality, a numerical range, a numerical trend, and an abnormal point; the data features are processed by using the large language model to obtain an analysis conclusion corresponding to the query request.
[0275] For example, the slope of linear regression is used to measure the direction and strength of the numerical trend; when analyzing the abnormal points in the high-dimensional and large-scale data set, the Isolation Forest unsupervised anomaly detection algorithm is used after data standardization to predict the abnormal points in the result data set. For example, a plurality of isolation trees (iTree) are built, each tree recursively separates data by randomly selecting features and dividing values; abnormal points are often isolated at a shallow tree depth (i.e., a small number of division times) due to sparse distribution or extreme feature values; normal points are distributed in dense areas and need more steps to be isolated.
[0276] Secondly, the average path length of each sample in all trees is calculated, and the shorter the average path length, the higher the abnormal probability, and the calculation formula is ; wherein, represents the average path length of the sample in all trees, represents a correction factor, which is related to the size of the data set.
[0277] For example, when analyzing the abnormal points in the low-dimensional and small-scale data set, the One-Class SVM unsupervised anomaly detection algorithm is used after data standardization to construct a hyperplane in a high-dimensional feature space, separate the normal data from the origin (abnormal area) as much as possible, and identify abnormal points that deviate significantly from the normal data distribution: first, use a kernel function (such as linear, poly, or sigmoid) to map the data to a high-dimensional space, find a hyperplane that makes the normal data points as far away from the origin as possible, and minimize the distance from the hyperplane to the origin, the optimization objective is , and the constraint condition is , 0; wherein, is the upper bound of the abnormal proportion and the proportion of support vectors, is a slack variable that allows some data points to be inside the hyperplane.
[0278] Then, the decision function is used to score the sample x, and the function outputs +1 (normal) or -1 (abnormal).
[0279] In some embodiments, the analysis conclusion generation prompt word is constructed based on the result data set, data features, user query request, and conclusion generation requirements, the analysis conclusion generation prompt word is sent to the large language model, the large language model performs key indicator summarization, trend analysis, anomaly analysis, and main findings on the result data set, and a conclusion text and points are obtained.
[0280] In summary, the embodiments of the present application cooperate in multiple ways through the multi-path query splitting mechanism, dynamically adapting SQL templates for each independent subtask, and pre-installing a scenario-based rule engine. The large language model improves the accuracy of SQL generation in complex analysis scenarios such as same-period comparison and moving average. At the same time, it realizes the dynamic injection of row data authority control statements, and the SQL meets the data security requirements. The large language model translates the SQL into a data retrieval logic description that business personnel can understand, outputs the metadata information of the result set, generates a visual result with clear data traceability annotations, and improves the understanding efficiency of business personnel. And form an end-to-end intelligent analysis closed loop of "natural language query → multi-source data fusion → intelligent SQL generation → visual insight → analysis conclusion output". Compared with the traditional segmented processing mode, it promotes the dual improvement of bank multi-business scenario analysis efficiency and complex query accuracy, while reducing the technical use threshold.
[0281] Figure 4 The structure diagram of the data visualization device 40 provided by the embodiments of the present application is shown in Figure 5 as shown, comprising:
[0282] The receiving module 401 is configured to receive a user's natural language-based query request.
[0283] The conversion module 402 is configured to convert the query request based on historical query data to obtain a standardized query request.
[0284] The analysis module 403 is configured to analyze the standardized query request to obtain a target scene and a target topic corresponding to the standardized query request.
[0285] The acquisition module 404 is configured to acquire an analysis type and a data table corresponding to the standardized query request based on the target scene and the target topic.
[0286] The construction module 405 is configured to acquire a query statement template based on the analysis type, and construct a query statement according to the query statement template and the standardized query request.
[0287] The execution module 406 is configured to execute the query statement to obtain a data set result from the data table.
[0288] The visualization module 407 is configured to generate a visual result according to the data set result.
[0289] In some embodiments, the conversion module 402 is configured to associate a pronoun in the query request to an entity in the historical dialogue and replace the pronoun with the entity; check the integrity of the query request, and if there is a missing parameter in the query request, supplement the missing parameter based on historical parameters; if there is still a missing mandatory parameter in the query request after the missing parameter is supplemented, generate a fuzzy intent clarification prompt according to the mandatory parameter; supplement the mandatory parameter based on the feedback of the user to the fuzzy intent clarification prompt to obtain a standardized query request.
[0290] In some embodiments, the parsing module 403 is configured to construct a first prompt word based on a scene theme directory and the standardized query request; the scene theme directory includes a mapping relationship between a scene and a theme, and description information of the scene and the theme; use the scene theme directory, the standardized query request and the first prompt word as input of a large language model, and use the large language model to parse the standardized query request to obtain a target scene and a target theme corresponding to the standardized query request.
[0291] In some embodiments, the acquisition module 404 is configured to perform table retrieval in a database corresponding to the target scene and the target theme based on a preset retrieval strategy to obtain a plurality of candidate tables; determine at least one target candidate table from the plurality of candidate tables based on scene fitting degree, timeliness and association network centrality of the candidate tables; construct a second prompt word based on summary information of the target candidate table and the standardized query request; use the standardized query request, the second prompt word and the target candidate table as input of a large language model, and use the large language model to process the standardized query request to obtain a data table and an analysis type.
[0292] In some embodiments, the construction module 405 is configured to obtain a corresponding query statement template from a template library based on the analysis type; obtain a business rule corresponding to the target scene and the target theme; construct a third prompt word based on the business rule, the query statement template and a query statement processing rule; use the third prompt word, the query statement template and the standardized query request as input of a large language model, and use the large language model to construct a query statement.
[0293] In some embodiments, the visualization module 407 is configured to generate a field combination according to data characteristics of the dataset result; obtain a corresponding visualization strategy from a strategy library based on the field combination; if the visualization strategy corresponding to the field combination does not exist in the strategy library, generate a visualization strategy based on the standardized query request using a large language model; and perform visualization processing on the dataset result based on the visualization strategy to obtain a visualization result.
[0294] In some embodiments, the acquisition module 404 is configured to acquire a data feature in the data set result, the data feature comprising at least one of a field type, a cardinality, a numerical range, a numerical trend, and an outlier point; and the large language model is used to process the data feature to obtain an analysis conclusion corresponding to the query request.
[0295] The data visualization device provided by the embodiments of the present application can execute the data visualization method shown in any of the above embodiments, and has similar principles and technical effects, which will not be described here again,
[0296] The embodiments of the present application further provide an electronic device.
[0297] Figure 5 A structural schematic diagram of the electronic device 50 provided by the embodiments of the present application is shown in The electronic device can include a transceiver 501, a processor 502, and a memory 503.
[0298] The processor 502 executes computer execution instructions stored in the memory, so that the processor 502 executes the schemes in the above embodiments. The processor 502 can be a general-purpose processor, including a central processing unit CPU, a network processor NP, etc.; and can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.
[0299] The memory 503 is connected with the processor 502 through a system bus and completes mutual communication, and the memory 503 is used to store computer program instructions.
[0300] The transceiver 501 can execute receiving and sending data and instructions.
[0301] Optionally, the electronic device 50 can further include a communication interface 504, so that the communication interface 503 can communicate and interact with external or internal devices, and the external device can be a client (for example, a mobile phone, a tablet). In specific implementation, if the communication interface 504, the memory 503 and the processor 502 are independently implemented, the communication interface 504, the memory 503 and the processor 502 can be connected with each other through a bus and complete mutual communication.
[0302] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus or the like. The system bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus. The transceiver is used to realize the communication between the database access device and other computers (such as clients, read-write libraries and read-only libraries). The memory can include random access memory (RAM) and can also include non-volatile memory.
[0303] Optionally, in a specific implementation, if the communication interface 504, the memory 503 and the processor 502 are integrated on a chip, the communication interface 504, the memory 503 and the processor 502 can complete communication through an internal interface.
[0304] The embodiment of the present application also provides a chip for running instructions, which is used to execute the technical solutions in the above embodiments.
[0305] In the embodiment of the present application, a computer readable storage medium is also provided, which stores a computer program. The computer program is executed by a processor to implement the technical solutions of the above embodiments, and the implementation principle and technical effects are similar, which will not be repeated here.
[0306] In a possible implementation, the computer readable medium can include a Random Access Memory (RAM), a Read-Only Memory (ROM), a compact disc read-only memory (CD-ROM) or other optical memory, a magnetic disk storage or other magnetic storage devices, or any other medium that is suitable for storing desired program code in the form of instructions or data structures and that can be accessed by a computer. Also, any connection is properly termed a computer readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk, and Blu-ray® disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer readable media.
[0307] The embodiments of the present application also provide a computer program product, including a computer program, which, when executed by a processor, implements the technical solutions of the above embodiments, and has similar implementation principles and technical effects, which will not be described herein.
[0308] In the specific implementation of the terminal device or the server, it should be understood that the processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as execution completed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
[0309] Those skilled in the art can understand that all or part of the steps of any of the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer readable storage medium, and when the program is executed, all or part of the steps of the above method embodiments are executed.
[0310] If the technical solutions of the present application are realized in the form of software and sold or used as products, they can be stored in a computer readable storage medium. Based on such an understanding, all or part of the technical solutions of the present application can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions or a computer program. The computer software product makes a computer device (which can be a personal computer, a server, a network device or similar electronic equipment) execute all or part of the steps of the method of the embodiments of the present application.
[0311] It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all expressed as a combination of a series of actions, but those skilled in the art should know that the present application is not limited to the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0312] It should be further noted that, although each step in the flowchart is displayed in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise stated in this document, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other orders. Moreover, at least part of the steps in the flowchart can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily sequential, but can be executed in rotation or alternation with other steps or sub-steps or stages of other steps.
[0313] It should be understood that the above-mentioned device embodiments are only schematic, and the device of the present application can also be realized in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and another division method can be used in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0314] In addition, each functional unit / module in each embodiment of the present application can be integrated in one unit / module, or each unit / module can exist physically, or two or more units / modules can be integrated together. The integrated unit / module can be realized in the form of hardware or in the form of a software program module.
[0315] If the integrated units / modules are implemented in the form of hardware, the hardware can be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. Unless otherwise specified, the storage unit can be any appropriate magnetic storage medium or magneto-optical storage medium, such as resistive random access memory (RRAM), dynamic random access memory (DRAM), static random access memory (SRAM), enhanced dynamic random access memory (EDRAM), high-bandwidth memory (HBM), hybrid memory cube (HMC), etc.
[0316] If the integrated units / modules are implemented in the form of software program modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application or the entire or part of the technical solutions that essentially contribute to the prior art can be embodied in the form of a software product stored in a storage medium, including a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the embodiments of the present application. The aforementioned storage medium includes: a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.
[0317] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method of data visualization, characterized by, Comprise: Receiving a user natural language-based query request; Converting the query request based on historical query data to obtain a standardized query request; Parsing the standardized query request to obtain the target scene and target theme corresponding to the standardized query request; wherein, if the standardized query request includes multiple independent business themes or analysis dimensions, the target scene and target theme include the scene and theme corresponding to each business theme or analysis dimension after the standardized query request is split respectively; Based on the target scene and the target theme, the analysis type and the data table corresponding to the standardized query request are obtained; Based on the analysis type, a query statement template is obtained, and a query statement is constructed according to the query statement template and the standardized query request; Executing the query statement to obtain a data set result from the data table; Generating a visualization result according to the data set result.
2. The method of claim 1, wherein, The standardized query request is obtained by converting the query request based on historical query requests, comprising: Associating the pronoun in the query request to the entity in the historical dialogue, and replacing the pronoun according to the entity; Verify the integrity of the query request, and if there is a parameter missing in the query request, supplement the missing parameter based on the historical parameter; If there are still mandatory parameters missing in the query request after the missing parameter is supplemented, generate a fuzzy intent clarification prompt according to the mandatory parameters; Based on the user's feedback to the fuzzy intent clarification prompt, the mandatory parameters are supplemented to obtain the standardized query request.
3. The method of claim 2, wherein, Parsing the standardized query request to obtain the target scene and target theme corresponding to the standardized query request, comprising: Based on the scene theme directory and the standardized query request, a first prompt word is constructed; wherein, the scene theme directory includes the mapping relationship between scene and theme, and the description information of scene and theme; The scene theme directory, the standardized query request and the first prompt word are used as the input of the large language model, and the large language model is used to parse the standardized query request to obtain the target scene and target theme corresponding to the standardized query request; If the standardized query request includes multiple independent business themes or analysis dimensions, the first prompt word includes a multi-path query splitting prompt word; the multi-path query splitting prompt word is used to instruct the large language model to split the standardized query request into multiple independent sub-tasks for parsing, and output the scene and theme corresponding to each sub-task respectively.
4. The method of claim 3, wherein, Based on the target scene and the target theme, the analysis type and the corresponding data table corresponding to the standardized query request are obtained, comprising: Based on the preset retrieval strategy, table retrieval is performed in the database corresponding to the target scene and target theme to obtain a plurality of candidate tables; Based on the scene fit degree, timeliness and association network centrality of the candidate table, at least one target candidate table is determined from the plurality of candidate tables; According to the summary information of the target candidate table and the standardized query request, a second prompt word is constructed; The standardized query request, the second prompt word, and the target candidate table are input into a large language model, the large language model is used to process the standardized query request, and the data table and the analysis type are obtained.
5. The method of claim 4, wherein, The query statement template is obtained based on the analysis type, and the query statement is constructed based on the query statement template and the standardized query request, including: The corresponding query statement template is obtained from a template library based on the analysis type; The business rule corresponding to the target scene and the target topic is obtained; The third prompt word is constructed based on the business rule, the query statement template, and a query statement processing rule; The third prompt word, the query statement template, and the standardized query request are input into a large language model, and the large language model is used to construct the query statement.
6. The method of claim 5, wherein, The visual result is generated based on the data set result, including: The field combination is generated based on the data characteristics of the data set result; The corresponding visual strategy is obtained from a strategy library based on the field combination; If the visual strategy corresponding to the field combination does not exist in the strategy library, the visual strategy is generated based on the standardized query request by using a large language model; The data set result is visualized based on the visual strategy, and the visual result is obtained.
7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: Data characteristics in the data set result are obtained; the data characteristics include at least one of a field type, a cardinality, a numerical range, a numerical trend, and an abnormal point; The data characteristics are processed by using a large language model, and an analysis conclusion corresponding to the query request is obtained.
8. An electronic device, comprising: including: a processor, a transceiver, and a memory; the processor is in communication connection with the transceiver and the memory respectively; the memory is used to store a computer program; the transceiver is used to communicate and interact with an external device; the processor is used to execute the computer program to realize the method in any one of claims 1-7.
9. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and the computer program is executed by a processor to realize the method in any one of claims 1-7.
10. A computer program product, characterised in that, A computer program is stored thereon, and the computer program is executed by a processor to realize the method in any one of claims 1-7. A computer program is stored thereon, and the computer program is executed by a processor to realize the method in any one of claims 1-7.
Citation Information
Cited By
Data query method, related device and computer program product
CN122019597A