Product quality risk automatic early warning method based on event reasoning

By constructing a multi-source regulatory corpus and graph neural network, the problems of lag and insufficient modeling capabilities in traditional product quality supervision methods are solved, and efficient and accurate automatic early warning of product quality risks is achieved.

CN121478985APending Publication Date: 2026-02-06SHANGHAI MUNICIPAL ADMINISTRATION FOR MARKET REGULATION INFORMATION APPL RES CENT (SHANGHAI FOOD SAFETY TECH APPL CENT SHANGHAI MUNICIPAL ADMINISTRATION FOR MARKET REGULATION ARCHIVES)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511603365.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-04
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

Traditional product quality supervision methods rely on manual sampling and enterprise declarations, which have problems such as slow response, reliance on experience, and lack of scalability. Furthermore, existing market monitoring systems lack the ability to model the causal relationships of events, time series evolution, and multi-source cross-validation, making it difficult to form an interpretable risk scoring model.

Method used

By collecting structured and unstructured data, a multi-source regulatory corpus is constructed. Risk scoring is performed using event quintuple structures and graph neural networks, and early warning reports are generated. Cross-source entity fusion and graph structure consistency verification are achieved. Risk assessment is conducted by combining graph attention networks, temporal graph neural networks, and structural causal modeling.

Benefits of technology

It has realized a closed-loop regulatory mechanism of pre-identification, real-time assessment and post-event linkage, which has improved the timeliness and accuracy of product quality risk analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121478985A_ABST
    Figure CN121478985A_ABST
Patent Text Reader

Abstract

The invention discloses a product quality risk automatic early warning method based on event reasoning, and relates to the technical field of artificial intelligence. The method comprises the following steps: constructing a multi-source supervision corpus; modeling data in the multi-source supervision corpus based on an event quintuple structure; designing prompt templates of different event classes according to the event classes in the semantic ontology model, and generating a quintuple structure of the event; entity nodes and semantic relation edges are generated according to the quintuple structures of the structured data and the unstructured data, cross-source entity fusion and graph structure consistency verification are carried out, and a heterogeneous graph structure is output; performing risk evaluation on nodes and paths of the heterogeneous graph structure to obtain a risk score of the event; and according to the risk level, generating an early warning report, and matching linkage resources to carry out coping scheduling. According to the invention, a closed-loop supervision mechanism of beforehand identification-real-time evaluation-afterward linkage is realized, and the timeliness and accuracy of product quality risk analysis are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, in particular to a product quality risk automatic early warning method based on event reasoning. BACKGROUND

[0002] With the wide application of e-commerce platforms, social media and Internet of Things devices, the data scale of market behavior has rapidly expanded. Traditional product quality supervision methods often rely on manual sampling and enterprise reporting, etc., which have problems such as reaction lag, dependence on experience, and lack of scalability. Especially in product recall, enterprise compliance supervision and consumer product risk control scenarios, regulatory agencies are facing the challenges of information explosion and multi-source heterogeneous data fusion, and need to use intelligent technology to achieve active identification and automatic early warning.

[0003] In recent years, the rapid development of knowledge graph, large language model (LLM) and graph neural network (GNN) technologies has provided a solid foundation for event-level information understanding and reasoning modeling. By constructing a semantic-rich event ontology model, unstructured supervision information is converted into structured "event metadata", and graph neural networks are used to model the potential relationships between these structures, which can realize dynamic perception and reasoning of risk chains. For example, the system constructs a product quality event association network based on quality standard specification data, supervision and recall public data, social media public opinion, etc.

[0004] Existing market monitoring systems mostly focus on text clustering, sentiment analysis or simple keyword matching, and lack the ability to model event causal relationships, time series evolution and multi-source cross-validation. While traditional graph databases have some entity relationship representation capabilities, they lack intelligent reasoning and causal chain calculation capabilities, making it difficult to form an explainable risk scoring model. SUMMARY

[0005] The purpose of the present application is to provide a product quality risk automatic early warning method based on event reasoning, which aims to solve or improve at least one of the above technical problems.

[0006] To achieve the above purpose, the present application provides the following scheme: A product quality risk automatic early warning method based on event reasoning, comprising: Collecting structured data, unstructured data and real-time stream data, and constructing a multi-source supervision corpus; Based on the event five-tuple structure, the data in the multi-source supervision corpus is modeled, and a semantic ontology model containing entity classification, semantic relationship modeling and standardized representation is constructed; According to the event class in the semantic ontology model, the prompt templates of different event classes are designed to guide the large language model and the SpanBERT model to extract the event elements in the unstructured data and generate the five-tuple structure of the event. According to the five-tuple structure of the structured data and the unstructured data, entity nodes and semantic relationship edges are generated, cross-source entity fusion and graph structure consistency verification are performed, and a heterogeneous graph structure is output. Based on the graph attention network GAT, the time graph neural network TGAT, and the structural causal modeling SCM method, the risk of the nodes and paths of the heterogeneous graph structure is evaluated, and the risk score of the event is obtained. According to the risk score of the event, the risk level is determined, the early warning report containing the risk score explanation and the event path is automatically generated, and the linkage resources are matched for response and scheduling.

[0007] Further, the structured data, unstructured data, and real-time stream data are collected, including: Real-time monitoring of supervision information platform events to obtain structured data; According to the keyword rule, the content of news websites, social platforms, and public opinion monitoring sites is captured to obtain unstructured data; if the captured content is an image type announcement or a scanned file, further text recognition is performed using Tesseract OCR to extract the text content as unstructured data.

[0008] Further, based on the event five-tuple structure, the data in the multi-source supervision corpus is modeled, and a semantic ontology model containing entity classification, semantic relationship modeling, and standardized representation is constructed, including: Based on the five-tuple structure, the four-layer semantic ontology structure of "event class-element-attribute-semantic relationship" is constructed for the data in the multi-source supervision corpus; Based on the four-layer semantic ontology structure, the event class, entity class, and semantic relationship class in the product quality supervision event are systematically modeled, and the field attributes and constraint logic are defined; According to the four-layer semantic ontology structure and the field attributes and constraint logic, formal modeling is performed in the Protégé tool using the OWL language to generate the semantic ontology model, and the hierarchical relationship and semantic constraints of classes and attributes are defined by RDFS.

[0009] Further, according to the event class in the semantic ontology model, the prompt templates of different event classes are designed to guide the large language model and the SpanBERT model to extract the event elements in the unstructured data and generate the five-tuple structure of the event, including: According to the event class in the semantic ontology model, the prompt templates of different event classes are designed to determine specific elements and guide the large language model to extract in an instruction-driven manner; According to the extracted specific elements, the key fields in the unstructured data are extracted using a pre-trained language model based on the Transformer architecture combined with the SpanBERT model, and the event elements are obtained; The extracted event elements are uniformly organized into a five-tuple structure, and according to the attribute set in the semantic ontology model, the attribute fields related to the event are supplemented.

[0010] Further, according to the five-tuple structure of structured data and unstructured data, entity nodes and semantic relationship edges are generated, and cross-source entity fusion and graph structure consistency verification are performed, and the output is a heterogeneous graph structure, including: According to the event elements in the five-tuple structure, nodes and edges are constructed to form an event graph structure in the form of a "regulatory agency-product-behavior" three-tuple; Based on the event graph structure, the same entity from different sources is represented and learned through a graph embedding algorithm, and the entity alignment is performed combined with the text similarity; for the ambiguous entity, the clustering algorithm is used to aggregate and merge the nodes to obtain a basic graph; The semantic verification is performed on the basic graph structure to ensure the logical consistency of node type, edge attribute and multi-hop path, and the nodes with semantic conflict and non-standard structure are removed to obtain a heterogeneous graph structure.

[0011] Further, based on the graph attention network GAT, the time graph neural network TGAT and the structural causal modeling SCM method, the risk evaluation is performed on the nodes and paths of the heterogeneous graph structure to obtain the risk score of the event, including: The graph attention network GAT is used to dynamically aggregate the features of adjacent nodes through dynamic weighting to learn the semantic role and propagation ability of the node in the heterogeneous graph structure, and the structural risk score of each node is obtained; The time graph neural network TGAT is used to consider the time sequence, interval and dynamic evolution path between the nodes in the heterogeneous graph structure, and the time trend risk score of the node is output; According to the entity attributes, behavior types and result labels in the heterogeneous graph structure as causal variable nodes, a structural causal model SCM is constructed, and causal edges between the causal variable nodes are defined based on domain rules or statistical correlations to generate a causal structure; Based on the causal structure, the causal reasoning framework is used to perform an intervention inference on the selected causal variable nodes to simulate the change of the result under different intervention conditions, and a causal risk score of the event is generated; The structural risk score, the time trend risk score and the causal risk score are weighted and fused to generate a risk score of the event.

[0012] Further, according to the risk score of the event, a risk level is determined, a warning report containing a risk score explanation and an event path is automatically generated, and a linkage resource is matched for response scheduling, including: The risk score is compared with a preset risk threshold, a segmented mapping strategy is adopted to divide the risk level into four levels, and corresponding labels are assigned; According to the risk level, a preset document generation model is called to fill in the structured report corresponding to the risk level; The system calls a standard template library, an emergency resource library and a geographic location service according to the risk type, automatically recommends matched law enforcement units, detection agencies and standard documents, and realizes a warning linkage closed loop.

[0013] According to the specific embodiments provided by the present application, the following technical effects are disclosed: The present application discloses a product quality risk automatic warning method based on event reasoning, which realizes a closed-loop supervision mechanism of pre-identification-real-time evaluation-post-event linkage by fusing event ontology modeling, event extraction, knowledge graph construction, graph neural network reasoning and causal analysis, and improves the timeliness and accuracy of product quality risk analysis. BRIEF DESCRIPTION OF DRAWINGS

[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0015] Figure 1 The flowchart of the method of the present application is shown in the figure. Figure 2 The heterogeneous graph structure in the present embodiment is shown in the figure. DETAILED DESCRIPTION

[0016] The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0017] The purpose of the present application is to provide a product quality risk automatic warning method based on event reasoning, which aims to solve or improve at least one of the above technical problems.

[0018] In order to make the above objectives, features and advantages of the present application more obvious and easy to understand, the present application will be further described in detail below with reference to the drawings and specific embodiments.

[0019] Noun explanation: spaCy: An open-source natural language processing (NLP) library designed for production-level applications, supporting part-of-speech tagging, named entity recognition, text classification, and other functions.

[0020] BERTopic: A topic modeling tool based on the BERT pre-training model, combining deep learning and clustering algorithms to improve semantic understanding capabilities.

[0021] MongoDB: An open-source distributed document database written in C++, supporting JSON format data storage, providing high-performance, easy-to-expand data storage solutions.

[0022] As shown in Figure 1 The present application provides an event reasoning-based product quality risk automatic early warning method, comprising: Step S1, collecting structured data, unstructured data and real-time stream data, constructing a multi-source supervision corpus containing sampling, public opinion, recall and other contents, including the following steps: Step S11, collecting structured data, using Flink CDC (Change Data Capture) technology to listen to supervision information platform events in real time, and obtaining structured data; the supervision information platform includes the national enterprise credit information public system, product quality supervision notification platform, etc., and real-time acquisition of structured data such as business registration, administrative punishment and product standards.

[0023] Step S12, collecting unstructured data, building a distributed crawler system through the Scrapy crawler framework, combining keyword rules to crawl the content of news websites, social platforms and public opinion monitoring sites, and obtaining unstructured data. If the crawled content is an image type announcement or a scanned file, further use Tesseract OCR for text recognition to extract text content as unstructured data.

[0024] It should be noted that the keyword rule is based on product quality-related keywords provided by experts, and the rule is used to match the text content to identify and crawl the content related to product quality in multiple sites.

[0025] The purpose of keyword rules is to enable web crawlers to accurately identify valuable content relevant to our research or business objectives from massive amounts of web page information, avoiding resource waste and data redundancy caused by indiscriminate crawling. The core content of keyword rules includes: domain-related core keywords, synonyms and near-synonyms, and keyword combination patterns. A specific example is shown below: Let's say you want to monitor "the new policy on waste sorting issued by the Municipal Environmental Protection Bureau".

[0026] Key keywords: waste sorting, waste disposal, sanitation; Issuing agencies: Environmental Protection Bureau, Ecological Environment Bureau, Urban Management Bureau; Document types: policies, notices, announcements, management measures, new regulations; Time-related: latest, new, revised, released.

[0027] Step S13: Construct a multi-source regulatory corpus. SpaCy is used for word segmentation and Named Entity Recognition (NER) of unstructured data, and BERTopic is used for unsupervised topic clustering of the unstructured data, classifying it into multiple topic libraries such as sampling inspection information, product standards, complaint and public opinion, and penalty cases. The structured and unstructured data are uniformly encoded and stored in a MongoDB document-oriented database to obtain the multi-source regulatory corpus.

[0028] Step S2, based on the event quintuple structure, models the data in the multi-source regulatory corpus, constructing a semantic ontology model that includes entity classification, semantic relation modeling, and standardized representation, including the following steps: Step S21: Based on the five-tuple structure, construct a four-layer semantic ontology structure of "event class—element—attribute—semantic relationship" for the data in the multi-source regulatory corpus. The five-tuple structure includes subject, behavior, object, time, and location. Step S22: Based on the four-layer semantic ontology structure, system modeling is performed on the event class, entity class and semantic relationship class in product quality supervision events, and field attributes and constraint logic are defined.

[0029] Among them, common product quality supervision events include event categories such as product quality events and public opinion events; entity categories include enterprises, institutions, and products; semantic relationship categories include: spot checks, penalties, and recalls; and their field attributes and constraint logic are defined. For example, "product quality events" include fields such as "defect type," "spot check results," and "involved standards," while "public opinion events" include fields such as "public opinion theme," "main complaint," and "dissemination channels," ensuring that different data sources can be integrated within the ontology framework.

[0030] Step S23: Based on the four-layer semantic ontology structure and field attributes and constraint logic, formal modeling is performed using the OWL language in the Protégé tool to generate a semantic ontology model. The hierarchical relationships between classes and attributes, as well as semantic constraints, are defined using RDFS. Classes include entity classes and event classes; attributes include field attributes and semantic relationship classes.

[0031] Step S3: Based on the event classes in the semantic ontology model, design prompt templates for different event classes to guide the large language model and SpanBERT model in extracting event elements from unstructured data and generating a five-tuple structure for events. This includes the following steps: Step S31: Based on the event classes in the semantic ontology model, design prompt templates for different event classes, determine specific elements, and guide the large language model to extract in an instruction-driven manner. In the above steps, different prompt templates are set for different types of events. For example, the prompt for public opinion is "Please extract the product, event theme, and dissemination time involved in the public opinion", and the prompt for sampling results is "Extract the product name, sampling time, non-conforming items and sampling agency", etc.

[0032] Step S32: Based on the extracted specific elements, use a pre-trained language model based on the Transformer architecture, combined with the SpanBERT model, to extract key fields from the unstructured data to obtain event elements.

[0033] In the above steps, the pre-trained language model first uses a self-attention mechanism to model the context, and then uses Span representation to identify phrase-level entity boundaries and extract event quintuples.

[0034] In the steps above, Span represents a sequence labeling method that labels the start and end positions of all possible consecutive text segments in the text, as well as their corresponding entity types.

[0035] Specific examples are shown below: A span is uniquely identified by its start index and end index in the text.

[0036] For example, in the sentence “[0]Beijing[1]the[2]weather[3]is[4]so[5].”: Span[0,0] represents the single word "Beijing".

[0037] Span[0,2] represents the phrase "Beijing weather".

[0038] Span[3,4] represents the phrase "great".

[0039] Each possible [start, end] combination defines a potential Span.

[0040] Step S33: Organize the extracted event elements into a five-tuple structure <subject, behavior, object, time, location>, and supplement event-related attribute fields based on the attribute set in the semantic ontology model, such as product standard number, non-conforming items, etc. The output format is JSON-LD or RDF for easy subsequent graph integration.

[0041] Step S4 involves generating entity nodes and semantic relation edges based on the quintuple structure of structured and unstructured data, performing cross-source entity fusion and graph structure consistency verification, and outputting a heterogeneous graph structure, including the following steps: Step S41: Construct nodes and edges based on the event elements in the quintuple structure to form an event graph structure with "regulatory agency-product-behavior" triples; Step S42: Based on the event graph structure, representation learning is performed on synonymous entities from different sources using a graph embedding algorithm, and entity alignment is performed by combining text similarity. For ambiguous entities, a clustering algorithm is used to aggregate and merge nodes to obtain the basic graph. The preferred graph embedding algorithm is TransE; the preferred text similarity is cosine similarity from BERT embedding. Step S43: Use SHACL (Shapes Constraint Language) rules to perform semantic verification on the basic graph structure to ensure the logical consistency of node types, edge attributes and multi-hop paths, remove nodes with semantic conflicts and non-standard structures, and obtain a heterogeneous graph structure.

[0042] Step S5, based on the Graph Attention Network (GAT), Temporal Graph Neural Network (TGAT), and Structural Causal Modeling (SCM) method, performs risk assessment on nodes and paths in heterogeneous graph structures to obtain risk scores for events, including the following steps: Step S51: Using the Graph Attention Network (GAT) model, the semantic role and propagation ability of nodes in heterogeneous graph structures are learned through dynamic weighted aggregation of neighboring node features, and the structural risk score of each node is obtained. The above steps map the nodes in the constructed heterogeneous graph structure into vector form, initializing them as embedding vectors containing multi-dimensional information such as node type, entity attributes, and historical event frequency. The GAT model, based on a multi-head attention mechanism, calculates the attention weights between each node and its neighboring nodes, enabling the model to adaptively aggregate important neighbor information and improve its ability to model complex semantic paths. After learning through multi-layer GAT stacking, the final representation vector of each node is obtained, and the structural risk score of the node is output through a risk prediction head.

[0043] Step S52: Use Temporal Graph Attention Network (TGAT) to consider the temporal order, occurrence interval and dynamic evolution path between nodes in the heterogeneous graph structure, and output the temporal trend risk score of the node. In the above steps, each edge in the heterogeneous graph structure carries timestamp information. The TGAT model embeds this time information, enabling it to perceive the differences in the influence intensity of different time nodes during the aggregation of neighbor nodes.

[0044] In practical applications, each node and its adjacent event sequence can constitute a dynamic time chain. Time differences are mapped to low-dimensional vectors using periodic functions or trainable embeddings, participating in the graph attention calculation process. While aggregating historical behavior nodes, the model incorporates temporal context for adjustment, learning the behavioral patterns and rhythmic changes of nodes within the evolutionary chain to determine whether they are in a risk-increasing phase. The output is a time trend risk score, indicating whether a node exhibits behavioral characteristics such as high-frequency event outbreaks, a surge in the frequency of incidents, and an increase in the severity of events within a recent time window. This score assists in the horizontal verification and vertical time-based determination of structural risk.

[0045] Step S53: Based on the entity attributes, behavior types, and result labels in the heterogeneous graph structure as causal variable nodes, construct a structural causal model (SCM), and define causal edges between causal variable nodes based on domain rules or statistical correlation to generate a causal structure. Based on the causal structure, a causal inference framework is used to make interventional inferences on selected causal variable nodes, simulate the changes in outcomes under different intervention conditions, and generate a causal risk score for the event; among them, the preferred causal inference framework is DoWhy; In the above steps, the causal risk score quantifies the sensitivity of the current node to changes in the upstream dependent variable, reflecting the node's responsiveness and potential risk linkage ability in the causal path.

[0046] Step S54 involves weighting and fusing the structural risk score, time trend factor (TGAT time series index), and causal influence coefficient (DoWhy inference value) to generate a risk score for the event, which is used for classification and decision support.

[0047] Step S6: Determine the risk level based on the event's risk score, automatically generate an early warning report containing an explanation of the risk score and the event path, and match relevant resources for response scheduling, including the following steps: Step S61: Compare the risk score with the preset risk threshold, divide it into four risk levels using a segmented mapping strategy, and assign corresponding labels; whereby the risk levels include low, medium, high, and severe. In the above steps, the preset risk threshold is set based on expert experience.

[0048] Step S62: Based on the risk level, call the preset document generation model, fill in the structured report corresponding to the risk level, and support output in PDF, HTML and other formats.

[0049] In the above steps, the document generation model uses preset document generation rules and templates to obtain the corresponding risk score explanation, event path, and other content based on the risk level and fill them into the corresponding positions in the document to form a structured report.

[0050] Step S63: Based on the risk type, the compliance template library, emergency resource library, and geolocation service are invoked to automatically recommend matching law enforcement agencies, testing institutions, and standard documents, thereby achieving a closed-loop early warning and linkage mechanism. Specific Implementation Information obtained from the quality supervision platform states: "Recently, a sampling inspection agency conducted a special quality inspection of commercially available child safety seats. The results showed that some products had non-compliance due to excessively large interface tolerances. This defect caused the head support structure to detach during simulated crash tests. This malfunction could cause head injuries to children, posing a serious safety hazard. The relevant inspection results have been transferred for handling in accordance with the law, and the companies have been ordered to rectify the issues within a specified period."

[0052] Please extract the products, event topics, and dissemination time involved in the above public opinion. The prompts for the sampling results are "extract product name, sampling time, non-conforming items and sampling agency", etc.

[0053] The extracted content includes the following: Product: Child safety seat; Non-conformance: Excessive interface tolerance; Failure mode: Head support structure detached during collision; Injury type: Head injury; Inspection agency: Name of agency.

[0054] The extraction process described above uses different prompt templates depending on the type of event. For example, the prompt for public opinion events is "Please extract the products involved in the public opinion, the theme of the event, and the time of dissemination," while the prompt for sampling results events is "Extract the product name, sampling time, non-conforming items, and sampling agency," etc.

[0055] Based on the extracted specific elements, a pre-trained language model based on the Transformer architecture, combined with the SpanBERT model, is used to extract key fields from unstructured data to obtain event elements, including the following: Product: Child safety seat; Non-conformance: Excessive interface tolerance; Failure mode: Head support structure detached during collision; Injury type: Head injury; Inspection agency: Name of agency.

[0056] Based on the above quintuple structure, entity nodes and semantic relation edges are generated, including the following: Entity nodes include: Regulatory agency node: Agency name; Product entity node: Child safety seat; Non-conformance node: Excessive interface tolerance; Failure mode node: Structural detachment; Hazard type node: Head injury Semantic relation edges include: spot check, existence of non-compliant items, cause, and may trigger.

[0057] like Figure 2 As shown, cross-source entity fusion and graph structure consistency verification are performed on the above entity nodes and semantic relationship edges to output a heterogeneous graph structure. Based on Graph Attention Network (GAT), Temporal Graph Neural Network (TGAT), and Structural Causal Modeling (SCM), risk assessment is performed on nodes and paths in heterogeneous graph structures to obtain event risk scores, including the following: Suppose we identify the following facts: Company A's "baby stroller" products failed two random inspections in November 2023 and March 2024; The non-compliance items were all related to "loose frame rivets" and there were historical complaints about "finger pinching when folding". In May 2024, a video posted by a user on a public opinion platform claimed that their stroller automatically folded shut, causing injury. The product complies with the GB 14748 standard and does not meet the requirement that "folding locking structures must have double security".

[0058] Graph structure reasoning includes: Input: Nodes in the heterogeneous graph structure: Enterprise node (A), Product node (baby stroller), Inspection record node ×2, Public opinion event node, Implementation standard node (GB 14748); Node attributes (such as product category, historical pass rate, number of complaints). Graph structure: Edge connections such as "Spot check results", "Products involved", "Public opinion release", "Implementation standards", etc. Output: {"Node": "Baby stroller"; "GAT_score": 0.76; "Description": "Two unqualified inspections + high intensity of public opinion exposure, most of the adjacent nodes are high-risk events"}.

[0059] Time series modeling includes: Input: Sampling time series: 2023-11, 2024-03 (time interval ≈ 4 months); Public opinion outbreak time: 2024-05; Node timestamps: Each event node and its edges have time attributes attached; Output: {"Product": "Baby stroller"; "TGAT_time_factor": 0.67; "Description": "Two consecutive events triggered within 90 days indicate an escalating risk trend"}.

[0060] Causal relationship modeling includes: Input: Variable graph: Independent variables: raw material replacement, quality inspection frequency, price promotion; Dependent variables: non-conformance rate, number of complaints; Data sample: historical data comparison of similar companies and products. Output: {"DoWhy_score": 0.52; "Main causal path": "Raw material change → Decreased finished product qualification rate → Increased public opinion"; "Key factors": ["Welding process change", "New batch not fully tested"]} Risk scoring and rating include: The fusion formula is: S = 0.5 × GAT_score + 0.3 × TGAT_time_factor + 0.2 × DoWhy_score; where S is the risk score; GAT_score is the structural risk score; TGAT_time_factor is the time trend risk score; and DoWhy_score is the causal risk score. Output: {"Entity": "A"; "Product": "Baby stroller"; "Overall Risk Score": 0.685; "Risk Level": "High Risk"; "Recommended Measures": "Focus on spot checks, initiate recall procedures, issue risk warnings"; "Critical Path Description": ["Continuous non-compliance in spot checks → Concentrated outbreak of public opinion → Standard violation → Accelerated spread of public opinion"]} Based on the risk level, an early warning report is automatically generated, which includes a risk score explanation and event path, and coordinated resources are allocated for response.

[0061] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0062] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for automatic early warning of product quality risks based on event reasoning, characterized in that, include: Collect structured data, unstructured data, and real-time streaming data to construct a multi-source regulatory corpus; Based on the event quintuple structure, we model the data in the multi-source regulatory corpus and construct a semantic ontology model that includes entity classification, semantic relationship modeling and standardized representation. Based on the event classes in the semantic ontology model, prompt templates for different event classes are designed to guide the large language model and SpanBERT model to extract event elements from unstructured data and generate the five-tuple structure of events. Entity nodes and semantic relation edges are generated based on the five-tuple structure of structured and unstructured data, and cross-source entity fusion and graph structure consistency verification are performed to output a heterogeneous graph structure. Based on the graph attention network (GAT), the temporal graph neural network (TGAT), and the structural causal modeling (SCM) method, risk assessment is performed on nodes and paths in heterogeneous graph structures to obtain risk scores for events. The risk level is determined based on the risk score of the event, an early warning report is generated, and relevant resources are matched and dispatched for response.

2. The method for automatic early warning of product quality risks based on event reasoning according to claim 1, characterized in that, The collection of structured data, unstructured data, and real-time streaming data includes: Monitor and supervise events on the information platform in real time to obtain structured data; Content is crawled from news websites, social media platforms, and public opinion monitoring sites based on keyword rules to obtain unstructured data. If the crawled content is an image-based announcement or a scanned document, Tesseract OCR is used to perform text recognition and extract the text content as unstructured data.

3. The automatic early warning method for product quality risks based on event reasoning according to claim 1, characterized in that, The method, based on the event quintuple structure, models data from a multi-source regulatory corpus, constructing a semantic ontology model that includes entity classification, semantic relation modeling, and standardized representation, comprising: Based on the five-tuple structure, a four-layer semantic ontology structure of "event class - element - attribute - semantic relationship" is constructed for the data in the multi-source regulatory corpus; Based on the four-layer semantic ontology structure, the event class, entity class and semantic relationship class in product quality supervision events are systematically modeled, and field attributes and constraint logic are defined. Based on the four-layer semantic ontology structure, field attributes, and constraint logic, formal modeling is performed using the OWL language in the Protégé tool to generate a semantic ontology model. The hierarchical relationship between classes and attributes and semantic constraints are defined with the help of RDFS.

4. The automatic early warning method for product quality risks based on event reasoning according to claim 1, characterized in that, Based on the event classes in the semantic ontology model, different event class prompt templates are designed to guide the large language model and SpanBERT model in extracting event elements from unstructured data and generating a five-tuple structure for events, including: Based on the event classes in the semantic ontology model, prompt templates for different event classes are designed, specific elements are determined, and the large language model is guided to extract in an instruction-driven manner. Based on the extracted specific elements, a pre-trained language model based on the Transformer architecture, combined with the SpanBERT model, is used to extract key fields from unstructured data to obtain event elements. The extracted event elements are organized into a five-tuple structure, and attribute fields related to the event are added based on the attribute set in the semantic ontology model.

5. The automatic early warning method for product quality risks based on event reasoning according to claim 1, characterized in that, The process of generating entity nodes and semantic relation edges based on the five-tuple structure of structured and unstructured data, performing cross-source entity fusion and graph structure consistency verification, and outputting a heterogeneous graph structure includes: Based on the event elements in the quintuple structure, nodes and edges are constructed to form an event graph structure with "regulatory agency-product-behavior" triples; Based on the event graph structure, a graph embedding algorithm is used to learn the representation of synonymous entities from different sources, and entity alignment is performed by combining text similarity; for ambiguous entities, a clustering algorithm is used to aggregate and merge nodes to obtain the basic graph. Semantic verification is performed on the basic graph structure to ensure the logical consistency of node types, edge attributes, and multi-hop paths. Nodes with semantic conflicts and non-standard structures are removed to obtain a heterogeneous graph structure.

6. The automatic early warning method for product quality risks based on event reasoning according to claim 1, characterized in that, The method based on Graph Attention Network (GAT), Temporal Graph Neural Network (TGAT), and Structural Causal Modeling (SCM) assesses the risk of nodes and paths in heterogeneous graph structures, obtaining risk scores for events, including: The graph attention network GAT is used to learn the semantic role and propagation ability of nodes in heterogeneous graph structures by dynamically weighting and aggregating the features of neighboring nodes, and to obtain the structural risk score of each node. The Time-Graph Neural Network (TGAT) is used to consider the temporal order, occurrence intervals, and dynamic evolution paths between nodes in a heterogeneous graph structure, and outputs the temporal trend risk score of the nodes. Based on entity attributes, behavior types, and result labels in the heterogeneous graph structure as causal variable nodes, a structural causal model (SCM) is constructed, and causal edges between causal variable nodes are defined based on domain rules or statistical correlation to generate a causal structure. Based on the causal structure, an interventional inference framework is used to make inferences about selected causal variable nodes, simulate the changes in outcomes under different intervention conditions, and generate a causal risk score for the event. The risk score of an event is generated by weighting and integrating the structural risk score, the time trend risk score, and the causal risk score.

7. The automatic early warning method for product quality risks based on event reasoning according to claim 1, characterized in that, The process of determining the risk level based on the event's risk score, automatically generating an early warning report, and matching and coordinating resources for response includes: The risk score is compared with the preset risk threshold, and a segmented mapping strategy is used to divide it into four risk levels, and corresponding labels are assigned. The system calls the preset document generation model based on the risk level and fills in the structured report corresponding to the risk level. The system calls upon the compliance template library, emergency resource library, and geolocation service based on the risk type, and automatically recommends matching law enforcement agencies, testing institutions, and standard documents to achieve a closed-loop early warning and linkage mechanism.