River and canal patrol automatic filing system and method supporting offline collection
Patent Information
- Application Number
- CN202611129644.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-28
- Publication Date
- 2026-10-27
AI Technical Summary
[0005]本发明所要解决的技术问题是提供一种支持离线采集的河渠巡查自动归档系统及方法,旨在克服现有河渠巡查工具在无网络区域无法正常采集数据、归档依赖人工整理易出错、表单字段固化需修改代码以及照片缺乏防伪校验的缺陷,具有基于PWA离线采集与自动归档引擎实现巡查数据全流程自动化处理、以哈希链保障档案完整性、通过可视化配置与版本向量机制提升业务适配性与数据一致性的特点
1,本发明通过构建基于渐进式网页技术的移动端采集终端,结合IndexedDB与Service Worker实现无网络环境下的巡查数据与现场图片的结构化离线缓存,并在拍摄端引入拉普拉斯方差清晰度筛选与DCT感知哈希去重机制对图片进行质量预筛选,同时采用分块断点续传方式实现网络恢复后的增量数据同步,实现了野外无信号区域巡查数据的完整采集与可靠回传。该方案使得巡查人员在完全无网络的河渠现场可正常填报巡查记录、拍摄并留存有效现场照片,关闭页面或重启设备后数据不丢失,网络恢复后自动从断点继续传输,无需人工干预。解决了现有技术中纯在线工具在无信号区域无法使用、基础缓存数据易丢失以及大图片上传反复失败的缺陷,完美适配偏远河渠无信号的巡查场景,同时免安装的使用方式大幅降低了基层巡查人员的学习与使用门槛。
Smart Images

Figure CN122985718A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of information management technology for water conservancy projects, and in particular relates to an automatic archiving system and method for river and canal inspections that supports offline data collection. Background Technology
[0002] With the full implementation of the river chief and lake chief systems, daily river and canal patrols have become a core and routine task in water conservancy project management and water environment protection. Patrol personnel are required to regularly conduct on-site inspections of their managed river sections, recording various issues such as embankment damage, water pollution, illegal sewage discharge, floating garbage, and abnormal water levels, and retaining on-site photos as supporting evidence. These are ultimately compiled into standardized archives for future reference. The patrol work covers a wide range of rivers and canals, is frequent, and many are located in remote areas with insufficient or no mobile communication signal coverage. In such network-free environments, how to reliably collect and persistently store patrol data, how to automatically convert collected patrol data into standardized ledgers that conform to water conservancy archive management standards, and how to flexibly adapt patrol forms for different river sections and seasons without relying on system code modifications are a set of interrelated technical problems that urgently need to be solved in the current informatization construction of river and canal patrols.
[0003] The current river patrol field is gradually transitioning from traditional paper records to digital ones. Existing technologies mainly include three categories: dedicated native applications, WeChat mini-programs, and ordinary web-based reporting systems. Dedicated native applications are usually developed for specific operating systems, requiring users to download and install packages and update them regularly, resulting in high promotion costs in grassroots environments with diverse patrol equipment. While WeChat mini-programs and ordinary web-based reporting systems are installation-free, their operation is heavily dependent on a network connection, rendering them unusable in areas without signal. Some tools offer basic local caching capabilities, but their caching mechanisms largely rely on the browser's default storage quota, leading to poor data persistence and a risk of data loss when the page is closed or the device is restarted. Regarding the archiving of patrol data, existing systems typically only store patrol data as database records, lacking fully automated processing capabilities from data reception to archive compilation. Staff must manually log into the system to export patrol records one by one, manually categorize and store on-site photos by river section and time, and create ledger documents according to water conservancy archive standards—a process highly dependent on manual operation.
[0004] The aforementioned existing technical solutions have the following drawbacks. First, purely online web pages and mini-programs cannot fill in data or retain photos in offline environments. The basic caching capabilities of some tools are limited by capacity and insufficient data persistence, making it difficult to support a complete offline inspection workflow, severely impacting the normal operation of inspections in remote river sections. Second, the archiving and organization of inspection data relies entirely on manual operation. From data export, photo classification, file naming to ledger creation, each step requires manual completion by office staff. This is cumbersome, labor-intensive, and prone to errors such as classification errors, data omissions, and non-standard naming, failing to meet the standardized and regulated management requirements of water conservancy archives. Third, the field structure of the inspection forms is fixed during the system development phase. The inspection focus for different river sections and the inspection items for different seasons vary. Each adjustment to the form fields requires modification of the system source code and redeployment, resulting in poor adaptability, high maintenance costs, and an inability to quickly respond to the dynamic changes in inspection needs. Fourth, the lack of effective anti-counterfeiting verification mechanisms for on-site inspection photos makes them susceptible to replacement or tampering during storage and transmission, resulting in insufficient evidentiary value of inspection records. Furthermore, most existing systems have weak operational traceability capabilities, failing to fully record the entire process of data upload, modification, and export, which is insufficient to meet the compliance management requirements of water conservancy work. Therefore, it is necessary to design an automatic archiving system and method for river and canal inspections that supports offline data collection to address the above issues. Summary of the Invention
[0005] The technical problem to be solved by this invention is to provide an automatic archiving system and method for river and canal inspections that supports offline data collection. It aims to overcome the shortcomings of existing river and canal inspection tools, such as the inability to collect data properly in areas without network access, reliance on manual sorting for archiving which is prone to errors, fixed form fields requiring code modification, and lack of anti-counterfeiting verification for photos. It features automated processing of inspection data throughout the entire process based on PWA offline data collection and automatic archiving engine, ensuring the integrity of archives with hash chain, and improving business adaptability and data consistency through visual configuration and version vector mechanism.
[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows: An automatic archiving system for river and canal inspections that supports offline data collection includes a mobile PWA data collection terminal, a backend management service unit, an automatic archiving engine unit, a visual form configuration unit, and a local data storage unit, wherein: The mobile PWA data acquisition terminal is built using progressive web technology. It can be accessed through a browser and added to the desktop for full-screen operation. It has built-in login authentication unit, dynamic form rendering unit, on-site photo processing unit, GPS positioning unit, offline storage unit and automatic synchronization unit. The offline storage unit is implemented based on IndexedDB and ServiceWorker. It caches form field configurations, river and canal ledger lists, filled-in patrol data and captured on-site photos in the absence of network environment. The data is persistently retained after the page is closed or the device is restarted. The automatic synchronization unit monitors the network status of the device in real time. After detecting that the network connection has been restored, it silently uploads the patrol records and pictures to be synchronized locally to the backend management service unit in batches. After the upload is successful, it automatically clears the local cache data. The backend management service unit is deployed on an internal server and includes a user permission management unit, a data verification unit, a river and canal ledger management unit, and an operation log unit, providing service support for the mobile PWA data collection terminal and the PC management backend. After receiving the inspection data and images, the automatic archiving engine unit automatically creates a multi-level storage directory according to the preset hierarchical rules, renames the on-site images according to the preset naming rules, and automatically generates a PDF inspection log containing inspection text information and image thumbnails according to the form field configuration, and saves it into the corresponding task directory. The visual form configuration unit is integrated into the PC management backend, providing an interface for adding, deleting, modifying, and sorting form fields. After the configuration is saved, it is synchronized to the database in real time. When the mobile PWA data collection terminal pulls the configuration, the form structure is automatically updated. The local data storage unit uses the SQLite lightweight file database to store business data, while archive files are stored on the server's local file system.
[0007] Furthermore, the offline storage unit creates a database named "InspectionDB" in IndexedDB, containing three object stores: "formConfig" for storing form field configurations, with the key path "configVersion"; "riverLedger" for storing the list of river and canal ledgers, with the key path "riverId" and an index "district"; and "pendingRecords" for storing inspection records and images to be synchronized, with the key path "recordId" and two indexes "syncStatus" and "createdTime". ServiceWorker adopts a cache-first strategy: it intercepts fetch requests from mobile devices for form configurations and river and canal ledgers, prioritizes returning cached data from IndexedDB, and updates the cache in the background.
[0008] Furthermore, the layout rules for the PDF inspection log generated by the automatic archiving engine unit are as follows: the page adopts an A4 portrait layout, the header displays the river / canal name and inspection date in the center, the text area is arranged in the order of the form fields in the configuration, each field occupies a separate line with a display name and field value paired, text and multi-line text field values are displayed left-aligned, number and date field values are displayed right-aligned, and drop-down selection field values display the corresponding Chinese labels of the options; on-site image thumbnails are arranged in rows of 3 with equal width after the text content, and the corresponding renamed file name of the image is displayed in the center below each thumbnail.
[0009] Preferably, after the on-site photo processing unit calls the device's camera to take a picture or selects a picture from the album, it compresses a single picture to a set size of less than 800KB at the front end and automatically overlays a semi-transparent anti-counterfeiting watermark on the picture. The watermark content includes the river section name, shooting time, GPS coordinates and the name of the patrolman. The watermark is fixed in the lower left corner of the picture.
[0010] Furthermore, the GPS positioning unit automatically obtains the coordinate information of the current patrol point and binds the coordinates to the patrol record, while also allowing patrol personnel to manually correct coordinate deviations.
[0011] Preferably, the user permission management unit divides the roles and permissions into three levels: inspector, administrator, and leader. Inspectors can only operate and view the inspection data they submit, administrators have full system management and configuration permissions, and leaders can only view inspection records and statistics without modification or configuration permissions; user passwords are stored using bcrypt hash encryption.
[0012] Furthermore, the cost factor for bcrypt hash encryption is 12, meaning that... Round iteration; the salt value is generated independently by the system calling the secure random number generator, and a 16-byte random salt value is generated for each user. The salt value and the hash result are concatenated and stored in a standard format.
[0013] Furthermore, the operation log unit records all user login, data submission, configuration modification, file export, and information deletion operations. Each log entry includes the operation time, operator IP, and operation content. The logs are permanently retained and cannot be deleted.
[0014] Furthermore, the automatic archiving engine unit's archiving directory hierarchy rules are as follows: it automatically creates multi-level storage directories based on year, month, river / canal name, and task identifier consisting of patrol task ID, patroller, and patrol date; on-site images are automatically renamed to standardized filenames consisting of date, hazard type, and serial number; and only fields configured for PDF display are included in the ledger content.
[0015] Furthermore, the automatic archiving engine unit also includes a batch export unit, which supports filtering patrol files by time period, river / canal name, and patrol personnel, and packages all eligible archive directories into a ZIP archive for download. It also supports exporting individual patrol records as PDFs or downloading them as a package.
[0016] Furthermore, the visual form configuration unit supports five field types: text, multiline text, drop-down selection, number, and date. Each field can be configured with attributes such as field identifier, display name, field type, whether it is required, and whether it is displayed in the PDF ledger. Drop-down type fields support a custom list of option values. It also has a built-in function to reset default fields, which can restore the system's initial form configuration with one click.
[0017] Preferably, before uploading each inspection record, the automatic synchronization unit uses a version vector mechanism to detect data conflicts. When a concurrent conflict is detected, the last writer wins the merge strategy. Each inspection record maintains a version vector, and each device identifier in the record corresponds to a monotonically increasing logical clock value. During synchronization, the local and server version vectors are compared. If the local version vector is causally earlier than the server version vector, the upload is performed to overwrite. If the server version vector is causally earlier than the local version vector, the download is performed to update. When the two are concurrent, a conflict merge is triggered.
[0018] Preferably, the specific rule for causal order comparison of version vectors is as follows: Let the local version vector be: ; The server version vector is: ; in Indicates equipment identification. and These represent the local and server sides on the device, respectively. The logical clock value on; the causal precedence criterion is: for all satisfy And there exists at least one satisfy ,but Cause and effect precede Concurrency criterion is: neither Cause and effect precede Not Cause and effect precede In the event of concurrent conflicts, if the conflicting fields are different fields, the modifications of both parties will be automatically merged and retained. If they are the same field, the newer value will be retained based on the last write timestamp of the server record.
[0019] Preferably, after capturing images but before compression, the on-site image processing unit also performs image quality pre-screening: first, it uses the Laplacian variance algorithm to calculate the image sharpness score, the calculation formula being: ; in, Represents pixels The Laplace operator response value at that point. This represents the mean of the Laplace response across the entire graph. and These represent the image's pixel height and width, respectively; sharpness score. Below the preset threshold If the image is deemed blurry, the user is prompted to retake the photo, and storage is refused. Secondly, for images that pass the clarity screening, a 64-bit binary fingerprint is generated using the DCT perceptual hash algorithm. This fingerprint is then compared with the Hamming distance of the hash set of locally stored images. If the distance is less than a preset threshold... Images that are identified as duplicates are automatically discarded if they are greater than or equal to [the specified value]. The hash fingerprint is stored in the offline storage unit and added to the local collection.
[0020] Furthermore, the sharpness scoring threshold The value range is [50, 200], and the default value is 100; Hamming distance threshold The value range is [5, 15], and the default value is 10, which means that if the number of different bits in the 64-bit hash fingerprint does not exceed 10, it is determined to be a duplicate image.
[0021] Preferably, the automatic synchronization unit synchronizes each image to be synchronized according to a fixed size. The bytes are divided into several data blocks, and each data block is assigned a sequence number. and upload status flags During upload, data blocks are transmitted sequentially in ascending order of their sequence numbers. The server returns an acknowledgment response upon receiving each complete data block. The mobile device then sends the corresponding response upon receiving the acknowledgment. Marked as complete; if the network is interrupted during the upload process, data blocks marked as complete will not be retransmitted, and will resume from the first block after the network is restored. Continue transmitting the data blocks to be uploaded.
[0022] Furthermore, the automatic synchronization unit also maintains a synchronization state machine for each inspection record, including five states: pending synchronization, synchronizing, uploaded, verified, and cleared. The state transition rules are as follows: when a record enters the synchronization queue, it is set to pending synchronization; when the first data block starts uploading, it is set to synchronizing; after all data blocks have been uploaded and the server returns a verification result, it is set to uploaded; after the server completes the archiving process and returns an archiving confirmation, it is set to verified; and after the local cached data is cleared, it is set to cleared.
[0023] Preferably, after completing each archiving operation, the automatic archiving engine unit calculates the SHA-256 hash value for each file in the archive directory; organizes all file hash values into a Merkle tree structure; assuming the archive directory contains... There are 3 files, and the hash value of each file is used as the leaf node of the level 0 Merkle tree: ; Two adjacent hash values are concatenated and then hashed again to generate the node at the next level: ; Continue upwards layer by layer until a unique root hash value is generated. ; Write it to the operation log unit for permanent retention; the first one of the same canal The archived record will contain the first The root hash value of the second archive As a predecessor hash field This forms a hash chain that spans time.
[0024] Preferably, a method for automatic archiving of river and canal patrols that supports offline data collection includes the following steps: System initialization configuration: Administrators enter river and canal ledger information through the PC backend, create user accounts and assign role permissions, configure form fields according to patrol business needs, and store all configuration information in the local data storage unit; Mobile login and resource caching: Patrol personnel open the system page through a mobile device browser and add it to the desktop. They complete identity authentication using their employee ID and password. After successful authentication, the system automatically retrieves the latest form field configuration and the list of rivers and canals that the patrol personnel are responsible for, and caches them locally on the mobile device. On-site inspection data collection: After the inspection personnel arrive at the inspection point, the GPS positioning unit automatically obtains the current coordinates; the inspection personnel fill in the inspection information in the dynamically generated form, call the camera to take on-site photos, and the images are processed in sequence by clarity filtering, perceptual hash deduplication, compression and watermark overlay; if the network is normal, the data is uploaded to the backend management service unit in real time after submission; if there is no network, the data is temporarily stored in the offline storage unit. Automatic offline data synchronization: The mobile device continuously monitors the network status. After the network is detected to be restored, version vector conflict detection is performed on each record to be synchronized. For records with no conflict or whose conflicts have been merged, the associated images are uploaded in a breakpoint resume manner according to data block fragments. After the upload is successful, the local cache data is automatically cleared. Backend automatic archiving: After receiving the inspection data, the backend automatic archiving engine creates multi-level storage directories according to preset hierarchical rules, renames the on-site pictures according to preset naming rules and stores them in the corresponding directories, generates a PDF inspection log containing inspection text information and image thumbnails according to the form field configuration and stores it in the corresponding directory, calculates the hash value of all files in the archive directory and builds a Merkle tree, and writes the root hash value into the operation log for permanent retention. File Query and Export: Administrators or leaders can filter patrol records by time period, river / canal name, and patrol personnel through the PC backend, view record details and on-site photos, select a single record to export as PDF, or select a batch of records to generate a ZIP archive package for download.
[0025] During the on-site inspection data collection process, the Laplacian variance algorithm was used for image sharpness selection: the Laplacian response variance of the image was calculated. ,when Below the preset threshold If an image is deemed blurry, it is refused storage and a retake is prompted. For deduplication, a 64-bit binary fingerprint is generated using the DCT perceptual hash algorithm and compared to the locally stored image hash set. The Hamming distance is calculated between the fingerprint and the fingerprint; if the distance is less than a preset threshold... Images that are identified as duplicates are automatically discarded.
[0026] Preferably, in the automatic offline data synchronization, the version vector conflict detection mechanism is as follows: each inspection record maintains a version vector, and each device corresponds to a logical clock value. During synchronization, the local version vector and the server version vector are compared. If the local version vector is causally earlier than the server version vector, the overwrite upload is performed. If the server version vector is causally earlier than the local version vector, the download update is performed. If the two occur concurrently, the conflict merging is triggered.
[0027] Preferably, in the backend automatic archiving process, the hash chain is constructed as follows after archiving: SHA-256 hash values are calculated for each file in the archive directory to serve as Merkle leaf nodes; the hash values of adjacent leaf nodes are concatenated and hashed again to generate the root hash value layer by layer upwards. The first of the same canal The archived record will contain the first The root hash value of the second archive Deposit the first The predecessor hash field of each record forms a hash chain that spans time.
[0028] Preferably, a computer device includes a memory and a processor, which are interconnected. The memory stores computer instructions, and the processor executes the computer instructions to perform the aforementioned automatic archiving method for river and canal patrols that supports offline data collection.
[0029] Preferably, a computer-readable storage medium stores computer instructions that cause a computer to execute the aforementioned automatic archiving method for river and canal patrols supporting offline data collection.
[0030] The beneficial effects of this invention are as follows: 1. This invention constructs a mobile data acquisition terminal based on progressive web technology, combining IndexedDB and Service Worker to achieve structured offline caching of patrol data and on-site images in network-free environments. At the shooting end, Laplace variance sharpness filtering and DCT perceptual hashing deduplication mechanisms are introduced to pre-screen images for quality. Simultaneously, a segmented breakpoint resume transmission method is used to synchronize incremental data after network recovery, achieving complete collection and reliable transmission of patrol data in signal-free areas. This solution allows patrol personnel to normally fill out patrol records, take and retain valid on-site photos in completely network-free river and canal sites. Data is not lost after closing the page or restarting the device, and transmission automatically resumes from the breakpoint after network recovery, requiring no manual intervention. It solves the shortcomings of existing technologies, such as the inability of purely online tools to be used in signal-free areas, easy loss of basic cached data, and repeated failures in uploading large images. It is perfectly adapted to patrol scenarios in remote river and canal areas without signal, and the installation-free usage significantly reduces the learning and usage threshold for grassroots patrol personnel.
[0031] 2. This invention, through the establishment of a fully automated archiving engine, automatically creates multi-level storage directories according to preset hierarchical levels of year, month, river / canal name, and task identifier after receiving patrol data. It automatically renames on-site images according to rules of date, hazard type, and sequence number, and automatically generates standard PDF patrol ledgers containing patrol text information and image thumbnails based on form field configurations. Simultaneously, after archiving is completed, a Merkle tree hash chain is constructed for all files in the directory, and the root hash value is permanently stored in the operation log. This solution achieves fully automated processing from patrol data submission to standard archive compilation, eliminating the need for manual classification and organization by internal staff, and completely avoiding common problems in manual archiving such as classification errors, data omissions, and non-standard naming. The hash chain mechanism provides file-level integrity self-verification capabilities for archived files; any replacement or modification of archived files will cause the hash chain to break and be detected. This solves the shortcomings of existing technologies that rely on manual operation for patrol data archiving, resulting in low efficiency and susceptibility to errors, meets the requirements of standardized management of water conservancy archives, and improves the tamper-proof capability of archived files.
[0032] 3. This invention, through the configuration of a visual form configuration unit, allows administrators to visually add, delete, modify, drag, and sort inspection form fields via a PC backend. Each field can be independently configured with an identifier, display name, type, required attributes, and PDF display attributes. Configuration takes effect immediately upon saving, and mobile devices automatically synchronize the latest form structure without requiring client updates. Simultaneously, a version vector conflict detection mechanism is introduced to automatically detect and merge concurrent modification conflicts in offline data during multi-device collaborative inspections, preventing data overwriting and loss. Furthermore, on-site photos are automatically overlaid with a semi-transparent anti-counterfeiting watermark containing the river section name, shooting time, GPS coordinates, and inspector's name. Combined with a permanent, non-deletable mechanism for the entire operation process log and a three-tiered role-based access control system, this forms a complete anti-counterfeiting and traceability system from data collection, transmission, storage to archiving. This solves the shortcomings of existing technologies, such as fixed form fields requiring code modification, potential data conflicts in offline multi-device collaboration, lack of anti-counterfeiting verification for photos, and weak operation traceability capabilities. It significantly improves the system's business adaptability and the evidentiary value of inspection data, meeting the compliance management requirements of water conservancy work. Attached Figure Description
[0033] Figure 1 This is a schematic diagram of the system structure according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the method flow according to an embodiment of the present invention; Figure 3 This is a schematic diagram illustrating the Laplace variance distribution and sharpness threshold determination of on-site photos of river and canal inspections in an embodiment of the present invention. Figure 4 This is a schematic diagram illustrating the perceptual hash Hamming distance distribution and the determination of the duplicate image deduplication threshold in an embodiment of the present invention; Figure 5 This is a schematic diagram comparing the Merkle tree root hash value of the archived files in this embodiment of the invention under normal and tampered conditions. Detailed Implementation
[0034] Example 1: like Figure 1 As shown, an automatic archiving system for river and canal inspections that supports offline data collection includes a mobile PWA data collection terminal, a backend management service unit, an automatic archiving engine unit, a visual form configuration unit, and a local data storage unit, wherein: The mobile PWA data acquisition terminal is built using progressive web technology. It can be accessed through a browser and added to the desktop for full-screen operation. It has built-in login authentication unit, dynamic form rendering unit, on-site photo processing unit, GPS positioning unit, offline storage unit and automatic synchronization unit. The offline storage unit is implemented based on IndexedDB and ServiceWorker. It caches form field configurations, river and canal ledger lists, filled-in patrol data and captured on-site photos in the absence of network environment. The data is persistently retained after the page is closed or the device is restarted. The automatic synchronization unit monitors the network status of the device in real time. After detecting that the network connection has been restored, it silently uploads the patrol records and pictures to be synchronized locally to the backend management service unit in batches. After the upload is successful, it automatically clears the local cache data. The backend management service unit is deployed on an internal server and includes a user permission management unit, a data verification unit, a river and canal ledger management unit, and an operation log unit, providing service support for the mobile PWA data collection terminal and the PC management backend. After receiving the inspection data and images, the automatic archiving engine unit automatically creates a multi-level storage directory according to the preset hierarchical rules, renames the on-site images according to the preset naming rules, and automatically generates a PDF inspection log containing inspection text information and image thumbnails according to the form field configuration, and saves it into the corresponding task directory. The visual form configuration unit is integrated into the PC management backend, providing an interface for adding, deleting, modifying, and sorting form fields. After the configuration is saved, it is synchronized to the database in real time, and the form structure is automatically updated when the mobile PWA data collection terminal pulls the configuration. The local data storage unit uses the SQLite lightweight file database to store business data, while archive files are stored on the server's local file system.
[0035] Furthermore, the offline storage unit creates a database named "InspectionDB" in IndexedDB, containing three object stores: "formConfig" for storing form field configurations, with the key path "configVersion"; "riverLedger" for storing the list of river and canal ledgers, with the key path "riverId" and an index "district"; and "pendingRecords" for storing inspection records and images to be synchronized, with the key path "recordId" and two indexes "syncStatus" and "createdTime". ServiceWorker adopts a cache-first strategy: it intercepts fetch requests from mobile devices for form configurations and river and canal ledgers, prioritizes returning cached data from IndexedDB, and updates the cache in the background.
[0036] Furthermore, the layout rules for the PDF inspection log generated by the automatic archiving engine unit are as follows: the page adopts an A4 portrait layout, the header displays the river / canal name and inspection date in the center, the text area is arranged in the order of the form fields in the configuration, each field occupies a separate line with a display name and field value paired, text and multi-line text field values are displayed left-aligned, number and date field values are displayed right-aligned, and drop-down selection field values display the corresponding Chinese labels of the options; on-site image thumbnails are arranged in rows of 3 with equal width after the text content, and the corresponding renamed file name of the image is displayed in the center below each thumbnail.
[0037] Preferably, after the on-site photo processing unit calls the device's camera to take a picture or selects a picture from the album, it compresses a single picture to a set size of less than 800KB at the front end and automatically overlays a semi-transparent anti-counterfeiting watermark on the picture. The watermark content includes the river section name, shooting time, GPS coordinates and the name of the patrolman. The watermark is fixed in the lower left corner of the picture.
[0038] Furthermore, the GPS positioning unit automatically obtains the coordinate information of the current patrol point and binds the coordinates to the patrol record, while also allowing patrol personnel to manually correct coordinate deviations.
[0039] Preferably, the user permission management unit divides the roles and permissions into three levels: inspector, administrator, and leader. Inspectors can only operate and view the inspection data they submit, administrators have full system management and configuration permissions, and leaders can only view inspection records and statistics without modification or configuration permissions; user passwords are stored using bcrypt hash encryption.
[0040] Furthermore, the cost factor for bcrypt hash encryption is 12, meaning that... Round iteration; the salt value is generated independently by the system calling the secure random number generator, and a 16-byte random salt value is generated for each user. The salt value and the hash result are concatenated and stored in a standard format.
[0041] Furthermore, the operation log unit records all user login, data submission, configuration modification, file export, and information deletion operations. Each log entry includes the operation time, operator IP, and operation content. The logs are permanently retained and cannot be deleted.
[0042] Furthermore, the automatic archiving engine unit's archiving directory hierarchy rules are as follows: it automatically creates multi-level storage directories based on year, month, river / canal name, and task identifier consisting of patrol task ID, patroller, and patrol date; on-site images are automatically renamed to standardized filenames consisting of date, hazard type, and serial number; and only fields configured for PDF display are included in the ledger content.
[0043] Furthermore, the automatic archiving engine unit also includes a batch export unit, which supports filtering patrol files by time period, river / canal name, and patrol personnel, and packages all eligible archive directories into a ZIP archive for download. It also supports exporting individual patrol records as PDFs or downloading them as a package.
[0044] Furthermore, the visual form configuration unit supports five field types: text, multiline text, drop-down selection, number, and date. Each field can be configured with attributes such as field identifier, display name, field type, whether it is required, and whether it is displayed in the PDF ledger. Drop-down type fields support a custom list of option values. It also has a built-in function to reset default fields, which can restore the system's initial form configuration with one click.
[0045] Preferably, before uploading each inspection record, the automatic synchronization unit uses a version vector mechanism to detect data conflicts. When a concurrent conflict is detected, the last writer wins the merge strategy. Each inspection record maintains a version vector, and each device identifier in the record corresponds to a monotonically increasing logical clock value. During synchronization, the local and server version vectors are compared. If the local version vector is causally earlier than the server version vector, the upload is performed to overwrite. If the server version vector is causally earlier than the local version vector, the download is performed to update. When the two are concurrent, a conflict merge is triggered.
[0046] Preferably, the specific rule for causal order comparison of version vectors is as follows: Let the local version vector be: ; The server version vector is: ; in Indicates equipment identification. and These represent the local and server sides on the device, respectively. The logical clock value on; the causal precedence criterion is: for all satisfy And there exists at least one satisfy ,but Cause and effect precede Concurrency criterion is: neither Cause and effect precede Not Cause and effect precede In the event of concurrent conflicts, if the conflicting fields are different fields, the modifications of both parties will be automatically merged and retained. If they are the same field, the newer value will be retained based on the last write timestamp of the server record.
[0047] Preferably, after capturing images but before compression, the on-site image processing unit also performs image quality pre-screening: first, it uses the Laplacian variance algorithm to calculate the image sharpness score, the calculation formula being: ; in, Represents pixels The Laplace operator response value at that point. This represents the mean of the Laplace response across the entire graph. and These represent the image's pixel height and width, respectively; sharpness score. Below the preset threshold If the image is deemed blurry, the user is prompted to retake the photo, and storage is refused. Secondly, for images that pass the clarity screening, a 64-bit binary fingerprint is generated using the DCT perceptual hash algorithm. This fingerprint is then compared with the Hamming distance of the hash set of locally stored images. If the distance is less than a preset threshold... Images that are identified as duplicates are automatically discarded if they are greater than or equal to [the specified value]. The hash fingerprint is stored in the offline storage unit and added to the local collection.
[0048] Furthermore, the sharpness scoring threshold The value range is [50, 200], and the default value is 100; Hamming distance threshold The value range is [5, 15], and the default value is 10, which means that if the number of different bits in the 64-bit hash fingerprint does not exceed 10, it is determined to be a duplicate image.
[0049] Preferably, the automatic synchronization unit synchronizes each image to be synchronized according to a fixed size. The bytes are divided into several data blocks, and each data block is assigned a sequence number. and upload status flags During upload, data blocks are transmitted sequentially in ascending order of their sequence numbers. The server returns an acknowledgment response upon receiving each complete data block. The mobile device then sends the corresponding response upon receiving the acknowledgment. Marked as complete; if the network is interrupted during the upload process, data blocks marked as complete will not be retransmitted, and will resume from the first block after the network is restored. Continue transmitting the data blocks to be uploaded.
[0050] Furthermore, the automatic synchronization unit also maintains a synchronization state machine for each inspection record, including five states: pending synchronization, synchronizing, uploaded, verified, and cleared. The state transition rules are as follows: when a record enters the synchronization queue, it is set to pending synchronization; when the first data block starts uploading, it is set to synchronizing; after all data blocks have been uploaded and the server returns a verification result, it is set to uploaded; after the server completes the archiving process and returns an archiving confirmation, it is set to verified; and after the local cached data is cleared, it is set to cleared.
[0051] Preferably, after completing each archiving operation, the automatic archiving engine unit calculates the SHA-256 hash value for each file in the archive directory; organizes all file hash values into a Merkle tree structure; assuming the archive directory contains... There are 3 files, and the hash value of each file is used as the leaf node of the level 0 Merkle tree: ; Two adjacent hash values are concatenated and then hashed again to generate the node at the next level: ; Continue upwards layer by layer until a unique root hash value is generated. ; Write it to the operation log unit for permanent retention; the first one of the same canal The archived record will contain the first The root hash value of the second archive As a predecessor hash field This forms a hash chain that spans time.
[0052] like Figure 2 As shown, an automatic archiving method for river and canal patrol inspections that supports offline data collection includes the following steps: System initialization configuration: Administrators enter river and canal ledger information through the PC backend, create user accounts and assign role permissions, configure form fields according to patrol business needs, and store all configuration information in the local data storage unit; Mobile login and resource caching: Patrol personnel open the system page through a mobile device browser and add it to the desktop. They complete identity authentication using their employee ID and password. After successful authentication, the system automatically retrieves the latest form field configuration and the list of rivers and canals that the patrol personnel are responsible for, and caches them locally on the mobile device. On-site inspection data collection: After the inspection personnel arrive at the inspection point, the GPS positioning unit automatically obtains the current coordinates; the inspection personnel fill in the inspection information in the dynamically generated form, call the camera to take on-site photos, and the images are processed in sequence by clarity filtering, perceptual hash deduplication, compression and watermark overlay; if the network is normal, the data is uploaded to the backend management service unit in real time after submission; if there is no network, the data is temporarily stored in the offline storage unit. Automatic offline data synchronization: The mobile device continuously monitors the network status. After the network is detected to be restored, version vector conflict detection is performed on each record to be synchronized. For records with no conflict or whose conflicts have been merged, the associated images are uploaded in a breakpoint resume manner according to data block fragments. After the upload is successful, the local cache data is automatically cleared. Backend automatic archiving: After receiving the inspection data, the backend automatic archiving engine creates multi-level storage directories according to preset hierarchical rules, renames the on-site pictures according to preset naming rules and stores them in the corresponding directories, generates a PDF inspection log containing inspection text information and image thumbnails according to the form field configuration and stores it in the corresponding directory, calculates the hash value of all files in the archive directory and builds a Merkle tree, and writes the root hash value into the operation log for permanent retention. File Query and Export: Administrators or leaders can filter patrol records by time period, river / canal name, and patrol personnel through the PC backend, view record details and on-site photos, select a single record to export as PDF, or select a batch of records to generate a ZIP archive package for download.
[0053] During the on-site inspection data collection process, the Laplacian variance algorithm was used for image sharpness selection: the Laplacian response variance of the image was calculated. ,when Below the preset threshold If an image is deemed blurry, it is refused storage and a retake is prompted. For deduplication, a 64-bit binary fingerprint is generated using the DCT perceptual hash algorithm and compared to the locally stored image hash set. The Hamming distance is calculated between the fingerprint and the fingerprint; if the distance is less than a preset threshold... Images that are identified as duplicates are automatically discarded.
[0054] Preferably, in the automatic offline data synchronization, the version vector conflict detection mechanism is as follows: each inspection record maintains a version vector, and each device corresponds to a logical clock value. During synchronization, the local version vector and the server version vector are compared. If the local version vector is causally earlier than the server version vector, the overwrite upload is performed. If the server version vector is causally earlier than the local version vector, the download update is performed. If the two occur concurrently, the conflict merging is triggered.
[0055] Preferably, in the backend automatic archiving process, the hash chain is constructed as follows after archiving: SHA-256 hash values are calculated for each file in the archive directory to serve as Merkle leaf nodes; the hash values of adjacent leaf nodes are concatenated and hashed again to generate the root hash value layer by layer upwards. The first of the same canal The archived record will contain the first The root hash value of the second archive Deposit the first The predecessor hash field of each record forms a hash chain that spans time.
[0056] Preferably, a computer device includes a memory and a processor, which are interconnected. The memory stores computer instructions, and the processor executes the computer instructions to perform the aforementioned automatic archiving method for river and canal patrols that supports offline data collection.
[0057] Preferably, a computer-readable storage medium stores computer instructions that cause a computer to execute the aforementioned automatic archiving method for river and canal patrols supporting offline data collection.
[0058] Example 2: This example uses the actual patrol work of a municipal river management office as an application scenario. The office manages five canals: the North Main Canal, South Main Canal, East Branch Canal, West Branch Canal, and the Central River Section, with a total patrol mileage of approximately 85 km. It is staffed with 10 patrol personnel and 2 internal affairs and record-keeping administrators. Patrols are conducted once daily, with each patrol member responsible for the entire length of one canal per day, taking an average of 20 to 30 photos per patrol.
[0059] The experimental platform was set up as follows: The server was deployed on the management office's intranet server, configured with an Intel Xeon E-2288G processor, 64GB of RAM, 4TB of local storage, running the Ubuntu Server 20.04 operating system, and equipped with the Node.js v18 runtime environment and SQLite 3.40 database. Three different Android devices were used to simulate patrol terminals: a Xiaomi 13, a Huawei Mate 60, and an OPPO Find X6. All devices accessed the PWA application page through the Chrome browser and were added to the desktop. The offline testing environment simulated a completely network-free state by disabling WiFi and mobile data. The weak network testing environment simulated weak 2G / 3G signal conditions in remote areas by limiting the router's speed to 128Kbps upload and 512Kbps download.
[0060] The parameter settings are as follows: Sharpness threshold Set the threshold to 100 (Hamming distance). Take 10, image compression limit 800KB, upload in chunks size We set the size to 256KB, the bcrypt cost factor to 12, and SHA-256 as the Merkle tree hash function.
[0061] The comparison method uses a widely adopted data collection solution based on a native Android app, commonly used in current river patrols. This solution supports basic SQLite local database storage and manual upload triggering, but lacks features such as image quality pre-screening at the camera end, perceptual hash deduplication, segmented breakpoint resume, and hash chain archive integrity verification. The archiving operation is performed manually by office staff. The comparison method operates under the same hardware and network conditions.
[0062] The implementation process was as follows: During a 30-day experimental period, 10 patrol personnel used both this solution and the comparative solution to complete 15-day patrols of 5 canals each, collecting a total of 300 patrol records and 7,500 on-site photos. This solution automatically performed Laplace variance sharpness filtering and DCT perceptual hashing deduplication at the shooting end. Filtered photos were compressed and watermarked before being stored in IndexedDB offline storage. After network recovery, the photos were uploaded in a segmented, breakpoint-resumption manner, and the server automatically archived and constructed a Merkle tree hash chain. The comparative solution directly stored all photos in an SQLite database. After network recovery, a full upload was manually triggered. After the upload was completed, office staff manually categorized, organized, and created a ledger. Specific data are shown in Tables 1 and 2 below.
[0063] Table 1: Image quality pre-screening results of this scheme;
[0064] Table 2: Comparison of key indicators between this plan and the comparative plan;
[0065] As shown in Tables 1 and 2, this solution demonstrates significant technological advancements over existing native app-based patrol solutions in terms of data collection quality, transmission efficiency, and archiving standardization during river and canal patrols.
[0066] In terms of data acquisition quality, by introducing Laplacian variance sharpness filtering and DCT perceptual hash deduplication mechanisms at the shooting end, this solution automatically removed 240 blurry photos and 162 near-duplicate photos from 1500 on-site photos, effectively storing 1098 high-quality unique photos. Offline storage space usage decreased from 984.5MB in the comparison solution to 723.1MB, a reduction of 26.5%. This mechanism performs quality gating at the source of shooting, avoiding unnecessary consumption of limited mobile IndexedDB storage space and network synchronization bandwidth by blurry and duplicate photos. The comparison solution stores all photos in SQLite without filtering, resulting in a large amount of low-quality data entering the subsequent transmission and archiving processes.
[0067] In terms of data transmission efficiency, the segmented breakpoint resumption mechanism of this solution reduces the average upload time for a single photo from 8.7 seconds in the comparison solution to 3.2 seconds, a reduction of 63.2%. The average number of retransmissions after an upload interruption is reduced from 3.5 to 0.8. Under simulated 128Kbps weak network uplink conditions, the comparison solution requires retransmitting the entire photo file from scratch after each network outage, resulting in repeated transmission failures of large images. This solution divides the image into 256KB blocks, transmits them block by block, and records the upload status. After network recovery, only the unfinished data blocks continue to be transmitted, significantly improving the synchronization success rate in weak network environments.
[0068] In terms of archiving standardization, our automated archiving engine reduced manual archiving time from 4.2 minutes per record in the comparison scheme to 0.5 minutes, achieving 100% accuracy in file naming and archive directory structure. More importantly, the Merkle tree hash chain mechanism provides file-level integrity verification for archived files—simulated replacement and tampering of archived photos of the North Main Canal and East Branch Canal were accurately detected with a 100% detection rate. The comparison scheme, relying solely on operation logs to record actions, cannot verify that file content remained unchanged after archiving, posing a security risk of undetected file replacement.
[0069] like Figure 3 The figure shows the statistical distribution of sharpness scores for 500 river and canal patrol photos using the Laplace variance algorithm. It is clear from the figure that the Laplace variance values of sharp photos are concentrated in the range of 150 to 600, forming a peak distribution on the right, while the variance values of blurry photos are concentrated in the range of 5 to 40, forming a low-value cluster on the left. There is a significant separation between the two types of photos in numerical space. The threshold line $T_s = 100$ is located in the middle blank area between the two distributions, enabling reliable binary classification of sharp and blurry photos. In existing technologies, patrol photos are directly stored and uploaded without sharpness screening, resulting in a large number of blurry and invalid photos occupying offline storage space and synchronization bandwidth. This invention deploys Laplace variance calculation at the shooting end, performing quality gating before photos enter offline storage, intercepting low-quality data at the source. This figure visually illustrates the distinguishing ability of Laplace variance as a sharpness indicator and the reasonable position of the threshold of 100 between the two distributions.
[0070] like Figure 4 The figure shows the statistical distribution of the Hamming distances of DCT-aware hashes between pairs of 500 photos. The figure plots the Hamming distance distributions between content-unique photo pairs and between nearly duplicate photo pairs. The Hamming distances of content-unique photo pairs are concentrated in the range of 25 to 45, with a mean of approximately 32, indicating significant differences between photos with different content in the 64-bit hash fingerprint space. The Hamming distances of nearly duplicate photo pairs are concentrated in the range of 0 to 14, with a mean of approximately 6, indicating minimal differences in the hash fingerprints of highly similar photos. The threshold line $T_h = 10$ is located in the transition region between the two distributions, effectively detecting nearly duplicate photo pairs while avoiding misclassification of photos with substantial content differences but similar visual styles as duplicates. In existing technologies, inspectors may unintentionally take multiple highly similar photos consecutively on-site, and the system does not perform any deduplication, leading to wasted storage and bandwidth. This invention uses a DCT-aware hashing deduplication mechanism to eliminate redundant data with lightweight computation before storage.
[0071] like Figure 5 As shown in the figure, a grouped bar chart compares the recalculated Merkle root hash values of five canals after normal archiving and after tampering. Under normal archiving conditions, the root hash value generated by SHA-256 hashing and Merkle tree reduction of all archived files within a 30-day inspection cycle for each canal is a unique 256-bit hash value. When a field photo file in the 15th day inspection record of the North Main Canal was replaced, the recalculated Merkle root hash value of the archived directory no longer matched the root hash value of the original record stored in the operation log. The difference is marked with a red highlighted bar in the figure. The South Main Canal was not tampered with, and its root hash value remained consistent. This figure visually demonstrates the self-verification capability of the hash chain mechanism for the integrity of archived files: any modification to an archived file will cause a change in the Merkle root hash value, which can be detected by comparing it with the original record stored in the log. Existing technologies rely solely on operation logs to record actions and cannot prove that the content of archived files has not been tampered with. This invention fills this protection gap through the hash chain.
[0072] Example 3: This invention also provides a computer device comprising: one or more processors, memory, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components are interconnected via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processor can process instructions executed within the computer device, including instructions stored in or on memory for displaying graphical information of a GUI on an external input / output device, such as a display device coupled to the interface. In some alternative embodiments, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations, for example, as a server array, a group of blade servers, or a multiprocessor system.
[0073] The processor can be a central processing unit, a network processor, or a combination thereof. The processor may further include hardware chips. These hardware chips can be application-specific integrated circuits (ASICs), programmable logic devices (PLDs), or combinations thereof. The programmable logic devices can be complex programmable logic devices (CLPs), field-programmable gate arrays (FPGAs), general-purpose array logic (GDAs), or any combination thereof.
[0074] The memory stores instructions executable by at least one processor to cause the at least one processor to perform the method shown in the above embodiments.
[0075] The memory may include a stored program area and a stored data area, wherein the stored program area may store the operating system and application programs required for at least one function; the stored data area may store data created based on the use of the computer device, etc. Furthermore, the memory may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory may optionally include memory remotely located relative to the processor, which can be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0076] The memory may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory may also include a combination of the above types of memory.
[0077] The computer device also includes a communication interface for communicating with other devices or communication networks.
[0078] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.
[0079] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and all such modifications and variations fall within the scope defined by the appended claims.
Claims
1. An automatic archiving system for river and canal inspections that supports offline data collection, comprising a mobile PWA data collection terminal, a backend management service unit, an automatic archiving engine unit, a visual form configuration unit, and a local data storage unit, characterized in that: The mobile PWA data acquisition terminal is built using progressive web technology. It can be accessed through a browser and added to the desktop for full-screen operation. It has built-in login authentication unit, dynamic form rendering unit, on-site photo processing unit, GPS positioning unit, offline storage unit and automatic synchronization unit. The offline storage unit is implemented based on IndexedDB and ServiceWorker. It caches form field configurations, river and canal ledger lists, filled-in patrol data and captured on-site photos in the absence of network environment. The data is persistently retained after the page is closed or the device is restarted. The automatic synchronization unit monitors the network status of the device in real time. After detecting that the network connection has been restored, it silently uploads the patrol records and pictures to be synchronized locally to the backend management service unit in batches. After the upload is successful, it automatically clears the local cache data. The backend management service unit is deployed on an internal server and includes a user permission management unit, a data verification unit, a river and canal ledger management unit, and an operation log unit, providing service support for the mobile PWA data collection terminal and the PC management backend. After receiving the inspection data and images, the automatic archiving engine unit automatically creates a multi-level storage directory according to the preset hierarchical rules, renames the on-site images according to the preset naming rules, and automatically generates a PDF inspection log containing inspection text information and image thumbnails according to the form field configuration, and saves it into the corresponding task directory. The visual form configuration unit is integrated into the PC management backend, providing an interface for adding, deleting, modifying, and sorting form fields. After the configuration is saved, it is synchronized to the database in real time, and the form structure is automatically updated when the mobile PWA data collection terminal pulls the configuration. The local data storage unit uses the SQLite lightweight file database to store business data, while archive files are stored on the server's local file system.
2. The automatic archiving system for river and canal inspections supporting offline data collection as described in claim 1, characterized in that, After the on-site photo processing unit calls the device's camera to take a picture or selects a picture from the album, it compresses a single picture to a set size at the front end and automatically overlays a semi-transparent anti-counterfeiting watermark on the picture. The watermark content includes the river section name, shooting time, GPS coordinates and the name of the patrolman. The watermark is fixed in the lower left corner of the picture.
3. The automatic archiving system for river and canal inspections supporting offline data collection as described in claim 1, characterized in that, The user permission management unit divides the roles into three levels: inspector, administrator, and leader. Inspectors can only operate on and view the inspection data they submit, administrators have full system management and configuration permissions, and leaders can only view inspection records and statistics without modification or configuration permissions. User passwords are stored using bcrypt hash encryption.
4. The automatic archiving system for river and canal inspections supporting offline data collection as described in claim 1, characterized in that, Before uploading each inspection record, the automatic synchronization unit uses a version vector mechanism to detect data conflicts. When a concurrent conflict is detected, the last writer wins the merge strategy. Each inspection record maintains a version vector, and each device identifier in the record corresponds to a monotonically increasing logical clock value. During synchronization, the local version vector is compared with the server version vector. If the local version vector is causally earlier than the server version vector, the upload is performed to overwrite. If the server version vector is causally earlier than the local version vector, the download is performed to update. When the two are concurrent, a conflict merge is triggered.
5. The automatic archiving system for river and canal inspections supporting offline data collection as described in claim 4, characterized in that, The specific rules for causal order comparison of version vectors are as follows: Let the local version vector be: ; The server version vector is: ; in Indicates equipment identification. and These represent the local and server sides on the device, respectively. The logical clock value on; the causal precedence criterion is: for all satisfy And there exists at least one satisfy ,but Cause and effect precede Concurrency criterion is: neither Cause and effect precede Not Cause and effect precede In the event of concurrent conflicts, if the conflicting fields are different fields, the modifications of both parties will be automatically merged and retained. If they are the same field, the newer value will be retained based on the last write timestamp of the server record.
6. The automatic archiving system for river and canal inspections supporting offline data collection as described in claim 1, characterized in that, After capturing images but before compression, the on-site image processing unit performs image quality pre-screening: first, it uses the Laplacian variance algorithm to calculate the image sharpness score, the formula of which is: ; in, Represents pixels The Laplace operator response value at that point. This represents the mean of the Laplace response across the entire graph. and These represent the image's pixel height and width, respectively; sharpness score. Below the preset threshold If the image is deemed blurry, the user is prompted to retake the photo, and storage is refused. Secondly, for images that pass the clarity screening, a 64-bit binary fingerprint is generated using the DCT perceptual hash algorithm. This fingerprint is then compared with the Hamming distance of the hash set of locally stored images. If the distance is less than a preset threshold... Images that are identified as duplicates are automatically discarded if they are greater than or equal to [the specified value]. The hash fingerprint is stored in the offline storage unit and added to the local collection.
7. The automatic archiving system for river and canal inspections supporting offline data collection as described in claim 1, characterized in that, The automatic synchronization unit will synchronize each image to a fixed size. The bytes are divided into several data blocks, and each data block is assigned a sequence number. and upload status flags During upload, data blocks are transmitted sequentially in ascending order of their sequence numbers. The server returns an acknowledgment response upon receiving each complete data block. The mobile device then sends the corresponding response upon receiving the acknowledgment. Marked as complete; if the network is interrupted during the upload process, data blocks marked as complete will not be retransmitted, and will resume from the first block after the network is restored. Continue transmitting the data blocks to be uploaded.
8. The automatic archiving system for river and canal inspections supporting offline data collection as described in claim 1, characterized in that, After each archiving operation, the automatic archiving engine unit calculates the SHA-256 hash value for each file in the archive directory; it then organizes all file hash values into a Merkle tree structure; assuming the archive directory contains... There are 3 files, and the hash value of each file is used as the leaf node of the level 0 Merkle tree: ; Two adjacent hash values are concatenated and then hashed again to generate the node at the next level: ; Continue upwards layer by layer until a unique root hash value is generated. ; Write it to the operation log unit for permanent retention; the first one of the same canal The archived record will contain the first The root hash value of the second archive As a predecessor hash field This forms a hash chain that spans time.
9. A method for automatic archiving of river and canal patrols supporting offline data collection as described in any one of claims 1-8, characterized in that, Includes the following steps: System initialization configuration: Administrators enter river and canal ledger information through the PC backend, create user accounts and assign role permissions, configure form fields according to patrol business needs, and store all configuration information in the local data storage unit; Mobile login and resource caching: Patrol personnel open the system page through a mobile device browser and add it to the desktop. They complete identity authentication using their employee ID and password. After successful authentication, the system automatically retrieves the latest form field configuration and the list of rivers and canals that the patrol personnel are responsible for, and caches them locally on the mobile device. On-site inspection data collection: After the inspection personnel arrive at the inspection point, the GPS positioning unit automatically obtains the current coordinates; the inspection personnel fill in the inspection information in the dynamically generated form, call the camera to take on-site photos, and the images are processed in sequence by clarity filtering, perceptual hash deduplication, compression and watermark overlay; if the network is normal, the data is uploaded to the backend management service unit in real time after submission; if there is no network, the data is temporarily stored in the offline storage unit. Automatic offline data synchronization: The mobile device continuously monitors the network status. After the network is detected to be restored, version vector conflict detection is performed on each record to be synchronized. For records with no conflict or whose conflicts have been merged, the associated images are uploaded in a breakpoint resume manner according to data block fragments. After the upload is successful, the local cache data is automatically cleared. Backend automatic archiving: After receiving the inspection data, the backend automatic archiving engine creates multi-level storage directories according to preset hierarchical rules, renames the on-site pictures according to preset naming rules and stores them in the corresponding directories, generates a PDF inspection log containing inspection text information and image thumbnails according to the form field configuration and stores it in the corresponding directory, calculates the hash value of all files in the archive directory and builds a Merkle tree, and writes the root hash value into the operation log for permanent retention. File Query and Export: Administrators or leaders can filter patrol records by time period, river / canal name, and patrol personnel through the PC backend, view record details and on-site photos, select a single record to export as PDF, or select a batch of records to generate a ZIP archive package for download.
10. A method for automatic archiving of river and canal patrols supporting offline data collection as described in claim 9, characterized in that, During on-site inspection data collection, the Laplacian variance algorithm was used for image sharpness selection: calculating the Laplacian response variance of the image. ,when Below the preset threshold If an image is deemed blurry, it is refused storage and a retake is prompted. For deduplication, a 64-bit binary fingerprint is generated using the DCT perceptual hash algorithm and compared to the locally stored image hash set. The Hamming distance is calculated between the fingerprint and the fingerprint; if the distance is less than a preset threshold... Images that are identified as duplicates are automatically discarded.
11. The automatic archiving method for river and canal patrols supporting offline data collection as described in claim 9, characterized in that, During offline data automatic synchronization, the version vector conflict detection mechanism is as follows: each inspection record maintains a version vector, and each device corresponds to a logical clock value. During synchronization, the local version vector is compared with the server version vector. If the local version vector is causally earlier than the server version vector, the overwrite upload is performed. If the server version vector is causally earlier than the local version vector, the download update is performed. If the two occur concurrently, conflict merging is triggered.
12. The automatic archiving method for river and canal patrols supporting offline data collection as described in claim 9, characterized in that, In the backend automatic archiving process, the hash chain is constructed as follows after archiving: SHA-256 hash values are calculated for each file in the archive directory, serving as Merkle leaf nodes. The hash values of adjacent leaf nodes are concatenated and hashed again, layer by layer upwards to generate the root hash value. The first of the same canal The archived record will contain the first The root hash value of the second archive Deposit the first The predecessor hash field of each record forms a hash chain that spans time.
13. A computer device, characterized in that, It includes a memory and a processor, which are interconnected and communicate with each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the automatic archiving method for river and canal patrol that supports offline data collection, as described in any one of claims 9 to 12.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to execute the automatic archiving method for river and canal patrols supporting offline data collection, as described in any one of claims 9 to 12.