A water conservancy resettlement data autonomous analysis and decision method and device
Patent Information
- Application Number
- CN202611464146.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-20
- Publication Date
- 2026-10-27
AI Technical Summary
[0003]针对现有技术存在的通用智能体在水利移民多源异构数据场景下任务编排盲目发散、接口匹配失准及跨表数值计算幻觉的问题,本申请通过水利移民数据自主分析决策方法,实现基于状态机动态编排与双重刚性约束的精准数据分析与可靠决策输出
(1)本发明通过构建涵盖接口概要、明细及跨接口关联逻辑的接口语义约束空间,将非标准化的异构API转化为具备业务语境感知的标准化任务描述空间,利用正向匹配与负向排除规则及先验业务约束拓扑图,强制智能体在正确的行业语义轨道内进行接口路由与任务编排,解决了通用模型因语义割裂导致的接口误选与逻辑错配问题。
Smart Images

Figure CN122986146A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of water conservancy information technology, and in particular to a method and device for autonomous analysis and decision-making of water conservancy resettlement data. Background Technology
[0002] Currently, in the field of water conservancy resettlement data analysis, querying and reasoning for multi-source heterogeneous business data typically relies on intelligent agent frameworks driven by general large language models. However, due to the cross-departmental, multi-dimensional, and strongly policy-constrained characteristics of water conservancy resettlement data, existing general intelligent agents often suffer from path divergence and logical leaps during task orchestration due to a lack of industry semantic constraints, leading to inaccurate interface routing. Furthermore, in the cross-table numerical reasoning stage, general code generation mechanisms struggle to identify dimensional conflicts and business alignment rules, easily causing computational illusions and unreliable results. Therefore, there is an urgent need for an autonomous analysis and decision-making method for water conservancy resettlement data that integrates industry semantic constraints and state feedback control. Summary of the Invention
[0003] To address the problems of blindly diverging task orchestration, inaccurate interface matching, and illusion of cross-table numerical calculation in existing technologies for general intelligent agents in the context of multi-source heterogeneous data of water conservancy and resettlement, this application proposes an autonomous analysis and decision-making method for water conservancy and resettlement data to achieve accurate data analysis and reliable decision output based on dynamic state machine orchestration and dual rigid constraints.
[0004] In a first aspect, the present invention provides an autonomous analysis and decision-making method for water conservancy resettlement data, comprising: receiving analysis requirements for water conservancy resettlement data, initializing a global state machine and a global context; performing multi-stage dynamic task orchestration on the analysis requirements based on the global state machine and the global context, generating a currently executing task; wherein, the multi-stage dynamic task orchestration includes: generating a data query task without pre-dependent dependencies in the initial state, and dynamically generating subsequent data query tasks or numerical calculation tasks based on the updated global context after obtaining the task execution results; responding to the current executing task being a data query task, performing interface routing and field matching based on the interface semantic constraint space to execute the data query, and updating the query results to the global context; wherein, the interface semantic constraint space includes interface summary information and interface detail information of multiple data interfaces; responding to the current executing task being a numerical calculation task, generating and executing numerical inference code based on an industry rule base and cross-table association logic, and updating the inference results to the global context; cyclically executing the multi-stage dynamic task orchestration and the currently executing task until the global state machine satisfies the closed-loop condition, and outputting a decision result for the analysis requirements.
[0005] According to the present invention, a method for autonomous analysis and decision-making of water conservancy resettlement data includes the following steps: after obtaining the task execution result, dynamically generating subsequent data query tasks or numerical calculation tasks based on the updated global context; merging the task execution result into the global context and making branch decisions based on the comparison result between the global context and the analysis requirements; if it is determined that the basic data is incomplete or that new entities have not been queried, then generating a new data query task; if it is determined that the basic data is ready and no logical calculation has been performed, then generating a numerical calculation task; if it is determined that the data and inference results in the global context meet the analysis requirements, then triggering a closed-loop condition; wherein, when generating a new data query task, an incremental entity deduplication operation is performed: calculating the difference between the new entity and the historical set of queried entities; if the difference is not empty, then only the entity corresponding to the difference is injected as an incremental parameter into the new data query task, and the historical set of queried entities is updated; if the difference is empty, then the generation of the new data query task is suppressed, and a forced transfer to the branch generating the numerical calculation task or triggering the closed-loop condition is initiated.
[0006] According to the autonomous analysis and decision-making method for water conservancy resettlement data provided by the present invention, the multi-stage dynamic task orchestration further includes an anomaly recovery mechanism. The anomaly recovery mechanism includes: if an execution anomaly is captured during the execution of the data query task or the numerical calculation task, a structured anomaly message containing the error type and error cause is returned to the global state machine; in response to receiving the structured anomaly message, the state of the global state machine is changed to an error recovery state, and the error cause is re-injected as a negative constraint condition to re-perform the multi-stage dynamic task orchestration; a loop counter is maintained, and the loop counter is incremented each time the global state machine enters the multi-stage dynamic task orchestration; if the same error type occurs consecutively for more than a preset number of retries, or the loop counter exceeds a preset depth threshold, the state of the global state machine is changed to a forced termination state, and an anomaly degradation output is triggered.
[0007] According to the present invention, an autonomous analysis and decision-making method for water conservancy resettlement data is provided. The method for interface routing and field matching based on the interface semantic constraint space includes: performing initial interface selection based on the interface summary information in the interface semantic constraint space to lock the target interface; the interface summary information includes positive matching features and negative exclusion boundaries; locating fields based on the interface details information of the target interface; for a clear query intent, identifying a unique field semantically equivalent to the clear query intent from the candidate fields of the interface details information; for a broad query intent, employing a dual filtering mechanism of business tags and semantics to filter out a set of fields that conform to the preset business tag definition or semantic category from the candidate fields; if neither the clear query intent nor the broad query intent locates a valid field, the initial interface selection is determined to be incorrect and the initial interface selection is re-executed.
[0008] According to the autonomous analysis and decision-making method for water conservancy resettlement data provided by the present invention, the interface semantic constraint space further includes cross-interface business association logic, which is dynamically injected into the multi-stage dynamic task orchestration as a priori business constraint topology graph. The cross-interface business association logic includes a primary key field and a business association field. The primary key field is a field that is common to multiple data interfaces and has global uniqueness, used to provide a physical alignment benchmark when horizontally splicing across interfaces. The business association field is a pair of fields with business logic association in multiple data interfaces, and the business association field is accompanied by an association logic description, which includes planning and execution comparison logic or fund flow tracing logic. In the multi-stage dynamic task orchestration, the cross-interface business association logic serves as a strong constraint boundary condition, limiting the path divergence and logical crossing of the multi-stage dynamic task orchestration.
[0009] According to the present invention, a method for autonomous analysis and decision-making of water conservancy resettlement data includes the following steps: generating numerical reasoning code based on an industry rule base and cross-table association logic, which includes: forcibly checking the tool library description file in the industry rule base before generating the numerical reasoning code; if the numerical calculation task involves preset core business calculations, generating code instructions to call the corresponding industry rule functions in the industry rule base, which are then embedded as atomic plug-ins into the numerical reasoning code, wherein the core business calculations include completion rate calculation, financial consistency audit, or dimensional conflict elimination; and generating cross-table fusion instructions based on the association primary key specified in the cross-table association logic, wherein the cross-table fusion instructions restrict the numerical reasoning code to physically align the data tables based on the association primary key, and prohibit horizontal splicing without a primary key.
[0010] According to the present invention, an autonomous analysis and decision-making method for water conservancy resettlement data is provided. The industry rule base encapsulates specific policy calculation logic, financial audit rules, and spatial alignment algorithms for the water conservancy resettlement field. The numerical inference code is executed in an isolated environment, which is a code execution sandbox pre-installed with a data analysis library and declaring the industry rule base call interface. If a calculation anomaly is captured during the execution of the numerical inference code in the isolated environment, the error reason is output through a structured error output statement, allowing the global state machine to capture and re-orchestrate the multi-stage dynamic task based on the error reason. After executing the numerical inference code, the obtained result data is encapsulated and stored, and a structured representation containing data descriptions and data addresses is generated. This structured representation is then fed back to the global context.
[0011] According to the present invention, an autonomous analysis and decision-making method for water conservancy resettlement data is provided. The output of decision results for the analysis requirements includes: when the global state machine meets the closed-loop condition, integrating the global context, and outputting a statistical analysis summary containing natural language responses and structured data file addresses; when the global state machine triggers the forced termination state due to timeout or execution failure, stopping the general question-and-answer summary and triggering the abnormal degradation output; the abnormal degradation output includes: calling a large language model to perform a visual review of the global context, the executed task chain, and the underlying error information, outputting a fault cause analysis and a report of completed phase results, and providing the path of the structured data file generated before the interruption.
[0012] Secondly, the present invention also provides an autonomous analysis and decision-making device for water conservancy resettlement data, comprising: The task orchestration module is used to receive analysis requirements for water conservancy resettlement data, initialize the global state machine and global context; based on the global state machine and global context, perform multi-stage dynamic task orchestration on the analysis requirements to generate the currently executing task; wherein, the multi-stage dynamic task orchestration includes: generating a data query task without prerequisite dependencies in the initial state, and dynamically generating subsequent data query tasks or numerical calculation tasks based on the updated global context after obtaining the task execution results; The query execution module is used to respond to the current execution task being a data query task, perform interface routing and field matching based on the interface semantic constraint space to execute the data query, and update the query results to the global context; wherein, the interface semantic constraint space includes interface summary information and interface detail information of multiple data interfaces; The numerical reasoning module is used to generate and execute numerical reasoning code based on the industry rule base and cross-table association logic in response to the current execution task being a numerical calculation task, and update the reasoning result to the global context. The task orchestration module is also used to cyclically execute the multi-stage dynamic task orchestration and the currently executing task until the global state machine meets the closed-loop condition and outputs the decision result for the analysis requirements.
[0013] Thirdly, the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the autonomous analysis and decision-making method for water conservancy resettlement data as described above.
[0014] The autonomous analysis and decision-making method and apparatus for water conservancy resettlement data provided by this invention have the following advantages compared with the prior art: (1) This invention transforms non-standard heterogeneous APIs into standardized task description spaces with business context awareness by constructing an interface semantic constraint space that covers interface summary, details and cross-interface association logic. By using positive matching and negative exclusion rules and prior business constraint topology graphs, the intelligent agent is forced to perform interface routing and task orchestration within the correct industry semantic track, thus solving the problem of interface misselection and logic mismatch caused by semantic fragmentation in general models.
[0015] (2) This invention proposes a multi-stage dynamic task orchestration mechanism based on global state machine and context. Through the principle of logical restraint, only dependent queries are activated in the initial stage, and tasks are dynamically generated in subsequent iterations based on incremental entity deduplication and branch decision. This realizes the autonomous cognitive closed loop of "query-computation-new entity-re-query", which overcomes the path divergence and dead loop defects of the traditional linear decomposition mode when dealing with complex composite constraints.
[0016] (3) This invention uses a dual rigid constraint mechanism that combines industry rule tool library and cross-table association logic to generate numerical reasoning code, encapsulates core business calculations into atomic plug-ins and forces physical alignment based on associated primary keys, restricts the free generation of large models within the compliant track, eliminates dimensional conflicts and logical drift from the underlying algorithm, and ensures the absolute accuracy and industry compliance of water conservancy resettlement data analysis results. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating the autonomous analysis and decision-making method for water conservancy resettlement data provided by the present invention. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0020] It should be noted that, in the description of the embodiments of the present invention, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0021] Example 1 Figure 1 This is a flowchart illustrating the autonomous analysis and decision-making method for water conservancy resettlement data provided by the present invention, as shown below. Figure 1 As shown, including but not limited to the following steps: like Figure 1 As shown in the figure, this embodiment provides a method for autonomous analysis and decision-making of water conservancy resettlement data. This method transforms complex natural language analysis requirements into an executable sequence of atomic tasks by constructing a linkage mechanism between a global state machine and a global context. During execution, the task path is dynamically adjusted based on feedback, thereby achieving autonomous closed-loop analysis from fuzzy intent to precise decision results.
[0022] Step S100: Receive the analysis request for water conservancy resettlement data and initialize the global state machine and global context.
[0023] Specifically, when the system receives a natural language analysis request from a user, it first initiates the initialization procedure of the decision-making center. In this embodiment, the global state machine refers to a finite state automaton that runs through the entire analysis and decision-making process. It maintains the current execution stage identifier of the system and performs deterministic transitions between different stages according to preset state transition rules. For example, the state set of the global state machine includes: the initial state START, the data query state DATA_SELECT, the reasoning and decision-making state THINKING, the completion state FINISH, the error recovery state ERROR_RECOVERY, the timeout termination state TERMINATE_TIMEOUT, and the failure termination state TERMINATE_FAILED. As the control center of the system, the global state machine determines the type of operation to be executed in the current stage and the direction of state transition in the next stage. The global context refers to a shared data structure that is continuously maintained throughout the entire lifecycle of the analysis and decision-making process. It is used to record all data assets, intermediate calculation results, metadata information, and task execution history acquired by the system during execution. The global context is incrementally updated as each task is completed, providing factual basis for subsequent task orchestration decisions, enabling the system to dynamically adjust the execution path based on the information it has acquired.
[0024] During the initialization phase, the global state machine's state value is set to the initial state START, and the global context is initialized to an empty set. This step establishes the starting point for the entire analysis task, providing a baseline environment for subsequent task orchestration.
[0025] Step S200: Based on the global state machine and global context, perform multi-stage dynamic task orchestration on the analysis requirements to generate the currently executing task; wherein, the multi-stage dynamic task orchestration includes: generating a data query task without prerequisite dependencies in the initial state, and dynamically generating subsequent data query tasks or numerical calculation tasks based on the updated global context after obtaining the task execution results.
[0026] In this embodiment, multi-stage dynamic task orchestration refers to the process by which the decision-making center, driven by the global state machine, plans tasks in stages based on the real-time state of the global context to meet analytical needs. This orchestration process does not statically decompose all tasks at once, but rather dynamically determines the type and content of the next task to be executed at each stage based on the currently available data and calculation results, thereby achieving a progressive cognitive loop of "query—calculation—new entity discovery—re-query".
[0027] Specifically, when the global state machine is in the START state, the system performs the initial query intent decomposition. To prevent the large model from blindly speculating on computational logic or planning future merging and filtering steps in a "vacuum" state lacking basic data, this embodiment introduces the principle of "logical restraint." The system injects specific role definition prompts into the large model, setting it as the "initial task decomposition hub that pursues extreme pragmatism and strictly prohibits guesswork," and explicitly issues constraints of "absolute logical restraint" and "strictly prohibits premature planning," requiring the model to focus only on the most basic data that must be obtained immediately, pretending not to know how to write code or perform complex comparisons later.
[0028] For example, regarding the requirement of "regions where the number of immigrant villages with cultural activity rooms decreased in 2025 compared to 2024, assuming the total number of immigrant villages remained unchanged," the system initially only generates a JSON task list in the following format: [{"task_id": 1, "task_type": "DATA_QUERY", "description": "Query the total number of immigrant villages in each city in 2024 and 2025"}, {"task_id": 2, "task _type": "DATA_QUERY","description": "Query the number of immigrant villages with cultural activity rooms in each city in 2024 and 2025"}].
[0029] The task list contains only the `task_id`, `task_type` (of type `DATA_QUERY`), and `description` fields, without any computational logic or filtering conditions. Through this mechanism, the system transitions the global state machine's state from `START` to `DATA_SELECT`, ensuring the determinism and security of the task starting point and effectively avoiding task chain breaks or illusions caused by prematurely introducing complex logic.
[0030] Step S300: In response to the current task being a data query task, perform interface routing and field matching based on the interface semantic constraint space to execute the data query, and update the query results to the global context; wherein, the interface semantic constraint space includes the interface summary information and interface detail information of multiple data interfaces.
[0031] In this embodiment, the interface semantic constraint space refers to a pre-built structured semantic knowledge base based on multiple heterogeneous data interfaces. It contains two levels of description: a summary of each data interface and detailed information about each interface. This space is used to constrain and guide the interface selection and field matching behavior of the large model during data querying, enabling the large model to complete interface routing and field location at the semantic level, rather than solely relying on keyword matching. Specifically, when the generated current execution task type is DATA_QUERY, the system calls the query execution module. This module, based on the pre-built interface semantic constraint space, accurately routes to the target interface from numerous heterogeneous APIs and matches the corresponding fields. After the query is completed, the system not only obtains the raw data but also encapsulates the results into a structured format and feeds them back to the global context. For example, the JSON format returned by the query results includes the data_path (data storage path) and data_sample (first few data samples) fields, such as: [{"task_id": 1,..., "data_path": " / path / data1.csv", "data_sample": [...]}]. The global context is then updated to include these newly acquired data assets and their metadata information. This step maps abstract query intent to specific physical data and provides factual basis for subsequent dynamic decision-making.
[0032] Step S400: In response to the current task being a numerical calculation task, generate and execute numerical reasoning code based on the industry rule base and cross-table association logic, and update the reasoning result to the global context.
[0033] In this embodiment, the industry rule base refers to a set of functions encapsulating specific business calculation logic in the field of water conservancy and resettlement. It provides core business calculation capabilities such as completion rate calculation, financial consistency auditing, and dimensional conflict elimination in the form of pre-defined industry rule functions, providing rigid calculation constraints for the generation of numerical reasoning code and preventing large models from arbitrarily creating calculation formulas. Cross-table association logic refers to structured knowledge describing the field relationships and physical alignment rules between multiple data interfaces. It includes association primary key fields and business association fields, used to provide physical alignment benchmarks and business logic constraints during cross-table data fusion, ensuring that data from different sources can be associated and calculated on the correct dimensions.
[0034] Specifically, when the global state machine transitions to a stage requiring numerical processing, and the current task is determined to be a numerical computation task, the system no longer performs simple data retrieval but instead switches to code generation and execution mode. This process is strictly controlled by the industry rule base and cross-table join logic to ensure that the generated inference code conforms to the specific calculation specifications and data alignment requirements of water conservancy and resettlement business. The inference results after execution are also structured and updated to the global context, making the intermediate computation products new inputs for subsequent task orchestration. It should be understood that the numerical computation task is not generated in the initial stage, but is triggered by the dynamic orchestration mechanism after the basic data is complete, which reflects the "look up first, calculate later" reactive execution logic of this application.
[0035] Step S500: Execute the multi-stage dynamic task orchestration and the currently executing task in a loop until the global state machine meets the closed-loop condition, and output the decision results based on the analysis requirements.
[0036] In this embodiment, the closed-loop condition refers to the termination criterion used by the global state machine to determine that the current analysis requirements have been fully met. Specifically, when the data assets and inference results in the global context completely cover all data dimensions and computational logic involved in the user's original analysis requirements, the closed-loop condition is considered met, and the global state machine then transitions to the FINISH state and triggers the output of the final decision result. Specifically, the above steps S200 to S400 constitute a dynamic iterative closed loop. Whenever a task is completed and the global context is updated, the global state machine re-enters the task orchestration state (such as the THINKING state). Based on the comparison result of the latest context and analysis requirements, it decides whether to continue generating new data query tasks, start numerical calculation tasks, or determine that the requirements have been met, thereby triggering the closed-loop condition. Only when the data and inference results in the global context completely cover the user's original analysis requirements does the state machine transition to the FINISH state and output the final decision result.
[0037] This cyclical execution mechanism breaks the rigid limitations of traditional linear workflows, enabling the system to autonomously adjust its path based on data feedback. This allows it to handle complex scenarios such as cross-year and multi-condition complex constraints commonly encountered in water conservancy resettlement data analysis.
[0038] Example 2 Building upon Example 1, as an optional implementation, after obtaining the task execution results, subsequent data query tasks or numerical calculation tasks are dynamically generated based on the updated global context. This includes merging the task execution results into the global context and making branch decisions based on the comparison between the global context and the analysis requirements. Specifically, when the system leaves the initial state and enters the dynamic step-by-step orchestration stage dependent on the context, whenever the task execution module completes the task and returns the result, the state value of the global state machine changes to THINKING. At this time, the decision center merges the new results into the global context and faces branch decisions based on the latest context state. To achieve this process, the system injects specific role definition prompts into the large model, setting it as the "business scheduling decision-making brain that dynamically directs subsequent actions based on the latest context." This prompt explicitly requires the model to carefully compare the "original total requirements" with the "currently acquired data" to determine the single highest priority task that should be executed next, and strictly limits the generation of only one task at a time, prohibiting the generation of long-chain tasks to prevent logical divergence.
[0039] In this branch decision-making mechanism, the system defines three specific decision paths. If it is determined that the basic data is incomplete or that new entities have not been queried, a new data query task is generated. This corresponds to branch A (data incomplete, continue querying), that is, when it is found that basic data for certain dimensions is missing in order to answer the requirements, or when the previous calculation result has generated a batch of new entities (such as a list of specific cities) that need to be further supplemented and detailed, the system generates a new DATA_QUERY task. For example, for the intermediate entities [Zhengzhou City, Luoyang City], the system can generate the following JSON format task instruction: {"action": "CALL_MODULE_3", "task_type": "DATA_QUERY", "description": "For the intermediate entities [Zhengzhou City, Luoyang City] calculated in the previous step, accurately query the database for the theoretical amount and actual amount disbursed for the post-recovery support funds for large and medium-sized reservoirs in these two cities in 2025."
[0040] If the system determines that the basic data is ready but no logical calculations have been performed, a numerical calculation task is generated. This corresponds to branch B (data ready, start calculation), where the system generates a NUMERICAL_COMPUTATION task when the required heterogeneous basic data is already in the context but logical comparison, merging, or formula calculations have not yet been performed. For example, the system can output the following JSON command: {"action": "CALL_MODULE_4", "task_type": "NUMERICAL_COMPUTATION", "data_sources":["path / to / total.csv","path / to / room.csv"], "calculation_requirement": "Merge two tables using the city-level administrative division as the common primary key. Filter out cities that meet the following conditions: the total number of immigrant villages in 2024 and 2025 is equal, and the number of cultural activity rooms in 2025 is less than the number in 2024. Output the list and characteristics of these cities."
[0041] If the data and inference results in the global context are determined to meet the analysis requirements, the loop closure condition is triggered. This corresponds to branch C (complete loop closure, task termination), at which point the global state machine state value becomes FINISH, and the loop exits to prepare for output.
[0042] When generating a new data query task, an incremental entity deduplication operation is performed: the difference between the new entity and the historical set of queried entities is calculated. If the difference is not empty, only the entity corresponding to the difference is injected as an incremental parameter into the new data query task, and the historical set of queried entities is updated. If the difference is empty, the generation of a new data query task is suppressed, and the process is forced to transfer to the branch that generates a numerical calculation task or triggers a loop closure condition. Specifically, to prevent a dead loop of repeated queries caused by intermediate calculation results, the decision center maintains a historical set of queried entities. When subsequent calculations generate new entities at different stages. At that time, the central processing unit first performs the difference operation:
[0043] in, This represents the set of all entities generated in the current computation step. This represents the set of all entities that the system has queried in this analysis task. This represents the incremental set of entities that have not yet been queried. If If the data is not empty, it indicates that there is a new information gap, and the system will only include... Injected as an incremental parameter into the task list, and Merging The state machine normally transitions to the DATA_SELECT state; if If the value is empty, it means that all newly generated entities have been covered by historical queries. In this case, orchestration suppression is triggered, strictly prohibiting the generation of duplicate DATA_QUERY tasks. The state machine is forced to transition to decision branch B (start computation) or branch C (terminate task). This mechanism eliminates the "query-computation" infinite loop caused by data circular dependencies at the algorithm level, ensuring that task orchestration always converges along the effective path.
[0044] As an optional implementation, multi-stage dynamic task orchestration also includes an exception recovery mechanism. During the execution of a data query task or numerical calculation task, if an execution exception is captured, a structured exception message containing the error type and cause is returned to the global state machine.
[0045] Specifically, when the query execution module or numerical inference module triggers the error capture mechanism (Try-Except) while running in the sandbox environment, the execution end does not directly throw out the raw stack information. Instead, it encapsulates it into a structured message containing the error type (ERROR_TYPE) and the specific reason and feeds it back to the decision center. In this embodiment, the structured exception message adopts JSON format and includes, but is not limited to, the following fields: error type, error code, error description (explaining the reason for the error in natural language), identifier of the failed task, and retry suggestion (a repair strategy prompt that can be automatically generated by the execution end based on the error type).
[0046] In response to a received structured exception message, the global state machine is changed to an error recovery state, and the error cause is re-injected as a negative constraint into the prompt words to re-orchestrate the multi-stage dynamic task. When the global state machine enters the ERROR_RECOVERY state, the decision center explicitly writes the specific error cause (such as "field type mismatch", "API timeout", etc.) as a negative constraint into the prompt words for the next round of orchestration, guiding the large model to avoid the operation path that caused the error, and to try to change the interface, adjust the parameters, or correct the code logic, thereby achieving the system's self-correction.
[0047] In this embodiment, the specific implementation of negative constraint injection can be as follows: when the system constructs the prompts for the next round of arrangement, it adds a "negative constraint list" paragraph after the original role definition and task requirements. This paragraph is presented in the form of explicit prohibitive instructions.
[0048] For example, when an API timeout error is received, the system will inject the following constraints into the prompt: "
Negative Constraint List
[0049] To ensure the system's robustness in complex heterogeneous environments and prevent infinite retries, this embodiment also introduces a dual circuit breaker mechanism based on depth and frequency. A loop counter is maintained and incremented each time the global state machine enters a multi-stage dynamic task orchestration phase. Specifically, the system initializes a loop counter `Counter=0` when the global state machine is in the `START` state, and increments `Counter=Counter+1` each time the state machine enters the `THINKING` state. If the same error type occurs consecutively more than a preset number of retries, or if the loop counter exceeds a preset depth threshold, the global state machine is changed to a forced termination state, triggering an exception degradation output. For example, when `Counter` exceeds the preset threshold `N`, it indicates that the system cannot close the loop of the user's intent within a finite number of steps in the current context; the state machine will forcibly break the loop and change the global state to `TERMINATE_TIMEOUT`. If the same error type (such as a specific interface call failure) occurs consecutively more than a preset number of times (e.g., 2 times), it indicates that the error is unrecoverable in the current environment; the state machine directly changes the global state to `TERMINATE_FAILED`. This dual circuit breaker mechanism effectively prevents the system from falling into an ineffective infinite loop or a state of resource exhaustion.
[0050] To ensure a good user experience, the system employs differentiated output strategies for different final states. When the global state machine satisfies the closed-loop condition, it integrates the global context and outputs a statistical analysis summary containing natural language responses and the address of a structured data file. Specifically, when the state is FINISH, the system utilizes the general text summarization capabilities of the large model to convert the final global context into an easy-to-understand natural language response, directly addressing the user's original needs. Simultaneously, to ensure the rigor and traceability of the analysis results, the system explicitly lists the URL of the standardized structured data file (such as CSV or Excel) generated by the execution end at the end of the question-and-answer summary.
[0051] Here is an example of the prompt for achieving this output: "You are a question-and-answer assistant responsible for summarizing and presenting the final analysis results to users. The input context includes the user's original needs and the query and calculation results at each stage. The output task requires you to directly output the following two parts: 1. Use clear and natural language to answer the user's original questions and summarize the core data that has been calculated and filtered; 2. Explicitly list the detailed data file display addresses on which this analysis is based, so that users can easily trace them." When the global state machine triggers a forced termination state due to timeout or execution failure, the general question-and-answer summary stops, and anomaly degradation output is triggered. Anomaly degradation output includes: calling the large language model to perform a visual review of the global context, executed task chains, and underlying error information; outputting a fault cause analysis and a report of completed interim results; and providing the path to the structured data files generated before the interruption. Specifically, when the state is TERMINATE_TIMEOUT or TERMINATE_FAILED, the system no longer attempts to answer the original questions but switches to "fault diagnosis mode." The large model comprehensively analyzes the current global context, executed task sequences, and underlying error information to generate a visual review document containing a "fault cause analysis" and a "report of completed interim results."
[0052] An example fault diagnosis prompt is as follows: "You are a technical assistant responsible for generating a task execution review report. The input context includes the user's original requirements, the sequence of executed tasks, captured anomaly information, and a list of generated data files. The output task requires generating a structured fault diagnosis report, including: 1. Task execution overview (number of executed tasks, number of successful tasks, number of failed tasks); 2. Fault cause analysis (inferring the root cause based on anomaly information and providing possible remediation suggestions); 3. Completed interim results (listing all successfully generated data files and their descriptions in tabular form); 4. Explanation of incomplete parts (clearly indicating which analysis steps failed to be executed)." The large model comprehensively analyzes the current global context, the executed task sequence, and underlying error information to generate a visual debriefing document containing "fault cause analysis" and "completed interim results report." For example, the report will clearly state that "the task was interrupted due to the XX interface returning 500 errors three times consecutively," and simultaneously list interim results such as "successfully obtained the total number of immigrant villages in 2024" and their file paths. This degraded output mechanism ensures that even in extreme and abnormal situations, users can still obtain interpretable process information and some valid data, avoiding the "all right or none" experience gap of traditional systems, and significantly improving the system's usability and fault tolerance.
[0053] Example 3 Building upon Example 1, this example further elaborates on the construction and routing matching mechanism of the interface semantic constraint space to support the semantic space's ability to accurately constrain the behavior of large models. As an optional implementation, interface routing and field matching based on the interface semantic constraint space include: initial interface selection based on interface summary information in the interface semantic constraint space to lock the target interface; the interface summary information includes positive matching features and negative exclusion boundaries.
[0054] Specifically, to prevent large models from mistakenly selecting interfaces due to similar summary information, the system defines positive matching features (recommended labels) and negative exclusion boundaries (strict selection boundaries) for each interface. For example, for a funding-related interface, its positive matching features are set as follows: focusing on the entire funding process: such as "funds carried over from last year", "current year's income / expenditure", and "amount carried over to next year"; mentioning the breakdown of funding sources: such as "central government funds", "local government funds", "reservoir area funds", and "electricity price surcharge funds"; and prioritizing the exclusion of this interface when the user query contains project / number of people / engineering attributes.
[0055] In addition, the system is configured with typical query examples to assist the model in semantic alignment, such as: "How many people in XX County received post-recovery support in 2024? - Perfect match. This interface includes the total number of people receiving post-recovery support"; "Of the people receiving post-recovery support for large and medium-sized reservoirs in XX Province, how many chose direct subsidies? - Match. This interface can be further subdivided into the 'direct subsidy to the person' dimension."
[0056] During the initial interface selection, the system injects the following prompt into the large model: "You are now an API routing expert. The current task to be executed is known to be: [Enter the current query intent here]. Summary of currently available interfaces: [Enter the summary information of each interface here]. Instruction requirement: Based on the business keywords in the task, please select the interface most likely to contain the data from the above summary. You only need to provide the interface number; it is strictly forbidden to output any other unnecessary information." Through this combination of positive and negative rules and instance guidance, the system can quickly identify high-confidence target interfaces in the initial stage, avoiding contextual noise interference and token waste.
[0057] Field location is performed based on the interface details information of the target interface. Specifically, the interface details information contains a structured list of fields, such as: [{'Column Name': 'Report Year', 'Unit': ''}, {'Column Name': 'Project Name', 'Unit': ''}, {'Column Name': 'Project Overview / Total Designed Reservoir Capacity', 'Unit': '100 Million Cubic Meters'}, {'Column Name': 'Project Overview / Design Installed Capacity', 'Unit': '10,000 kilowatts'}, ...] For a given query intent, the system identifies a unique field semantically equivalent to the query intent from the candidate fields of the interface details information. For example, when the task is to retrieve the "Total Number of Immigrant Villages" field, the system uses the following prompt: Current task: Retrieve the 'Total number of immigrant villages' field.
[0058] Candidate field list: [Enter the list of fields for the target interface].
[0059] Requirements: Find semantically equivalent fields. Avoid being misled by complex hierarchical paths; focus on the business essence of the fields (e.g., 'total', 'number', 'quantity'); return only the corresponding standard field names, and strictly prohibit outputting other content; if no semantically equivalent field is found, return 'None'. This semantic equivalence recognition mechanism ensures a high field hit rate in precise query scenarios.
[0060] To address broad query intents, a dual filtering mechanism of business tags and semantics is employed to select a set of fields from candidate fields that conform to the preset business tag definitions or semantic categories. Specifically, the system pre-constructs a business tag ontology covering five dimensions of water conservancy resettlement, including: [Engineering Foundations] (involving reservoir capacity, installed capacity, approval time, etc.), [Spatiotemporal Dimension] (involving year, administrative division, etc.), [Planning Indicators] (involving expected data in the design and approval stages), [Execution Status] (involving actual completion, relocation progress, etc.), [Funding Details] (involving central / local funds, revenue and expenditure carryover, etc.), and [Livelihood Indicators] (involving income, housing, social security, etc.). To achieve automated field tagging, the system designs the following prompt-driven large model: # Role Definition: You are a senior water conservancy resettlement data analysis expert with extensive business background in the "Statistical Reports for Resettlement of Large and Medium-Sized Reservoirs". Your task is to assign predefined business attribute labels to each field based on the provided field list, so that the agent can perform accurate task planning in the future.
[0061] # Predefined tag system Please select the most appropriate labels from the following dimensions to assign to the fields (multiple selections are allowed): [Engineering Fundamentals]: This involves the physical or managerial attributes of the project, such as reservoir capacity, installed capacity, and approval time.
[0062] [Spatiotemporal Dimension]: Involves location information such as year, administrative division, and project location.
[0063] [Planning Indicators]: Expected data related to the design, planning, and approval stages.
[0064] [Execution Status]: This includes implementation data such as actual completion, relocation progress, and amount invested.
[0065] [Fund Details]: Financial data including central / local government funds, revenue and expenditure carryover, compensation fees, etc.
[0066] [Livelihood Indicators]: These include data on quality of life such as income, housing, social security, and infrastructure coverage.
[0067] # Output format requirements Please output in JSON array format, including: field name, original unit, business tag, and a brief description of the logic.
[0068] # Expected Output Example [ { Field Name: "Project Overview / Design Installed Capacity", Unit: 10,000 kilowatts "Business Tags": ["Engineering Fundamentals", "Planning Indicators"], "Logical Summary": "A technical parameter belonging to engineering design, used to define the scale of the project." }, { Field Name: "Relocation and Resettlement / Number of People Relocated / Rural Migrants", "Unit": "person", "Business Tag": ["Execution Status"], "Logical Summary": "Data reflecting the actual progress of the relocation and resettlement process." } ] Based on these tags, when faced with broad intents such as "querying 'immigrant resettlement status'", the system triggers double filtering by prompting the instruction "This is a broad intent. Please combine field names and tag information to extract all fields related to the query intent". This maximizes the coverage of relevant data and avoids information omissions due to non-standard field naming.
[0069] If neither the explicit query intent nor the broad query intent locates a valid field, the initial interface selection is deemed incorrect, and the initial interface selection is re-executed. Specifically, when the system cannot find a matching field in the detailed information of the selected interface, it automatically triggers an error correction mechanism, removing the currently failed interface from the candidate list of prompt words in the next round of interface selection, forcing the model to search for the answer among other potential interfaces. This progressive disclosure and retry mechanism effectively solves the semantic ambiguity and field omission problems under non-standard interface systems, ensuring the integrity of data acquisition.
[0070] As an optional implementation, the interface semantic constraint space also includes cross-interface business association logic, which is dynamically injected into the multi-stage dynamic task orchestration as a priori business constraint topology graph.
[0071] Specifically, conventional general-purpose large models often suffer from "spatial physical alignment fragmentation" or "business logic mismatch" when handling heterogeneous data across multiple tables due to a lack of industry common sense. To address this, this embodiment constructs rigid constraints by mining cross-interface relationship logic. This mining process includes three steps: First, manually identifying interface pairs with strong business logic relationships, such as "Interface A - Immigration Settlement Planning" and "Interface B - Immigration Settlement Implementation"; second, identifying frequently co-occurring field pairs between these two interfaces based on user historical behavior logs; and finally, describing the actual relationship logic based on detailed field information. The final relationship logic description is stored in JSON format, for example: [ { "Related fields": ["Interface A - Rural Migrant Resettlement Planning / Relocation and Resettlement Population", "Interface B - Relocation and Resettlement / Number of Migrants Relocated / Rural Migrants"], "Related primary key": ["Project Name", "Administrative Division Code"], "Association Logic": "Planning-Execution Comparison Logic. Interface A provides the expected relocation indicators during the engineering design phase, while Structure B provides the actual completion indicators during the construction and resettlement phase. After aligning the two by project name, they can be used to calculate resettlement progress percentages and task completion rates, etc." }, { "Related Fields": ["Interface C - Completed Funding Status / Direct Subsidies to Individuals", "Interface D - Central Government Funds / This Year's Expenditure / Post-Relocation Support Fund for Large and Medium-Sized Reservoir Immigrants"] "Related primary key": ["Year"], "Relationship Logic": "Funds flow tracing logic. Interface D records the total expenditure of centrally allocated funds from a financial perspective, while Interface C records the specific execution amount of funds disbursed to individuals from a business perspective. The relationship is used to verify the consistency between financial expenditures and business disbursements." } ] Cross-interface business association logic includes primary key fields and business association fields. The primary key field is a globally unique field shared across multiple data interfaces, used to provide a physical alignment benchmark during cross-interface horizontal splicing. Business association fields are pairs of fields with business logic relationships across multiple data interfaces, accompanied by a description of the association logic, including planning and execution comparison logic or fund flow tracing logic. In multi-stage dynamic task orchestration, cross-interface business association logic acts as a strong constraint boundary condition, limiting the path divergence and logical leaps in multi-stage dynamic task orchestration. Specifically, the primary key fields, business association fields, and their association logic extracted above are not merely stored as static mappings, but rather as a set of prior business constraint topology maps, dynamically injected into the prompts of the large model during the multi-stage dynamic task orchestration process described in Example 1. This means that even in the event of an initial data vacuum or facing fuzzy semantic input, the decision-making center can still force task planning along the correct water conservancy industry business context (e.g., aligning planning and execution data based on "project name" and verifying fund flow based on "year") based on these rigid semantic constraints. This mechanism fundamentally eliminates the problems of blind arrangement, incorrect splicing, or logical leaps caused by a lack of industry common sense in general large models, ensuring business compliance and accuracy of results in the analysis and decision-making process.
[0072] Example 4 Building upon embodiments 1 to 3, as an optional implementation, numerical reasoning code is generated based on an industry rule base and cross-table association logic. This includes: before generating the numerical reasoning code, a mandatory check of the tool library description file in the industry rule base is performed. Specifically, the water conservancy and resettlement field has unique multidimensional conflicts and differences in scope. For example, the "total expenditure in the financial dimension" at the funding level and the "specific execution amount issued to individuals" at the business level have fundamental differences in statistical scope and verification logic, as well as frequent conversions between "person" and "household". Conventional general code generation technologies, lacking an understanding of the rigidity of vertical industry policies, easily cause self-generated calculation scripts to ignore the above-mentioned conversions and consistency checks, leading to serious calculation logic drift. To address this deficiency, this embodiment mandates that the large model read and understand the tool library description file before writing the script. This file contains the method names, functions, and parameter information of each tool, ensuring that the model can accurately call the pre-set industry rule operators when generating code, rather than freely creating calculation formulas.
[0073] If the numerical calculation task involves preset core business calculations, code instructions that call the corresponding industry rule functions in the industry rule library are generated and embedded as atomic plugins in the numerical inference code. Core business calculations include completion rate calculation, financial consistency audit, or dimensional conflict resolution. In this embodiment, an atomic plugin refers to the smallest indivisible functional unit in the numerical inference code, embedded in the code in the form of function calls, used to execute specific industry rule calculations. The core feature of atomic plugins lies in their functional atomicity—each plugin corresponds to an independent business calculation logic (such as completion rate calculation, fund consistency verification, or dimensional conversion), and must be implemented by functions pre-defined in the industry rule library, rather than being freely generated by a large model, thereby ensuring the determinism and compliance of core business calculations. Specifically, the system encapsulates the specific policy calculation logic in the field of water conservancy and resettlement into rigid industry rule atomic plugins. For example, when a task involves analyzing the progress of relocation and resettlement, the `calc_move_progress(planned, actual)` function must be called to automatically calculate the completion rate by inputting the planned and executed numbers; when it involves verifying the compliance of funds, the `check_fund_consistency(finance_total, business_detail)` function must be called to verify the consistency between the total expenditure in the financial dimension and the specific execution number of individual payments in the business dimension; when there are differences in statistical units, the `convert_dimension_unit(data, from_unit, to_unit)` function must be called to handle conflicts in units such as "person" and "household".
[0074] Based on the primary key specified in the cross-table join logic, a cross-table fusion instruction is generated. This instruction restricts the numerical inference code to physical alignment of data tables based on the primary key, prohibiting horizontal concatenation without a primary key. Specifically, to prevent spatial physical alignment fragmentation, the system sets a physical alignment defense based on the business join primary key in the prompt. When dynamically constructing the computation script, the system provides four key inputs to the large model: the numerical inference task requirements issued by the multi-stage dynamic task orchestration, the data storage path required for numerical inference, the tool library description file path, and the cross-interface business join logic constructed in the interface semantic constraint space.
[0075] Based on this, the system injects complete prompts for a dual rigid constraint framework, defining the role as "a top expert proficient in Python data science and water conservancy industry immigration statistics".
[0076] The prompt, as the second constraint in the dual rigid constraint framework, explicitly prohibits blind horizontal splicing or row alignment of multiple data tables. Cross-table merging must be performed based on the primary keys specified in the cross-interface business logic (such as "project name" or "administrative division code"), using `pd.merge(..., on=['project name', 'administrative division code'])` or explicit index alignment to ensure precise alignment of planning and execution metrics on the same physical entity. Simultaneously, the prompt also specifies exception robustness boundaries, requiring the code to include a robust Try-Except error handling mechanism. If a calculation exception is caught, a structured error reason must be output via `print(f"ERROR_TYPE: {e}")` so that the central state machine can capture and trigger error recovery. Furthermore, the output format is strictly limited to outputting only Python code blocks that can run in the sandbox, prohibiting any natural language explanations or Markdown text descriptions to avoid non-code content interfering with subsequent execution.
[0077] Specifically, examples of prompt words are as follows: # Role Definition You are a top expert in Python data science and water industry immigration statistics.
[0078] # Input data The dataset to be processed is stored in the path [Enter the path to the CSV file containing the data required for computation output from Module 2]. The data profile is as follows: [Enter Data Example] The relationship information between the data table and its fields includes: [the relationship information modeling constructed in Module 1]. # Your task: [Fill in the deep numerical reasoning requirements output from Module 2].
[0079] # Available tool library description files: [Enter the path to the tool library description file.]
[0080] # Task Requirements (A dual rigid constraint framework that must be strictly adhered to): 1. Rigid Defense Line One: Industry-Specific Rule Functions for Mandatory Judgment and Dimensional Alignment Before you write the computational logic, you must first check the [Available Tool Library Description].
[0081] - Strong validation constraints If the task involves "completion rate / progress calculation", `calc_move_progress(planned, actual)` must be called directly; if it involves "comparison of total financial expenditure and individual disbursements", `check_fund_consistency(finance_total, business_detail)` must be called for consistency auditing; if there are statistical differences between "person" and "household", `convert_dimension_unit` must be called first to eliminate the conflict of units.
[0082] - It is strictly forbidden to write the calculation formulas for the above core business logic yourself. The above rule functions must be embedded into your code as atomic plugins.
[0083] 2. Rigid Defense Line Two: Physical Alignment Based on Business-Related Primary Keys - Blindly horizontally splicing, aligning rows, or merging without a primary key between two or more data tables is strictly prohibited, otherwise it will result in the fragmentation of spatial physical alignment.
[0084] - Cross-table merging must be performed using `pd.merge(..., on=['Project Name', 'Administrative Division Code'])` or explicit index alignment based on the "Related Primary Key" specified in [Related Information Modeling] (e.g., ['Project Name', 'Administrative Division Code']), to ensure that planning indicators and execution indicators are accurately aligned on the same physical entity.
[0085] 3. Abnormal robustness boundary - Considering that water conservancy resettlement data may contain missing values or type anomalies caused by unit conflicts, the code must include a robust error capture mechanism (Try-Except).
[0086] - If a computational exception is caught, a structured error reason must be output via `print(f"ERROR_TYPE: {e}")` so that the central state machine can capture and trigger error recovery.
[0087] # Output format requirements Output only Python code blocks that conform to the standards and can be run directly in the isolated sandbox. The inclusion of any natural language interpretations or Markdown text is strictly prohibited. As an optional implementation, the industry rule base encapsulates specific policy calculation logic, financial audit rules, and spatial alignment algorithms for the water conservancy and resettlement field. Numerical inference code is executed in an isolated environment, which is a code execution sandbox pre-installed with data analysis libraries and declaring the industry rule base's calling interface. Specifically, to ensure code execution security and environmental consistency, the system builds an isolated Python code execution sandbox. This sandbox environment pre-installs standard data analysis libraries such as pandas and numpy and pre-declares the calling interface of the industry rule function library, providing physical runtime support for scripts generated from large models. This isolation mechanism prevents malicious code from harming the host system and ensures that all numerical inference tasks run in a unified and controlled environment, avoiding inconsistencies in calculation results caused by environmental differences.
[0088] If a computational anomaly is captured while executing numerical inference code in an isolated environment, the error reason is output through a structured error output statement. This allows the global state machine to capture the error and re-orchestrate multi-stage dynamic tasks based on the reason. Specifically, when an exception is triggered during code execution within the sandbox, the system does not directly throw out the original stack trace. Instead, it uses the aforementioned structured error output statement to feed back the error type and specific reason to the decision center. This enables the global state machine to identify specific fault modes (such as failed dimension conversion, missing primary keys, etc.) and inject this information as negative constraints into the next round of task orchestration, thereby achieving self-correction and dynamic adjustment of the computation process.
[0089] After executing the numerical inference code, the resulting data is encapsulated and stored, and a structured representation containing data descriptions and addresses is generated. This structured representation is then fed back to the global context. Specifically, intermediate or final results generated by numerical inference are not directly printed or discarded, but are encapsulated and stored as standardized data files (such as CSV format). Subsequently, the system generates a JSON-formatted structured representation containing "data descriptions" and "data addresses," for example, [{"data description": "changes in cultural activity rooms in immigrant villages in various cities from 2024 to 2025", "data address": " / path / to / result.csv"}]. This structured representation is fed back to the global context, enabling subsequent dynamic task orchestration to accurately perceive the completed computational results and their physical storage locations, providing reliable data assets for incremental queries or final summaries. This standardized result feedback mechanism establishes a complete computational compliance chain from "generation-execution-feedback," ensuring the traceability and stability of complex inference tasks.
[0090] Example 5 The present invention also provides an autonomous analysis and decision-making device for water conservancy resettlement data, the device comprising: The task orchestration module is used to receive analysis requirements for water conservancy resettlement data, initialize the global state machine and global context; based on the global state machine and global context, perform multi-stage dynamic task orchestration on the analysis requirements to generate the currently executing task; wherein, the multi-stage dynamic task orchestration includes: generating a data query task without prerequisite dependencies in the initial state, and dynamically generating subsequent data query tasks or numerical calculation tasks based on the updated global context after obtaining the task execution results; The query execution module is used to respond to the current execution task being a data query task, perform interface routing and field matching based on the interface semantic constraint space to execute the data query, and update the query results to the global context; wherein, the interface semantic constraint space includes interface summary information and interface detail information of multiple data interfaces; The numerical reasoning module is used to generate and execute numerical reasoning code based on the industry rule base and cross-table association logic in response to the current execution task being a numerical calculation task, and update the reasoning result to the global context. The task orchestration module is also used to cyclically execute the multi-stage dynamic task orchestration and the currently executing task until the global state machine meets the closed-loop condition and outputs the decision result for the analysis requirements.
[0091] It should be noted that the autonomous analysis and decision-making device for water conservancy resettlement data provided in this embodiment of the invention can execute the autonomous analysis and decision-making method for water conservancy resettlement data described in any of the above embodiments during specific operation, which will not be elaborated in this embodiment.
[0092] Example 6 This embodiment provides an electronic device. The electronic device includes a memory and a processor. Specifically, the memory is configured to store a computer program and various types of data related to autonomous analysis and decision-making of water conservancy and resettlement data, such as a global context cache, interface semantic constraint space configuration, industry rule base files, cross-table association logic models, and intermediate results and final decision data generated during task execution. The processor is configured to execute the computer program stored in the memory to implement the steps of the autonomous analysis and decision-making method for water conservancy and resettlement data described in any of the foregoing method embodiments (such as Embodiments 1 to 5).
[0093] In practical implementation, when the processor calls and executes the computer program, its internal logic circuits or microarchitecture are driven to complete a series of specific data processing operations. For example, in response to the received analysis request for water conservancy resettlement data, the processor first initializes the global state machine and global context object in memory. Subsequently, the processor performs multi-stage dynamic task orchestration for the analysis request according to program instructions, generating data query tasks or numerical calculation tasks based on the current state machine state and context content. When executing a data query task, the processor calls network communication components or local database interfaces, completes interface routing and field matching based on the interface semantic constraint space, and writes the obtained data into the global context area in memory. When executing a numerical calculation task, the processor loads industry rule bases and cross-table association logic, dynamically generates numerical inference code, executes it in an isolated sandbox environment, and updates the inference results to the global context. Finally, the processor cyclically executes the above orchestration and execution process until the global state machine meets the closed-loop condition, and outputs the decision results for the analysis request through the output interface or display component.
[0094] It should be understood that the electronic device in this embodiment can be an independent server, personal computer, mobile terminal, or a computing node in a distributed cloud computing cluster. As long as it has memory and a processor and can execute the above-mentioned program logic, it falls within the protection scope of this application. In this way, general-purpose computer hardware is endowed with the ability to specifically handle complex data analysis tasks related to water conservancy and resettlement, realizing the engineering implementation from abstract algorithms to physical entities, ensuring the feasibility of the technical solution in practical application environments and the coverage of infringement determination.
[0095] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for autonomous analysis and decision-making based on water conservancy resettlement data, characterized in that, include: Receive analysis requests for water conservancy resettlement data and initialize the global state machine and global context; Based on the global state machine and the global context, the analysis requirements are dynamically orchestrated in multiple stages to generate the currently executing task; wherein, the multi-stage dynamic task orchestration includes: generating a data query task without any prerequisites in the initial state, and dynamically generating subsequent data query tasks or numerical calculation tasks based on the updated global context after obtaining the task execution results. In response to the current task being a data query task, interface routing and field matching are performed based on the interface semantic constraint space to execute the data query, and the query results are updated to the global context; wherein, the interface semantic constraint space includes interface summary information and interface detail information of multiple data interfaces; In response to the fact that the currently executing task is a numerical calculation task, numerical reasoning code is generated and executed based on the industry rule base and cross-table association logic, and the reasoning result is updated to the global context; The multi-stage dynamic task orchestration and the currently executing task are executed cyclically until the global state machine satisfies the closed-loop condition, and the decision result for the analysis requirements is output.
2. The autonomous analysis and decision-making method for water conservancy resettlement data according to claim 1, characterized in that, The step of dynamically generating subsequent data query tasks or numerical calculation tasks based on the updated global context after obtaining the task execution result includes: The task execution results are merged into the global context, and branch decisions are made based on the comparison results between the global context and the analysis requirements; If it is determined that the basic data is incomplete or that a new entity has not been queried, a new data query task will be generated. If it is determined that the basic data is ready and no logical calculation has been performed, then a numerical calculation task is generated. If it is determined that the data and inference results in the global context meet the analysis requirements, then the closed-loop condition is triggered; Specifically, when generating a new data query task, an incremental entity deduplication operation is performed: the difference between the new entity and the historical set of queried entities is calculated. If the difference is not empty, only the entity corresponding to the difference is injected as an incremental parameter into the new data query task, and the historical set of queried entities is updated. If the difference is empty, the generation of the new data query task is suppressed, and the branch is forced to generate a numerical calculation task or trigger a closed-loop condition.
3. The autonomous analysis and decision-making method for water conservancy resettlement data according to claim 2, characterized in that, The multi-stage dynamic task orchestration also includes an anomaly recovery mechanism, which includes: If an execution exception is detected during the execution of the data query task or the numerical calculation task, a structured exception message containing the error type and error reason is returned to the global state machine. In response to receiving the structured exception message, the state of the global state machine is changed to the error recovery state, and the error cause is re-injected as a negative constraint condition to re-orchestrate the multi-stage dynamic task. Maintain a loop counter, incrementing the loop counter each time the global state machine enters the multi-stage dynamic task orchestration; If the same error type occurs consecutively for more than the preset number of retries, or if the loop counter exceeds the preset depth threshold, the state of the global state machine will be changed to a forced termination state, and an abnormal degradation output will be triggered.
4. The autonomous analysis and decision-making method for water conservancy resettlement data according to claim 1, characterized in that, The interface routing and field matching based on the interface semantic constraint space includes: Initial interface selection is performed based on the interface summary information in the interface semantic constraint space to lock in the target interface; the interface summary information includes positive matching features and negative exclusion boundaries; Field location is performed based on the interface details information of the target interface; For a given query intent, identify a unique field from the candidate fields of the interface details that is semantically equivalent to the given query intent; For broad query intents, a dual filtering mechanism of business tags and semantics is adopted to filter out a set of fields that conform to the preset business tag definition or semantic category from the candidate fields; If neither the explicit query intent nor the broad query intent locates a valid field, the initial interface selection is determined to be incorrect and the initial interface selection is re-executed.
5. The autonomous analysis and decision-making method for water conservancy resettlement data according to claim 4, characterized in that, The interface semantic constraint space also includes cross-interface business association logic, which is dynamically injected into the multi-stage dynamic task orchestration as a priori business constraint topology graph. The cross-interface business association logic includes a primary key field and a business association field; The primary key field is a field that is common to multiple data interfaces and has global uniqueness. It is used to provide a physical alignment benchmark when horizontally splicing across interfaces. The business-related fields are pairs of fields with business logic relationships among multiple data interfaces. The business-related fields are accompanied by a description of the relationship logic, which includes planning and execution comparison logic or fund flow tracing logic. In the multi-stage dynamic task orchestration, the cross-interface business association logic serves as a strong constraint boundary condition, limiting the path divergence and logical traversal of the multi-stage dynamic task orchestration.
6. The autonomous analysis and decision-making method for water conservancy resettlement data according to claim 1, characterized in that, The numerical reasoning code generated based on the industry rule base and cross-table join logic includes: Before generating the numerical reasoning code, the tool library description file in the industry rule base is forcibly checked; If the numerical calculation task involves preset core business calculations, then code instructions that call the corresponding industry rule functions in the industry rule base are generated and embedded in the numerical reasoning code as atomic plug-ins. The core business calculations include completion rate calculation, financial consistency audit, or dimensional conflict elimination. Based on the primary key specified in the cross-table association logic, a cross-table fusion instruction is generated. The cross-table fusion instruction restricts the numerical reasoning code to perform physical alignment of the data tables based on the primary key and prohibits horizontal splicing without a primary key.
7. The autonomous analysis and decision-making method for water conservancy resettlement data according to claim 6, characterized in that, The industry rule base encapsulates specific policy calculation logic, financial audit rules, and spatial alignment algorithms for the field of water conservancy and immigration. The numerical inference code is executed in an isolated environment, which is a code execution sandbox with a pre-installed data analysis library and a declared industry rule base call interface; If a computational anomaly is captured when executing the numerical inference code in the isolated environment, the error reason is output through a structured error output statement so that the global state machine can capture it and re-orchestrate the multi-stage dynamic task based on the error reason. After executing the numerical reasoning code, the obtained result data is encapsulated and stored, and a structured representation containing data descriptions and data addresses is generated. The structured representation is then fed back to the global context.
8. The autonomous analysis and decision-making method for water conservancy resettlement data according to claim 3, characterized in that, The output includes decision results for the analysis requirements, including: When the global state machine satisfies the closed-loop condition, the global context is integrated to output a statistical analysis summary containing natural language responses and structured data file addresses; When the global state machine triggers the forced termination state due to timeout or execution failure, the general question-and-answer summary stops and the abnormal degradation output is triggered. The abnormal degradation output includes: calling the large language model to perform a visual review of the global context, the executed task chain, and the underlying error information; outputting a fault cause analysis and a report of completed phase results; and providing the path to the structured data file generated up to the time of interruption.
9. A device for autonomous analysis and decision-making of water conservancy resettlement data, characterized in that, include: The task orchestration module is used to receive analysis requests for water conservancy resettlement data and initialize the global state machine and global context. Based on the global state machine and the global context, the analysis requirements are dynamically orchestrated in multiple stages to generate the currently executing task; wherein, the multi-stage dynamic task orchestration includes: generating a data query task without any prerequisites in the initial state, and dynamically generating subsequent data query tasks or numerical calculation tasks based on the updated global context after obtaining the task execution results. The query execution module is used to respond to the current execution task being a data query task, perform interface routing and field matching based on the interface semantic constraint space to execute the data query, and update the query results to the global context; wherein, the interface semantic constraint space includes interface summary information and interface detail information of multiple data interfaces; The numerical reasoning module is used to generate and execute numerical reasoning code based on the industry rule base and cross-table association logic in response to the current execution task being a numerical calculation task, and update the reasoning result to the global context. The task orchestration module is also used to cyclically execute the multi-stage dynamic task orchestration and the currently executing task until the global state machine meets the closed-loop condition and outputs the decision result for the analysis requirements.
10. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.