Processing method, system and medium for intelligent form draft automatic saving
Patent Information
- Application Number
- CN202511045427.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-29
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2045-07-29
AI Technical Summary
[0002]在现有的表单管理系统中,智能草稿自动保存与管理功能的实现普遍存在一些技术缺陷:例如传统表单草稿管理方案高度依赖开发者手动配置表单类型判断规则(如通过硬编码检测表单状态字段),导致代码冗余度高达80%以上,且难以适应动态表单场景
1.键值状态判定操作模式减少无效保存(如编辑模式跳过保存),降低CPU和存储资源消耗;增量快照生成仅存储用户修改数据(而非全量数据),结合无损压缩减少存储占用;有利于提升存储效率和系统响应速度;通过智能区分表单操作类型并自动匹配相应的草稿管理策略,有利于降低开发成本;
Smart Images

Figure CN120950569B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart form processing technology, and in particular to a processing method, system and medium for automatically saving smart form drafts. Background Technology
[0002] In existing form management systems, the implementation of intelligent draft auto-save and management functions generally suffers from some technical defects: for example, traditional form draft management solutions rely heavily on developers manually configuring form type judgment rules (such as detecting form status fields through hard coding), resulting in code redundancy of over 80% and difficulty in adapting to dynamic form scenarios.
[0003] Therefore, traditional form management systems suffer from high development costs and low storage efficiency, and need to be improved. Summary of the Invention
[0004] To address the shortcomings of existing technologies, improve storage efficiency in form draft management, and reduce development costs, this application provides a processing method, system, and medium for automatically saving smart form drafts.
[0005] Firstly, the objective of this invention is achieved through the following technical solution: Methods for automatically saving smart form drafts include: The system monitors dynamic change events of form data objects in real time and detects the key-value status of the object's unique identifier field to automatically determine the current operation mode of the form. The key-value status includes a first key-value status and a second key-value status. The current operation mode of the form includes the add mode corresponding to the first key-value status and triggering the draft saving process, and the edit mode corresponding to the second key-value status and skipping the draft saving process. A silent mode switch interface is provided, which disables the automatic save mode by default. The silent mode is switched to silent mode based on the obtained user operation command. The silent mode only performs data persistence operation when the user triggers the save command. An initial default value baseline library is constructed, and a depth-first traversal algorithm is used to compare the field-level differences between the current form data and the default values to obtain the field comparison results. Based on the field comparison results, deduplication is performed, incremental data actively modified by the user is extracted, and a structured draft snapshot is generated. The volume is optimized based on a preset lossless compression algorithm, and storage is performed in conjunction with data storage and management parameters.
[0006] By adopting the above technical solution, the first key-value state is empty or null, and the second key-value state is a valid identifier. By monitoring the key-value state of the form data object in real time, the form operation mode is automatically determined and the report saving strategy is dynamically switched. Compared with the traditional solution that requires manual configuration of type judgment rules, the efficiency of form type recognition is improved. The silent mode switch interface disables the automatic saving function by default, and the data persistence operation is only performed when the user actively triggers the save command. This avoids the operation interruption problem caused by frequent pop-ups in the traditional solution, which is conducive to improving user operation efficiency. The incremental data actively modified by the user is extracted by the depth traversal algorithm. Compared with the traditional solution of full storage, combined with the lossless compression algorithm (such as the LZ-String lossless compression algorithm), the compression rate of draft data volume is improved, thereby reducing the storage space occupation rate and improving storage efficiency. By intelligently distinguishing the form operation type and automatically matching the corresponding draft management strategy, developers do not need to manually configure type judgment and data filtering rules, which is conducive to reducing development costs. This application avoids pop-up interruptions through the silent mode switch interface, and saves only through user-active operation, which is conducive to improving user experience.
[0007] In a preferred embodiment, this application further includes: In response to user input, form draft data is obtained, the form draft data including at least one key-value pair; The form fields in the form draft data are identified. The form fields are obtained by parsing a pre-trained dynamic parsing algorithm model, which includes a parameter extraction layer, a feature extraction layer, and a feature parsing layer, and is used to automatically identify key fields in the form. According to the preset saving strategy, the form draft data is stored in the log cache area. The target data in the log cache area includes the binary log corresponding to the form field, the transaction identifier of the transaction to which the form draft data belongs, and the position information of the form field in the transaction. In response to an interruption event, based on the data in the log buffer, the target transaction that supports resumption and the corresponding target resumption point are determined; The binary logs in the log cache area before the target resume point corresponding to the target transaction are restored to the target binary logs of the target transaction, and the form draft data is processed based on the target binary logs.
[0008] By adopting the above technical solution and utilizing a pre-trained dynamic parsing algorithm model to identify form fields, the accuracy and efficiency of form data processing are improved. Form draft data is stored in a log cache, and key information is recorded through binary logs, ensuring the security and integrity of data transmission. In the event of an interruption, the target transaction and its location that support resumption can be determined based on the data in the log cache, effectively avoiding data loss due to unexpected interruptions and ensuring the continuity and reliability of data processing.
[0009] In a preferred embodiment of this application, storing the form draft data in a log cache according to a preset saving strategy specifically includes: Real-time acquisition of user behavior information; based on the user behavior information, acquisition of user behavior coefficients for adjusting the saving frequency; when the user enables silent mode, the user behavior coefficients are forcibly set to 0. Adjust the storage frequency of the form draft data based on the user behavior coefficient; The adjusted form draft data is stored in the target slot of the log cache, and the target slot corresponds to the transaction identifier of the transaction.
[0010] By adopting the above technical solutions, user behavior coefficients (such as input frequency) are associated with storage frequency. During high-frequency operations, the number of saves is increased to ensure real-time performance, while during low-frequency operations, IO pressure is reduced. The silent mode forces a coefficient of 0, and persistence is entirely triggered by the user. By using transaction identifiers to correspond to target slots, storage efficiency is optimized and data writing efficiency under high concurrency is improved.
[0011] In a preferred example, after retrieving form draft data in response to user input, the method further includes: Determine whether the amount of data in the form draft exceeds a preset threshold; If the data is determined to exceed a preset threshold, the form draft data is compressed and stored in the log cache area. Conversely, it is stored directly in the log cache area.
[0012] By adopting the above technical solution, the storage load is balanced, and the decision to compress the data before storage is made by judging whether the amount of form draft data exceeds a preset threshold, which effectively prevents the storage space waste or overload problem caused by direct storage of a large amount of data.
[0013] In a preferred embodiment of this application, before determining the target transaction and corresponding target resumption point based on data in the log buffer in response to an interruption event, the method further includes: Based on the transaction identifier and location information, a draft state consistency framework information is generated; The current form draft data is compared with the draft status consistency framework information to obtain the status deviation value; If the deviation value is greater than the preset deviation threshold, the form draft data is determined to be abnormal and a repair process is triggered; otherwise, the form draft data is determined to be normal.
[0014] By adopting the above technical solution, and comparing the draft status consistency framework information with the current form draft data, anomalies can be detected and corrected in a timely manner, ensuring data consistency and accuracy. This significantly reduces problems caused by data inconsistency and improves system reliability.
[0015] In a preferred embodiment of this application: the step of responding to an interruption event by determining the target transaction and corresponding target resumption point supported by the log buffer data specifically includes: Extract the binary log, transaction identifier, and location information of the target transaction from the log cache. Based on the transaction identifier, obtain the engine location information of the corresponding transaction from the database engine layer log; By comparing the location information in the log cache with the engine location information, the target resume location is determined; If the log cache has more position information than the engine position information, then the last position of the engine position information is determined as the target resume position. If the engine location information is greater than the location information in the log cache, then the last location in the log cache is determined as the target resume location.
[0016] By adopting the above technical solution, after responding to an interruption event, the resume point of the target transaction is determined based on the data in the log cache, effectively restoring the state before the interruption and ensuring the continuity of the data processing process; by comparing log point information from different sources, the resume position is accurately located, greatly improving the success rate and efficiency of data recovery.
[0017] In a preferred embodiment of this application, the draft saving process includes: Based on the acquired user input data, the input frequency and input rhythm of the user input behavior are identified. The input frequency refers to the number of characters entered by the user per unit time, and the input rhythm refers to the time interval between consecutive inputs by the user. Based on the input frequency and rhythm, determine whether the user is in an interrupted input state: The average input rhythm of users is statistically analyzed based on historical input data to generate a rhythm benchmark value; the rhythm deviation value between the current input rhythm and the rhythm benchmark value is calculated in real time; if the rhythm deviation value exceeds a preset rhythm deviation threshold, it is determined that the user is in an interrupted input state. When the draft save operation is triggered, the current input data is encapsulated into form draft information, and a timestamp, user identifier, and form identifier are added to generate a draft save record; based on the draft save record, corresponding draft index information is generated.
[0018] By adopting the above technical solutions and analyzing the user's input frequency and rhythm, it is possible to accurately determine whether the user is in an interrupted input state, thereby triggering the draft saving process in a timely manner, which is beneficial to improving the user experience and ensuring the security of user data.
[0019] Secondly, the objective of this invention is achieved through the following technical solution: A processing system for automatically saving smart form drafts, comprising: The event listener module is used to listen for dynamic change events of form data objects in real time and detect the key value status of the object's unique identifier field to automatically determine the current operation mode of the form. The key value status includes a first key value status and a second key value status. The current operation mode of the form includes the add mode corresponding to the first key value status and triggering the draft saving process, and the edit mode corresponding to the second key value status and skipping the draft saving process. The silent mode control module provides a silent mode switch interface that disables automatic saving by default, and switches to silent mode based on acquired user operation commands. The silent mode only performs data persistence operations when the user triggers a save command. The difference detection module is used to build an initial default value benchmark library and use a depth-first traversal algorithm to compare the field-level differences between the current form data and the default values to obtain field comparison results. Based on the field comparison results, deduplication is performed, incremental data actively modified by the user is extracted, and a structured draft snapshot is generated. The data storage module is used to optimize the size of the structured draft snapshot based on a preset lossless compression algorithm, and perform storage in conjunction with data storage management parameters.
[0020] Thirdly, the objective of this invention is achieved through the following technical solution: A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described processing method for automatically saving smart form drafts.
[0021] Fourthly, the objective of this invention is achieved through the following technical solution: A computer program product includes a computer program / instructions that, when executed by a processor, implement the steps of the processing method described above for automatically saving smart form drafts.
[0022] In summary, this application includes at least one of the following beneficial technical effects: 1. Key-value status determination reduces invalid saves (e.g., skipping saves in edit mode), thus reducing CPU and storage resource consumption; incremental snapshot generation only stores user-modified data (instead of full data), and combined with lossless compression, reduces storage usage; this helps improve storage efficiency and system response speed; by intelligently distinguishing form operation types and automatically matching corresponding draft management strategies, it helps reduce development costs. 2. Focus on interruption recovery and consistency (such as transaction continuation and dynamic parsing) to solve the problem of draft loss during system crashes or switching; improve the intelligence level and user experience of automatic saving of smart forms. Attached Figure Description
[0023] Figure 1 This is a flowchart of a processing method for automatically saving smart form drafts in one embodiment of this application; Figure 2 This is another flowchart in a processing method for automatically saving smart form drafts in one embodiment of this application. Detailed Implementation
[0024] The present application will be further described in detail below with reference to the accompanying drawings.
[0025] In one embodiment, such as Figure 1 As shown, this application discloses a method for automatically saving drafts of smart forms, which specifically includes the following steps: S1: Real-time monitoring of dynamic change events of form data objects, and detection of the key-value status of the object's unique identifier field to automatically determine the current form operation mode; key-value status includes first key-value status and second key-value status, and the current form operation mode includes the add mode corresponding to the first key-value status and triggering the draft saving process, and the edit mode corresponding to the second key-value status and skipping the draft saving process.
[0026] In this embodiment, a form data object refers to the collection of data entered by the user in the form interface, typically stored in key-value pairs, such as {"name": "Zhang San", "email": "zhang@example.com"}. Each form field (such as a text box or drop-down menu) corresponds to a key. Dynamic change events are any modifications the user makes to a form field (such as entering text or selecting an option), which the system captures in real time through event listeners (such as JavaScript's addEventListener). The object's unique identifier field (such as formData.id) is a field in the form used to uniquely identify the form data object (such as formData). The first key-value state is when the identifier field is empty or null, corresponding to the add mode; the second key-value state is a valid identifier, corresponding to the edit mode. The current form operation mode refers to the mode that the system automatically switches to based on the key-value state, including: add mode—the system triggers the draft saving process when the user fills out the form for the first time; and edit mode—the system skips automatic saving when the user modifies existing form data to reduce redundant operations.
[0027] Specifically, the draft saving process includes: S11: Based on the acquired user input data, identify the input frequency and input rhythm of the user's input behavior. Input frequency refers to the number of characters entered by the user per unit time, and input rhythm refers to the time interval between consecutive inputs by the user.
[0028] In this embodiment, user input data refers to the sequence of characters that a user enters in real time in a form field (such as a text box), including keystroke timestamps, field identifiers, and input content. Input frequency refers to the number of characters entered per unit of time (such as per minute), reflecting the user's input speed. Input rhythm refers to the time interval (milliseconds) between two consecutive input operations, reflecting the continuity of user input, such as rapid continuous input vs. intermittent input.
[0029] Specifically, the total number of characters within a fixed time window (e.g., 60 seconds) is counted: Input frequency = (Current number of characters - Starting number of characters) / Time window length. Rhythm is calculated by recording the time difference between two input events: Input rhythm = Current event timestamp - Last event timestamp. A circular buffer is used to store the most recent 10 input rhythm values, and the average value is updated in real time.
[0030] S12: Determine whether the user is in an interrupted input state based on the input frequency and rhythm: S121: Calculate the average input rhythm of the user based on historical input data and generate a rhythm benchmark value; calculate the rhythm deviation value between the current input rhythm and the rhythm benchmark value in real time; if the rhythm deviation value exceeds the preset rhythm deviation threshold, determine that the user is in an interrupted input state.
[0031] In this embodiment, the interrupted input state refers to the user pausing input for more than a preset threshold (such as 30 seconds), which may be caused by leaving, thinking, or interruption of operation. The state is checked every 10 seconds.
[0032] Specifically, the rhythm baseline value refers to the weighted average of the user's historical input rhythms, with more recent data having higher weight. The rhythm baseline value can be set to be updated weekly or monthly. The rhythm deviation value is the absolute difference between the current rhythm and the baseline value, reflecting the degree of abnormality in input behavior. The rhythm deviation threshold is a dynamic threshold (e.g., 1.5 times the baseline value); exceeding this threshold will result in an interruption.
[0033] The new benchmark value is calculated using an exponentially weighted moving average algorithm. New benchmark value = α × current rhythm + (1-α) × old benchmark value, where α is typically taken as 0.2. Rhythm deviation value = |current rhythm - rhythm benchmark value|.
[0034] S122: When the draft save operation is triggered, the current input data is encapsulated into form draft information, and a timestamp, user identifier and form identifier are added to generate a draft save record; the corresponding draft index information is generated based on the draft save record.
[0035] In this embodiment, the form draft information includes the current form data, a timestamp, and a snapshot of the form with the user ID. The draft index information refers to metadata that uniquely identifies the draft, used for fast retrieval; a SHA-256 hash value is calculated from the draft information as the unique index. The draft index information is associated with the transaction identifier in the log cache. The hash index + transaction identifier enables multi-version draft tracking, supports breakpoint resume, and achieves precise version management.
[0036] S2: Provides a silent mode switch interface that disables automatic saving by default. Based on the obtained user operation command, it switches to silent mode. In silent mode, data persistence is only performed when the user triggers the save command.
[0037] In this embodiment, the silent mode switch interface refers to a user interface (UI) element (such as a button or checkbox) that allows the user to manually enable or disable the auto-save function. The default state is off, meaning auto-save is disabled. User operation commands refer to actions triggered by the user through clicking, touching, or voice commands, such as clicking the "Enable Silent Mode" button. Silent mode is a system state in which the auto-save function is disabled. The system performs data persistence, such as writing data to a database or file, only when the user explicitly triggers a save command, such as clicking the "Save" button. Data persistence operations involve storing form data from memory to persistent storage media, such as a database or disk.
[0038] Specifically, the mode switching logic uses a boolean variable `isSilentMode` (default false) maintained by the system. `isSilentMode` is set to true when the user enables the switch and false when disabled. Persistence operations are performed on the backend using database operations (such as SQL INSERT or UPDATE), combined with transactions to ensure atomicity. For example, data can be stored in a MySQL database via a REST API.
[0039] S3: Build an initial default value benchmark library, use a depth-first search algorithm to compare the field-level differences between the current form data and the default values, and obtain the field comparison results; based on the field comparison results, perform deduplication, extract incremental data actively modified by the user, and generate a structured draft snapshot.
[0040] In this embodiment, the initial default value baseline library refers to a database or data structure (such as a JSON file) that stores the default values of form fields. For example, the default value of a registration form might be {"name":", "email":"}. The depth-first search algorithm is a recursive algorithm that traverses the nested structure of form data (such as objects within objects), comparing field values layer by layer. This implementation uses depth-first search (DFS). Field-level differences refer to the field-by-field comparison results between the current form data and the default values, including whether the value has changed and the type of change. Field comparison results refer to the difference report output by the algorithm, such as {"name":"modified", "email":"unchanged"}. Deduplication refers to removing duplicate fields from the comparison results, such as the parent field of a nested object. Incremental data refers to the portion of data actually modified by the user (not the entire dataset), for example, only the value of the "name" field has been modified. A structured draft snapshot refers to a structured representation of the incremental data (such as a JSON object), including a timestamp and user identifier.
[0041] S4: Optimizes volume based on a preset lossless compression algorithm and performs storage in conjunction with data storage and management parameters.
[0042] In this embodiment, the LZ-String lossless compression algorithm is used. Volume optimization refers to reducing data size through compression, thereby reducing storage space requirements. Data retention management parameters refer to parameters that configure storage behavior, including storage location (such as memory, database), compression level (such as levels 1-9), and retention strategy (such as automatically deleting old drafts).
[0043] In one embodiment, such as Figure 2 As shown, the processing method for automatically saving smart form drafts also includes: S10: In response to user input, obtain form draft data, which includes at least one key-value pair.
[0044] In this embodiment, applicable to high-concurrency order systems (such as online order submission, financial account opening, etc.), it requires coordination between front-end data collection and back-end distributed storage architecture, focusing on interruption recovery and consistency issues (transaction continuation, dynamic parsing), and resolving draft loss issues during system crashes or switchovers. Key-value pairs are the mapping relationship between field names (Key) and user input values (Value), serving as the basic unit of structured data.
[0045] Specifically, after retrieving the form draft data in response to user input, the method also includes: S101: Determine whether the amount of data in the form draft exceeds a preset threshold.
[0046] In this embodiment, the preset threshold is a dynamically calculated storage capacity threshold (e.g., 10KB), which is adjusted in real time according to the system load. The preset threshold = base value (5KB) × memory pressure coefficient (0.8-1.5). Data volume calculation refers to the byte size of the form draft data, including key-value pairs and metadata. The byte length is calculated after serializing the draft data into a JSON string. The dynamic threshold adapts to changes in system load, avoiding delays caused by compression under high memory pressure.
[0047] S102: If it is determined that the preset threshold is exceeded, the form draft data is compressed and then stored in the log cache area.
[0048] Specifically, the log buffer is a circular buffer in memory, stored in slots according to transactions. The optimal compression algorithm is selected based on the data type; for example, Deflate compression is used for text and numeric data types, while LZ4 compression is used for binary file attachments.
[0049] S103: Conversely, it is directly stored in the log cache area.
[0050] Specifically, direct storage refers to writing raw data into the cache without compression, thus avoiding the overhead of compressing small amounts of data.
[0051] S20: Identify form fields in the form draft data. The form fields are obtained by parsing using a pre-trained dynamic parsing algorithm model. The pre-trained dynamic parsing algorithm model includes a parameter extraction layer, a feature extraction layer, and a feature parsing layer, which are used to automatically identify key fields in the form.
[0052] In this embodiment, the dynamic parsing algorithm model is a field recognition model based on a neural network, and its structure includes: Parameter extraction layer: Extracts field attributes (such as name, type) from HTML tags.
[0053] Feature extraction layer: Extracts visual features (such as input box position and size) through CNN.
[0054] Feature parsing layer: The LSTM network associates context and outputs semantic labels for fields (such as "name" and "phone number").
[0055] Key fields refer to the core fields that affect business logic (such as ID number and amount).
[0056] S30: According to the preset saving strategy, the form draft data is stored in the log cache area. The target data in the log cache area includes the binary log corresponding to the form field, the transaction identifier of the transaction to which the form draft data belongs, and the position information of the form field in the transaction.
[0057] In this embodiment, the log buffer refers to a circular buffer in memory, which stores data in slots according to transactions. The binary log refers to the binary record of field changes (e.g., 0x89AB represents "age from 30 to 31"). The transaction identifier (trx_id) is a unique UUID that identifies a form draft transaction. The undo information (Undo_no) is the undo log sequence number, marking the operation order (e.g., statement 1 → statement 2).
[0058] Specifically, according to the preset saving strategy, the form draft data is stored in the log cache area, including: S301: Acquire user behavior information in real time, and obtain user behavior coefficients for adjusting the saving frequency based on the user behavior information; when the user enables silent mode, force the user behavior coefficients to be set to 0.
[0059] In this embodiment, user behavior information refers to real-time collected user operation data, including input frequency (number of characters input per unit time), operation type (such as field modification, cursor movement), and session activity (duration of continuous user operation). The user behavior coefficient is a dynamically calculated value (range 0-1) used to quantify user activity. A higher coefficient indicates more frequent user input, requiring the system to increase the saving frequency; when the coefficient is 0, automatic saving is paused. Silent mode refers to the state manually enabled by the user (via a UI switch), disabling the automatic saving function. A forced coefficient of 0 ensures that persistence is only performed when the user explicitly triggers saving.
[0060] Specifically, the user behavior coefficient is dynamically calculated using a weighted formula: User behavior coefficient = α1 × input frequency + β × session activity + γ × operation type weight. α1 = 0.6, β = 0.3, γ = 0.1, and the weights are based on the operation type: text input = 1, cursor movement = 0.5.
[0061] For example, if the input frequency = 5 characters / second, the session activity = 120 seconds, and the operation type weight = 1, then the user behavior coefficient = 0.6×5 + 0.3×120 / 100 + 0.1×1 = 3.0 + 0.36 + 0.1 = 3.46 (normalized to the range of 0-1).
[0062] S302: Adjust the storage frequency of form draft data based on user behavior coefficients.
[0063] In this embodiment, the storage frequency refers to the time interval (e.g., milliseconds) at which draft data is automatically saved. It dynamically scales based on a coefficient; the higher the user behavior coefficient, the shorter the interval (more frequent saving); when the user behavior coefficient is 0, the interval is infinitely long (saving is paused). The storage frequency adjustment logic is based on mapping the user behavior coefficient to a preset frequency level, achieving adaptive resource allocation.
[0064] For example, the mapping relationship between coefficients and frequencies is defined (to avoid frequent changes), as shown in the table below: 0.8-1.0 1000ms High-frequency saving (user activity) 0.4-0.7 3000ms Intermediate frequency storage 0.1-0.3 5000ms Low-frequency storage 0.0 ∞ (Disabled) Silent mode Use a timer to trigger the save operation, and reset the timer when the user behavior coefficient changes.
[0065] S303: Store the adjusted form draft data in the target slot of the log cache, where the target slot corresponds to the transaction identifier of the transaction.
[0066] In this embodiment, the target slot refers to a pre-allocated storage unit in the cache area. Each slot is uniquely associated with a transaction identifier (trx_id) to ensure transaction isolation. The transaction identifier (trx_id) is a string (such as a UUID) that uniquely identifies a form draft transaction and is used for tracking and recovery.
[0067] S40: In response to an interruption event, based on the data in the log buffer, determine the target transaction that supports resume and the corresponding target resume point.
[0068] In this embodiment, an interruption event refers to a system crash, network disconnection, or active database switching. The target resume point is the last consistent state point before the interruption.
[0069] Specifically, step S40 includes: S401: Extract the binary log, transaction identifier, and location information of the target transaction from the log buffer.
[0070] In this embodiment, the target transaction refers to an active transaction (state = ACTIVE) that supports resuming, and its transaction identifier (trx_id) exists in the log cache. The binary log refers to binary records of form field changes (e.g., Protobuf encoding), which is smaller than JSON. The position information (Undo_no) refers to the sequential number of operations within the transaction (e.g., 1, 2, 3), used to mark the execution progress.
[0071] Data extraction directly reads the binary log using zero-copy technology, avoiding memory copying overhead. Site information verification checks the continuity of Undo_no; for example, 1, 2, 3 are valid, while 1, 3 are invalid.
[0072] S402: Based on the transaction identifier, obtain the engine location information of the corresponding transaction from the database engine layer log.
[0073] In this embodiment, the database engine layer log refers to the physical log (such as the Redo Log) of the database kernel (such as InnoDB), used to record the persistent status of transactions. Engine position information refers to the latest transaction position recorded by the engine layer, such as LSN and Undo_no, which may be inconsistent with the log cache due to disk flushing latency. The transaction status of the engine layer is queried through an SQL interface. If it is a distributed database (such as TiDB), the maximum committed position is obtained by calling each node via RPC. When there are no transaction records in the engine layer, it is determined that the transaction has been committed or rolled back, and it is excluded from the continuation list. The engine layer log query latency is <3ms, and data consistency guarantee can reach 99.999%.
[0074] S403: Compare the location information in the log cache with the engine location information to determine the target resume location.
[0075] In this embodiment, the site alignment determines the start point for resuming transmission by comparing the Undo_no (memory-state progress) in the cache with the Undo_no (persistence progress) in the engine layer. A globally consistent view at the time of alignment is obtained using MVCC (Multi-Version Concurrency Control), avoiding dirty reads. Furthermore, site information is preloaded into the memory cache, reducing I / O queries.
[0076] S404: If the log cache has more position information than the engine position information, then the last position of the engine position information will be determined as the target resume position.
[0077] In this embodiment, the cache ahead scenario refers to a new operation that has not been flushed to disk in the log cache area, such as transaction step 3, but the engine layer has only persisted up to step 2. In this case, the target resume point is selected to resume the transmission at the last point of the engine layer (Undo_no=2).
[0078] Data rollback is achieved by discarding operations at leading points in the log buffer. Transaction state reset is achieved by marking the transaction state as TO_RECOVER, awaiting resumption.
[0079] S405: If the engine location information is more than the log cache location information, then the last location in the log cache will be determined as the target resume location.
[0080] In this embodiment, the engine-advanced scenario refers to a situation where the engine layer has persisted an advanced operation, such as transaction step 3, but the log cache only records up to step 2 due to network latency. In this case, the target resume point is selected as the last position in the log cache (Undo_no=2) to prevent duplicate execution.
[0081] Log completion is achieved by pulling missing operations (Undo_no=3) from the engine layer and appending them to the log buffer. Transaction continuation is achieved by replaying the binary log starting from the buffer position Undo_no=2.
[0082] Furthermore, prior to step S40, i.e., before determining the target transaction and corresponding target resumption point based on the data in the log buffer in response to the interruption event, the method further includes: S4001: Generate draft state consistency framework information based on transaction identifier and location information.
[0083] In this embodiment, the position information (Undo_no) refers to the sequential number of operations within a transaction. This application establishes a distributed coordination mechanism, synchronizing framework information to all nodes through the Raft consensus protocol in the distributed system. The draft state consistency framework information refers to a verification template built based on transaction metadata, including: Hash Tree: A Merkle tree composed of the hash values of form field values, used to quickly locate differences.
[0084] Transaction version number: A monotonically increasing version identifier (+1 with each operation) that marks the data status.
[0085] Expected field list: A set of field names that should exist in the transaction, such as ["name", "email"].
[0086] S4002: Compare the current form draft data with the draft status consistency framework information to obtain the status deviation value.
[0087] In this embodiment, the state deviation value (0-100) is used to quantify the degree of data inconsistency. It is calculated based on the field missing rate and hash mismatch rate. The field missing rate is calculated as: (number of missing fields / total expected fields) × 40% weight, and the hash mismatch rate is calculated as: (number of fields with inconsistent hash values / total number of fields) × 60% weight. The comparison dimensions include field existence and field value consistency. Field existence is used to detect whether the current draft contains the expected fields. Field value consistency is obtained by comparing whether the hashes of the field values match.
[0088] Specifically, incremental comparison only compares the changed fields since the last verification, and parallel computing distributes multi-field comparison tasks to the thread pool for execution.
[0089] S4003: If the status deviation value is greater than the preset deviation threshold, the form draft data is determined to be abnormal and the repair process is triggered; otherwise, the form draft data is determined to be normal.
[0090] In this embodiment, the preset deviation threshold is a dynamically adjusted critical value, with a default value of 30. The calculation formula is: Deviation threshold = Deviation from base value × System load coefficient (0.7-1.3).
[0091] Specifically, the repair process includes multi-level repair strategies, including field-level repair, version rollback, and manual intervention. Field-level repair refers to automatically completing the default values of missing fields; version rollback is based on the transaction log to revert to the most recent consistent state; manual intervention includes notifying the administrator and locking the form.
[0092] For example, the graded repair strategy is shown in the table below: The tiered repair strategy and consistency verification can intercept 99.9% of dirty data writes, reducing the form data error rate to 0.01%.
[0093] S50: Restore the binary log in the log buffer before the target resume point corresponding to the target transaction to the target binary log of the target transaction, and continue to process the form draft data based on the target binary log.
[0094] In this embodiment, the target binary log refers to the complete sequence of operations required for resuming transmission, such as updating field 1 and then inserting field 2.
[0095] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0096] In one embodiment, a processing system for automatically saving smart form drafts is provided, which corresponds to the processing method for automatically saving smart form drafts in the above embodiments.
[0097] The system for automatically saving smart form drafts includes an event listener module, a silent mode control module, a difference detection module, and a data storage module. Detailed descriptions of each functional module are as follows: The event listener module is used to listen for dynamic change events of form data objects in real time and detect the key-value status of the object's unique identifier field to automatically determine the current operation mode of the form. The key-value status includes a first key-value status and a second key-value status. The current operation mode of the form includes the add mode corresponding to the first key-value status and triggering the draft saving process, and the edit mode corresponding to the second key-value status and skipping the draft saving process. The silent mode control module provides an interface to switch the silent mode off by default, and switches to silent mode based on the obtained user operation command. In silent mode, data persistence is only performed when the user triggers the save command. The difference detection module is used to build an initial default value benchmark library and use a depth-first search algorithm to compare the field-level differences between the current form data and the default values to obtain the field comparison results. Based on the field comparison results, deduplication is performed, incremental data actively modified by the user is extracted, and a structured draft snapshot is generated. The data storage module is used to optimize the size of structured draft snapshots based on a preset lossless compression algorithm and perform storage in conjunction with data storage management parameters.
[0098] In this embodiment, the processing system for automatically saving smart form drafts further includes: The data acquisition module is used to acquire form draft data in response to user input operations, wherein the form draft data includes at least one key-value pair; The field recognition module is used to recognize the form fields in the form draft data. The form fields are obtained by parsing a pre-trained dynamic parsing algorithm model. The pre-trained dynamic parsing algorithm model includes a parameter extraction layer, a feature extraction layer, and a feature parsing layer, which are used to automatically identify key fields in the form. The data storage module is used to store the form draft data in the log cache area according to the preset storage strategy. The target data in the log cache area includes the binary log corresponding to the form field, the transaction identifier of the transaction to which the form draft data belongs, and the position information of the form field in the transaction. The interrupt handling module is used to respond to an interruption event and, based on the data in the log buffer, determine the target transaction that supports resumption and the corresponding target resumption point. The data recovery module is used to restore the binary logs before the target resume point corresponding to the target transaction in the log cache to the target binary logs of the target transaction, and to continue processing the form draft data based on the target binary logs.
[0099] For specific limitations regarding the processing system for automatically saving smart form drafts, please refer to the limitations of the processing method for automatically saving smart form drafts mentioned above, which will not be repeated here. Each module in the above-mentioned processing system for automatically saving smart form drafts can be implemented entirely or partially through software, hardware, or a combination thereof. Each module can be embedded in the processor of the computer device in hardware form or independent of it, or it can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0100] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor: S1: Real-time monitoring of dynamic change events of form data objects, and detection of the key-value status of the object's unique identifier field to automatically determine the current form operation mode; key-value status includes the first key-value status and the second key-value status, and the current form operation mode includes the add mode corresponding to the first key-value status and triggering the draft saving process, and the edit mode corresponding to the second key-value status and skipping the draft saving process; S2: Provides a silent mode switch interface that disables automatic saving by default. Based on the obtained user operation command, it switches to silent mode. In silent mode, data persistence operation is only performed when the user triggers the save command. S3: Build an initial default value benchmark library, use a depth-first search algorithm to compare the field-level differences between the current form data and the default values, and obtain the field comparison results; based on the field comparison results, perform deduplication, extract incremental data actively modified by the user, and generate a structured draft snapshot; S4: Optimizes volume based on a preset lossless compression algorithm and performs storage in conjunction with data storage and management parameters.
[0101] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0102] In one embodiment, particularly according to embodiments of the present invention, the processes described above with reference to the flowchart can be implemented as a computer software program. For example, embodiments of the present invention include a computer program product comprising a computer program / instructions that, when executed by a processor, implement the steps of the processing method for automatically saving smart form drafts as described. In such embodiments, the computer program can be downloaded and installed from a network via a communication module, and / or installed from a removable medium. When the computer program is executed by a central processing unit (CPU), it performs the various functions defined in the present invention.
[0103] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0104] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application 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 features. Such 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 this application, and should all be included within the protection scope of this application.
Claims
1. A method for automatically saving drafts of smart forms, characterized in that, include: The system monitors dynamic change events of form data objects in real time and detects the key-value status of the object's unique identifier field to automatically determine the current operation mode of the form. The key-value status includes a first key-value status and a second key-value status. The current operation mode of the form includes the add mode corresponding to the first key-value status and triggering the draft saving process, and the edit mode corresponding to the second key-value status and skipping the draft saving process. The first key-value state is when the object's unique identifier field is empty or null, and the second key-value state is when the object's unique identifier field is a valid identifier; A silent mode switch interface is provided, which disables the automatic save mode by default. The silent mode switch interface is a switch element on the user interface used to enable or disable the automatic save function, and the default state is that the automatic save function is disabled. The system switches to silent mode based on the obtained user operation command. The silent mode is a system state in which the automatic save function is disabled, and the data persistence operation is only performed when the user triggers the save command. An initial default value benchmark library is constructed, which is a data structure that stores the default values of form fields. A depth-first traversal algorithm is used to perform a depth-first traversal on the nested structure of the current form data, and the field-level differences between the field values of the current form data and the default values in the initial default value benchmark library are compared layer by layer to obtain the field comparison results. Based on the field comparison results, duplicate data is removed, incremental data actively modified by the user is extracted, and a structured draft snapshot is generated. The structured draft snapshot is optimized for size based on a preset lossless compression algorithm, and storage is performed in conjunction with data storage management parameters, including storage location, compression level, and retention strategy.
2. The processing method for automatically saving smart form drafts according to claim 1, characterized in that, The method also includes: In response to user input, form draft data is obtained, the form draft data including at least one key-value pair; The form fields in the form draft data are identified. The form fields are obtained by parsing a pre-trained dynamic parsing algorithm model, which includes a parameter extraction layer, a feature extraction layer, and a feature parsing layer, and is used to automatically identify key fields in the form. According to the preset storage strategy, the form draft data is stored in the log cache area. The target data in the log cache area includes the binary log corresponding to the form field, the transaction identifier of the transaction to which the form draft data belongs, and the position information of the form field in the transaction. In response to an interruption event, based on the data in the log buffer, the target transaction that supports resumption and the corresponding target resumption point are determined; The binary logs in the log cache area before the target resume point corresponding to the target transaction are restored to the target binary logs of the target transaction, and the form draft data is processed based on the target binary logs.
3. The processing method for automatically saving smart form drafts according to claim 2, characterized in that, The step of storing the form draft data in the log cache area according to a preset saving strategy specifically includes: Real-time acquisition of user behavior information; based on the user behavior information, acquisition of user behavior coefficients for adjusting the saving frequency; when the user enables silent mode, the user behavior coefficients are forcibly set to 0. Adjust the storage frequency of the form draft data based on the user behavior coefficient; The adjusted form draft data is stored in the target slot of the log cache, and the target slot corresponds to the transaction identifier of the transaction.
4. The processing method for automatically saving smart form drafts according to claim 2, characterized in that, After retrieving the form draft data in response to user input, the method also includes: Determine whether the amount of data in the form draft exceeds a preset threshold; If the data is determined to exceed a preset threshold, the form draft data is compressed and stored in the log cache area. Conversely, it is stored directly in the log cache area.
5. The processing method for automatically saving smart form drafts according to claim 2, characterized in that, Before determining the target transaction and corresponding target resumption point that support resumption based on the data in the log buffer in response to an interruption event, the method further includes: Based on the transaction identifier and location information, a draft state consistency framework information is generated; The current form draft data is compared with the draft status consistency framework information to obtain the status deviation value; If the deviation value is greater than the preset deviation threshold, the form draft data is determined to be abnormal and a repair process is triggered; otherwise, the form draft data is determined to be normal.
6. The processing method for automatically saving smart form drafts according to claim 2, characterized in that, In response to an interruption event, based on the data in the log cache, the method for determining the target transaction and corresponding target resumption point that support resumption includes: Extract the binary log, transaction identifier, and location information of the target transaction from the log cache. Based on the transaction identifier, obtain the engine location information of the corresponding transaction from the database engine layer log; By comparing the location information in the log cache with the engine location information, the target resume location is determined; If the log cache has more position information than the engine position information, then the last position of the engine position information is determined as the target resume position. If the engine location information is greater than the location information in the log cache, then the last location in the log cache is determined as the target resume location.
7. The processing method for automatically saving smart form drafts according to claim 1, characterized in that, The draft saving process includes: Based on the acquired user input data, the input frequency and input rhythm of the user input behavior are identified. The input frequency refers to the number of characters entered by the user per unit time, and the input rhythm refers to the time interval between consecutive inputs by the user. Based on the input frequency and rhythm, determine whether the user is in an interrupted input state: The average input rhythm of users is statistically analyzed based on historical input data to generate a rhythm benchmark value; the rhythm deviation value between the current input rhythm and the rhythm benchmark value is calculated in real time; if the rhythm deviation value exceeds a preset rhythm deviation threshold, it is determined that the user is in an interrupted input state. When the draft save operation is triggered, the current input data is encapsulated into form draft information, and a timestamp, user identifier, and form identifier are added to generate a draft save record; based on the draft save record, corresponding draft index information is generated.
8. A processing system for automatically saving drafts of intelligent forms, characterized in that, The system includes: The event listener module is used to listen for dynamic change events of form data objects in real time and detect the key value status of the object's unique identifier field to automatically determine the current operation mode of the form. The key value status includes a first key value status and a second key value status. The current operation mode of the form includes the add mode corresponding to the first key value status and triggering the draft saving process, and the edit mode corresponding to the second key value status and skipping the draft saving process. The first key-value state is when the object's unique identifier field is empty or null, and the second key-value state is when the object's unique identifier field is a valid identifier; The silent mode control module provides a silent mode switch interface that disables the automatic save mode by default. The silent mode switch interface is a switch element on the user interface used to enable or disable the automatic save function, and the default state is that the automatic save function is disabled. Based on the obtained user operation command, the system switches to silent mode, which is a system state in which the automatic save function is disabled, and the data persistence operation is only performed when the user triggers the save command. The difference detection module is used to construct an initial default value benchmark library, which is a data structure that stores the default values of form fields. The module uses a depth-first traversal algorithm to perform a depth-first traversal on the nested structure of the current form data, and compares the field values of the current form data with the field-level differences of the default values in the initial default value benchmark library layer by layer to obtain the field comparison results. Based on the field comparison results, duplicates are removed, incremental data actively modified by the user is extracted, and a structured draft snapshot is generated. The data storage module is used to optimize the size of the structured draft snapshot based on a preset lossless compression algorithm, and perform storage in combination with data storage management parameters, including storage location, compression level and retention strategy.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the processing method for automatically saving smart form drafts as described in any one of claims 1 to 7.
10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the processing method for automatically saving smart form drafts as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and computer-readable medium for verifying and saving an electronic document
CN1794191A
Dynamic content management application
WO2002095617A1