Food safety sampling data verification method and system and computer storage medium thereof
By establishing a dependency mapping table and a service response cause-effect graph model, identifying and downgrading the weight of key verification fields, freezing the verification of related fields, and generating a report to be reviewed, the false consistency problem of the food safety sampling system when the external data source fails is solved, and proactive diagnosis and accurate verification of the failure state are realized.
Patent Information
- Application Number
- CN202510922822.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-04
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2045-07-04
AI Technical Summary
The existing food safety sampling inspection system cannot detect the health status of external data sources when critical dependent systems fail, resulting in false consistency during the verification process. Erroneous data is not intercepted, posing a significant risk of missed detection.
Establish a dependency mapping table, construct a service response cause-effect graph model, generate counterfactual ideal responses through virtual intervention parameters, identify external data sources in failure states, downgrade the weight of key validation fields, freeze the logical validation of associated validation fields, and generate a report to be reviewed.
It enables proactive diagnosis of external data source failures, prevents erroneous data from entering the verification process, and marks the failure status in real time through dependency mapping and causal analysis models to block the failure propagation chain, form a closed-loop control, and ensure the accuracy of verification results.
Smart Images

Figure CN120429162B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of food safety supervision information technology, more specifically, the present application relates to a food safety sampling data verification method and system and a computer storage medium thereof. BACKGROUND
[0002] In the field of food safety supervision, sampling data verification needs to rely on the cooperative operation of multiple heterogeneous systems; in the prior art, the sampling system usually interacts with the production license database, enterprise credit library and standard regulation library, implements logical verification on key fields such as test results and enterprise qualifications through preset rules, and adopts modular design, each database runs independently and realizes data calling through interface protocol. When the external dependent system (such as the production license library) fails, in order to maintain the continuous execution of the verification process, the system generally adopts a default value filling strategy to ensure data integrity and avoid global verification interruption caused by single point failure.
[0003] The existing verification method has the following defects: when the key dependent system fails, the verification process cannot perceive the health status of the external data source, and still outputs a logical verification pass conclusion based on the default value, forming a silent failure, which leads to false consistency of cross-system data verification results, and the error data is not effectively intercepted and there is no alarm mechanism, which will directly cause the missed judgment of major risks such as unlicensed production enterprises and over-standard food in the food safety sampling scene. SUMMARY
[0004] In order to overcome the above-mentioned defects of the prior art, the present application provides a food safety sampling data verification method, system and computer storage medium to solve the problems raised in the background art.
[0005] To achieve the above-mentioned purpose, the present application provides the following technical scheme:
[0006] The food safety sampling data verification method comprises:
[0007] S1, a dependency relationship mapping table of the sampling system and the external data source is established, and the dependency relationship mapping table records the binding relationship between each verification field and the corresponding external data source;
[0008] S2, a service response causal diagram model is constructed, a virtual intervention parameter is injected into the external data source, and an ideal counterfactual response is generated, when the KL divergence value of the actual response and the ideal counterfactual response exceeds a preset causal bias threshold, the external data source is marked as a failure state;
[0009] S3, the verification field set of the current sampling data is parsed, and the key verification field bound to the external data source in the failure state is identified based on the dependency relationship mapping table;
[0010] S4, degrade the check weight of the key check field below a preset threshold, and activate an artificial review flag bit;
[0011] S5, scan a preset coupling relationship set of the key check field and the non-degraded check field, if there is a coupling rule that is not triggered, freeze the logical verification of the associated check field corresponding to the coupling rule and mark a conflict topology;
[0012] S6, when executing the check rule engine, skip the logical verification of the degraded key check field, suspend the logical verification of the frozen associated field, and generate a pending review check report based on the artificial review flag bit and the conflict topology.
[0013] Further, S1 includes:
[0014] Obtain the unique identifier of all check fields of the sampling inspection system and the corresponding external data source network access address;
[0015] According to the food safety data check rule, determine the field type attribute of each check field, and the field type attribute includes enterprise qualification type, detection standard type and product identification type;
[0016] Generate a structured dependency relationship mapping table, wherein each mapping record contains a check field unique identifier, a bound external data source network access address and a field type attribute, and the dependency relationship mapping table is indexed and associated with the sampling inspection data field through the check field unique identifier.
[0017] Further, S2 includes:
[0018] Based on the historical service log data, a Bayesian network structure is constructed as a service response causal diagram model;
[0019] Using the service response causal diagram model, a test request carrying a virtual intervention parameter is sent to the target external data source, and the virtual intervention parameter includes a simulated request quantity multiplication value and a forced timeout threshold;
[0020] Receive the actual response data returned by the target external data source in response to the test request;
[0021] Calculate the counterfactual ideal response data under the virtual intervention parameter through the service response causal diagram model;
[0022] Calculate the KL divergence value between the probability distribution of the actual response data and the counterfactual ideal response data;
[0023] When the KL divergence value between the probability distributions exceeds a preset causal bias threshold, generate an external data source failure state marking signal.
[0024] Further, the Bayesian network structure includes a request quantity node, a response delay node and an error code node of the external data source.
[0025] Furthermore, S3 includes:
[0026] The system parses the set of validation fields in the current sampled data and identifies key validation fields bound to external data sources in the failure state based on the dependency mapping table, including:
[0027] Extract the unique identifier of the verification field to be verified from the current sampled data record;
[0028] Query the network access address of the external data source corresponding to the unique identifier of the validation field in the dependency mapping table;
[0029] Receive an external data source failure status marker signal, which contains the network access address of the failed external data source;
[0030] Match the retrieved external data source network access addresses with invalid external data source network access addresses;
[0031] When the network access address of the external data source is successfully matched, the corresponding unique identifier of the verification field is marked as a critical verification field.
[0032] Furthermore, S4 includes:
[0033] Obtain the initial verification weight value configured in the verification rule engine corresponding to the key verification fields;
[0034] The differentiated degradation strategy is determined based on the field type attributes bound to the key verification fields. The field type attributes include enterprise qualification, testing standard and product identification.
[0035] The initial verification weight value is adjusted to below the preset weight threshold by applying a differentiated degradation strategy, and a downgraded verification weight value is generated.
[0036] Create a manual review flag in the metadata of the random inspection data verification task, and set the manual review flag status to active.
[0037] Furthermore, S5 includes:
[0038] Load the predefined coupling relationship configuration library, which stores the logical dependency rules between key validation fields and non-degraded validation fields;
[0039] Iterate through instances of combinations of key validation fields and non-weighted validation fields in the current sampled data;
[0040] Check whether the logical dependency rules corresponding to the combined instance meet the triggering conditions;
[0041] Freeze the logical verification state of the associated verification field corresponding to the corresponding logical dependency rule in the spot check data verification task metadata when there is an untriggered logical dependency rule;
[0042] Construct a conflict topology graph based on the untriggered logical dependency rule, and the conflict topology graph records the invalid dependency path of the associated verification field and the key verification field.
[0043] Further, S6 comprises:
[0044] Start the verification rule engine to perform verification processing on the current spot check data;
[0045] Skip the logical verification operation on the key verification field after weight reduction during the verification processing;
[0046] Pause the logical verification operation on the frozen associated verification field during the verification processing;
[0047] Read the activation state of the manual review flag and the invalid dependency path recorded in the conflict topology graph;
[0048] Combine the manual review flag activation state, the conflict topology graph, and the unverified field list to generate a pending review verification report.
[0049] On the other hand, the present application provides a food safety spot check data verification system, comprising:
[0050] A dependency mapping module for establishing a dependency relationship mapping table between the spot check system and external data sources, the dependency relationship mapping table recording the binding relationship between each verification field and the corresponding external data source;
[0051] A causal analysis module for constructing a service response causal graph model, injecting a virtual intervention parameter into the external data source and generating an ideal counterfactual response, and marking the external data source as invalid when the KL divergence value between the actual response and the ideal counterfactual response exceeds a preset causal bias threshold;
[0052] An invalid transmission module for analyzing the verification field set of the current spot check data, and identifying the key verification field bound to the external data source in the invalid state based on the dependency relationship mapping table;
[0053] A weight regulation module for degrading the verification weight of the key verification field to below a preset threshold, while activating the manual review flag;
[0054] A coupling and decoupling module for scanning a preset coupling relationship set of the key verification field and the unweighted verification field, and if there is an untriggered coupling rule, freezing the logical verification of the associated verification field corresponding to the coupling rule and marking the conflict topology;
[0055] The cooperative execution module is configured to perform logical verification on the key verification fields after weight reduction, suspend logical verification on the frozen associated fields, and generate a verification report to be reviewed based on the manual review flag and the conflict topology when the verification rule engine is executed.
[0056] In another aspect, the present application provides a computer storage medium, and a program or instructions are stored on the computer storage medium, and the program or instructions are executed by a processor to implement the food safety sampling data verification method.
[0057] Compared with the prior art, the present application has the following beneficial effects:
[0058] 1. The dependence relationship mapping table cooperates with the causal analysis model to realize active diagnosis of external data source failure; unlike passive processing by default value filling, the failure state is marked in real time based on counterfactual response difference, and the affected key verification fields are accurately located through dependence mapping, so that the system activates weight degradation and manual review flag activation immediately when external abnormalities occur, avoids false consistency risks from entering the subsequent verification process, and intercepts false consistency risks from the source.
[0059] 2. Coupling the rule library and the conflict topology construction solves the secondary logical conflict problem caused by weight degradation; by scanning uncoupled rules, the associated field verification is frozen and the dependence path is marked, the failure transmission chain is blocked, the cooperative execution engine dynamically skips the degraded fields, suspends the frozen fields, and automatically integrates the topology graph to generate a report to be reviewed, forming a closed-loop control of failure awareness, accurate degradation, conflict isolation, and targeted review. BRIEF DESCRIPTION OF DRAWINGS
[0060] Figure 1 The flowchart of the food safety sampling data verification method of the present application is shown in the figure.
[0061] Figure 2 The structural schematic diagram of the food safety sampling data verification system of the present application is shown in the figure. DETAILED DESCRIPTION
[0062] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0063] Embodiment 1 Figure 1 The food safety sampling data verification method of the present application is given, including:
[0064] S1, establish a dependency relationship mapping table of the sampling system and external data sources, and the dependency relationship mapping table records the binding relationship of each verification field and the corresponding external data source;
[0065] S2, construct a service response causal diagram model, inject a virtual intervention parameter into the external data source and generate an ideal counterfactual response, and when the KL divergence value of the actual response and the ideal counterfactual response exceeds a preset causal bias threshold, mark the external data source as a failure state;
[0066] S3, analyze the verification field set of the current sampling data, and identify the key verification field bound to the external data source in the failure state based on the dependency relationship mapping table;
[0067] S4, degrade the verification weight of the key verification field to below a preset threshold, and activate an artificial audit flag;
[0068] S5, scan a preset coupling relationship set of the key verification field and the non-weighted verification field, if there is an uncoupled rule, freeze the logical verification of the associated verification field corresponding to the coupling rule and mark the conflict topology;
[0069] S6, when executing the verification rule engine, skip the logical verification of the key verification field after the weight reduction, suspend the logical verification of the frozen associated field, and generate a pending review verification report based on the artificial audit flag and the conflict topology.
[0070] S1, establish a dependency relationship mapping table of the sampling system and external data sources, and the dependency relationship mapping table records the binding relationship of each verification field and the corresponding external data source, and the specific implementation is:
[0071] When establishing the dependency relationship mapping table of the sampling system and external data sources, the generation of the unique identifier of the check field is realized through the preset field identification algorithm. The algorithm input parameters are three elements: the string of the field's database table name, the string of the field name, and the date and time value of the field creation timestamp. The three input parameters are connected in a fixed order of database table name first, field name in the middle, and timestamp last to form a combined string. The combined string is input into the SHA-512 hash function conforming to the RFC 6234 standard for one-way encryption operation, and the output length of the hexadecimal format string is 128 bits, which is used as the unique identifier. The hash operation process calls the built-in encryption service module of the operating system to realize, such as using the SHA512_Update function of the OpenSSL library in the Linux environment, to ensure that each field in the sampling system generates a determined and unique identifier string. The acquisition of the network access address of the external data source is completed by parsing the system preset address configuration template. The template is stored in a JSON format text file, which contains the standard application programming interface access path and identity authentication parameters corresponding to each check field. The access path is generated according to the interface specification document published by the external data source service provider, for example, the path template of the "unified social credit code" path parameter placeholder contains the complete uniform resource locator of the enterprise qualification class field.
[0072] The determination of the field type attribute is based on the function definition of the food safety data check rule. The rule parser loads the built-in rule configuration file of the sampling system, and identifies the feature description statement of the field classification in the configuration file through text pattern matching technology. The specific processing flow includes: when the configuration text contains the feature keywords such as "enterprise license" or "registration information", the associated field is classified as the enterprise qualification class; when the feature keywords such as "limit indicator" or "safety threshold" appear, it is classified as the detection standard class; when the feature keywords such as "product traceability" or "batch identification" appear, it is classified as the product identification class. The classification result is written into the field metadata attribute table, and the attribute value is stored as an integer value. Set 0 corresponds to the enterprise qualification class, 1 corresponds to the detection standard class, and 2 corresponds to the product identification class. The integer value is used as the fixed field value of the dependency relationship mapping table.
[0073] The generation of the dependency mapping table is implemented by using a relational database table structure. A database table named data dependency mapping table is created, which contains three core fields: a field for storing the unique identifier of the verification field is defined as a fixed-length character type with a fixed length of 128 characters; a field for storing the network access address of the external data source is defined as a variable-length string type with a maximum of 255 characters; and a field for storing the field type attribute is defined as a single-byte integer type. The index association mechanism is implemented by creating a balanced tree structure index in the field storing the unique identifier of the verification field, and the index key is the binary encoding sequence of the field value. When the sampling system accesses the data table field, the field name and table name combination parameters are submitted through the database connection interface, and after generating a 128-bit string through the same hash algorithm, an exact match query is performed in the index to locate the corresponding mapping record.
[0074] The maintenance mechanism of the mapping table includes a dynamic update process. When a new field is processed, the identifier generation algorithm is called to create the field value storing the unique identifier of the verification field, and the address configuration template is read to generate the field value of the network access address of the external data source. The rule parsing process is started to determine the field type attribute field value, and finally a new record is inserted into the data dependency mapping table. When the address is updated, the administrator updates the uniform resource locator in the configuration template, and the system scans the records containing the old address in the field storing the network access address of the external data source. The old address is updated to the new address in the template through a database transaction. When capacity management is performed, the initial table space is allocated as 100 megabytes, and when the number of records reaches, for example, 500,000, a sub-table is automatically created. The naming rule of the sub-table uses the original table name plus an underscore and a partition number. The partition strategy uses the remainder of the ASCII code value of the first character of the field storing the unique identifier of the verification field divided by 10 as the partition basis. The data consistency guarantee is implemented by using a two-phase commit protocol to synchronize multiple copies. The master database generates a pre-commit log before performing an update operation, and the slave database confirms the integrity of the log and feeds back a ready signal. After receiving confirmation from all slave databases, the master database sends a formal commit instruction.
[0075] The version control of the field type attribute is implemented by adding an effective timestamp field. In the data dependency mapping table, two date and time type fields, start effective time and end effective time, are added. When the food safety rules are updated: a new version record is generated for the affected field, all field values of the original record are copied, the field type attribute field is updated to a new integer value, the start effective time is set to the effective date of the rule, and the end effective time is set to the maximum date value; the end effective time of the original record is modified to one day less than the effective date of the rule. When querying, the records within the range of the start effective time and the end effective time on the current date are used by default, realizing multi-version coexistence and smooth switching.
[0076] The availability verification of the external data source network access address adopts an active probing mechanism, the probing frequency is set to perform full-volume probing every 24 hours; the probing method is to send a hypertext transfer protocol HEAD request to the field value storing the external data source network access address; the timeout setting includes a connection timeout of, for example, 3 seconds and a response timeout of, for example, 5 seconds; the result determination logic sets that receiving an HTTP status code 200 for three consecutive times is regarded as normal, otherwise, it is marked as abnormal. The abnormality is recorded in the mapping table to set a state flag bit, and the sampling inspection system skips the abnormal address record and triggers an alarm process when queried.
[0077] The data persistence architecture includes three levels of storage, the hot storage adopts a MySQL cluster to store the current effective records, and the response time is controlled within milliseconds; the warm storage adopts a full-text search engine to store, for example, historical version records within 6 months, and supports multi-condition retrieval; the cold storage adopts a distributed file system to store archived records, and is compressed and stored by year. The data access layer encapsulates a unified query interface, the input parameters are two strings of the verification field name and the table name to which the field belongs, and the output result is the external data source network access address and the field type attribute value corresponding to the field, and the internal automatic processing multi-level storage routing and cache mechanism.
[0078] S2, a service response causal graph model is constructed, a virtual intervention parameter is injected into an external data source, and an ideal counterfactual response is generated; when the KL divergence value of the actual response and the ideal counterfactual response exceeds a preset causal bias threshold, the external data source is marked as invalid, and the specific implementation is as follows:
[0079] When constructing the service response causal graph model, the Bayesian network structure is generated based on historical service log data. The historical service log data is derived from the access record database of the external data source connected by the sampling system. Each record contains a request timestamp accurate to milliseconds, a standardized request parameter string, a three-digit response status code, a response time delay value in milliseconds, and a data feature digest value. The data preprocessing process performs the following operations: delete invalid records with missing or zero response time delay; discretize the response time delay value into bins every 100 milliseconds, for example, 0 to 100 milliseconds is divided into the first interval, and 100 to 200 milliseconds is divided into the second interval; map the HTTP error code to a predefined categorical variable, for example, status code 500 to 599 is mapped to the server error type, and 400 to 499 is mapped to the client error type. The PC algorithm is used to construct the Bayesian network structure, and the conditional independence of the request volume node, the response time delay node, and the error code node is calculated to determine the dependency relationship between the nodes. When the mutual information value of two nodes given other nodes is greater than 0.3 bits, a directed edge connection is established, and finally a directed acyclic graph structure containing three nodes is formed. The network parameter learning uses the Bayesian estimation method to calculate the conditional probability table of each node based on the frequency statistics of historical data, for example, the conditional probability value of the response time delay node exceeding 500 milliseconds when the request volume node is in a high load state.
[0080] When performing virtual intervention using the service response causal graph model, the virtual intervention parameters include two core parameters: simulated request volume multiplication value and forced timeout threshold. The simulated request volume multiplication value is generated by multiplying the current actual request volume by a specified coefficient, which is a floating-point number between 1.5 and 3.0, for example. The specific value is set by the system administrator according to the service level agreement of the target external data source; the forced timeout threshold is set as the response interruption time point, with a value range of 100 milliseconds to 1000 milliseconds, for example. The specific value is determined based on the 90th percentile of the historical normal response time delay. The construction of the test request follows the interface specification document published by the target external data source, inserts a custom intervention marker field in the standard HTTP request message header, and loads the virtual intervention parameter key-value pair in the JSON format request body, for example, adds the "intervention_factor" key corresponding to the multiplication value and the "timeout_threshold" key corresponding to the timeout threshold. The request sending uses a synchronous call mechanism, establishes a transmission control protocol connection, writes the complete request message, and sets the socket read timeout parameter to twice the value of the forced timeout threshold.
[0081] The process of receiving actual response data contains data parsing and feature extraction operations. The original response data is read as byte stream from the Transmission Control Protocol connection, and the status line, message header and message body are parsed according to the Hypertext Transfer Protocol 1.1 specification. The feature vector of actual response data contains three dimensions: the response time delay feature value is the time difference from the request sending completion to the reception of the last byte, accurate to milliseconds; the error code feature value is the three-digit integer status code parsed; the data integrity feature value is the ratio of the actual byte length of the message body to the expected length, for example, calculated as 0.85 indicates that 85% of the data amount is returned. The feature vector normalization processing adopts the minimum-maximum scaling method, which linearly transforms each feature value to the interval of 0 to 1, and the transformation formula is (current value - historical minimum value) / (historical maximum value - historical minimum value).
[0082] The calculation of counterfactual ideal response data is achieved by performing intervention reasoning through the service response causal graph model. In the Bayesian network, the request volume node is fixed as the discretized interval value corresponding to the simulated request volume multiplication value, and the forced timeout threshold is input as the conditional evidence into the response time delay node. The posterior probability distribution of the error code node is calculated by the variable elimination algorithm. The feature vector of counterfactual ideal response data is generated by performing the following steps: the response time delay feature takes the mathematical expectation value of the network output; the error code feature takes the state code category corresponding to the maximum probability value in the probability mass function; the data integrity feature takes the arithmetic mean value of the historical normal response samples, which is maintained in the interval of, for example, 0.95 to 1.05. The probability distribution is represented as the probability mass function of a discrete random variable, and each possible state code corresponds to a probability value, for example, the probability value of state code 200 is P1 and the probability value of state code 500 is P2.
[0083] The calculation of the KL divergence value between probability distributions uses the Kullback-Leibler divergence formula to process discrete probability distributions. The input parameters are the probability distribution P converted from the actual response feature vector and the probability distribution Q converted from the counterfactual ideal response feature vector, where the P distribution is obtained by statistical analysis of the actual response data, and the Q distribution is generated by Bayesian network reasoning. The calculation process performs the following steps: first, determine the union of the event spaces of the two distributions; for each event i in the union, perform the following conditional judgment: when the probability value of event i in the Q distribution is greater than one in a million, calculate the probability value of event i in the P distribution multiplied by the logarithm to the base 2 of the ratio of the probability value of event i in the P distribution to the probability value of event i in the Q distribution; when the probability value of event i in the Q distribution is less than or equal to one in a million, skip this event. The sum of the calculation results of all valid events is added to obtain the KL divergence value, which is in bits. The calculation process contains a smoothing mechanism, which adds a small amount of one in a million to all event probability values in the Q distribution to avoid division by zero errors.
[0084] The setting of the preset causal bias threshold is based on benchmark test data in a historical normal service state. During the confirmation of the external data source working normally, 30-day intervention tests are continuously performed, and 100 groups of KL divergence value samples of actual response and counterfactual response are collected every day during the business off-peak period. The 95% quantile of all sample values is taken as the initial value of the threshold, for example, 0.5 bits. The threshold dynamic adjustment mechanism includes recalculating the quantile when new test data is added every week; and performing a new round of 30-day benchmark test after the external data source service version is upgraded. The logic judgment process of generating the external data source failure state marking signal is: when the KL divergence value of a single test exceeds the current threshold, the abnormal counter is incremented by 1; and when three consecutive tests all exceed the threshold, the failure marking signal is generated. The signal format adopts a binary flag bit form, and setting 1 represents the failure state and 0 represents the normal state. The flag bit is written into the external data source state registration database table and is associated to the network access address field.
[0085] The update cycle of the service response causal graph model is set to be full reconstruction every week. The reconstruction trigger conditions include two situations: when the daily average prediction error rate exceeds 10%; or when the external data source interface version number is changed. The model verification adopts the leave-one-out method, 30% of the historical data are taken as the test set, and the root mean square error value of the predicted response delay and the actual delay is calculated. When the error value exceeds 20% of the historical benchmark value, the model abnormal alarm is triggered. The model is persistently stored as a graph structure data file, the node attributes are serialized and stored in JSON format, and the edge relationship is stored in a compressed sparse row format matrix. The model version management adopts the timestamp naming rule, and the latest ten versions are retained to support historical backtracking.
[0086] S3, parse the verification field set of the current sampling data, identify the key verification field bound to the external data source in the failure state based on the dependency relationship mapping table, and the specific implementation is:
[0087] When the verification field set of the current sampling data is parsed, the unique identifier of the verification field to be verified is extracted from the sampling data record. The sampling data record is stored in a structured data format, and the verification field is distributed in the fixed hierarchical position of the data object and accessed through the pre-defined field positioning path. The extraction of the unique identifier of the verification field performs the following operations: reading a special field in the data record for storing the metadata of the verification field, which contains a hexadecimal format string with a length of 128 characters, which is generated by a hash algorithm when the field is created; when the data record contains a nested structure, all child objects are traversed in a depth-first order, and all identifiers of the fields marked for verification are collected; and finally, an ordered list of unique identifiers of the fields to be verified is formed, and each element in the list is a complete 128-bit string.
[0088] When querying the external data source network access address corresponding to the check field unique identifier in the dependency mapping table, a batch query optimization strategy is adopted. After establishing a connection to the dependency mapping database, a parameterized query statement is constructed, and the query statement template contains a list of check field unique identifiers as input parameters. The query execution process implements performance optimization: when the number of identifiers exceeds 50, it is automatically divided into multiple sub-queries; duplicate identifiers are processed to remove duplicates; the query response timeout threshold is set to 2000 milliseconds. The query result is returned in the form of key-value pairs, where the key is the check field unique identifier string, and the value is the corresponding complete external data source network access address string, such as mapping the identifier string to a standard uniform resource locator containing protocol, domain name and path.
[0089] When receiving the external data source failure state marker signal, reliable transmission is achieved through a distributed message system. The failure state marker signal is encoded in a structured data format, and the message content includes a list of failed external data source network access addresses and a signal generation timestamp. Subscribe to the specified topic channel of the message system and configure the consumer instance to process the message stream. When a new message arrives, trigger the parsing function. The parsing function performs the following operations: decode the message binary content; extract the failed address list field, which is a string array type; verify the validity of the timestamp and ignore signals generated more than 30 minutes before the current time. The parsed failed address list is stored in the cache with a 60-second time-to-live to ensure data timeliness.
[0090] When matching the queried external data source network access address with the failed external data source network access address, standardized string comparison is implemented. The matching process performs the following steps: iterate through each network access address in the address list to be matched; perform normalization on each address, including converting to all lowercase, removing query parameters, and standardizing path separators; compare the processed address with the elements in the failed address list for exact string comparison. The matching algorithm includes special case handling: when the address strings are identical, it is determined to be a match; when there are case differences, they are considered different addresses; when the address contains default port number differences, they are considered not to match. The matching result generates a record set, each record containing a check field unique identifier and a match status indicator, which is a Boolean value indicating whether the match is successful.
[0091] When the external data source network access address matching is successful, the corresponding check field unique identifier is marked as a key check field. The marking operation creates a key field registry in the sampling task execution context, which uses a hash table data structure to store the marking timestamp and invalidation type code with the check field unique identifier as the key. The marking process implements concurrent control: detects concurrent conflicts using a version number mechanism; and merges the invalidation type code when detecting duplicate marking. The key field registry is persisted to the task metadata storage area, and an operation audit log is added. After marking is completed, a state change notification event is published, and the event content includes the check field unique identifier list and the key state identifier.
[0092] The verification mechanism of the key check field marking performs a consistency check before starting the subsequent processing flow. All marking records are read from the key field registry, and a batch query is initiated to the dependency mapping database to verify the state of the external data source. The verification query sets a 200 millisecond response timeout, and when the consistency rate of the matching results exceeds 80%, it is confirmed that the marking is valid; otherwise, a marking revocation operation is performed to clear inconsistent records and record an exception event. The final confirmed key check field list is written to the sampling task state file, and each line of the file contains the check field unique identifier, the marking timestamp, and the associated invalidation address.
[0093] The life cycle management of the key field marking is bound to the sampling task execution process. An empty registry is created when the task is initialized; marking records are dynamically added during task execution; the final state is persisted when the task is completed; and memory resources are released after the task is terminated. For tasks with an execution time exceeding 60 minutes, periodic state refreshing is implemented, with the invalidation state being re-verified and the registry being updated every hour. The retention policy for marking data is set to 30 days, and historical marking records can be queried by check field unique identifier.
[0094] The extraction path of the check field unique identifier is predefined in the system configuration, and the path format uses a dot separator notation, such as "metadata.validation_fields.uid". The dependency mapping database query interface provides batch access capability, with a maximum of 100 identifiers queried at a time. The transmission of the invalidation state marking signal is implemented through a message confirmation mechanism, and the producer waits for all consumer confirmations before deleting the message. The standardized processing of the address matching follows the Uniform Resource Identifier specification, and the percent encoding is uniformly decoded into uppercase letters. The version number of the key field registry is initially set to 0 and is incremented each time it is updated. The threshold parameter for consistency checking is configurable, with a default value of 80%, which is determined based on historical false positive rate statistical analysis. The task state file uses an append write mode, and the file locking mechanism prevents concurrent write conflicts.
[0095] S4, degrade the check weight of the key check field to below a preset threshold, and activate an artificial review flag bit, which is implemented as follows:
[0096] When the initial check weight value of the key check field is obtained from the check rule engine, the weight parameter storage area provided by the rule engine configuration service is queried. The storage area is implemented by a distributed key-value database, where the key is a 128-bit hexadecimal string of the unique identifier of the check field, and the value is a weight value in the format of a single-precision floating-point number, with the weight value ranging from 0.0 to 1.0. The query process performs the following operations: constructing a batch query request containing a list of unique identifiers of the key check fields; sending a query instruction to the rule engine service through a remote procedure call protocol; receiving the returned weight value set, each element in the set containing a complete check field unique identifier and the corresponding initial check weight value. The initial check weight value is set according to the importance classification model of the field in food safety check. This model analyzes the frequency and severity of field check failure in historical sampling data, for example, a field that triggers frequent check failures is assigned a higher weight value, and the specific weight value is set by the system administrator in the configuration interface.
[0097] When the differential degradation strategy is determined according to the field type attribute bound to the key check field, the field type attribute is divided into three categories: enterprise qualification, detection standard and product identification. This classification information is obtained from the dependency relationship mapping database. The differential degradation strategy is formulated according to the following logic: when the field type attribute is enterprise qualification, the multiplication degradation strategy is used, which multiplies the initial check weight value by a preset proportion coefficient, and the proportion coefficient takes a floating-point number ranging from 0.1 to 0.3; when the field type attribute is detection standard, the subtraction degradation strategy is used, which subtracts a fixed offset from the initial check weight value, and the offset takes a value ranging from 0.2 to 0.4; when the field type attribute is product identification, the conditional degradation strategy is used, which applies different degradation amplitudes according to the interval in which the initial check weight value is located. The strategy selection is based on the integer enumeration value of the field type attribute, where enumeration value 0 corresponds to enterprise qualification, 1 corresponds to detection standard, and 2 corresponds to product identification.
[0098] The initial check weight value is adjusted to below the preset weight threshold using a differentiated degradation strategy. The preset weight threshold is defined by a system configuration file. The adjustment process implements the following steps: reading the integer enumeration value of the current field type attribute; selecting the corresponding degradation strategy according to the enumeration value; applying the selected strategy to calculate a new check weight value; verifying whether the new weight value is lower than the preset weight threshold. The preset weight threshold is set based on a sampling task tolerance analysis model. The model analyzes the field misjudgment rate in historical manual review records, calculates the acceptable minimum weight value for each type of field, for example, the enterprise qualification threshold is set to 0.15, the detection standard threshold is set to 0.2, and the product identification threshold is set to 0.25. The degraded check weight value is written into the weight parameter storage area through the rule engine configuration interface, and a weight change audit log record operation detail is generated, which includes the check field unique identifier, the initial weight value, the degraded weight value, and the operation timestamp.
[0099] When creating a manual review flag bit in the sampling data check task metadata, the task metadata is stored in a structured database table. The flag bit creation process includes: adding a manual review flag bit field in the task metadata table; setting the field data type to Boolean; initializing the field value to a logical false state. When the manual review flag bit state is set to active, perform state conversion operations: update the manual review flag bit field value to logical true; record the activation timestamp and trigger reason code in the task event log table. The active state setting includes a concurrency control mechanism, which uses database transactions to ensure the atomicity of state changes and prevent multiple task concurrency conflicts. The active state is associated with a list of key check fields to form an audit task work order data structure, which includes an array of check field unique identifiers, an array of degraded check weight values, and a reference identifier of the original sampling data.
[0100] The task routing mechanism after the manual review flag bit is activated includes queue allocation logic. The audit task work order data is pushed to a distributed message queue, which is stored in separate queue channels according to field type attributes. Enterprise qualification, detection standard, and product identification correspond to independent queue channels. The task allocation strategy configures routing rules based on the professional field of the reviewer, for example, enterprise qualification tasks are routed to the business qualification audit group queue. The work order data structure includes a list of key check field unique identifiers, degraded check weight values, and a reference pointer to the original sampling data. The audit result feedback mechanism sets a 48-hour timeout control, and automatically upgrades the unprocessed task to the supervisor audit queue, and sends a system alarm notification.
[0101] The rollback mechanism of the check weight degradation is activated after the external data source recovers. The state change event of the external data source state registry is monitored, and when the invalid state flag signal is removed, the weight recovery process is triggered: the original weight value is obtained by querying the weight change audit log; the weight recovery request is submitted through the rule engine configuration interface; and it is verified whether the weight value is restored to the initial value. The recovery process includes version control, and the last three weight change records are retained to support backtracking operation. The manual review flag remains active after the weight recovery until the review is completed, and after the review is completed, the state reset operation is performed, the flag is updated to a logical false state, and the completion timestamp is recorded.
[0102] The dynamic adjustment of the degradation policy parameters is based on the review effect evaluation system. The manual review result data is counted, the misjudgment rate index of the degradation field is calculated, the misjudgment rate calculation formula is the number of manual review corrections divided by the total number of checks, and when the misjudgment rate exceeds 5%, the policy optimization process is triggered: adjust the proportion coefficient or offset parameter range in the degradation policy; modify the preset weight threshold value; update the differentiated degradation policy selection logic. The parameter adjustment adopts the gray release mechanism, and the new parameters are first tested in 10% of the sampling tasks, and after the test is passed, the full effect is taken. All parameter changes are recorded in the version control system, supporting parameter rollback and historical version comparison functions.
[0103] The weight degradation influence evaluation of the key check field is performed after the sampling task is completed. The difference between the results of the degradation field in automatic checking and manual review is compared, and a field reliability analysis report is generated. The report includes the degradation field proportion, the manual review correction rate, and the weight adjustment influence factor, etc. The influence factor calculation process is to take the absolute difference between the manual review result value and the automatic check result value, and divide by the data allowed error range value. The evaluation result is used to optimize the initial weight allocation strategy, forming a closed-loop feedback mechanism, and a policy optimization suggestion report is generated every week for administrator decision.
[0104] The data processing flow under the active state of the manual review flag includes a safety isolation mechanism. The original data of the degradation field is copied to the safety audit storage area, and read-only access permission is set to prevent incorrect modification. The audit interface displays the highlight mark of the key check field, and the check weight value after degradation and the external data source failure reason are displayed in association. The double-check mechanism is executed when the audit result is entered into the system, to ensure the accuracy of the audit conclusion. After the audit is completed, a check result report is generated, the manual review intervention field and the final determination conclusion are marked.
[0105] S5, a set of preset coupling relationships of the key check field and the non-weight-degraded check field are scanned, if there is an untriggered coupling rule, the logical verification of the associated check field corresponding to the coupling rule is frozen and a conflict topology is marked, and the specific implementation is:
[0106] When loading the predefined coupling relationship configuration library, the configuration library uses a graph database to store the logical dependency rules between the key check fields and the non-weighted check fields. The construction process of the coupling relationship configuration library includes defining four core fields: rule unique identifier, subject field identifier, object field identifier, and trigger condition expression; entering the business constraint relationship between the fields through the rule management interface, such as when the field corresponding to the key check field unique identifier is invalid, the field corresponding to the non-weighted check field unique identifier needs to be frozen; the configuration library uses a version control mechanism, and a new configuration version number is generated each time it is updated. When the configuration library is initialized, the full rule data is loaded into the memory graph structure, the graph node is the check field unique identifier string, and the edge attribute stores the trigger condition expression string and the rule state Boolean value.
[0107] When traversing the combination instances of the key check fields and the non-weighted check fields in the current sampling data, first identify the key check field list and the non-weighted check field list. The key check field list is obtained from the task metadata, containing all check field unique identifiers marked as key state; the non-weighted check field list is obtained by scanning the check rule engine configuration and filtering the field identifiers with a weight value greater than a preset weight threshold. The combination instance generation algorithm performs the following steps: Cartesian product operation on the key check field list and the non-weighted check field list; filter out field combinations that do not exist in the coupling relationship configuration library; create a combination instance object for each valid combination, which contains the subject field identifier string, the object field identifier string, and the associated rule unique identifier string. The traversal process uses a paging optimization mechanism, processing for example 100 combination instances per page to avoid running out of memory resources.
[0108] When detecting whether the logical dependency rule corresponding to the combination instance meets the trigger condition, the trigger condition expression is written in a logical expression language. The detection process performs the following operations: parsing the condition expression string into a syntax tree structure; binding the actual value of the current sampling data record to the expression variable; recursively performing logical operations to return a Boolean result. The trigger condition includes multiple types: when the expression is a numerical comparison operation, such as "field A value is greater than field B value", data type conversion is required before comparison; when the expression is a logical combination, such as "field C exists and field D is empty", the results of the sub-expressions need to be calculated and combined. Boundary condition processing includes: returning an undefined state when the field value is empty; returning an exception identifier when the numerical value is out of the valid range. The detection result generates a rule trigger state table, recording the rule unique identifier and the trigger flag.
[0109] When there is an untriggered logical dependency rule, the logical verification state of the associated verification field corresponding to the logical dependency rule is frozen in the spot-check data verification task metadata. The freezing operation performs the following steps: creating a frozen rule registry data structure in the task metadata; inserting the rule unique identifier of the untriggered rule and its associated object field identifier into the frozen rule registry; marking the verification state of the associated verification field as a "frozen" string constant; sending a state update request to the rule engine service. The freezing state implements a time control mechanism, and the default freezing duration is set to, for example, 24 hours, and the frozen state is automatically released after the timeout. During the freezing period, the rule engine skips the verification logic of the frozen field and directly returns a predefined frozen state code.
[0110] When constructing a conflict topology graph based on untriggered logical dependency rules, the conflict topology graph is stored in a directed graph data structure. The construction process includes: taking the key verification field as the starting node; taking the untriggered logical dependency rule as the directed edge; and taking the frozen associated verification field as the terminal node. The graph structure storage adopts the adjacency list format, each node records the field unique identifier string and the field type attribute string, and each edge records the rule unique identifier string and the trigger condition expression string. The generation of the invalid dependency path performs a depth-first traversal algorithm, starting from the key verification field node, traversing along the untriggered rule edge to the associated verification field node, and recording all node sequences on the path. The path data is encoded in JSON array format, and the array elements are the field unique identifier string sequence of the path nodes.
[0111] The persistent storage of the conflict topology graph adopts a dual backup mechanism of a graph database and a file system. The graph database stores the complete topology structure to support real-time queries; the file storage adopts a graph description language format, and a full snapshot file is generated every week. The analysis service of the topology graph provides a path retrieval interface, which inputs the key verification field identifier string and returns a list of all affected associated verification fields. An interactive relationship graph can be generated to highlight the key verification field node and the frozen field node, and the invalid dependency path is marked with a specific color connection line.
[0112] The monitoring mechanism of the frozen state includes an automatic unfreezing process. Periodically scan the frozen rule registry, and when the weight of the key verification field is restored to the initial value and the external data source state registry shows a normal state, trigger the unfreezing operation: clear the rule records in the frozen rule registry; update the state of the associated verification field to the "activated" string constant; notify the rule engine service to restore the verification logic. The unfreezing process records operation audit logs, including the unfreezing timestamp and the associated rule unique identifier list. For complex topology structures, a hierarchical unfreezing strategy is implemented, which unfreezes layer by layer from the bottom to the top according to the dependency path hierarchy.
[0113] The verification mechanism of the coupling relationship configuration library performs a rule validity check before the sampling task is started. The checking process includes: verifying whether the field identifier referenced by the rule exists in the current data set; detecting the syntax correctness of the trigger condition expression; simulating the rule trigger logic using the test data set. Invalid rules are automatically marked as inactive and a system alarm notification is sent. Version rollback support of the configuration library restores to the last three valid versions, and the rollback operation automatically reloads the historical configuration data to the in-memory graph structure.
[0114] The impact range analysis of the conflict topology graph is performed immediately after the freeze operation. The analysis algorithm calculates the proportion value of the affected fields, which is calculated by dividing the number of frozen fields by the total number of verification fields. When the proportion value exceeds, for example, 30%, a global verification strategy adjustment is triggered: the automatic verification strictness level parameter value is reduced; the manual review proportion parameter value is increased; the task timeout duration parameter value is extended. The analysis report generates a list of affected fields and a business function impact assessment, for example, when the product identification class field is frozen, the product traceability function is affected, and the reliability index value is affected.
[0115] The dynamic update of the coupling relationship configuration library supports the rule subscription mechanism. When a new key verification field is added, the related rules that may be affected are automatically scanned, and a confirmation notification is sent to the rule owner. The rule subscription list is managed according to the field type attribute classification, and different subscription groups are corresponded to enterprise qualification class, detection standard class and product identification class respectively. The rule change history is preserved for 90 days, and the change record can be queried according to the time range.
[0116] The data verification exception handling in the frozen state includes a degradation strategy. When the coupling rule of the key verification field and the non-degraded verification field is frozen, the simplified rule set in the backup verification rule library is enabled. The simplified rule set uses a loose condition expression, for example, changing the exact match to range matching. The effective period of the degradation strategy is bound to the frozen state, and the standard verification rule is automatically restored when it is unfrozen. The degradation process records the policy switching log, including the switching timestamp and the rule replacement comparison table.
[0117] S6, when executing the verification rule engine, skipping logical verification for the degraded key verification field, suspending logical verification for the frozen associated field, and generating a pending verification report based on the manual review flag and the conflict topology, the specific implementation is:
[0118] When starting the verification rule engine to perform verification processing on the current sampling data, first, a verification environment initialization operation is performed. The initialization process includes: loading the sampling data record into the memory buffer; parsing the task metadata to obtain the verification rule set version identifier; and establishing a network connection session to the rule engine service. The verification rule engine adopts an event-driven execution model, and the engine core includes three parts: a rule parsing component, a condition evaluation component, and an action execution component. The rule parsing component converts the rule configuration data in the storage area into an executable instruction sequence; the condition evaluation component binds the current sampling data value to the rule condition variable; and the action execution component executes the verification logic in priority order. The engine start parameters are dynamically configured according to the data record size, including a task timeout threshold, for example, 300 seconds, a maximum memory allocation amount, for example, 512 MB, and an abnormal retry number, for example, 3 times. These parameters are automatically calculated by a task complexity evaluation algorithm.
[0119] In the verification processing process, a fine-grained verification control mechanism is implemented when skipping the logical verification operation on the key verification field after weight reduction. The following steps are performed to identify the weight-reduced field: querying the key verification field registration table data structure in the task metadata; obtaining the list of verification weight values after weight reduction; and screening the set of field unique identifiers whose weight values are lower than the preset weight threshold. The skipping operation is specifically implemented as follows: in the rule matching stage, when it is detected that the current field unique identifier belongs to the set of weight-reduced fields, a predefined skip state code is directly returned; no condition evaluation and action triggering logic is executed; and the "weight reduction skip" state description text is recorded in the verification result set. The skip operation includes complete audit tracking, recording the skipped field unique identifier string, the skip operation timestamp, and the weight value after weight reduction.
[0120] In the verification processing process, a state-aware verification scheduling strategy is implemented when suspending the logical verification operation on the frozen associated verification field. The following steps are performed to identify the frozen field: accessing the frozen rule registration table data structure in the task metadata; and extracting the list of all associated object field unique identifiers. The suspension operation is specifically implemented as follows: in the rule scheduling queue, a placeholder task object is created for each frozen field; the placeholder task object does not execute the actual verification logic and immediately returns the "verification frozen" state code; and the actual verification task is prevented from entering the execution queue. A timeout control mechanism is maintained for the suspension state, and when the frozen duration exceeds the preset value, for example, 24 hours, the task requeueing operation is automatically triggered. During the suspension period, a snapshot copy of the original field value is retained for subsequent manual audit reference.
[0121] When reading the activation state of the manual review flag and the invalid dependent path recorded in the conflict topology graph, a multi-source metadata collection operation is performed. The collection process includes: reading the Boolean type state value of the manual review flag from the task metadata database; querying the adjacency table structure data of the conflict topology graph from the graph database service; parsing the JSON format array data of the invalid dependent path. The activation state reading includes a version checking step to ensure that the latest state flag value is obtained. The conflict topology graph data acquisition implements an incremental loading strategy, only obtaining the subgraph structure data related to the current task. The invalid dependent path is parsed into a sequence of field unique identifiers, each sequence representing the complete influence chain data from the key check field to the frozen field. The path data implements integrity verification to check whether all node fields exist in the current dataset.
[0122] When generating the pending review check report by combining the activation state of the manual review flag, the conflict topology graph, and the unverified field list, a structured report assembly process is implemented. The unverified field list is generated by merging the de-prioritized field list and the frozen field list, and the list elements include field unique identifier strings, unverified reason codes, and original data value texts. The report generation performs the following steps: creating a report template framework structure; inserting manual review flag activation state description text; visualizing the conflict topology graph image; listing the unverified field list table data; adding check result summary statistics. The report format uses both HTML format and JSON format output, with HTML format for manual viewing and JSON format for system integration processing. The report is stored in the task report storage area and an access link is generated and written to the task event log record.
[0123] The content enhancement of the pending review check report includes impact analysis. Calculate the key indicators: the de-prioritized field proportion value is the percentage value of the number of de-prioritized fields divided by the total number of key fields; the frozen influence range is the number of business function points affected by the frozen fields; the manual review urgency score is obtained by weighted sum based on the importance of the unverified fields. The indicator values are visualized using color coding, for example, values exceeding 30% are marked with a red warning symbol. The report adds data bloodline annotation information, labeling the data source table and processing link path of each unverified field. The report version management uses the naming rule of task identifier plus timestamp, and retains historical versions to support audit tracing operations.
[0124] The execution monitoring of the verification rule engine implements a real-time index collection function. The collected indexes include: the number of processed fields, the number of skipped fields, the number of paused fields, and the rule matching duration percentile value. The monitoring dashboard displays the current execution state information, and uses a progress bar control to display the task completion ratio value. The abnormal processing mechanism captures error events in engine execution, and when the number of continuous errors exceeds a threshold value, for example, 5 times, the task is paused and a system alarm notification is sent. The resource recycling process releases the memory buffer space, closes the database connection session, and cleans up the temporary file resources after the task ends.
[0125] The report distribution mechanism is implemented based on subscription rule configuration. When the manual review flag is in the active state, the report is automatically sent to the manual review queue; otherwise, it is sent to the automatic archiving storage area. The distribution channel supports three modes of email transmission, message queue delivery and file transfer protocol, and automatically selects the optimal transmission channel according to the report data size. The report reading receipt tracking system records the recipient identifier, opening timestamp and review duration value, and a timeout unread report triggers a reminder notification message. The feedback collection embeds an evaluation button element in the report page, and the reviewer can submit a report quality score value and improvement suggestion text.
[0126] The incremental update of the to-be-reviewed verification report supports dynamic change processing in task execution. When a new frozen field or weight adjustment event occurs, a report version update operation is triggered: the latest unverified field list data is obtained; the conflict topology graph subset data is regenerated; and the change log description text is appended. The version difference comparison function highlights the changed content, and the changed part is marked with a special identifier for differentiation. The final report is locked for protection when the task is submitted, preventing subsequent modification operations, and the lock state is verified by a digital signature algorithm to protect the integrity.
[0127] The quality verification of the generated report implements an automatic check process. The check items include: field coverage verification to ensure that all unverified fields are recorded; dependency path integrity verification to ensure that the topology graph contains all failure paths; and state consistency verification to ensure that the active state in the report is consistent with the metadata. The verification result generates a quality score report, and when the score is lower than a threshold value, for example, 80 points, the report regeneration process is triggered. The quality score calculation formula is the weighted average value of the pass rates of each check item, and the weight coefficients are dynamically assigned according to the business importance.
[0128] The storage security of the to-be-reviewed verification report implements an encryption protection mechanism. The report file is encrypted using a symmetric encryption algorithm when it is persisted, and the encryption key is assigned by the key management system according to the task. The access control implements role-based permission management, and the auditor role can only access the reports of the assigned tasks. The audit log records all report access operations, including the access identifier, access timestamp and operation type code. The report retention period is set to 90 days after the task ends, and the archiving cleanup process is automatically started at the end of the period.
[0129] The implementation of steps S1 to S6 addresses the cascading verification issues caused by external data source failures through a layered processing mechanism. Specifically: Dynamic weight adjustment (S4) reduces the weight of key fields rather than disabling them entirely, preserving basic verification capabilities and avoiding the waste of resources from full manual review. For example, enterprise qualification fields are downgraded in stages, reducing the risk of misjudgment while maintaining minimum verification logic. Conflict topology modeling (S5) transforms field coupling relationships into visual dependency paths, accurately locating the frozen range. Compared to traditional full table scans, the graph structure stored in adjacency tables reduces invalid detections, and the hierarchical unfreezing mechanism avoids over-freezing. The collaborative control mechanism (S6) dynamically skips downgraded and suspended frozen fields during engine execution and automatically integrates manual review flags with the topology graph to generate reports. Dual-format (HTML / JSON) reports cater to both human and machine processing needs, improving efficiency compared to single output. Through the linkage of weight threshold control, topology dependency tracking, and state collaboration, the impact radius of external data anomalies on the system is compressed (based on measured data) while ensuring verification reliability, and the workload of manual review is reduced.
[0130] Example 2: Figure 2 A schematic diagram of the food safety sampling inspection data verification system of the present invention is provided. The food safety sampling inspection data verification system includes:
[0131] The dependency mapping module is used to establish a dependency mapping table between the sampling system and external data sources. The dependency mapping table records the binding relationship between each validation field and the corresponding external data source.
[0132] The causal analysis module is used to build a service response causal graph model, inject virtual intervention parameters into external data sources and generate counterfactual ideal responses. When the KL divergence value between the actual response and the counterfactual ideal response exceeds a preset causal deviation threshold, the external data source is marked as a failure.
[0133] The failure propagation module is used to parse the set of verification fields of the current sampling data and identify the key verification fields that are bound to the external data source with the failure status based on the dependency mapping table.
[0134] The weight adjustment module is used to downgrade the verification weight of key verification fields to below a preset threshold, while activating the manual review flag.
[0135] The coupling and decoupling module is used to scan the preset set of coupling relationships between key verification fields and non-de-weighted verification fields. If there are untriggered coupling rules, the logical verification of the associated verification fields corresponding to the coupling rules is frozen and the conflict topology is marked.
[0136] The cooperative execution module is configured to perform logical verification on the key verification field after the weight reduction, suspend logical verification on the frozen associated field, and generate a verification report to be reviewed based on the artificial review flag and the conflict topology when the verification rule engine is executed.
[0137] Embodiment 3: A computer storage medium, a program or instructions are stored on the computer storage medium, and the program or instructions are executed by a processor to implement the food safety sampling data verification method.
[0138] The calculations involved in the embodiments are all dimensionless numerical calculations, and the preset parameters and threshold values in the calculations are set by a person skilled in the art according to actual conditions.
[0139] It should be noted that the application can be deployed on the device itself to realize embedded application, or run on a PC terminal or other terminal with a user interface, thereby meeting various hardware environments and use requirements.
[0140] The above embodiments can be realized by software, hardware, firmware or any combination thereof, in whole or in part. When realized by software, the above embodiments can be realized in the form of a computer program product in whole or in part. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the flow or function described in the embodiments of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wireless or wired direction. The wired transmission mode includes optical fiber, twisted pair, coaxial cable, etc. The wireless transmission includes infrared, microwave, etc. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. containing one or more available medium collections. The available medium can be a magnetic medium (for example, floppy disk, hard disk, magnetic tape), optical medium (for example, DVD), or semiconductor medium. The semiconductor medium can be a solid state disk.
[0141] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device and module can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0142] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other manners. For example, the division of the above-described device embodiment is merely an example, and there can be other division manners. For example, the modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or modules, and can be in electrical, mechanical or other forms.
[0143] The modules illustrated as separated components can or can not be physically separated, and the components illustrated as modules can or can not be physical modules, and can be located in one place, or can be distributed on a plurality of network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment.
[0144] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can be physically present alone, or two or more modules can be integrated into one module.
[0145] If the functions are realized in the form of software function modules and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part of the prior art that contributes to the technical solutions or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program codes that can be stored in the medium.
[0146] The above description is merely a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
[0147] Finally: the above only for the preferred embodiments of the present application, and not for limiting the present application, any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application, should be included in the scope of protection of the present application.
Claims
1. A method for verifying food safety sampling inspection data, characterized in that, include: S1. Establish a dependency mapping table between the sampling inspection system and external data sources. The dependency mapping table records the binding relationship between each verification field and the corresponding external data source. S2. Construct a service response causal graph model, inject virtual intervention parameters into the external data source and generate a counterfactual ideal response. When the KL divergence value between the actual response and the counterfactual ideal response exceeds the preset causal deviation threshold, mark the external data source as a failure state. S2 includes: constructing a Bayesian network structure based on historical service log data as a causal graph model for service response; Using a service response cause-effect graph model, a test request carrying virtual intervention parameters is sent to the target external data source. The virtual intervention parameters include a simulated request volume multiplier and a forced timeout threshold. Receive the actual response data returned by the target external data source in response to the test request; Counterfactual ideal response data under virtual intervention parameters were calculated using a service response causal graph model. S3. Parse the set of verification fields in the current sampling data, and identify the key verification fields that are bound to the external data source in the failure state based on the dependency mapping table; S4. Reduce the verification weight of key verification fields to below the preset threshold, and activate the manual review flag. S5. Scan the preset coupling relationship set of key verification fields and non-de-weighted verification fields. If there are untriggered coupling rules, freeze the logical verification of the associated verification fields corresponding to the coupling rules and mark the conflict topology. S6. When executing the verification rule engine, skip logical verification for key verification fields that have been downgraded, suspend logical verification for frozen related fields, and generate a verification report to be reviewed based on the manual review flag and conflict topology.
2. The food safety sampling inspection data verification method according to claim 1, characterized in that, S1 includes: Obtain the unique identifiers of all validation fields in the sampling inspection system and their corresponding external data source network access addresses; According to the food safety data verification rules, the field type attributes of each verification field are determined. The field type attributes include enterprise qualification, testing standard, and product identification. Generate a structured dependency mapping table, where each mapping record contains a unique identifier for the validation field, the network access address of the bound external data source, and the field type attribute. The dependency mapping table establishes an index association between the unique identifier of the validation field and the sampled data field.
3. The food safety sampling inspection data verification method according to claim 2, characterized in that, S2 also includes: Calculate the KL divergence between the probability distributions of the actual response data and the counterfactual ideal response data; When the KL divergence value between probability distributions exceeds the preset causal deviation threshold, an external data source failure status marker signal is generated.
4. The food safety sampling inspection data verification method according to claim 3, characterized in that, A Bayesian network structure includes nodes representing the request volume of external data sources, response latency, and error codes.
5. The food safety sampling inspection data verification method according to claim 3, characterized in that, S3 includes: The system parses the set of validation fields in the current sampled data and identifies key validation fields bound to external data sources in the failure state based on the dependency mapping table, including: Extract the unique identifier of the verification field to be verified from the current sampled data record; Query the network access address of the external data source corresponding to the unique identifier of the validation field in the dependency mapping table; Receive an external data source failure status marker signal, which contains the network access address of the failed external data source; Match the retrieved external data source network access addresses with invalid external data source network access addresses; When the network access address of the external data source is successfully matched, the corresponding unique identifier of the verification field is marked as a critical verification field.
6. The food safety sampling inspection data verification method according to claim 5, characterized in that, S4 includes: Obtain the initial verification weight value configured in the verification rule engine corresponding to the key verification fields; The differentiated degradation strategy is determined based on the field type attributes bound to the key verification fields. The field type attributes include enterprise qualification, testing standard and product identification. The initial verification weight value is adjusted to below the preset weight threshold by applying a differentiated degradation strategy, and a downgraded verification weight value is generated. Create a manual review flag in the metadata of the random inspection data verification task, and set the manual review flag status to active.
7. The food safety sampling inspection data verification method according to claim 6, characterized in that, S5 include: Load the predefined coupling relationship configuration library, which stores the logical dependency rules between key validation fields and non-degraded validation fields; Iterate through instances of combinations of key validation fields and non-weighted validation fields in the current sampled data; Check whether the logical dependency rules corresponding to the combined instance meet the triggering conditions; When there are untriggered logical dependency rules, freeze the logical verification status of the associated verification fields corresponding to the logical dependency rules in the metadata of the sampling data verification task. A conflict topology graph is constructed based on untriggered logical dependency rules. The conflict topology graph records the invalid dependency paths of associated validation fields and key validation fields.
8. The food safety sampling inspection data verification method according to claim 7, characterized in that, S6 include: The verification rule engine is started to verify the current sampled data; During the verification process, logical verification operations are skipped for key verification fields that have been downgraded in weight. During the verification process, the logical verification operation of the frozen associated verification fields is paused; Read the activation status of the manual review flag and the failure dependency paths recorded in the conflict topology graph; The system combines manually reviewed flag activation status, conflict topology diagram, and unverified field list to generate a verification report pending review.
9. A food safety sampling inspection data verification system, used to implement the food safety sampling inspection data verification method according to any one of claims 1-8, characterized in that, include: The dependency mapping module is used to establish a dependency mapping table between the sampling system and external data sources. The dependency mapping table records the binding relationship between each validation field and the corresponding external data source. The causal analysis module is used to build a service response causal graph model, inject virtual intervention parameters into external data sources and generate counterfactual ideal responses. When the KL divergence value between the actual response and the counterfactual ideal response exceeds a preset causal deviation threshold, the external data source is marked as a failure. The failure propagation module is used to parse the set of verification fields of the current sampling data and identify the key verification fields that are bound to the external data source with the failure status based on the dependency mapping table. The weight adjustment module is used to downgrade the verification weight of key verification fields to below a preset threshold, while activating the manual review flag. The coupling and decoupling module is used to scan the preset set of coupling relationships between key verification fields and non-de-weighted verification fields. If there are untriggered coupling rules, the logical verification of the associated verification fields corresponding to the coupling rules is frozen and the conflict topology is marked. The collaborative execution module is used to skip logical verification of key verification fields after weight reduction, suspend logical verification of frozen related fields, and generate a verification report to be reviewed based on manual review flags and conflict topology when executing the verification rule engine.
10. A computer storage medium, characterized in that, A program or instruction is stored on a computer storage medium, and when the program or instruction is executed by a processor, it implements the food safety sampling inspection data verification method as described in any one of claims 1-8.
Citation Information
Patent Citations
Food safety sampling inspection data verification method, storage medium and system
CN118278959A
Compliance verification method and device for medical process data
CN120108657A