Intelligent analysis method, device, medium and program product based on large language model
Patent Information
- Application Number
- CN202511564101.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-30
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2045-10-30
AI Technical Summary
[0004]1. 能力局限于查询范式:Text2SQL 仅能生成 SQL 查询语句,无法支持趋势预测、归因分析、多模型组合计算、优化建议生成等更高阶的数据智能需求
[0025] This invention encapsulates analysis tasks into a JSON file with complete semantics, automatically assigning IDs, versions, and states, forming a knowledge asset that can be repeatedly invoked, gradually upgraded, and rolled back. This file is both an executable script and can be directly parsed into a Prompt context by a large language model, possessing the triple attributes of "machine-readable, business-interpretable, and version-governed." When hospitals reuse the same model in different departments at different times, there is no need to redevelop scripts, significantly reducing maintenance costs. Without this unified encapsulation, it is impossible to accumulate reusable assets, reduce Prompt engineering costs, or support subsequent automatic attribution chain assembly and data lineage tracing. Traditional Text2SQL can only generate temporary SQL statements, losing their value after the query ends. Moreover, because the schema, driving functions, and governance mechanisms are standardized, the introduction of new models only requires supplementing the JSON file to take effect; old models can also be smoothly replaced using version numbers. The system can continuously expand as hospital business and algorithm capabilities upgrade without disrupting existing workflows, possessing long-term evolution and commercialization value.
Smart Images

Figure CN121502375B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic digital data processing, and in particular to intelligent analysis methods based on large language models. Background Technology
[0002] With the increasing digitalization of the healthcare IT field, a large amount of structured and unstructured data is being centrally stored in data warehouses, data lakes, and business databases. To lower the professional barrier, the industry has proposed the "Natural Language-Data Query" paradigm, a typical implementation of which is Text2SQL technology—that is, automatically converting user queries into SQL statements through Natural Language Processing (NLP), then executing them in the database and returning the query results. This technology, to some extent, addresses the pain point of non-technical personnel being unable to write SQL, bringing better usability to data analysis and decision-making systems.
[0003] However, in practical applications, Text2SQL technology has revealed the following prominent limitations:
[0004] 1. Limited capabilities: Text2SQL can only generate SQL query statements and cannot support higher-level data intelligence needs such as trend prediction, attribution analysis, multi-model combination calculation, and optimization suggestion generation.
[0005] 2. Lack of assetization of analytical models: Existing technologies focus on "one-time queries" and cannot encapsulate analytical logic, input parameters, interpretation rules, etc. into reusable and versionable structured analytical models, resulting in insufficient knowledge accumulation and high maintenance costs.
[0006] 3. Lack of interpretability of results: SQL queries only return raw data or summarized values, and cannot automatically provide key influencing factors, business implications, and improvement suggestions, making it difficult to meet the needs of business personnel for interpretability and decision guidance.
[0007] 4. Insufficient context and multi-turn interaction capabilities: Text2SQL relies on single-turn, clear input. For complex question-and-answer scenarios that include omissions, ambiguous time expressions, or require referencing historical context, it cannot automatically complete parameters, understand intent, or continuously build analytical chains.
[0008] 5. Difficulty in integrating multi-source data and multiple AI algorithms: SQL statements are inherently limited to a single relational data source and lack a mechanism to combine and execute multiple AI components such as machine learning models, graph algorithms, and rule engines, making it impossible to build a hybrid intelligent analysis process.
[0009] Therefore, there is a need to provide an intelligent analysis method that can overcome at least some of the limitations mentioned above. Summary of the Invention
[0010] This invention provides an intelligent analysis method, device, medium, and program product based on a large language model. While returning numerical results to analytical queries, it can generate explanatory text and scientific optimization suggestions tailored to business scenarios and decision-makers. Furthermore, it supports multi-turn interaction, contextual understanding, and the fusion of multiple algorithms. The method, device, medium, and program product of this invention also support the correlation between analytical models, enabling attribution analysis of specific queries.
[0011] In a first aspect of the present invention, an intelligent analysis method based on a large language model is provided, the method comprising the steps of:
[0012] S1: Receives user queries in natural language format;
[0013] S2: Use the deployed large language model to perform intent recognition and slot extraction on the question;
[0014] S3: Based on the identified intent and the extracted slots, and using semantic vector similarity, determine the analysis model matching the query from the constructed analysis model library. The analysis model library includes two or more analysis models, each encapsulated as a JSON file. Each analysis model includes basic metadata, data access, input parameters, analysis logic, output structure, and interpretation rule fields. The basic metadata field includes analysis model name, label, and purpose subfields. The data access field includes data retrieval method and physical location subfields. The input parameter field includes parameter name, filtering expression, and missing parameter completion rule subfields. The analysis logic field includes execution type and analysis logic template subfields. The execution type includes SQL, machine learning, graph algorithm, or rule engine. The analysis logic template subfield stores SQL fragments, algorithm service URIs, or rule scripts. The output structure field specifies the name, type, and business semantics of each output field. The interpretation rule field includes interpretation template and threshold subfields. The interpretation template subfield embeds a natural language template for interpretation. The threshold subfield defines the threshold for each output field and the corresponding alarm information.
[0015] S4: Based on the missing parameter completion rules declared in the determined analysis model, supplement the missing input parameters, replace the placeholders in the corresponding filter expressions with the parameter values, and generate filter conditions;
[0016] S5: Call the corresponding driver function according to the data retrieval method declared in the determined analysis model. The data retrieval method includes views, tables, APIs, services built based on the model context protocol, or files.
[0017] S6: Execute the corresponding analysis logic according to the execution type declared in the determined analysis model;
[0018] S7: Traverse the output structure fields defined in the determined analysis model and fill the values of the analysis logic execution results into the preset placeholders in the interpretation template;
[0019] S8: Based on the rules set in the threshold subfield, determine whether each output field meets the alarm conditions; if so, record that the output field triggers an alarm and read the corresponding alarm information.
[0020] S9: Integrate the text after filling the explanation template with the triggered alarm information into a natural language explanation;
[0021] S10: Present the explanation content, either alone or together with the structured numerical values of the analysis logic execution result, to the user as the analysis result of the question.
[0022] In a second aspect of the invention, a computer device is provided, including a processor, a memory, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method described in the first aspect.
[0023] In a third aspect of the invention, a computer-readable storage medium is provided having a computer program / instructions stored thereon, characterized in that the computer program / instructions, when executed by a processor, implement the steps of the method described in the first aspect.
[0024] In a fourth aspect of the invention, a computer program product is provided, comprising a computer program / instructions, characterized in that, when executed by a processor, the computer program / instructions implement the steps of the method described in the first aspect.
[0025] This invention encapsulates analysis tasks into a JSON file with complete semantics, automatically assigning IDs, versions, and states, forming a knowledge asset that can be repeatedly invoked, gradually upgraded, and rolled back. This file is both an executable script and can be directly parsed into a Prompt context by a large language model, possessing the triple attributes of "machine-readable, business-interpretable, and version-governed." When hospitals reuse the same model in different departments at different times, there is no need to redevelop scripts, significantly reducing maintenance costs. Without this unified encapsulation, it is impossible to accumulate reusable assets, reduce Prompt engineering costs, or support subsequent automatic attribution chain assembly and data lineage tracing. Traditional Text2SQL can only generate temporary SQL statements, losing their value after the query ends. Moreover, because the schema, driving functions, and governance mechanisms are standardized, the introduction of new models only requires supplementing the JSON file to take effect; old models can also be smoothly replaced using version numbers. The system can continuously expand as hospital business and algorithm capabilities upgrade without disrupting existing workflows, possessing long-term evolution and commercialization value.
[0026] This invention defines interpretation templates, threshold rules, and optimization suggestions natively in the model file. After the model is executed, the system can directly combine the values and templates into readable text for management, along with actionable suggestions. This eliminates the need for business personnel to interpret obscure reports, greatly improving decision-making efficiency. This ensures the system's end-to-end "readable and improveable" capabilities, a core difference that traditional SQL result sets cannot provide.
[0027] In this invention, each analysis model can declare different execution types, and the platform automatically selects the corresponding executor during runtime, achieving hybrid scheduling of SQL, machine learning, graph algorithms, and rule engines. This retains the efficient aggregation capabilities of SQL while seamlessly invoking predictive models, graph computations, or business rules, realizing integrated intelligent analysis of "query + prediction + attribution + suggestion," thus overcoming the limitation of Text2SQL, which can only return static results.
[0028] Furthermore, the attribution field solidifies the causal relationships between models in a machine-readable manner. The platform can automatically construct tree-like links such as "profit ← revenue / cost," helping hospitals quickly pinpoint the root causes of issues like declining revenue or abnormal costs.
[0029] Other features and advantages of the present invention will become clearer after reading the detailed description of the embodiments of the present invention in conjunction with the accompanying drawings. Attached Figure Description
[0030] Figure 1 This is a flowchart of an embodiment of the method according to the present invention.
[0031] For clarity, these figures are schematic and simplified, showing only the details necessary for understanding the invention, while omitting other details. Detailed Implementation
[0032] The embodiments and examples of the present invention will now be described in detail with reference to the accompanying drawings.
[0033] The scope of the invention will become apparent from the detailed description given below. However, it should be understood that while the detailed description and specific examples illustrate preferred embodiments of the invention, they are given for illustrative purposes only.
[0034] Against the backdrop of rapid development in medical informatization, massive amounts of structured and unstructured data are scattered across different information systems within hospitals. Traditional Text2SQL technology can only query a single relational database and can only return "data slices," making it difficult to meet the needs of hospitals for prediction, attribution, optimization suggestions, and multi-source fusion analysis in scenarios such as operational analysis, quality control management, and clinical decision-making. To completely overcome these shortcomings, this invention proposes a method and system for defining structured analysis models (Models) oriented towards Large Language Models (LLMs). It aims to upgrade the fragmented "natural language → intelligent data retrieval" capabilities in the medical operations field into a self-describing, asset-based, and attributable "natural language → multi-model collaborative decision-making → intelligent analysis" system, and to build the next-generation digital intelligence foundation for medical operations with model assetization and multi-source fusion as its core.
[0035] Figure 1 A flowchart of a preferred embodiment of the intelligent analysis method based on a large language model (LLM) according to the present invention is shown.
[0036] In step S1, the system receives questions from users in natural language. Users can input questions through various means such as web input boxes, voice recognition interfaces, and BI platform integration portals. The system then converts the input content into an internal text data structure.
[0037] In step S2, the deployed large language model is used to perform intent recognition and slot extraction on the question. After the end user initiates a natural language question, the system calls the deployed large language model (such as Qwen or DeepSeek) to complete the two steps of intent recognition and slot extraction. The system maps the input statement to semantic tags based on a set prompt template or a finely tuned classification model. For example, "cardiology department's profit trend last month" is recognized as the intent "department profit analysis". The system records this semantic tag for subsequent retrieval scope limitation. The system also parses key parameter fields and their values from the input statement, such as "department = cardiology department" and "month_range = the last three months", and generates structured key-value pairs, which can be directly mapped to the input parameter names of the analysis model later.
[0038] In step S3, based on the identified intent and the extracted slots, and using semantic vector similarity, an analysis model matching the query is determined from the constructed analysis model library. The analysis model library includes two or more analysis models, each encapsulated as a JSON file. The schema structure of each analysis model includes basic metadata, data access, input parameters, analysis logic, output structure, and interpret rules. The basic metadata fields include analysis model name, label, and purpose subfields. The data access fields include data retrieval method and physical location subfields. The input parameter fields include parameter name, filtering expression, and missing parameter completion rule subfields. The analysis logic fields include execution type and analysis logic template subfields. The execution type includes SQL, machine learning, graph algorithm, or rule engine. The analysis logic template subfield is used to store SQL fragments and algorithm service URIs. Alternatively, the rule script output structure field specifies the name, type, and business semantics of each output field. The interpretation rule field includes an interpretation template and a threshold subfield. The interpretation template subfield embeds a natural language template for interpretation, and the threshold subfield defines the threshold for each output field and the corresponding alarm information. In this embodiment, the interpretation rule field also includes a suggestion generation logic subfield, which points to a template or rule engine used for automatically generating suggestions. In this embodiment, the schema structure of each analysis model also includes a datasets field, used to record the data retrieval method, physical location, and refresh strategy of the input, process, and output datasets, facilitating lineage tracing and operation and maintenance monitoring. In this embodiment, the schema structure of each analysis model also includes an attribution relationship field, which includes a driving model subfield listing the upstream analysis model IDs that this model depends on and an impact model subfield listing the downstream analysis model IDs that the results of this model will affect.
[0039] The following is an example of the schema structure of an analysis model. JSON Schema Draft-2020-12 is used as the strongly typed constraint language, and the file is named analysis-model.schema.json. The top-level schema declares the model object as consisting of fields such as "basic metadata, data access, input parameters, analysis logic, output structure, interpretation rules, dataset metadata, and attribution relationships." The meaning of each field and its subfields are as follows:
[0040] Basic Meta-information
[0041] A globally unique identifier (model_id): generated by the system when the model is first added to the database;
[0042] Version number: For example, semantic version number, which supports three segments, such as 1.0.3;
[0043] Name: Used to understand the role and meaning of the LLM analysis model.
[0044] Status: Values include draft, active, or deprecated, used for canary releases and rollbacks;
[0045] Business domain: Used for classifying business domains;
[0046] Tags: Used for weighted retrieval;
[0047] Purpose (description): Used to describe in detail the purpose of the analysis model;
[0048] Creation time (created_at) and modification time (modified_at): These are automatically written for easy auditing.
[0049] Data access (data_access)
[0050] Data retrieval method (access_type): options include view, table, API, service built based on model context protocol (mcp_service), or file;
[0051] Physical location: Used to record physical locations, such as library / table / API path / Service name / file path, for example, "finance.v_dept_profit_components";
[0052] The system has five built-in driver functions that distribute data to the corresponding SQL executor, REST client, MCP SDK, or file parser through data retrieval.
[0053] Input parameters (input_schema)
[0054] Each parameter is described by fields such as name, data type, and required.
[0055] The filter expression (expr) is used to generate filter conditions on a single data entry. The placeholders follow the ":parameter name" format and are automatically replaced by the system at runtime.
[0056] For example, the input parameter of a model is named department_code, and its filtering expression expr can be defined as:
[0057]
[0058] During runtime, if the user inputs "cardiology", the system will automatically replace the placeholder ":department_code" with "100201" (based on the context or the department mapping dictionary), ultimately generating the complete filter conditions.
[0059]
[0060] The filtering conditions are defined by the expr field of each input parameter. Before the model is executed, the system performs parameter value replacement and expression rendering, and then injects them into the data access layer (such as SQL, API, MCP service, etc.) as query statements or request conditions to limit the data range of this analysis.
[0061] The missing parameter completion rule (from_context) can point to rules such as "last_month" and supports missing parameter completion.
[0062] Analysis logic (logic_module)
[0063] Execution type (exec_type): Informs the system whether SQL, machine learning, graph algorithms, or rule engines should be invoked;
[0064] Analysis logic template: stores SQL fragments, algorithm service URIs, or rule scripts;
[0065] Hyperparameters and constraints are optional and can be used to adjust the learning rate, memory threshold, or timeout limit, etc.
[0066] Output structure (output_schema)
[0067] Clearly define the name, type, and business semantics of each output field to facilitate structured storage of results in the database and downstream calls.
[0068] Interpret rules
[0069] Interpretation template (nl_template): An embedded natural language template;
[0070] Thresholds: Defines field thresholds and alarm information;
[0071] Advice generation logic (advice_logic): can point to LLM Prompt or rule engine, used to automatically generate action suggestions.
[0072] Dataset metadata
[0073] Used to record the data retrieval method, physical location, and refresh strategy of input, process, and output datasets, facilitating lineage tracing and operation and maintenance monitoring.
[0074] Attribution relationships
[0075] Drivers: Lists the upstream analytics model IDs that this model depends on;
[0076] Impacts: Lists the IDs of downstream analytical models that will be affected by the results of this model;
[0077] Weight (weight_hint): Represents the historical attribution strength of the dependencies specified by the driving model subfield and the influencing model subfield;
[0078] Dimension tags: Label the attribution (drillable) dimensions.
[0079] All of the above fields are strongly constrained in the schema using keywords such as "required", "enum", "pattern", and "format". Any missing or mismatched JSON model files will fail validation.
[0080] An example of an analysis model (Model) conforming to the ModelSchema specification is as follows:
[0081] {
[0082] "model_id": "M_HOS_PROFIT_001",
[0083] "version": "1.1",
[0084] "status": "active",
[0085] "name": "Department Monthly Profit Analysis Model",
[0086] "domain": "finance",
[0087] "tags": ["profit","department","monthly"],
[0088] "created_at": "2025-08-05T10:30:00Z",
[0089] "modified_at": "2025-08-05T10:30:00Z",
[0090] "description": "Calculate the revenue, costs, and profits of a specified department in a given month, and generate optimization suggestions."
[0091] / * -------- Data Access -------- * /
[0092] "data_access": {
[0093] "access_type": "view",
[0094] "location": "finance.v_dept_profit_components",
[0095] "description": "Pre-aggregated view, including departmental monthly revenue and costs"
[0096] },
[0097] / * -------- Input parameters -------- * /
[0098] "input_schema": [
[0099] {
[0100] "name": "department",
[0101] "data_type": "string",
[0102] "required": true,
[0103] "semantic": "department_name",
[0104] "expr": "dept_name = :department"
[0105] },
[0106] {
[0107] "name": "month",
[0108] "data_type": "date",
[0109] "required": true,
[0110] "semantic": "month_first_day",
[0111] "from_context": "last_completed_month",
[0112] "expr": "stat_month = to_char(:month,'YYYY-MM')"
[0113] }
[0114] ,
[0115] / * -------- Analysis Logic -------- * /
[0116] "logic_module": {
[0117] "exec_type": "SQL",
[0118] "template": "SELECT SUM(income) AS income_total,\n SUM(cost) AS cost_total,\n SUM(income) - SUM(cost) AS profit_value\nFROM finance.v_dept_profit_components\nWHERE {{department_expr}} AND {{month_expr}};"
[0119] },
[0120] / * -------- Output Structure -------- * /
[0121] "output_schema":
[0122] { "name": "profit_value", "data_type": "number", "semantic": "dept_month_profit"},
[0123] { "name": "income_total", "data_type": "number", "semantic": "dept_month_income"},
[0124] { "name": "cost_total", "data_type": "number", "semantic": "dept_month_cost"}
[0125] ],
[0126] / * -------- Explain the rules -------- * /
[0127] "interpret_rules": {
[0128] "nl_template": "In {month}, the {department} department has an income of {income_total} yuan, a cost of {cost_total} yuan, and a profit of {profit_value} yuan."
[0129] "thresholds": [
[0130] { "field": "profit_value", "op": "<", "value": 0, "message": "A loss was incurred this month. Please check your revenue structure or cost control."},
[0131] { "field": "cost_total", "op": ">", "value": 0.6, "message": "Costs account for over 60% of total costs; it is recommended to focus on verifying consumables and labor expenses."}
[0132] ],
[0133] "advice_logic": "prompt: / / gpt4o / advice / finance_cost_control"
[0134] },
[0135] / * -------- Dataset Metadata -------- * /
[0136] "datasets": [
[0137] {
[0138] "name": "v_dept_profit_components",
[0139] "role": "driver_input",
[0140] "access_type": "view",
[0141] "location": "finance.v_dept_profit_components",
[0142] "granularity": "monthly",
[0143] "refresh_policy": "daily_etl",
[0144] Description: A summary view of departmental monthly revenue and costs.
[0145] },
[0146] {
[0147] "name": "dept_month_profit_result",
[0148] "role": "output",
[0149] "access_type": "table",
[0150] "location": "analytics.dept_month_profit",
[0151] "granularity": "monthly",
[0152] "refresh_policy": "on_demand",
[0153] "description": "Profit results table output by the model"
[0154] }
[0155] ],
[0156] / * -------- Attribution Relationship -------- * /
[0157] "relationships": {
[0158] "drivers": ["M_HOS_INCOME_001", "M_HOS_COST_001"],
[0159] "impacts": ["M_HOS_MARGIN_DASHBOARD"],
[0160] "weight_hint": { "M_HOS_INCOME_001": 0.65, "M_HOS_COST_001": 0.35},
[0161] "dimension_tags": ["department","month"]
[0162] }
[0163] }
[0164] When creating and registering an analytical model, domain analysts or data engineers fill out a JSON file (or generate it through any other appropriate means) based on business needs and the schema. After completion, it is submitted to the "Model Management Service" interface. The server loads `analysis-model.schema.json` using a Json-schema validator, performs field-by-field validation on the uploaded file, and proceeds to the next step only after successful validation. The system generates a `model_id` using the Snowflake algorithm and simultaneously reads the `version` field from the file, comparing it with historical versions of the same model. If the version number is lower than an existing version, the system rejects the data entry. Then, fields such as `name`, `description`, `tags`, and `domain` are vectorized using Sentence-Transformer and written to a vector library; an inverted index is created for keywords. The full text of the JSON file is stored in object storage, its summary metadata is written to the relational database `t_model_meta`, and data lineage records are written to `t_dataset_lineage`.
[0165] During the model registration phase, the system parses and records the contents of the attribution relationships field in the model file, establishing an attribution chain topology. This field contains four subfields: drivers, impacts, weight_hint, and dimension_tags, which respectively describe the model's forward dependencies, backward effects, historical attribution strength of dependencies, and drill-down dimensions. The specific implementation process is as follows: The system establishes a dependency table for the model IDs listed in the drivers field. For example, if the profit model declares dependencies on the revenue model and the cost model, the system writes the following into the model dependency table:
[0166]
[0167] Meanwhile, the system records the weight values in the weight_hint field and writes them as optional parameters into the subsequent graph visualization and factor sorting logic.
[0168] To avoid the complexity of combining multiple data sources, this invention stipulates that each model can only declare one data retrieval method. The data retrieval entry point can be a database table, database view, HTTP API, MCP microservice, or Excel file. All filtering expressions in the model are rendered and executed at this single entry point. The system's underlying layer provides pre-defined driver functions for the five data retrieval methods, thus decoupling the model definition from the specific data infrastructure.
[0169] Each model is assigned a unique ID and semantic version number upon initial import. Status fields control draft, activation, and deprecation status. The model's JSON file serves as both a registered asset and the LLM's runtime Prompt context, containing parameter semantics, default context, data location, logic template, and interpretation template. Once the LLM obtains this JSON, it can automatically complete the entire process of "parameter completion—data retrieval—execution—interpretation."
[0170] After completing question parsing (intent recognition and slot extraction), the model retrieval phase begins. Semantic vector similarity is used to retrieve candidate models. During model registration, the platform generates embedding vectors for each model's name, description, and tags subfields, storing them in a vector indexing engine (such as FAISS or pgvector). At runtime, the system converts user intent tags into semantic vectors, calculates the cosine similarity between these vectors and the vectors (i.e., models) in the vector indexing engine, and extracts the Top-K models as the candidate set. Simultaneously, keyword matching is performed. Keywords from the user's question are matched against the model tag fields, calculating keyword overlap scores to aid in ranking.
[0171] In this embodiment, candidate models can be scored and ranked according to the following rules:
[0172] 1) Semantic vector cosine similarity score;
[0173] 2) Keyword matching score;
[0174] 3) Model state weighting. The model weight for the active state is 1.0, for the draft state it is 0.5, and for the deprecated state it is 0.2.
[0175] The final ranking score of the candidate models is calculated using the following weighted fusion formula:
[0176]
[0177] in:
[0178] The semantic vector similarity score is calculated as the cosine similarity between the user input vector and the model embedding vector.
[0179] The keyword matching score is calculated as the matching rate between the query keywords and the model label fields (such as the number of overlaps or BM25).
[0180] : These are the model state weights, for example, active is 1.0, draft is 0.5, and deprecated is 0.2;
[0181] α, β: These are the system's preset weighting coefficients, with the default values set to α=0.7 and β=0.3, which can be adjusted according to the actual application scenario.
[0182] During runtime, a final score is calculated for each candidate model according to the above formula, and the models are sorted accordingly. The model with the highest score is selected as the analysis model that matches the input question.
[0183] In step S4, missing input parameters are supplemented according to the missing parameter completion rules declared in the determined analysis model, and the placeholders in the corresponding filter expressions are replaced with parameter values to generate filter conditions. That is, missing parameters are supplemented using the from_context rule; the parameter values are replaced with the placeholders in expr to generate the final filter conditions.
[0184] In step S5, the corresponding driving function is called according to the data retrieval method declared in the determined analysis model:
[0185] view / table → JDBC executor;
[0186] API → REST Client;
[0187] mcp_service → Internal SDK;
[0188] Excel → CSV parsing module.
[0189] In step S6, the corresponding analysis logic is executed according to the execution type (exec_type) declared in the determined analysis model. When the execution type is SQL, the rendered SQL fragment is assembled into the template and executed. When the execution type is ML / GRAPH / RULE, the algorithm service or rule engine is invoked.
[0190] In step S7, the output fields of the output structure defined in the determined analysis model are traversed, and the numerical values of the actual execution results of the analysis logic are filled into the preset placeholders in the interpretation template. The interpretation template uses a parameterized expression structure, such as: "This month's profit is: {profit} ten thousand yuan, year-on-year growth of {yoy}%", where "profit" and "yoy" are parameter placeholders, which are generally consistent with the field names of the data query results, and are replaced with specific values during output.
[0191] After the model execution is complete, the system structurally encapsulates the results according to the field order and data type defined in the output_schema, generating a unified result object for subsequent stages such as interpret rule generation (interpret_rules), attribution chain concatenation, result caching, API return, and visualization. For example:
[0192] If the fields defined in the model's output_schema are:
[0193]
[0194] The system will then encapsulate the execution result as:
[0195]
[0196] This result object will be used to explain the field placeholder replacements in the template (such as "This month's profit is: {profit} ten thousand yuan, and the profit margin is: {profit_margin}%), and can also be passed as an input field for downstream impact models, or used for data binding of dashboard components to achieve traceability and reusability of structured results.
[0197] In step S8, based on the rules set in the threshold subfield, each output field is checked to determine whether it meets the alarm conditions. If so, the alarm triggered by that output field is recorded, and the corresponding alarm information is read. For example, if the output field "profit margin (profit_margin) < 10%", the low threshold alarm is recorded, and the corresponding alarm information (message) is read (such as "profit margin is too low, cost structure needs to be checked"). The explanation template (nl_template) and threshold alarms (thresholds) (and suggestion logic (advice_logic)) are written into the analysis model ontology, so that any call can output natural language insights and optimization measures for managers while returning numerical values.
[0198] In step S9, the text filled with the explanation template is integrated with the triggered alarm information into a natural language explanation.
[0199] In step S10, the explanation content, either alone or together with the structured numerical values of the analysis logic execution result, is presented to the user as the analysis result of the question.
[0200] Taking the "Department Monthly Profit" analysis model as an example, developers only need to:
[0201] Specify the view finance.v_dept_profit_components in data_access;
[0202] Declare the department and month parameters and their expr in input_schema;
[0203] Write three lines of SQL summary in logic_module.template;
[0204] Set the interpretation template and cost threshold in interpret_rules.
[0205] After uploading the model file, the system will automatically complete the registration. When an end user enters "What was the profit of the cardiology department last month and give me cost advice" in the chat box, the system will execute the following process:
[0206] 1. Detect the model;
[0207] 2. Automatically complete month to the first day of the previous month;
[0208] 3. Render the SQL and query the view;
[0209] 4. Refill the values into the explanation template;
[0210] 5. If the cost percentage exceeds the threshold, an alarm message will be added: "Cost is too high, and consumable and labor costs need to be optimized."
[0211] 6. Output structured results and natural language explanations, and then push the results to the "Profit Margin Dashboard" model.
[0212] The entire process requires no manual SQL or script writing; it relies entirely on the self-describing information in the model file.
[0213] In this embodiment, if the analysis model defines a suggestion generation logic (advice_logic) subfield, the current structured result is used as input to call this suggestion generation logic to generate suggestion text. Common forms of suggestion generation logic include:
[0214] Template rule set: Outputs suggested text based on rules combining multiple fields;
[0215] LLM Prompt Template: Embeds field values with prompts to generate targeted suggestions;
[0216] Microservice API: Request optimization suggestions from the backend strategy engine.
[0217] In this case, step S9 above includes: integrating the text after the explanation template is filled, the triggered alarm information, and the suggested text into an explanation in natural language form.
[0218] In an embodiment, where the analysis model includes a dataset information field, the method of the present invention may further include: recording the full execution log, execution batches, and / or performance metrics of the corresponding analysis model in the dataset information field of the analysis model. The datasets field records the physical location, granularity, and refresh strategy of the input, process, and output datasets, forming an explicit data lineage. Operations personnel can then implement access control, quality monitoring, and scheduling optimization based on this, achieving observable data governance instead of relying on experience to find SQL scripts.
[0219] In embodiments, the method of the present invention may further include: if the determined analysis model declares a driver field, automatically reading the dependent driver models and calling them sequentially, using the result data of each driver model's operation (such as revenue breakdown and cost structure) as supplementary content to the explanation content of the determined analysis model. Wherein, if a driver model itself also declares a driver model, a multi-layered model chain is recursively retrieved for multi-level attribution and multi-round drill-down. If the model defines a dimension_tags field, the system enables group drill-down functionality on the front end (such as decomposing revenue structure by department or month) to assist users in root cause localization. The aforementioned supplementary content is generated based on the execution results of each driver model, in conjunction with the explanation rules of the determined analysis model. For example, automatically generating attribution-type explanation text such as "The profit decline is mainly due to a 20% increase in costs, primarily stemming from increased material expenditures," forming an integrated output of "result-cause-recommendation." If the determined analysis model declares an "impacts" field, the execution result of this determined analysis model is automatically pushed to downstream visualization modules or large-screen components that depend on the determined analysis model, forming a linked display. Thus, this invention enables explicit expression and automatic execution of the attribution chain at the model layer, supports intelligent causal chain construction, factor priority judgment, and visualization, achieving a one-stop output of "result-cause-recommendation," significantly superior to traditional pure SQL queries or hard-coded rules.
[0220] Existing Text2SQL technology can only generate single-database SQL and cannot handle advanced tasks such as trend prediction, attribution analysis, and optimization suggestions. This invention defines and encapsulates richer analysis and inference logic, which can be triggered during interaction with an LLM (Local Management Module). The analysis model natively supports heterogeneous data sources such as relational databases, document databases, time-series databases, object storage, and third-party interfaces. Moreover, the analysis model comes with semantic tags, contextual constraints, data definitions, analysis logic, and interpretation rules, forming a readable, executable, and interpretable unit; enabling the LLM to automatically complete parameter completion, data binding, and execution after retrieving the model, without manual configuration. Furthermore, this invention encapsulates complex analysis tasks into registerable, versionable, and governable model assets; the model metadata directly maps to business concepts such as hospital departments, diseases, and cost centers, ensuring both professional depth and ease of cross-scenario reuse; and it can flexibly integrate AI composite capabilities such as machine learning, graph algorithms, and rule engines.
[0221] Through this invention, when an end user asks a question in natural language, the system first performs intent recognition and slot extraction using a large language model, and then retrieves a matching model from the semantic index. Once a model is selected, the system renders filtering conditions based on the `expr` placeholder in the input parameters, calls the corresponding data retrieval driver to complete data fetching, and then executes calculations using SQL, machine learning, graph algorithms, or rule engines based on the `logic_module`. The structured results, combined with `interpret_rules`, enter a second large language model processing stage to generate explanatory text and actionable suggestions for business decision-makers, forming a complete closed loop. As can be seen, this invention encapsulates complex analytical tasks into standardized, reusable structured analytical models; supports LLM in automatically retrieving, calling, and combining these models through natural language; while returning numerical results, it can generate explanatory texts and scientific optimization suggestions tailored to business scenarios and decision-makers; it supports multi-turn interaction, contextual understanding, and multi-algorithm fusion execution; it supports the association between models for attribution analysis of specific questions; and it significantly outperforms existing Text2SQL solutions in terms of analytical capability reuse, data compliance, security auditing, business explanation, causal tracing, hybrid intelligence, operation and maintenance governance, and implementation costs, providing efficient, reliable, and sustainable intelligent analytical support for complex fields such as medical informatics.
[0222] In another embodiment, a computer device is provided, including a processor, a memory, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method described above.
[0223] In another embodiment, a computer-readable storage medium is provided that stores a computer program / instructions thereon, characterized in that the computer program / instructions, when executed by a processor, implement the steps of the method described above.
[0224] In another embodiment, a computer program product is provided, including a computer program / instructions, characterized in that the computer program / instructions, when executed by a processor, implement the steps of the method described above.
[0225] The various embodiments described herein, or their specific features, structures, or characteristics, may be suitably combined in one or more embodiments of the invention. Furthermore, in some cases, the order of steps described in the flowcharts and / or pipeline processes may be modified where appropriate, and they need not be performed in the exact order described. Additionally, various aspects of the invention may be implemented using software, hardware, firmware, or combinations thereof, and / or other computer-implemented modules or devices that perform the described functions. Software implementations of the invention may include executable code stored in a computer-readable medium and executed by one or more processors. Computer-readable media may include computer hard disk drives, ROM, RAM, flash memory, portable computer storage media such as CD-ROM, DVD-ROM, flash drives, and / or other devices having a Universal Serial Bus (USB) interface, and / or any other suitable tangible or non-transitory computer-readable medium or computer memory on which executable code can be stored and executed by a processor. The invention may be used in conjunction with any suitable operating system.
[0226] Unless explicitly stated otherwise, the singular forms “a” and “the” as used herein include the plural meaning (i.e., meaning “at least one”). It should be further understood that the terms “having,” “comprising,” and / or “including” as used in the specification indicate the presence of the described features, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The term “and / or” as used herein includes any and all combinations of one or more of the listed related items.
[0227] The foregoing has described some preferred embodiments of the present invention. However, it should be emphasized that the present invention is not limited to these embodiments, but can be implemented in other ways within the scope of the present invention. Those skilled in the art can make various modifications and variations to the present invention based on the inventive concept and without departing from the scope of the present invention, and such modifications or variations still fall within the protection scope of the present invention.
Claims
1. An intelligent analysis method based on a large language model, characterized in that, The method includes: S1: Receives user queries in natural language format; S2: Use the deployed large language model to perform intent recognition and slot extraction on the question; S3: Based on the identified intent and the extracted slots, and using semantic vector similarity and keyword matching, determine the analysis model matching the query from the constructed analysis model library. The analysis model library includes two or more analysis models, each encapsulated as a JSON file. Each analysis model includes basic metadata, data access, input parameters, analysis logic, output structure, and interpretation rule fields. The basic metadata field includes analysis model name, label, and purpose subfields. The data access field includes data retrieval method and physical location subfields. The input parameter field includes parameter name, filtering expression, and missing parameter completion rule subfields. The analysis logic field includes execution type and analysis logic template subfields. The execution type includes SQL, machine learning, graph algorithm, or rule engine. The analysis logic template subfield stores SQL fragments, algorithm service URIs, or rule scripts. The output structure field specifies the name, type, and business semantics of each output field. The interpretation rule field includes interpretation template and threshold subfields. The interpretation template subfield embeds a natural language template for interpretation. The threshold subfield defines the threshold for each output field and the corresponding alarm information. S4: Based on the missing parameter completion rules declared in the determined analysis model, supplement the missing input parameters, replace the placeholders in the corresponding filter expressions with the parameter values, and generate filter conditions; S5: Call the corresponding driver function according to the data retrieval method declared in the determined analysis model. The data retrieval method includes views, tables, APIs, services built based on the model context protocol, or files. S6: Execute the corresponding analysis logic according to the execution type declared in the determined analysis model; S7: Traverse the output structure fields defined in the determined analysis model and fill the values of the analysis logic execution results into the preset placeholders in the interpretation template; S8: Based on the rules set in the threshold subfield, determine whether each output field meets the alarm conditions; if so, record that the output field triggers an alarm and read the corresponding alarm information. S9: Integrate the text after filling the explanation template with the triggered alarm information into a natural language explanation; S10: Present the explanation content, either alone or together with the structured numerical values of the analysis logic execution result, to the user as the analysis result of the question.
2. The method according to claim 1, characterized in that, The explanation rule field also includes a suggestion generation logic subfield, which points to a template or rule engine for automatically generating suggestions. The method further includes: if the determined analysis model declares suggestion generation logic, the structured result of the analysis logic execution is used as input to call the corresponding suggestion generation logic to generate suggestion text; wherein step S9 includes: integrating the text after the explanation template is filled, the triggered alarm information and the suggestion text into a natural language explanation content.
3. The method according to claim 1, characterized in that, Step S3 includes: The identified intent is converted into a semantic vector, and the semantic vector similarity score between the semantic vector and each vector in the vector indexing engine is calculated, where each vector in the vector indexing engine is generated based on the name, label and purpose of each analysis model; The extracted keywords from the slot analysis are matched with the label fields of each analysis model to calculate the keyword matching score. The analysis models in the analysis model library are ranked based on the semantic vector similarity score and the keyword matching score. The analysis model ranked highest is selected as the analysis model to be used.
4. The method according to claim 1, characterized in that, Each analysis model also includes a dataset metadata field, and the method further includes: Record the full execution log, execution batches, and / or performance metrics of the corresponding analysis model in the dataset metadata field of the analysis model.
5. The method according to claim 1, characterized in that, Each analysis model also includes an attribution field, which includes a driving model subfield for listing the upstream analysis model IDs that this model depends on and an impact model subfield for listing the downstream analysis model IDs that the results of this model will affect. The method further includes: If the determined analysis model declares a driving model, the dependent driving models are automatically read and called in sequence, and the result data of each driving model is used as supplementary content to the interpretation of the determined analysis model. If the determined analysis model declares an influencing model, the execution result of the determined analysis model will be automatically pushed to the downstream visualization modules or large screen components that depend on the determined analysis model to form a linked display.
6. The method according to claim 5, characterized in that, The method further includes: If a certain driving model also declares a driving model, then recursively pull multi-level model chains to perform multi-level attribution and multi-round drill-down.
7. The method according to claim 5, characterized in that, The supplementary content is generated based on the execution results of each driving model and in conjunction with the interpretation rules of the determined analysis model.
8. A computer device, comprising a processor, a memory, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1-7.
9. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1-7.
10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method described in any one of claims 1-7.
Citation Information
Patent Citations
Conversation method and device for service robot and service robot conversation system
CN118778818A
High-precision multi-modal twin model assembly method based on large language model and multiple docking optimization mechanism
CN120371417A