Clinical subject data matching and recommendation method based on database and knowledge graph

By using a database and knowledge graph-based approach, combined with an improved GraphGPS network and GraphRAG algorithm, the problem of insufficient semantic fusion capability in clinical subject screening and matching was solved, achieving highly accurate and interpretable recommendation results, thus meeting the precise matching needs of clinical trials.

CN121506520BActive Publication Date: 2026-05-19BEIJING KANGYAN MEICHEN PHARMACEUTICAL TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING KANGYAN MEICHEN PHARMACEUTICAL TECHNOLOGY CO LTD
Filing Date
2025-10-30
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing technologies lack the ability to semantically fuse structured data, inclusion and exclusion standard texts, and medical ontology knowledge during the screening and matching of clinical subjects. This results in insufficient matching accuracy and compliance, making it difficult to achieve precise matching. Furthermore, the lack of modeling ability for semantic hierarchy and graph structure between medical entities affects the interpretability of recommendation results and the scalability of the model.

Method used

We employ a database and knowledge graph-based approach, utilizing structured clinical data processing, medical knowledge graph modeling, and deep graph neural network inference techniques. By using an improved GraphGPS network and GraphRAG algorithm, we achieve multi-scale graph convolution, cross-relational attention modeling, ontology-constrained attention modeling, and clinical feature gating. This generates feature vectors for subjects and experimental conditions, performs hard constraint screening and semantic matching, and constructs multi-level evidence subgraphs and recommended interpretation paths.

Benefits of technology

It improved the accuracy and coverage of clinical subject matching, made the recommendation results interpretable and efficient in enrollment, enhanced medical staff's trust in the recommendation results and decision-making efficiency, and met the need for accurate matching under complex conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121506520B_ABST
    Figure CN121506520B_ABST
Patent Text Reader

Abstract

The application discloses a clinical subject data matching and recommendation method based on a database and a knowledge graph, which comprises the following steps: step 1, collecting structured clinical data of a clinical subject; step 2, preprocessing to generate a standardized clinical data set; step 3, constructing a medical knowledge graph; step 4, generating a subject feature vector and a test condition feature vector through an improved GraphGPS network; step 5, performing hard constraint screening and similarity matching through an improved GraphRAG algorithm to generate a clinical trial set; step 6, constructing a multi-level evidence subgraph and performing semantic enhancement screening on the clinical trial set to generate a recommended clinical trial set; and step 7, based on the recommended clinical trial set, constructing a recommended explanation path and a recommended explanation tuple, and generating a recommended visual card to be pushed to a clinical terminal. The application improves the accuracy of clinical trial subject matching, the explainability of recommendation results and response efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of medical information processing and artificial intelligence recommendation technology, and in particular to a method for matching and recommending clinical subject data based on databases and knowledge graphs. Background Technology

[0002] With the rapid development of precision medicine and intelligent clinical research, the subject screening and matching process in clinical trials urgently needs to transform from the traditional reliance on manual judgment to a data-driven intelligent recommendation approach. In recent years, clinical enrollment auxiliary decision-making systems based on electronic medical record data have gradually emerged, attempting to perform subject screening through structured information comparison, keyword matching, or rule engines. However, in practical applications, the following problems are commonly encountered:

[0003] Existing methods lack sufficient semantic fusion capabilities between structured data of subjects, inclusion / exclusion criteria text, and medical ontology knowledge, making it difficult to achieve accurate matching when faced with complex experimental conditions. Hard restrictions in inclusion / exclusion criteria, such as age ranges, laboratory test thresholds, and drug contraindications, are usually described in text form, lacking structured parsing and logical reasoning capabilities, which affects the accuracy and compliance of matching. Most existing models are based on shallow rules or general recommendation algorithms, lacking the ability to model differences in semantic hierarchy, ontology paths, and graph structure between medical entities, resulting in a lack of interpretability in recommendation results and difficulty in supporting real clinical decisions. Individual differences, such as patients' past medication history, chronic disease background, and current indicator status, are difficult to represent in a one-to-one correspondence with experimental conditions, affecting semantic matching accuracy and model scalability.

[0004] Therefore, how to provide a method for matching and recommending clinical subject data based on databases and knowledge graphs is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] One objective of this invention is to propose a clinical subject data matching and recommendation method based on databases and knowledge graphs. This invention integrates structured clinical data processing, medical knowledge graph modeling, and deep graph neural network reasoning technology. It describes in detail the graph semantic modeling mechanism of the improved GraphGPS network and the hard constraint screening and semantic recommendation strategy of the improved GraphRAG algorithm, which has the advantages of high matching accuracy, strong recommendation interpretability, and high enrollment efficiency.

[0006] The clinical subject data matching and recommendation method based on databases and knowledge graphs according to embodiments of the present invention includes the following steps:

[0007] Step 1: Collect structured clinical data from clinical subjects;

[0008] Step 2: Preprocess the structured clinical data to generate a standardized clinical dataset;

[0009] Step 3: Construct a medical knowledge graph based on standardized clinical datasets;

[0010] Step 4: Input the medical knowledge graph into the improved GraphGPS network, perform multi-scale graph convolution, cross-relational attention modeling, ontology-constrained attention modeling, and clinical feature gating to generate subject feature vectors and experimental condition feature vectors;

[0011] Step 5: Based on the improved GraphRAG algorithm, perform hard constraint screening and similarity matching on the subject feature vector and the trial condition feature vector of the clinical trial to be matched, respectively, to generate a set of clinical trials;

[0012] Step 6: Construct a multi-level evidence subgraph based on the clinical trial set, and perform semantic enhancement filtering on the clinical trial set to generate a recommended clinical trial set;

[0013] Step 7: Based on the recommended clinical trial set, construct the recommendation interpretation path and recommendation interpretation tuple, and generate recommendation visualization cards to push to the clinical end.

[0014] Optionally, step one specifically includes:

[0015] The structured clinical data includes demographic information fields, diagnostic information fields, laboratory test result fields, vital sign monitoring fields, medication use record fields, surgical and treatment record fields, imaging examination summary fields, and gene testing fields.

[0016] Structured clinical data is stored in a pre-defined database.

[0017] Optionally, step two specifically includes:

[0018] Missing values ​​are filled in the structured clinical data to generate complete clinical data. Numerical fields are filled using the mean method, categorical fields are filled using the mode method, and time series fields are filled using linear interpolation.

[0019] The Z-Score method was used to identify and remove outliers from the numerical fields in the completed clinical data, and the units of numerical fields with unit differences were standardized to generate standardized numerical fields.

[0020] Remove spaces, standardize capitalization, and delete special symbols from the categorical fields in the completed clinical data to generate standardized categorical fields;

[0021] Medical terminology mapping is performed on structured clinical data, specifically: the diagnostic information field is mapped to ICD-10 code; the medication use record field is mapped to ATC code; and the laboratory test item field is mapped to LOINC code.

[0022] The standardized numeric fields are normalized using the min-max normalization method to generate normalized numeric fields;

[0023] The standardized categorical fields are transformed into sparse vectors of a preset dimension through one-hot encoding, generating categorical field vectors;

[0024] The time series fields are converted into standard timestamp format and sorted in ascending order by subject identifier and timestamp to form a subject time series sample set;

[0025] The normalized numerical fields, categorical field vectors, and subject time series sample sets are combined and aligned according to field dimensions to form a standardized clinical dataset.

[0026] Optionally, step three specifically includes:

[0027] Based on standardized clinical datasets, medical entities are extracted, including subject entities, disease entities, symptom entities, examination indicator entities, drug entities, surgical and treatment entities, imaging examination entities, gene mutation entities, medical terminology entities, and test condition entities.

[0028] Based on the international medical terminology system and medical ontology rules, semantic relationships between medical entities are extracted;

[0029] Construct a medical knowledge graph, where the graph nodes are medical entities and the graph edges represent the semantic relationships between medical entities;

[0030] Each graph node is assigned a node identifier, a medical entity type label, and a semantic category label. The node identifier is converted into a node position embedding vector through embedding mapping, the medical entity type label is converted into a node type vector through one-hot encoding, and the semantic category label is generated into a semantic embedding vector through a medical term embedding model.

[0031] The node position embedding vector, node type vector, and semantic embedding vector are concatenated to generate the initial node feature vector, and the initial node feature vectors of each graph node in the medical knowledge graph are combined into the initial node feature matrix.

[0032] Construct an initial adjacency matrix. If there is a semantic relationship between two graph nodes, the corresponding element of the initial adjacency matrix is ​​set to 1; otherwise, the corresponding element of the initial adjacency matrix is ​​set to 0.

[0033] Optionally, step four specifically includes:

[0034] The initial adjacency matrix is ​​denoted as the first-order adjacency matrix, and based on the first-order adjacency matrix, a set of K-order adjacency matrices is recursively constructed using the matrix exponentiation method.

[0035] Based on the set of K-order adjacency matrices, each K-order adjacency matrix and the initial node feature matrix are processed through a graph convolution layer to generate the corresponding order feature matrix;

[0036] All the feature matrices of all orders are concatenated along the feature dimension to generate a multi-scale graph embedding matrix, where each row of the multi-scale graph embedding matrix represents a multi-scale feature vector of a graph node.

[0037] Define a set of relationship types, and for each relationship type, obtain the set of neighboring nodes of the target node under the current relationship type;

[0038] Based on the set of neighboring nodes, calculate the attention weights that relate the multi-scale feature vectors of the target node to the multi-scale feature vectors of its neighboring nodes.

[0039] Based on relational attention weights, the multi-scale feature vectors of neighboring nodes are weighted and summed to generate a single relation-enhanced feature vector.

[0040] Set cross-relation fusion weight coefficients, perform weighted fusion on all single-relation enhancement feature vectors to generate a relation enhancement graph feature vector for each target node; combine the relation enhancement graph feature vectors of all graph nodes in the medical knowledge graph into a relation enhancement graph feature matrix;

[0041] An ontology mask matrix is ​​generated based on the path relationship of the medical ontology. Specifically, if the shortest path length between the corresponding ontology entities of graph node i and graph node j in the medical ontology library does not exceed the preset ontology path depth threshold, then the corresponding element of the ontology mask matrix is ​​set to 1; otherwise, it is set to 0.

[0042] The logarithm of the ontology mask matrix is ​​then incorporated into the global attention calculation to generate the global graph feature matrix, specifically:

[0043] The query matrix, key matrix, and value matrix are constructed from the feature matrix of the relationship enhancement graph through embedding mapping;

[0044] Perform matrix multiplication on the query matrix and key matrix and divide by the scaling factor to obtain the initial attention score matrix. Then, take the logarithm of the ontology mask matrix and add it element-wise to the initial attention score matrix to generate the attention score matrix.

[0045] The attention score is Softmax normalized and multiplied with the value matrix to generate a global graph feature matrix, where each row of the global graph feature matrix represents the global node feature vector of a graph node.

[0046] Obtain clinical characteristic tags of the subjects, including gender, age group, underlying diseases, medication status and previous treatment records;

[0047] Each clinical feature label is mapped to a dense embedding vector through a trainable embedding mapping matrix;

[0048] All densely embedded vectors are average-pooled to generate clinical label vectors;

[0049] The global node feature vector of each graph node is concatenated with the corresponding clinical label vector and input into two fully connected layers. The first fully connected layer is linearly transformed and then activated by GELU, and the second fully connected layer is linearly transformed and then activated by Sigmoid to generate a gated weight vector.

[0050] The gating weight vector is multiplied element-wise with the global node feature vector to generate the gating node feature vector;

[0051] Obtain the feature vectors of all gated nodes that are subject entities in the graph, and perform average pooling to generate subject feature vectors;

[0052] Obtain the feature vectors of all gated nodes that are entities of the test conditions in the graph, and perform average pooling to generate the feature vectors of the test conditions.

[0053] Optionally, step five specifically includes:

[0054] Based on the inclusion and exclusion criteria of clinical trials, hard constraint information in the form of structured fields is parsed and extracted to construct a set of hard constraint conditions. The set of hard constraint conditions includes age range constraints, contraindication disease constraints, laboratory test value threshold constraints, and drug conflict constraints.

[0055] Hard constraint matching is performed on the subject's structured information. If the subject's structured information meets the current hard constraint conditions, the matching indicator variable is set to 1; otherwise, it is set to 0.

[0056] Perform a logical product operation on all matching indicator variables to generate a constraint satisfaction score indicating whether the subject meets the set of hard constraints. If the constraint satisfaction score is equal to 1, it means that the subject meets the set of hard constraints. If the constraint satisfaction score is equal to 0, it means that the subject does not meet the hard constraints.

[0057] Iterate through all clinical trials to be matched in the database, calculate the constraint satisfaction score for each clinical trial, and select clinical trials with a constraint satisfaction score of 1 to form a candidate clinical trial set.

[0058] The semantic similarity between the subject feature vector and the trial condition feature vector of each clinical trial in the candidate clinical trial set is calculated using cosine similarity:

[0059] The candidate clinical trial set is sorted based on semantic similarity, and the top K clinical trials with the highest semantic similarity are selected to generate a clinical trial set.

[0060] Optionally, step six specifically includes:

[0061] Based on a clinical trial set, an evidence subgraph is constructed between subjects and trial conditions;

[0062] The graph nodes in the evidence subgraph include subject entities and test condition entities, the edges in the evidence subgraph are the semantic relationships between graph nodes in the medical knowledge graph, and the feature vectors of the graph nodes in the evidence subgraph are the feature vectors of the corresponding gating nodes.

[0063] The feature vectors of all graph nodes in the evidence subgraph are concatenated to form a subgraph encoding matrix, and the subgraph encoding matrix is ​​then processed by a single graph convolution layer to generate a structure encoding matrix.

[0064] Based on the structural encoding matrix, the structural semantic similarity score between the subject feature vector and the experimental condition feature vector is calculated. Specifically, the subject feature vector and the structural encoding matrix are multiplied by matrix, and then the inner product is performed with the experimental condition feature vector. Finally, the result is divided by the L2 norm product of the subject feature vector and the experimental condition feature vector to generate the structural semantic similarity score.

[0065] The structural semantic similarity score is compared with the set semantic screening threshold. If the structural semantic similarity score is greater than or equal to the semantic screening threshold, the current clinical trial is retained in the recommended clinical trial set; otherwise, the current clinical trial is removed.

[0066] Optionally, step seven specifically includes:

[0067] Based on the recommended clinical trial set, the graph connection paths between the subject entity and the trial condition entity are obtained in the medical knowledge graph, and a set of recommended interpretation paths is constructed.

[0068] For each recommended explanation path, the entity node pairs and semantic relationship edges contained therein are extracted to form a recommended explanation tuple, which includes the subject entity, the test condition entity, and the semantic relationship between the two.

[0069] Calculate the semantic confidence score for each recommended explanation path, which is a weighted average of the length of the recommended explanation path and the number of semantic tags covered by the path;

[0070] Each recommended explanation path is organized into a structured explanation information unit along with the corresponding recommended trial information and semantic confidence score, and a recommendation visualization card is formed. The recommendation visualization card includes trial number, title, trial status, matching score, recommended explanation tuple and semantic confidence score.

[0071] The recommended visualization cards are encoded into a structured data format and pushed to the clinical end for visualization.

[0072] The beneficial effects of this invention are:

[0073] First, this invention establishes a standardized clinical dataset with a unified format by collecting and standardizing demographic information fields, diagnostic information fields, laboratory test result fields, vital sign monitoring fields, medication use record fields, surgical and treatment record fields, imaging examination summary fields, and gene testing fields, thus ensuring the consistency and integrity of subject data across different types and sources.

[0074] Secondly, a medical knowledge graph is constructed based on a standardized clinical dataset, and node type vectors, semantic embedding vectors, and hierarchical position embedding vectors are injected into the medical knowledge graph. By constructing an initial node feature matrix and adjacency matrix, a deep expression of semantic relationships and ontology structure between medical entities is achieved. The improved GraphGPS network introduces a multi-scale graph convolutional structure, a cross-relationship attention mechanism, ontology-constrained attention modeling, and a clinical feature gating structure, comprehensively improving the ability to model heterogeneous structures and understand clinical semantics, generating subject feature vectors and experimental condition feature vectors with global semantic expression capabilities.

[0075] Furthermore, this invention employs an improved GraphRAG algorithm to perform hard-constraint screening and semantic matching of subjects and matching trials, ensuring that the matching results satisfy both the rigid logic of medicine and individual semantic relevance. Moreover, by constructing multi-level evidence subgraphs and recommendation interpretation paths, it achieves interpretable output of the clinical recommendation process, enhancing medical staff's trust in the recommendation results and improving decision-making efficiency.

[0076] In summary, this invention establishes a collaborative optimization mechanism across three levels: medical knowledge graph construction, graph neural network modeling, and semantic constraint matching. This improves the accuracy and coverage of clinical trial subject matching, enables the visual explanation of recommended paths, and has significant potential for widespread application. Attached Figure Description

[0077] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:

[0078] Figure 1 This is a schematic diagram of the clinical subject data matching and recommendation method based on databases and knowledge graphs proposed in this invention;

[0079] Figure 2 This invention presents a flowchart of the medical knowledge graph construction and improved GraphGPS network modeling process in the clinical subject data matching and recommendation method based on databases and knowledge graphs.

[0080] Figure 3 This is a flowchart of the improved GraphRAG matching and recommendation interpretation process in the clinical subject data matching and recommendation method based on databases and knowledge graphs proposed in this invention. Detailed Implementation

[0081] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.

[0082] refer to Figures 1-3 A clinical subject data matching and recommendation method based on databases and knowledge graphs includes the following steps:

[0083] Step 1: Collect structured clinical data from clinical subjects;

[0084] Step 2: Preprocess the structured clinical data to generate a standardized clinical dataset;

[0085] Step 3: Construct a medical knowledge graph based on standardized clinical datasets;

[0086] Step 4: Input the medical knowledge graph into the improved GraphGPS network, perform multi-scale graph convolution, cross-relational attention modeling, ontology-constrained attention modeling, and clinical feature gating to generate subject feature vectors and experimental condition feature vectors;

[0087] Step 5: Based on the improved GraphRAG algorithm, perform hard constraint screening and similarity matching on the subject feature vector and the trial condition feature vector of the clinical trial to be matched, respectively, to generate a set of clinical trials;

[0088] Step 6: Construct a multi-level evidence subgraph based on the clinical trial set, and perform semantic enhancement filtering on the clinical trial set to generate a recommended clinical trial set;

[0089] Step 7: Based on the recommended clinical trial set, construct the recommendation interpretation path and recommendation interpretation tuple, and generate recommendation visualization cards to push to the clinical end.

[0090] In this embodiment, step one specifically includes:

[0091] The structured clinical data includes demographic information fields, diagnostic information fields, laboratory test result fields, vital sign monitoring fields, medication use record fields, surgical and treatment record fields, imaging examination summary fields, and gene testing fields. Among these, the dosage in the laboratory test result fields, vital sign monitoring fields, and medication use record fields is a numerical field; the route of administration in the demographic information fields, diagnostic information fields, and medication use record fields is a categorical field; and the vital sign monitoring fields, laboratory test result fields, and medication use record fields are time series fields.

[0092] Structured clinical data is stored in a pre-defined database.

[0093] In this embodiment, step two specifically includes:

[0094] Missing values ​​are filled in the structured clinical data to generate complete clinical data. Numerical fields are filled using the mean method, categorical fields are filled using the mode method, and time series fields are filled using linear interpolation.

[0095] The Z-Score method was used to identify and remove outliers from the numerical fields in the completed clinical data, and the units of numerical fields with unit differences were standardized to generate standardized numerical fields.

[0096] Remove spaces, standardize capitalization, and delete special symbols from the categorical fields in the completed clinical data to generate standardized categorical fields;

[0097] Medical terminology mapping is performed on structured clinical data, specifically: the diagnostic information field is mapped to ICD-10 code; the medication use record field is mapped to ATC code; and the laboratory test item field is mapped to LOINC code.

[0098] The standardized numeric fields are normalized using the min-max normalization method to generate normalized numeric fields;

[0099] The standardized categorical fields are transformed into sparse vectors of a preset dimension through one-hot encoding, generating categorical field vectors;

[0100] The time series fields are converted into standard timestamp format and sorted in ascending order by subject identifier and timestamp to form a subject time series sample set;

[0101] The normalized numerical fields, categorical field vectors, and subject time series sample sets are combined and aligned according to field dimensions to form a standardized clinical dataset.

[0102] In this embodiment, step three specifically includes:

[0103] Based on standardized clinical datasets, medical entities are extracted, including subject entities, disease entities, symptom entities, examination indicator entities, drug entities, surgical and treatment entities, imaging examination entities, gene mutation entities, medical terminology entities, and test condition entities.

[0104] Based on the international medical terminology system and medical ontology rules, semantic relationships between medical entities are extracted;

[0105] Construct a medical knowledge graph, where the graph nodes are medical entities and the graph edges represent the semantic relationships between medical entities;

[0106] Each graph node is assigned a node identifier, a medical entity type label, and a semantic category label. The node identifier is converted into a node position embedding vector through embedding mapping, the medical entity type label is converted into a node type vector through one-hot encoding, and the semantic category label is generated into a semantic embedding vector through a medical term embedding model.

[0107] The node position embedding vector, node type vector, and semantic embedding vector are concatenated to generate the initial node feature vector, and the initial node feature vectors of each graph node in the medical knowledge graph are combined into the initial node feature matrix.

[0108] Construct an initial adjacency matrix. If there is a semantic relationship between two graph nodes, the corresponding element of the initial adjacency matrix is ​​set to 1; otherwise, the corresponding element of the initial adjacency matrix is ​​set to 0.

[0109] In this embodiment, step four specifically includes:

[0110] The initial adjacency matrix is ​​denoted as the first-order adjacency matrix, and based on the first-order adjacency matrix, a set of K-order adjacency matrices is recursively constructed using the matrix exponentiation method.

[0111] Based on the set of K-order adjacency matrices, each K-order adjacency matrix and the initial node feature matrix are processed through a graph convolution layer to generate the corresponding order feature matrix;

[0112] All the feature matrices of all orders are concatenated along the feature dimension to generate a multi-scale graph embedding matrix, where each row of the multi-scale graph embedding matrix represents a multi-scale feature vector of a graph node.

[0113] Define a set of relationship types, and for each relationship type, obtain the set of neighboring nodes of the target node under the current relationship type;

[0114] Based on the set of neighboring nodes, calculate the attention weights that relate the multi-scale feature vectors of the target node to the multi-scale feature vectors of its neighboring nodes.

[0115] In the relationship attention weight calculation, the multi-scale feature vector of the target node is concatenated with the multi-scale feature vector of the current neighbor node, and linear transformation and non-linear mapping operations are performed on the concatenated vector to output the attention relevance score between the target node and the neighbor node under the current relationship type. All attention relevance scores are normalized using the Softmax function to generate the relationship attention weight value between the target node and each neighbor node.

[0116] Based on relational attention weights, the multi-scale feature vectors of neighboring nodes are weighted and summed to generate a single relation-enhanced feature vector.

[0117] Set cross-relation fusion weight coefficients, perform weighted fusion on all single-relation enhancement feature vectors to generate a relation enhancement graph feature vector for each target node; combine the relation enhancement graph feature vectors of all graph nodes in the medical knowledge graph into a relation enhancement graph feature matrix;

[0118] An ontology mask matrix is ​​generated based on the path relationship of the medical ontology. Specifically, if the shortest path length between the corresponding ontology entities of graph node i and graph node j in the medical ontology library does not exceed the preset ontology path depth threshold, then the corresponding element of the ontology mask matrix is ​​set to 1; otherwise, it is set to 0.

[0119] The logarithm of the ontology mask matrix is ​​then incorporated into the global attention calculation to generate the global graph feature matrix, specifically:

[0120] The query matrix, key matrix, and value matrix are constructed from the feature matrix of the relationship enhancement graph through embedding mapping;

[0121] Perform matrix multiplication on the query matrix and key matrix and divide by the scaling factor to obtain the initial attention score matrix. Then, take the logarithm of the ontology mask matrix and add it element-wise to the initial attention score matrix to generate the attention score matrix.

[0122] In this invention, the elements in the ontology mask matrix are only 0 or 1, which cannot fully express the degree of difference between graph nodes on the ontology path. Taking the logarithm of the ontology mask matrix can keep the positions with a value of 1 as 0, that is, without bias effect, while the positions with a value of 0 are transformed into negative infinity. This effectively suppresses node pairs that do not conform to the ontology path constraints in the global attention calculation, thereby enhancing the attention mechanism's ability to model global semantic consistency.

[0123] The attention score is Softmax normalized and multiplied with the value matrix to generate a global graph feature matrix, where each row of the global graph feature matrix represents the global node feature vector of a graph node.

[0124] Obtain clinical characteristic tags of the subjects, including gender, age group, underlying diseases, medication status and previous treatment records;

[0125] Each clinical feature label is mapped to a dense embedding vector through a trainable embedding mapping matrix;

[0126] All densely embedded vectors are average-pooled to generate clinical label vectors;

[0127] The global node feature vector of each graph node is concatenated with the corresponding clinical label vector and input into two fully connected layers. The first fully connected layer is linearly transformed and then activated by GELU, and the second fully connected layer is linearly transformed and then activated by Sigmoid to generate a gated weight vector.

[0128] The gating weight vector is multiplied element-wise with the global node feature vector to generate the gating node feature vector;

[0129] Obtain the feature vectors of all gated nodes that are subject entities in the graph, and perform average pooling to generate subject feature vectors;

[0130] Obtain the feature vectors of all gated nodes that are entities of the test conditions in the graph and perform average pooling to generate the feature vectors of the test conditions.

[0131] In this embodiment, step five specifically includes:

[0132] Based on the inclusion and exclusion criteria of clinical trials, hard constraint information in the form of structured fields is parsed and extracted to construct a set of hard constraint conditions. The set of hard constraint conditions includes age range constraints, contraindication disease constraints, laboratory test value threshold constraints, and drug conflict constraints.

[0133] Hard constraint matching is performed on the subject's structured information. If the subject's structured information meets the current hard constraint conditions, the matching indicator variable is set to 1; otherwise, it is set to 0.

[0134] Perform a logical product operation on all matching indicator variables to generate a constraint satisfaction score indicating whether the subject meets the set of hard constraints. If the constraint satisfaction score is equal to 1, it means that the subject meets the set of hard constraints. If the constraint satisfaction score is equal to 0, it means that the subject does not meet the hard constraints.

[0135] Iterate through all clinical trials to be matched in the database, calculate the constraint satisfaction score for each clinical trial, and select clinical trials with a constraint satisfaction score of 1 to form a candidate clinical trial set.

[0136] The semantic similarity between the subject feature vector and the trial condition feature vector of each clinical trial in the candidate clinical trial set is calculated using cosine similarity:

[0137] The candidate clinical trial set is sorted based on semantic similarity, and the top K clinical trials with the highest semantic similarity are selected to generate a clinical trial set.

[0138] For example, the database contains clinical trials A, B, and C, with the following inclusion and exclusion criteria: Clinical trial A: age 18–65 years, no hypertension, ALT < 50 U / L, and not taking aspirin; Clinical trial B: age 40–75 years, no diabetes, ALT < 60 U / L, and not taking warfarin; Clinical trial C: age 30–70 years, no hypertension, ALT < 45 U / L, and having taken ibuprofen in the past two weeks.

[0139] A subject's structured information is as follows: age 52, no hypertension, no diabetes, ALT = 42 U / L, and no medication taken in the past two weeks. First, hard constraint sets are constructed for clinical trials A, B, and C respectively, and the subject's structured information is compared sequentially with the constraints of each clinical trial. The matching results are: the subject meets all constraints of clinical trials A and B, with matching indicator variables of 1, and constraint satisfaction of 1; the subject does not meet the drug restrictions of trial C, with matching indicator variables of 0, and constraint satisfaction of 0. Therefore, clinical trials A and B are included in the candidate clinical trial set. The subject's feature vector is used, and cosine similarity is calculated with the corresponding trial condition feature vectors of clinical trials A and B. Assuming the semantic similarity with clinical trial A is 0.91 and with clinical trial B is 0.78, clinical trials A and B are ranked according to semantic similarity, and clinical trial A, with the highest similarity, is included in the clinical trial set.

[0140] In this embodiment, step six specifically includes:

[0141] Based on a clinical trial set, an evidence subgraph is constructed between subjects and trial conditions;

[0142] The graph nodes in the evidence subgraph include subject entities and test condition entities, the edges in the evidence subgraph are the semantic relationships between graph nodes in the medical knowledge graph, and the feature vectors of the graph nodes in the evidence subgraph are the feature vectors of the corresponding gating nodes.

[0143] The feature vectors of all graph nodes in the evidence subgraph are concatenated to form a subgraph encoding matrix, and the subgraph encoding matrix is ​​then processed by a single graph convolution layer to generate a structure encoding matrix.

[0144] Based on the structural encoding matrix, the structural semantic similarity score between the subject feature vector and the experimental condition feature vector is calculated. Specifically, the subject feature vector and the structural encoding matrix are multiplied by matrix, and then the inner product is performed with the experimental condition feature vector. Finally, the result is divided by the L2 norm product of the subject feature vector and the experimental condition feature vector to generate the structural semantic similarity score.

[0145] The structural semantic similarity score is compared with the set semantic screening threshold. If the structural semantic similarity score is greater than or equal to the semantic screening threshold, the current clinical trial is retained in the recommended clinical trial set; otherwise, the current clinical trial is removed.

[0146] In this embodiment, step seven specifically includes:

[0147] Based on the recommended clinical trial set, the graph connection paths between the subject entity and the trial condition entity are obtained in the medical knowledge graph, and a set of recommended interpretation paths is constructed.

[0148] For each recommended explanation path, the entity node pairs and semantic relationship edges contained therein are extracted to form a recommended explanation tuple, which includes the subject entity, the test condition entity, and the semantic relationship between the two.

[0149] Calculate the semantic confidence score for each recommended explanation path, which is a weighted average of the length of the recommended explanation path and the number of semantic tags covered by the path;

[0150] Each recommended explanation path is organized into a structured explanation information unit along with the corresponding recommended trial information and semantic confidence score, and a recommendation visualization card is formed. The recommendation visualization card includes trial number, title, trial status, matching score, recommended explanation tuple and semantic confidence score.

[0151] The recommended visualization cards are encoded into a structured data format and pushed to the clinical end for visualization.

[0152] Example 1

[0153] To verify the feasibility of this invention in practice, it was applied to the recruitment phase of a clinical trial on drug intervention for patients with hypertension and renal dysfunction, led by a tertiary hospital. This clinical trial faced several challenges in the subject selection process: firstly, the inclusion and exclusion criteria were complex, involving both rigid medical constraints such as age, gender, systolic blood pressure, diastolic blood pressure, and creatinine levels, and comprehensive consideration of patients' past medication records, underlying disease status, and diagnostic history; secondly, the subject data in the hospital database had diverse structures and heterogeneous formats, with some fields missing or inconsistent units, resulting in low efficiency for manual screening. Furthermore, semantic understanding and logical matching of experimental conditions were prone to errors, leading to low screening accuracy and a heavy workload.

[0154] In this scenario, structured clinical data of the target patients is first collected from the hospital information system, including demographic information, diagnostic records, laboratory test results, medication prescription information, vital sign monitoring records, and image summary reports, and stored uniformly in a pre-defined database. To address missing values ​​in the collected data, methods such as mean, mode, and linear interpolation are used for imputation, and outlier values ​​are identified and removed using the Z-Score method. Subsequently, fields with inconsistent units are standardized, such as unifying creatinine to μmol / L and blood pressure to mmHg. Using international standard terminology systems such as ICD-10, ATC, and LOINC, diagnostic, medication, and examination fields are mapped to unified semantic expressions, ultimately constructing a standardized clinical dataset.

[0155] A multi-level medical knowledge graph is constructed based on a standardized dataset. The graph entities include ten categories of nodes, such as diseases, symptoms, examination indicators, drugs, surgical procedures, and experimental conditions. Entities are connected through semantic relationships such as "diagnosed as," "existing indicator," "drug effect," and "inclusion criteria." In the graph neural network modeling stage, an improved GraphGPS network is used to model the medical knowledge graph, achieving a deep fusion expression of individual subject characteristics and semantic graph structure, generating subject feature vectors and experimental condition feature vectors.

[0156] In the matching phase, a modified GraphRAG algorithm is used to perform two-stage filtering: First, hard constraints in the trial conditions are extracted, including age between 45 and 70 years, systolic blood pressure ≥140 mmHg, eGFR ≥60 ml / min, no history of diabetes, and no use of ACE inhibitors, forming a set of hard conditions. The structured information of the subjects is logically compared with these conditions to filter out all candidate patients who meet the criteria. Then, cosine matching is performed based on the semantic similarity between the subject's semantic feature vector and the trial condition feature vector of each trial to rank the candidate set and select the Top-K clinical trials with high matching scores. Finally, a recommended set of clinical trials, along with their corresponding evidence subgraph and recommended interpretation paths, are output.

[0157] To evaluate the effectiveness of this invention, a comparative experiment was conducted with traditional rule engine matching methods and general GNN matching methods. A total of 1024 historical subjects from the hypertension and nephrology departments of the hospital were selected. Trial matching was performed on the same subject dataset using the three methods, and six indicators were evaluated: matching accuracy, recall, matching time, recommendation interpretability, satisfaction of hard constraints, and physician acceptance. The experimental results are shown in Table 1.

[0158] Table 1. Performance Comparison of the Invention Method and Comparative Methods

[0159] Matching scheme Matching accuracy Matching recall Average matching time (seconds) Recommended explainability score (out of 5) Hard constraint satisfaction rate Doctor acceptance rate Method of the present invention 93.4% 89.2% 1.34 4.72 100% 91.6% Traditional rule engine matching methods 78.5% 62.3% 2.89 2.18 100% 68.9% General GNN matching method 86.1% 73.4% 3.56 3.12 72.7% 75.2%

[0160] As shown in Table 1, the method of this invention outperforms both traditional rule engine matching methods and general GNN matching methods in all core indicators. Regarding matching accuracy, the method of this invention achieves 93.4%, an improvement of 14.9 percentage points compared to traditional rule engine matching methods and 7.3 percentage points compared to general GNN methods. This indicates that the method of this invention has stronger semantic matching capabilities between clinical subjects and experimental conditions under complex conditions, and the results are closer to real clinical judgments. In terms of matching recall, the method of this invention achieves 89.2%, significantly higher than the 62.3% of traditional rule engine matching methods and the 73.4% of general GNN methods. This demonstrates that the method of this invention can identify more potentially eligible subjects while ensuring matching quality, significantly improving enrollment coverage. Regarding efficiency, the average matching time of the method of this invention is 1.34 seconds, significantly lower than the comparative methods, indicating that the method of this invention can achieve rapid response and large-scale matching, meeting the requirements of high-concurrency screening in clinical scenarios. Regarding the interpretability of recommendations, the method of this invention relies on a multi-level evidence subgraph and semantic path construction mechanism, achieving an interpretability score of 4.72, which far exceeds that of general models and rule engines, fully meeting doctors' requirements for transparency and trust in the recommendation process.

[0161] Furthermore, the method of this invention maintains a 100% satisfaction rate for hard constraints, consistent with traditional rule engine matching methods, and superior to the 72.7% of the general GNN method. This indicates that the present invention can strictly enforce the medical logic constraints of inclusion and exclusion conditions, ensuring screening compliance. Regarding physician acceptance rate, the method of this invention reaches 91.6%, an improvement of 22.7 percentage points compared to traditional rule engine matching methods, and also significantly superior to the general GNN method, indicating that the method of this invention is more likely to gain recognition and adoption by clinical experts in practical applications.

[0162] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A clinical subject data matching and recommendation method based on databases and knowledge graphs, characterized in that, Includes the following steps: Step 1: Collect structured clinical data from clinical subjects; Step 2: Preprocess the structured clinical data to generate a standardized clinical dataset; Step 3: Construct a medical knowledge graph based on standardized clinical datasets; Step 4: Input the medical knowledge graph into the improved GraphGPS network, perform multi-scale graph convolution, cross-relational attention modeling, ontology-constrained attention modeling, and clinical feature gating to generate subject feature vectors and experimental condition feature vectors, specifically including: The initial adjacency matrix is ​​denoted as the first-order adjacency matrix, and based on the first-order adjacency matrix, a set of K-order adjacency matrices is recursively constructed using the matrix exponentiation method. Based on the set of K-order adjacency matrices, each K-order adjacency matrix and the initial node feature matrix are processed through a graph convolution layer to generate the corresponding order feature matrix; All the feature matrices of all orders are concatenated along the feature dimension to generate a multi-scale graph embedding matrix, where each row of the multi-scale graph embedding matrix represents a multi-scale feature vector of a graph node. Define a set of relationship types, and for each relationship type, obtain the set of neighboring nodes of the target node under the current relationship type; Based on the set of neighboring nodes, calculate the attention weights that relate the multi-scale feature vectors of the target node to the multi-scale feature vectors of its neighboring nodes. Based on relational attention weights, the multi-scale feature vectors of neighboring nodes are weighted and summed to generate a single relation-enhanced feature vector. Set cross-relation fusion weight coefficients, perform weighted fusion on all single-relation enhancement feature vectors to generate a relation enhancement graph feature vector for each target node; combine the relation enhancement graph feature vectors of all graph nodes in the medical knowledge graph into a relation enhancement graph feature matrix; An ontology mask matrix is ​​generated based on the path relationship of the medical ontology. Specifically, if the shortest path length between the corresponding ontology entities of graph node i and graph node j in the medical ontology library does not exceed the preset ontology path depth threshold, then the corresponding element of the ontology mask matrix is ​​set to 1; otherwise, it is set to 0. The logarithm of the ontology mask matrix is ​​then incorporated into the global attention calculation to generate the global graph feature matrix, specifically: The query matrix, key matrix, and value matrix are constructed from the feature matrix of the relationship enhancement graph through embedding mapping; Perform matrix multiplication on the query matrix and key matrix and divide by the scaling factor to obtain the initial attention score matrix. Then, take the logarithm of the ontology mask matrix and add it element-wise to the initial attention score matrix to generate the attention score matrix. The attention score is Softmax normalized and multiplied with the value matrix to generate a global graph feature matrix, where each row of the global graph feature matrix represents the global node feature vector of a graph node. Obtain clinical characteristic tags of the subjects, including gender, age group, underlying diseases, medication status and previous treatment records; Each clinical feature label is mapped to a dense embedding vector through a trainable embedding mapping matrix; All densely embedded vectors are average-pooled to generate clinical label vectors; The global node feature vector of each graph node is concatenated with the corresponding clinical label vector and input into two fully connected layers. The first fully connected layer is linearly transformed and then activated by GELU, and the second fully connected layer is linearly transformed and then activated by Sigmoid to generate a gated weight vector. The gating weight vector is multiplied element-wise with the global node feature vector to generate the gating node feature vector; Obtain the feature vectors of all gated nodes that are subject entities in the graph, and perform average pooling to generate subject feature vectors; Obtain the feature vectors of all gated nodes that are experimental condition entities in the graph, and perform average pooling to generate experimental condition feature vectors; Step 5: Based on the improved GraphRAG algorithm, perform hard constraint screening and similarity matching on the subject feature vector and the trial condition feature vector of the clinical trial to be matched, respectively, to generate a set of clinical trials, specifically including: Based on the inclusion and exclusion criteria of clinical trials, hard constraint information in the form of structured fields is parsed and extracted to construct a set of hard constraint conditions. The set of hard constraint conditions includes age range constraints, contraindication disease constraints, laboratory test value threshold constraints, and drug conflict constraints. Hard constraint matching is performed on the subject's structured information. If the subject's structured information meets the current hard constraint conditions, the matching indicator variable is set to 1; otherwise, it is set to 0. Perform a logical product operation on all matching indicator variables to generate a constraint satisfaction score indicating whether the subject meets the set of hard constraints. If the constraint satisfaction score is equal to 1, it means that the subject meets the set of hard constraints. If the constraint satisfaction score is equal to 0, it means that the subject does not meet the hard constraints. Iterate through all clinical trials to be matched in the database, calculate the constraint satisfaction score for each clinical trial, and select clinical trials with a constraint satisfaction score of 1 to form a candidate clinical trial set. Cosine similarity was used to calculate the semantic similarity between the subject feature vector and the trial condition feature vector of each clinical trial in the candidate clinical trial set; The candidate clinical trial set is sorted based on semantic similarity, and the top K clinical trials with the highest semantic similarity are selected to generate a clinical trial set. Step 6: Construct a multi-level evidence subgraph based on the clinical trial set, and perform semantic enhancement filtering on the clinical trial set to generate a recommended clinical trial set; Step 7: Based on the recommended clinical trial set, construct the recommendation interpretation path and recommendation interpretation tuple, and generate recommendation visualization cards to push to the clinical end.

2. The clinical subject data matching and recommendation method based on database and knowledge graph according to claim 1, characterized in that, Step one specifically includes: The structured clinical data includes demographic information fields, diagnostic information fields, laboratory test result fields, vital sign monitoring fields, medication use record fields, surgical and treatment record fields, imaging examination summary fields, and gene testing fields. Structured clinical data is stored in a pre-defined database.

3. The clinical subject data matching and recommendation method based on database and knowledge graph according to claim 1, characterized in that, Step two specifically includes: Missing values ​​are filled in the structured clinical data to generate complete clinical data. Numerical fields are filled using the mean method, categorical fields are filled using the mode method, and time series fields are filled using linear interpolation. The Z-Score method was used to identify and remove outliers from the numerical fields in the completed clinical data, and the units of numerical fields with unit differences were standardized to generate standardized numerical fields. Remove spaces, standardize capitalization, and delete special symbols from the categorical fields in the completed clinical data to generate standardized categorical fields; Medical terminology mapping is performed on structured clinical data, specifically: the diagnostic information field is mapped to ICD-10 code; the medication use record field is mapped to ATC code; and the laboratory test item field is mapped to LOINC code. The standardized numeric fields are normalized using the min-max normalization method to generate normalized numeric fields; The standardized categorical fields are transformed into sparse vectors of a preset dimension through one-hot encoding, generating categorical field vectors; The time series fields are converted into standard timestamp format and sorted in ascending order by subject identifier and timestamp to form a subject time series sample set; The normalized numerical fields, categorical field vectors, and subject time series sample sets are combined and aligned according to field dimensions to form a standardized clinical dataset.

4. The clinical subject data matching and recommendation method based on database and knowledge graph according to claim 1, characterized in that, Step three specifically includes: Based on standardized clinical datasets, medical entities are extracted, including subject entities, disease entities, symptom entities, examination indicator entities, drug entities, surgical and treatment entities, imaging examination entities, gene mutation entities, medical terminology entities, and test condition entities. Based on the international medical terminology system and medical ontology rules, semantic relationships between medical entities are extracted; Construct a medical knowledge graph, where the graph nodes are medical entities and the graph edges represent the semantic relationships between medical entities; Each graph node is assigned a node identifier, a medical entity type label, and a semantic category label. The node identifier is converted into a node position embedding vector through embedding mapping, the medical entity type label is converted into a node type vector through one-hot encoding, and the semantic category label is generated into a semantic embedding vector through a medical term embedding model. The node position embedding vector, node type vector, and semantic embedding vector are concatenated to generate the initial node feature vector, and the initial node feature vectors of each graph node in the medical knowledge graph are combined into the initial node feature matrix. Construct an initial adjacency matrix. If there is a semantic relationship between two graph nodes, the corresponding element of the initial adjacency matrix is ​​set to 1; otherwise, the corresponding element of the initial adjacency matrix is ​​set to 0.

5. The clinical subject data matching and recommendation method based on database and knowledge graph according to claim 1, characterized in that, Step six specifically includes: Based on a clinical trial set, an evidence subgraph is constructed between subjects and trial conditions; The graph nodes in the evidence subgraph include subject entities and test condition entities, the edges in the evidence subgraph are the semantic relationships between graph nodes in the medical knowledge graph, and the feature vectors of the graph nodes in the evidence subgraph are the feature vectors of the corresponding gating nodes. The feature vectors of all graph nodes in the evidence subgraph are concatenated to form a subgraph encoding matrix, and the subgraph encoding matrix is ​​then processed by a single graph convolution layer to generate a structure encoding matrix. Based on the structural encoding matrix, the structural semantic similarity score between the subject feature vector and the experimental condition feature vector is calculated. Specifically, the subject feature vector and the structural encoding matrix are multiplied by matrix, and then the inner product is performed with the experimental condition feature vector. Finally, the result is divided by the L2 norm product of the subject feature vector and the experimental condition feature vector to generate the structural semantic similarity score. The structural semantic similarity score is compared with the set semantic screening threshold. If the structural semantic similarity score is greater than or equal to the semantic screening threshold, the current clinical trial is retained in the recommended clinical trial set; otherwise, the current clinical trial is removed.

6. The clinical subject data matching and recommendation method based on database and knowledge graph according to claim 1, characterized in that, Step seven specifically includes: Based on the recommended clinical trial set, the graph connection paths between the subject entity and the trial condition entity are obtained in the medical knowledge graph, and a set of recommended interpretation paths is constructed. For each recommended explanation path, the entity node pairs and semantic relationship edges contained therein are extracted to form a recommended explanation tuple, which includes the subject entity, the test condition entity, and the semantic relationship between the two. Calculate the semantic confidence score for each recommended explanation path, which is a weighted average of the length of the recommended explanation path and the number of semantic tags covered by the path; Each recommended explanation path is organized into a structured explanation information unit along with the corresponding recommended trial information and semantic confidence score, and a recommendation visualization card is formed. The recommendation visualization card includes trial number, title, trial status, matching score, recommended explanation tuple and semantic confidence score. The recommended visualization cards are encoded into a structured data format and pushed to the clinical end for visualization.