An AI agent-based financial data automatic cleaning method and system
Patent Information
- Application Number
- CN202611416161.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-14
- Publication Date
- 2026-10-16
AI Technical Summary
例如,会计流水的摘要字段信息模糊且缺失收支方向标记,导致传统关键词匹配方法无法准确归集科目;又如,利息收入中“结息”与“欠款利息”在语义上高度相近,难以仅凭关键词区分
本发明通过“存储—调度”解耦架构,使文件二进制流不经由AI Agent节点中转,仅传递预签名访问凭证地址,解决了大规模数据清理中的内存瓶颈与系统稳定性问题。
Smart Images

Figure CN122925323A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of data processing and artificial intelligence, and specifically discloses a method and system for automated cleaning of financial data based on an AI Agent (artificial intelligence intelligent agent). Background Technology
[0002] The cleaning and standardization of raw financial data faces significant challenges during the digital transformation of finance. First, financial data is highly heterogeneous and unstructured. Paper vouchers contain numerous interfering images and have complex formats, while electronic transaction records exhibit significant header differences across different financial institutions, making unified management difficult. Second, raw data often contains semantic ambiguity and logical gaps. For example, the summary field of accounting transactions is often vague and lacks income / expenditure direction markers, making it impossible for traditional keyword matching methods to accurately categorize accounts. Similarly, in interest income, "interest settlement" and "interest on outstanding loans" are semantically very similar, making them difficult to distinguish based on keywords alone. Furthermore, cross-table joins often suffer from alignment difficulties due to missing key fields. In complex scenarios such as property mapping, a single field cannot uniquely identify the corresponding record, making manual alignment time-consuming and error-prone. Finally, large-scale financial data cleaning places stringent demands on system stability. Directly transferring binary file streams in the scheduling node can easily create memory bottlenecks, while unordered and unrestrained calls to large language models can easily lead to system crashes or request failures.
[0003] Existing financial data processing solutions mostly rely on fixed templates and rule scripts, lack the ability to automatically parse natural language cleaning intentions, cannot dynamically arrange processing flows according to business dependencies, and also lack a high-precision cleaning mechanism that combines financial business logic with the semantic capabilities of large language models.
[0004] Therefore, this invention provides an automated financial data cleaning method and system based on AI Agent, which can automatically parse cleaning intentions, decouple storage and scheduling, and has business logic reasoning capabilities. Summary of the Invention
[0005] The purpose of this invention is to provide an automated financial data cleaning method and system based on AI Agent, addressing the following technical problems: how to eliminate semantic ambiguity during financial data cleaning, how to perform data alignment during cross-table joins, and how to optimize system stability during large-scale cleaning; the specific solution is as follows: An automated financial data cleansing method based on AI Agent includes: temporarily storing the financial files to be processed in an object storage terminal and generating a pre-signed access credential address pointing to the financial files; using an AI Agent node with a built-in Planner task planner, decomposing the received natural language processing instructions using a chain of thought to generate a task execution sequence; the task execution sequence includes the tool call order and parameter dependencies; the AI Agent node, according to the task execution sequence, passes the pre-signed access credential address to the corresponding functional process in the cleansing process library, and the functional process reads the financial files from the object storage terminal and performs cleansing based on the pre-signed access credential address; wherein the binary stream of the financial files does not pass through the AI Agent node; the cleaned result file is written to the object storage terminal, and the AI Agent node returns the access address of the result file. The Planner task planner refers to a task orchestration component deployed in the AI Agent scheduling layer. Based on the chain of thought reasoning capability of a large language model, it semantically decomposes and logically reconstructs the natural language processing instructions input by the user, transforming ambiguous intentions into a structured task execution sequence composed of the tool call order and parameter dependencies, and is responsible for managing the parameter passing of tool calls and the verification of task dependencies. A pre-signed access credential is a temporary access link generated by the object storage terminal for temporarily stored financial documents. It includes the storage path, a time-sensitive signature, and an expiration timestamp. The authorized holder can perform read or write operations on the specified file within the validity period without exposing the storage account key. The validity period is set to 24 hours by default.
[0006] Furthermore, the method of using a thought chain to decompose the received natural language processing instructions includes: performing word segmentation and entity recognition on the natural language processing instructions; matching the closest intent type from a preset intent type enumeration table; and using the associated target tool of the closest intent type as the target tool; or matching the identified business object elements to the associated business domain; and locking the target tool within the functional tool set of the associated business domain in conjunction with the processing action; each record in the intent type enumeration table includes an intent type identifier, associated business domain, associated target tool, and a set of triggering keywords; parsing execution parameters for the target tool and generating a structured execution plan; the execution parameters include a pre-signed access credential address and a year parameter; and the structured execution plan includes an action type, a target tool identifier, and a year dimension.
[0007] Furthermore, the intent type enumeration table includes intents for accounting transaction classification, accounting income and expenditure statement generation, bank income and expenditure statement generation, invoice OCR recognition, property mapping and writing, and property table upload.
[0008] Furthermore, the process of locking the target tool includes: pre-configuring tool description information for each functional tool in the cleanup process library; the tool description information includes tool code, function description, description of applicable business scenarios, and a list of input parameters; matching the natural language processing instructions with the tool description information of each functional tool, selecting the most matching target tool, and outputting the selection result and confidence score; when the confidence score is higher than a preset threshold, the match is considered successful; when the confidence score is lower than or equal to the preset threshold, the AI Agent node returns a clarification request to the user.
[0009] Furthermore, the generation of the task execution sequence includes: embedding preset task dependency rules into the system prompts of the large language model, which then reads and adheres to the task dependency rules to generate the task execution sequence; the task dependency rules include mapping processing dependency rules, no-prerequisite dependency rules, and execution order constraint rules; the mapping processing dependency rule refers to determining whether the amount of data in the property table in the database is zero when the target tool is a property mapping writing tool; if it is zero, the property table upload tool is inserted as a prerequisite task; otherwise, it is executed directly; the no-prerequisite dependency rule refers to generating a single-step execution plan when the target tool is an accounting transaction classification tool, an accounting income and expenditure statement generation tool, a bank income and expenditure statement generation tool, or a document OCR recognition tool; the execution order constraint rule refers to arranging the execution sequence according to the dependency order when the same instruction involves multiple dependent subtasks, and configuring parallel execution when there is no dependency.
[0010] Furthermore, the AI Agent node has a built-in scheduling prompt word, which is loaded each time the large language model receives a natural language processing instruction. The scheduling prompt word includes a role definition part, an intent recognition and scheduling rule part, a tool-driven constraint part, and a result output constraint part: the role definition part is used to define the large language model as a data processing assistant; the intent recognition and scheduling rule part is used to define tool invocation rules and pre-confirmation rules; the tool-driven constraint part is used to require the large language model to refrain from self-calculation or inference, and all data processing results should come from the tool's return, and the file path and status information returned by the tool should be transmitted as is; the result output constraint part is used to require the final output to include a download link and to concatenate the complete file access address.
[0011] Furthermore, the cleanup process includes accounting transaction cleanup, cross-table data mapping, invoice OCR transcription cleanup, and automated summarization of bank income and expenditure statements. The accounting transaction cleanup includes: grouping accounting transactions by pre-signed access vouchers; adding income and expenditure direction markers to each group of vouchers based on the comparison between the total debit and credit amounts; and performing secondary classification on the data with added income and expenditure direction markers using a large language model in batches. The cross-table data mapping includes: simultaneously reading the mapping table and the benchmark data from the property table in the database, constructing a composite matching primary key, and performing matching; when a match is successful, obtaining the matching result and filling in the corresponding fields of the property table; the corresponding fields include transaction amount, owner name, and transaction time; when a match fails, including the corresponding data in the unmatched result set; and packaging the matching result and the unmatched result set back. The invoice OCR transcription cleanup includes: using AI... The Agent node schedules the corresponding OCR processing flow based on the intent recognition result of the natural language processing instructions; the selected OCR processing flow extracts images from the object storage terminal, performs text recognition, and transcribes them into a standardized structured file; the automated summary of the bank income and expenditure statement includes: traversing and reading multiple unprocessed bank statement files in the object storage terminal; using preset financial features to identify and match the corresponding expenditure code, interest code, or deposit code from the transaction summary; calculating the amount corresponding to each code according to the file dimension, and performing cross-file summary to generate the bank income and expenditure statement.
[0012] Furthermore, adding receipt and payment direction markings to the group of vouchers includes: filtering bank accounts marked as bank categories from all accounts in each group of vouchers using an account category lookup table, and including the detailed records of the matching bank categories in the calculation scope; merging and calculating the detailed records of all bank accounts in each group of vouchers, taking the total debit amount as the total debit amount, and taking the total credit amount as the total credit amount; marking it as receipt when the total debit amount is greater than the total credit amount; marking it as payment when the total debit amount is less than the total credit amount; marking it as change when the total debit amount is equal to the total credit amount; voucher groups marked as receipt and payment enter secondary classification, while voucher groups marked as change do not enter secondary classification and are output separately in the change summary table.
[0013] Furthermore, the step of calling the large language model in batches for secondary classification includes: grouping the data to be classified into groups according to a preset slice size; setting a dynamic waiting interval between each batch during cleanup; and generating a summary table and detailed sub-tables after the secondary classification is completed and storing them in the object storage terminal.
[0014] This invention also provides an AI Agent-based automated financial data cleaning system, applying any of the aforementioned AI Agent-based automated financial data cleaning methods, comprising an interactive perception layer, an Agent scheduling layer, a cleaning process library, and a persistent storage layer: the interactive perception layer includes a terminal interface unit and a result feedback unit; the Agent scheduling layer incorporates a CoT logic reasoning engine, a Planner task planner, and a voucher distributor; the cleaning process library includes accounting classification cleaning sub-processes, cross-table alignment cleaning sub-processes, multimodal OCR recognition sub-processes, batch data entry processing sub-processes, and bank transaction processing sub-processes; the persistent storage layer includes an object storage terminal, a relational database, and a prompt word template library.
[0015] The present invention has the following advantages and beneficial effects: This invention solves the memory bottleneck and system stability problems in large-scale data cleaning by using a "storage-scheduling" decoupled architecture, which allows the file binary stream to bypass the AI Agent node and only transmit the address of the pre-signed access credential.
[0016] This invention utilizes financial lending balance logic to assist large language model classification, combining deterministic business rules with semantic understanding capabilities to achieve high-precision semantic cleaning and effectively eliminate semantic ambiguity in the summary field.
[0017] This invention ensures the rigor and traceability of heterogeneous cross-table data synchronization through a composite primary key consisting of property area, floor, and room number, and a mechanism for unmatched result sets.
[0018] This invention also avoids request failures caused by disordered calls to large language models through a batch cleanup and dynamic waiting interval rate limiting protection mechanism. Attached Figure Description
[0019] Figure 1 This is an exemplary structural diagram of an AI Agent-based automated financial data cleaning system provided by the present invention. Figure 2 This is an exemplary flowchart of an automated financial data cleaning method based on AI Agent provided by the present invention. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0021] Figure 1 This is an exemplary structural diagram of an AI Agent-based automated financial data cleaning system provided by the present invention. See also... Figure 1 The AI Agent-based automated financial data cleanup system 100 provided by this invention adopts a top-down four-layer architecture, including an interaction perception layer 110, an agent scheduling layer 120, a cleanup process library 130, and a persistent storage layer 140. The layers are connected through bidirectional data flow and call relationships, forming a complete closed loop from user interaction to intelligent scheduling and then to business execution.
[0022] The interaction perception layer 110 includes a terminal interface unit 111 and a result feedback unit 112. The terminal interface unit 111 receives natural language processing instructions and financial documents to be processed from user input, and transmits the access credential address to the Agent scheduling layer 120. The result feedback unit 112 manages the uploading of financial documents to the object storage terminal 141 and the acquisition of pre-signed access credential addresses, parses the financial processing intent, and finally returns an accessible link to the result file to the user.
[0023] The Agent scheduling layer 120 is the core of the system, housing a CoT inference engine 121, a Planner task planner 122, and a credential distributor 123. The CoT inference engine 121 uses Chain of Thought technology to semantically decompose natural language processing instructions. The Planner task planner 122 executes Chain of Thought-based task sequence orchestration, manages parameter passing for tool calls, and schedules functional processes in the cleanup process library 130 based on task dependencies. The credential distributor 123 manages the generation and transmission of pre-signed access credential addresses, enabling lightweight scheduling by bypassing the Agent scheduling layer 120 for file binary streams.
[0024] The cleanup process library 130 includes an accounting classification cleanup sub-process 131, a cross-table alignment cleanup sub-process 132, a multimodal OCR recognition sub-process 133, a batch data entry processing sub-process 134, and a bank statement processing sub-process 135. The multimodal OCR recognition sub-process 133 further includes a statement recognition sub-process, a payment list recognition sub-process, and an accounting voucher recognition sub-process. The accounting classification cleanup sub-process 131 is used to execute the direction determination logic based on the total debit and credit amounts of the vouchers and the secondary classification logic based on large language model slicing processing; the cross-table alignment cleanup sub-process 132 is used to execute the cross-table data synchronization logic based on the composite primary key of property area, floor, and room number.
[0025] The persistent storage layer 140 includes a distributed object storage terminal 141, a relational database 142, and a prompt template library 143, which are used for the persistent storage and management of intermediate process data, baseline data, and structured prompts, respectively.
[0026] Figure 2 This is an exemplary flowchart of an AI Agent-based automated financial data cleaning method provided by the present invention. See also Figure 2 The automated financial data cleaning method based on AI Agent provided by this invention includes the following steps: Step 210: File Temporary Storage and Access Credential Generation. The system obtains the financial file uploaded by the user and the natural language processing instructions, and temporarily stores the financial file in the object storage terminal 141 via streaming. After completing the file writing, the object storage terminal 141 generates a unique object storage path and a corresponding pre-signed access credential address that identify the file. The pre-signed access credential address includes the storage path, a time-sensitive signature, and an expiration timestamp, with the validity period set to 24 hours by default. After obtaining the pre-signed access credential address, the AIAgent node stores it in the context of the current session.
[0027] In one embodiment, the pre-signed access credential address has a retry mechanism: when a functional process node returns an access failure response due to the expiration of the pre-signed access credential address during task execution, the AI Agent node captures the failure response, automatically regenerates a valid pre-signed access credential address, and retryes once; if the retry still fails, the current task is terminated and an error message is returned to the user.
[0028] Step 220: Agent Intelligent Scheduling. The AI Agent node utilizes the large language model of the built-in Planner task planner 122, employing a thought chain to logically decompose natural language processing instructions, obtaining a standardized task execution sequence. This task execution sequence includes the tool invocation order and parameter dependencies. This step further includes steps 221 to 225.
[0029] Step 221: Intent Acquisition and Recognition. The large language model uses semantic understanding to segment and recognize entities in natural language processing instructions, matching the closest intent type from a pre-defined intent type enumeration table. During the initialization phase, the system pre-defines the intent type enumeration table, with each record including four fields: intent type identifier, associated business domain, associated target tool, and set of triggering keywords. For example, this enumeration table includes at least the following: Intent type identifier "Accounting Transaction Classification", associated with the accounting domain, triggering keywords including "accounting transaction, transaction classification, voucher classification, income and expenditure classification"; Intent type identifier "Accounting Income and Expenditure Statement Generation", associated with the accounting domain, triggering keywords including "accounting income and expenditure statement, income and expenditure report"; Intent type identifier "Bank Income and Expenditure Statement Generation", associated with the bank domain, triggering keywords including "bank income and expenditure statement, bank statement summary, income and expenditure balance"; Intent type identifier "Invoice OCR Recognition", associated with the invoice domain, triggering keywords including "bank statement recognition, payment list, accounting voucher, invoice recognition"; Intent type identifier "Building Mapping Write", associated with the mapping domain, triggering keywords including "mapping, building table write, cross-table synchronization"; Intent type identifier "Building Table Upload", associated with the building domain, triggering keywords including "upload building table, import building data".
[0030] Step 222: CoT reasoning chain, matching the identified business object elements to the associated business domain, and combining the processing actions to lock the target tool within the functional tool set of the associated business domain. Taking the user input "Help me process last year's accounting records and classify them" as an example, the reasoning process of Planner 122 based on the thought chain includes steps S11 to S13.
[0031] Step S11, semantic extraction and time resolution: the instruction is segmented and semantic role labeled, the time element "last year", the business object element "accounting flow" and the processing behavior "classification" are extracted, and "last year" is parsed into the year parameter 2025 according to the current system date.
[0032] Step S12, Business Domain Mapping and Tool Locking: Match the business object element "Accounting Transaction Record" to the predefined accounting domain, and lock the target tool as the accounting transaction record classification tool within the functional tool set of that domain, in conjunction with the processing action "Classification".
[0033] Step S13, parameter parsing and execution plan generation, parses the execution parameters for the target tool, including the pre-signed access credential address and the year parameter 2025, and generates a structured execution plan containing the action type, target tool identifier and year dimension. The AI Agent node passes the pre-signed access credential address as an input parameter to the target tool node.
[0034] Step 223: Tool Retrieval and Matching. Each functional tool in the cleanup process library is pre-configured with tool description information during registration, including tool code, functional description, applicable business scenario description, and a list of required input parameters for invocation. The Planner task planner 122 inputs the user instructions and tool description information of each tool into the large language model. The large language model directly selects the most matching target tool based on semantic understanding and outputs the selection result and confidence score. When the confidence score is higher than a preset threshold, a successful match is determined; when it is lower than the preset threshold, the AI Agent node returns a clarification request to the user. For example, the preset threshold can be 0.8. The generated structured execution instructions include Action, Target, and Year dimensions.
[0035] Step 224: Task Dependency Verification. Task dependency verification employs a rule-based verification mechanism guided by prompt words. Pre-defined task dependency rules are embedded in the system prompt words of the large language model, which then reads and adheres to them autonomously when generating the execution plan. These task dependency rules include: Rule 1, Mapping Processing Dependency Rule: When the target tool is a building mapping and writing tool, it checks if the amount of data in the building table in the database is zero. If it is zero, the building table upload tool is automatically inserted as a prerequisite task; otherwise, execution proceeds directly. Rule 2, No Prerequisite Dependency Rule: When the target tool is an accounting transaction classification tool, accounting income and expenditure statement generation tool, bank income and expenditure statement generation tool, or invoice OCR recognition tool, a single-step execution plan is generated. Rule 3, Execution Order Constraint Rule: When the same instruction involves multiple dependent subtasks, the execution sequence is arranged according to the dependency order; when there are no dependencies, parallel execution is configured.
[0036] Step 225: Scheduling Prompt Configuration. The AI Agent node has built-in scheduling prompts as system prompts for the large language model, which are loaded each time a user command is received. The scheduling prompts include: a role definition section, defining the large language model as a professional data processing assistant for banks, accounting firms, and real estate projects; an intent recognition and scheduling rules section, defining tool invocation rules and pre-confirmation rules for mapping processing based on business domain types; a tool-driven constraint section, which mandates that the large language model is prohibited from performing its own calculations or inferences, and all data processing results must and can only come from tool returns, and the file path and status information returned by the tool must be transmitted verbatim; and a result output constraint section, requiring that the final output must include a download link and be concatenated into a complete file access address according to a preset format.
[0037] Step 230: Schedule the cleanup process. The AI Agent node schedules the corresponding cleanup process in the cleanup process library 130 according to the task execution sequence, and passes the pre-signed access credential address as an input parameter to the cleanup process. The cleanup process reads the file to be processed directly from the object storage terminal 141 based on this address and performs the cleanup. After processing, it writes the result file back to the object storage terminal 141 and returns the access credential address of the result file to the AI Agent node. Throughout the entire process, the file binary stream does not need to be relayed through the AI Agent node.
[0038] The cleanup process includes accounting record cleanup, cross-sheet data mapping, invoice OCR transcription cleanup, and automated summarization of bank statements. For image-based financial documents, the workflow automatically identifies the invoice type based on image features and accordingly calls the statement recognition tool, payment list recognition tool, or accounting voucher recognition tool. The following section uses accounting record cleanup, cross-sheet data mapping, invoice OCR transcription, and bank statement summarization as examples to explain the cleanup process in detail.
[0039] Step 240: The functional flow stores the processed result file in object storage terminal 141, and the AI Agent node returns the access address of the result file to the user. In one embodiment, the system automatically summarizes the classification reports and anomaly reports, packages them into a compressed file, and returns a result download credential. Example 1
[0040] This embodiment details the execution process of the accounting classification and clearing sub-process 131.
[0041] Step 301: Marking Receipts and Payments. After grouping the accounting transaction data by voucher number, the system calculates the total debit and credit amounts for each group of vouchers. The total debit amount is represented by the symbol D and is defined as the sum of the debit amounts in all bank category details within the group; the total credit amount is represented by the symbol C and is defined as the sum of the credit amounts in all bank category details within the group.
[0042] In corporate accounting, an account is a category name used to classify and account for various economic transactions according to their economic content. Each accounting record includes an account name field. Bank accounts are those marked as bank categories in the account category lookup table, including but not limited to "Bank Deposits," "Industrial and Commercial Bank of China Deposits," and "China Construction Bank Deposits." The system filters bank category accounts from all accounts using the account category lookup table, and only includes records matching the bank category in the calculation of D and C. Records of other non-bank accounts retain their original data but do not participate in the determination of the direction of receipt and payment. When multiple bank accounts are involved in the same voucher group, the detailed records of all bank accounts are combined for calculation. The sum of the debit amounts of all bank accounts is taken as the D value, and the sum of the credit amounts is taken as the C value. The direction of receipt and payment is determined based on the combined D and C, without determining each bank account separately.
[0043] Based on the comparison results of D and C, the system adds an income / expenditure direction marker to each group of vouchers: when D is greater than C, it is marked as "Income (0)"; when D is less than C, it is marked as "Expenditure (1)"; when D is equal to C, it is marked as "Change Category (-1)". Voucher groups marked as "Income (0)" and "Expenditure (1)" enter the secondary classification process, while voucher groups marked as "Change Category (-1)" do not enter the secondary classification process, and the system classifies them into the change category summary table for separate output.
[0044] Step 302: Structured Prompt and Secondary Classification. The system will batch-call the large language model to perform secondary classification on the data that has been marked with income and expenditure directions but has not matched the deterministic rules. The call will use a structured prompt word architecture, which includes four levels: Role domain, which defines the expert identity with a preset financial data processing background; Task domain, which defines the array format of the input data and the JSON array output constraints; Rule domain, which defines the special classification logic for income or expenditure, including keyword matching priority and semantic distinction criteria; Output constraint domain, which forces the large language model to output pure JSON format data and prohibits explanatory text.
[0045] Taking the secondary classification of income direction as an example: the role domain defines the large language model as a senior financial analyst with many years of auditing experience, specializing in the classification of income and expenditure in bank statements; the task domain defines the input data format as a JSON array, with each record containing the fields of date, voucher number, summary, amount, and income / expenditure direction, requiring the output to be a JSON array with the classification field appended to each record; the rule domain defines the income classification logic—when the summary contains "interest accrued" but not "debt owed," it is classified as "deposit interest income"; when the summary contains "interest accrued" and "debt owed," it is classified as "debt interest income"; when the summary contains "capital occupation fee," it is classified as "debt interest income"; when the summary contains "handling fee" or "processing fee," it is classified as "bank handling fee expenditure." If any of the above rules are not matched, the classification field is set to a preset value to be reviewed; the output constraint domain forces the large language model to output only pure JSON format data, prohibiting the output of any explanatory text. The secondary classification of expenditure direction uses the same structured prompt words architecture, and its rule domain defines a dedicated classification logic for expenditure scenarios. The structured prompts for each scenario are retrieved from the prompt template library 143 by the system based on the income and expenditure direction markers and then injected.
[0046] Step 303: Batch Processing and Rate Limiting Protection. The classification executor groups the data to be classified into preset slice sizes. In a specific example, it processes 5 data entries per batch and sets a dynamic waiting interval of 2 seconds between each batch to achieve dynamic rate limiting protection and ensure the stability of large language model calls. After classification, the system generates a summary table and detailed sub-tables by category. The summary table uses financial category as the header and voucher number as the content. The detailed classification table is split into multiple sub-tables according to the category. Each sub-table records the corresponding original transaction data, which are then packaged and stored in object storage terminal 141. Example 2
[0047] This embodiment details the execution process of the cross-table alignment cleanup sub-process 132.
[0048] The system simultaneously reads the baseline data from the mapping table and the building information table in relational database 142, extracting the "property area name + floor + room number" to construct a composite matching primary key for matching. When a match is successful, the transaction amount, owner name, and transaction time from the mapping table are accurately written into the corresponding fields in the building information table; when a match fails, the data in that row is included in the unmatched result set. Finally, the matching results and the unmatched result set are packaged and returned to ensure the traceability of the data cleaning process.
[0049] Before performing the mapping process, the system determines whether the amount of data in the building table in relational database 142 is zero based on the task dependency rules. If it is zero, the building table upload tool is automatically inserted as a prerequisite task. The building table upload is completed first, and then the mapping write is performed. Example 3
[0050] This embodiment details the execution process of the multimodal OCR recognition sub-process 133.
[0051] After the AI Agent node parses the user's command intent, it schedules the corresponding OCR processing flow based on the document type: if the command involves "statement statement," the statement recognition flow is invoked; if it involves "payment list," the payment list recognition flow is invoked; and if it involves "accounting voucher," the accounting voucher recognition flow is invoked. The selected processing flow extracts the image from the object storage terminal 141, performs text recognition, removes interference information, and transcribes it into a standardized structured file (such as an Excel file), thus realizing the transformation of unstructured data into a standardized schema. Example 4
[0052] This embodiment details the execution process of the bank transaction processing sub-process 135.
[0053] After the AI Agent node recognizes the user's intent as "generate income and expenditure statement," it passes the storage path voucher containing multiple statement files to the income and expenditure statement generation process. This process includes the following steps: traversing and reading multiple statement files to be processed in the object storage terminal 141; using preset financial features, identifying and matching the corresponding expenditure code, interest code, or deposit code from each transaction summary (in one example, a summary containing "interest" is determined to be interest income, while others are determined to be expenditures or deposit income based on the debit identifier); calculating the amount corresponding to each code by file dimension, performing cross-file aggregation, writing the individual statistics and global aggregation into a preset Excel template, generating a bank income and expenditure statement summary, saving it back to the object storage terminal 141, and returning the download voucher.
[0054] This invention performs differentiated business logic processing for different business objects. For accounting records, data is grouped by date and voucher number. The direction of income and expenditure is determined based on the total debit and credit amounts of bank accounts in each group of vouchers and marked accordingly. A first classification is performed using preset coding rules. Data that does not match the rules is then classified in batches using a large language model. After classification, a summary report and a detailed classification table are generated. For data mapping, common fields between the mapping table and the property table in the database are extracted to construct a composite primary key for matching. Successfully matched mapping data is synchronously written to the property table, and the matching results and unmatched results are exported separately. For bank statements, multiple original bank statement files are obtained. Based on preset business rule coding, expenditure items, interest income, and deposit income are extracted from each file, and a multi-dimensional summary is performed to generate a balance sheet.
[0055] The specific values (such as validity period of 24 hours, 5 items per batch, and waiting interval of 2 seconds), keyword sets, subject names, and business domain divisions in the above embodiments are merely examples, and those skilled in the art can adjust and replace them according to actual needs. The large language model can be replaced with language models from different vendors or of different scales; the object storage terminal can be replaced with other forms of object storage services; and the structure file can be replaced with other standardized formats such as CSV and JSON. All the above modifications do not depart from the protection scope of this invention.
[0056] The above are merely preferred embodiments of the present invention and are not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for automated cleaning of financial data based on AI Agent, characterized in that, include: The financial documents to be processed are temporarily stored in the object storage terminal, and a pre-signed access credential address pointing to the financial documents is generated. Using the AI Agent node with the built-in Planner task planner, the received natural language processing instructions are broken down using a thought chain to generate a task execution sequence; the task execution sequence includes the tool invocation order and parameter dependencies. The AI Agent node transmits the pre-signed access credential address to the corresponding functional process in the cleanup process library according to the task execution sequence. The functional process reads the financial file from the object storage terminal and performs cleanup based on the pre-signed access credential address. The binary stream of the financial file does not pass through the AI Agent node. The cleaned result file is written to the object storage terminal, and the AI Agent node returns the access address of the result file.
2. The method for automated financial data cleaning based on AI Agent according to claim 1, characterized in that, The method of using a thought chain to break down the received natural language processing instructions includes: The natural language processing instructions are segmented and entity recognized, and the closest intent type is matched from a preset intent type enumeration table; each record in the intent type enumeration table includes an intent type identifier, associated business domain, associated target tool, and a set of triggering keywords; Match the identified business object elements to the associated business domain, and combine the processing actions to locate the target tool within the functional tool set of the associated business domain; The execution parameters of the target tool are parsed to generate a structured execution plan; the execution parameters include the pre-signed access credential address and the year parameter; the structured execution plan includes the action type, the target tool identifier, and the year dimension.
3. The method for automated financial data cleaning based on AI Agent according to claim 2, characterized in that, The intent type enumeration table includes intents for accounting transaction classification, accounting income and expenditure statement generation, bank income and expenditure statement generation, invoice OCR recognition, property mapping and writing, and property table upload.
4. The method for automated financial data cleaning based on AI Agent according to claim 2, characterized in that, The target locking tool includes: Each functional tool in the cleanup process library is pre-configured with tool description information; the tool description information includes tool code, function description, description of applicable business scenarios, and a list of input parameters. The system matches natural language processing instructions with the tool descriptions of each functional tool, selects the most matching target tool, and outputs the selection results and confidence scores. A successful match is determined when the confidence score is higher than the preset threshold; when the confidence score is lower than or equal to the preset threshold, the AIAgent node returns a clarification request to the user.
5. The method for automated financial data cleaning based on AI Agent according to claim 2, characterized in that, The generated task execution sequence includes: Pre-defined task dependency rules are embedded into the system prompts of the large language model. The large language model reads and follows the task dependency rules to generate a task execution sequence. The task dependency rules include mapping processing dependency rules, no prerequisite dependency rules, and execution order constraint rules. The mapping processing dependency rule refers to determining whether the amount of data in the property table in the database is zero when the target tool is a property mapping writing tool; if it is zero, the property table upload tool is inserted as a prerequisite task; otherwise, it is executed directly. The rule of no pre-dependents refers to generating a single-step execution plan when the target tool is an accounting transaction classification tool, an accounting income and expenditure statement generation tool, a bank income and expenditure statement generation tool, or a document OCR recognition tool. The execution order constraint rule refers to arranging the execution sequence according to the dependency order when the same instruction involves multiple dependent subtasks, and configuring them to be executed in parallel when there is no dependency.
6. The method for automated financial data cleaning based on AI Agent according to claim 1, characterized in that, The AI Agent node has built-in scheduling prompts and loads the scheduling prompts each time the large language model receives a natural language processing instruction. The scheduling prompts include a role definition section, an intent recognition and scheduling rule section, a tool-driven constraint section, and a result output constraint section. The role definition section is used to define the large language model as a data processing assistant; The intent recognition and scheduling rules section is used to define tool invocation rules and pre-confirmation rules; The tool-driven constraint section is used to require large language models to refrain from self-computation or inference, and all data processing results are returned by the tool, and the file path and status information returned by the tool are transmitted as is. The output constraint section requires that the final output include a download link and be concatenated with the complete file access address.
7. The method for automated financial data cleaning based on AI Agent according to claim 1, characterized in that, The cleanup process includes accounting record cleanup, cross-table data mapping, invoice OCR transcription cleanup, and automated summary of bank income and expenditure statements. The accounting record clearing includes: Group the accounting records by pre-signed access vouchers, and add a receipt / payment direction mark to the vouchers in each group based on the comparison between the total debit amount and the total credit amount in each group of pre-signed access vouchers. The data with added income and expenditure direction tags will be used in batches to perform secondary classification by calling the large language model. The cross-table data mapping includes: Simultaneously, read the baseline data from the mapping table and the building information table in the database, construct a composite matching primary key, and perform matching. When a match is successful, the matching result is obtained, and the corresponding fields in the property list are filled in; the corresponding fields include transaction amount, owner name, and transaction time; When a match fails, the corresponding data is added to the unmatched result set. Pack the matching results and the unmatched result set and return them; The document OCR transcription cleanup includes: The AI Agent node schedules the corresponding OCR processing flow based on the intent recognition result of the natural language processing instruction; The selected OCR processing flow extracts images from the object storage terminal, performs text recognition, and transcribes them into standardized structured files; The automated summary of the bank's income and expenditure statements includes: Iterate through and read multiple pending statement files in the object storage terminal; The system uses preset financial characteristics to identify and match corresponding expenditure codes, interest codes, or deposit codes from transaction summaries. The amounts corresponding to each code are calculated separately according to the file dimension, and cross-file aggregation is performed to generate a bank income and expenditure statement.
8. The method for automated cleaning of financial data based on AI Agent according to claim 7, characterized in that, Adding receipt and payment direction markers to this group of vouchers includes: By using the subject category comparison table, the bank subjects marked as bank categories are selected from all subjects in each group of vouchers, and the detailed records that match the bank category are included in the calculation scope; Combine and calculate the detailed records of all bank accounts in each group of vouchers, take the total debit amount as the total debit amount, and take the total credit amount as the total credit amount. When the total debit amount is greater than the total credit amount, it is marked as a receipt; when the total debit amount is less than the total credit amount, it is marked as an expense; when the total debit amount is equal to the total credit amount, it is marked as a change. Voucher groups marked as receipts and payments are entered into secondary classification, while voucher groups marked as change categories are not entered into secondary classification and are included in the change category summary table for separate output.
9. The method for automated cleaning of financial data based on AI Agent according to claim 7, characterized in that, The process of calling the large language model in batches for secondary classification includes: Group the data to be classified according to the preset slice size; When performing cleanup, set a dynamic waiting interval between each batch; After the secondary classification is completed, a summary table and detailed sub-tables are generated and stored in the object storage terminal.
10. An automated financial data cleaning system based on AI Agent, characterized in that, The application of the AI Agent-based automated financial data cleaning method as described in any one of claims 1-9 includes an interaction perception layer, an agent scheduling layer, a cleaning process library, and a persistent storage layer: The interactive perception layer includes a terminal interface unit and a result feedback unit; The Agent scheduling layer incorporates a CoT logic reasoning engine, a Planner task planner, and a credential distributor. The cleanup process library includes accounting classification cleanup sub-process, cross-table alignment cleanup sub-process, multimodal OCR recognition sub-process, batch data entry processing sub-process, and bank transaction processing sub-process; The persistent storage layer includes an object storage terminal, a relational database, and a prompt word template library.