Medical scheme recommendation method, system and equipment based on knowledge base and storage medium

By dynamically generating drug attribute weight values ​​in the medical knowledge graph and using random forest models to generate drug recommendation solutions, the problem of lack of multi-dimensional evaluation and individualized recommendation of diagnosis and treatment solutions in the prior art is solved, and the safety of accurate recommendation of high-value solutions and combination of drugs is improved.

CN119864121AActive Publication Date: 2025-04-22NORTH CHINA DIGITAL HEALTH TECHNOLOGY CO LTD

Patent Information

Application Number
CN202510336672.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-21
Publication Date
2025-04-22
Estimated Expiration
2045-03-21

AI Technical Summary

Technical Problem

The existing medical knowledge graph has not established a multi-dimensional evaluation system in the recommendation of diagnosis and treatment plans, resulting in a mixed presentation of high-value plans and conventional plans, and the individualized data of patients is not integrated, so differentiated recommendations cannot be achieved.

Method used

By obtaining user attention, weight values ​​are generated for drug attributes in the drug knowledge graph, based on these weight values, the corresponding drug group is queried from the knowledge graph, and a recommended scheme is generated based on the drug properties characteristics of the drug entity using a pre-trained random forest model.

Benefits of technology

A multi-dimensional evaluation system was established, and the dynamically generated weight values ​​were adapted to individualized patients' data, differentiated recommendations were achieved, and the safety of drug combination was improved through the number of citations in the drug combination relationship.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119864121A_ABST
    Figure CN119864121A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of large models, and particularly provides a knowledge base-based medical scheme recommendation method, system and device and a storage medium, and the method comprises the steps: obtaining a first disease and a second disease, the priority of the first disease being higher than that of the second disease; generating weight values for drug attributes in a pre-constructed drug knowledge graph according to the user attention input by the front end; based on the weight values, a first medicine group corresponding to the first disease and a second medicine group corresponding to the second disease are inquired from the knowledge graph; and generating a recommendation scheme based on the drug property characteristics of the drug entities in the first drug group and the second drug group by using a pre-trained random forest model. According to the method, a multi-dimensional evaluation system is established through the drug attributes and the weight values, and the dynamic weight values adapt to individualized data of patients, so that differentiated recommendation is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of large models, and specifically relates to a medical plan recommendation method, system, device and storage medium based on a knowledge base. Background Art

[0002] The current mainstream medical knowledge graph uses symptoms as entry nodes and treatment plans as associated nodes, and builds a recommendation system through simple edge connections. When the disease is diagnosed, the system will mechanically return all associated plans based on historical data (for example, a cancer treatment plan includes 10+ options such as surgery, chemotherapy, and targeted drugs). As the average annual case volume of hospitals exceeds one million, the recommendation results often show exponential growth, and doctors need to spend a lot of time on preliminary screening of plans.

[0003] This recommended treatment approach has the following shortcomings: The recommendation of diagnosis and treatment plans has not established a multi-dimensional evaluation system (such as efficacy, cost, and incidence of adverse reactions), resulting in the mixing of high-value plans and conventional plans.

[0004] Without integrating individualized patient data, differentiated recommendations cannot be achieved. Summary of the invention

[0005] In view of the above-mentioned deficiencies in the prior art, the present invention provides a medical plan recommendation method, system, device and storage medium based on a knowledge base to solve the above-mentioned technical problems.

[0006] In a first aspect, the present invention provides a method for recommending a medical plan based on a knowledge base, comprising: Acquire a first symptom and a second symptom, wherein the first symptom has a higher priority than the second symptom; Generate weight values ​​for drug attributes in the pre-built drug knowledge graph based on user attention input from the front-end; Based on the weight values, query the knowledge graph for a first drug group corresponding to the first disease and a second drug group corresponding to the second disease respectively; A pre-trained random forest model is used to generate recommended regimens based on the medicinal properties of drug entities in the first drug group and the second drug group.

[0007] In an optional embodiment, the method for constructing the drug knowledge graph includes: Obtain case data, and extract cure time and cure duration from the case data; Perform cluster analysis on the cure time of case data, and generate a time identifier for the case data based on the clusters; Extract drug entities and disease entities from case data, construct treatment triples of drug entities and disease entities, and construct joint triples for drug entities in the same case data; Constructing a knowledge graph based on the treatment triples and the combination triples, using the number of repetitions of the triples as the number of references of the corresponding edge in the knowledge graph, and setting the duration identifier of the case data as the duration attribute of the corresponding drug entity; Extracting drug attributes and drug property characteristics from a pre-built drug dictionary, wherein the drug attributes include price, severity of adverse reactions, and indications; and the drug property characteristics include drug contraindication information, chemical structure, and metabolic enzyme targets; The drug attributes and medicinal properties characteristics are set as node attribute values ​​of the corresponding drug entities in the knowledge graph.

[0008] In an optional embodiment, the method for constructing the drug dictionary includes: Obtaining the identity information of the drug, including name, manufacturer, and batch; Calculate a hash value of the identity information and use the hash value as the identity code of the drug; Use natural language processing technology to extract indications, adverse reaction information, drug contraindications, chemical structure, and metabolic enzyme targets from drug instructions; Generate the severity level of adverse reactions of drugs according to the preset correspondence between the severity level of adverse reactions and the adverse reaction information and the adverse reactions of drugs; The drug's identity code, indication, adverse reaction level, drug contraindication information, chemical structure and metabolic enzyme target are stored in the drug dictionary.

[0009] In an optional implementation, generating weight values ​​for drug attributes in a pre-constructed drug knowledge graph according to user attention input by the front end includes: Generate quantitative values ​​for drug attributes, and normalize the quantitative values ​​to obtain attribute quantitative values; Obtaining the user's attention to the attribute, and setting a weight factor of the corresponding attribute quantization value according to the attention; Calculate the weighted sum of the attribute quantization values ​​to obtain the weight value of the drug entity.

[0010] In an optional embodiment, querying the first drug group corresponding to the first disease and the second drug group corresponding to the second disease from the knowledge graph based on the weight value respectively includes: Querying the knowledge graph for a plurality of main drug entities whose weight values ​​are the highest and whose indications match the target disease, wherein the target disease is the first disease or the second disease; Querying a drug entity set corresponding to a target disease from the knowledge graph, wherein the drug entity set includes all drug entities connected to the first disease; Acquire a secondary drug entity having an associated edge with the primary drug entity, wherein the number of citations of the associated edge reaches a set citation number threshold; Eliminate drug entities whose duration attributes do not match those of the primary drug entity from the secondary drug entity; The updated drug entity is stored with the main drug entity as a drug group corresponding to the target condition.

[0011] In an optional embodiment, removing drug entities whose duration attributes do not match the primary drug entity from the secondary drug entities includes: Get the duration attribute of the main drug entity; The secondary drug entities whose duration attribute is greater than the duration attribute of the primary drug entity are eliminated.

[0012] In an optional embodiment, a pre-trained random forest model is used to generate a recommendation based on the medicinal properties of the drug entities in the first drug group and the second drug group, including: Obtain the number of references of the associated edge between the drug entity in the first drug group and the drug entity in the second drug group; Confirming that there is no association edge between the first drug entity and the second drug entity or the number of citations of the association edge does not reach a set citation number threshold, obtaining the drug property characteristics of the first drug entity and the drug property characteristics of the second drug entity; the first drug entity belongs to the first drug group, and the second drug entity belongs to the second drug group; Inputting the medicinal property characteristics of the first drug entity and the medicinal property characteristics of the second drug entity into a pre-trained random forest model to determine whether the first drug entity and the second drug entity can be used in combination; If the first drug entity and the second drug entity cannot be used in combination, the second drug entity is eliminated; The first drug group and the second drug group after eliminating the drug entities that cannot be used in combination are output as recommended solutions.

[0013] In a second aspect, the present invention provides a medical plan recommendation system based on a knowledge base, comprising: An acquisition module, configured to acquire a first symptom and a second symptom, wherein the priority of the first symptom is higher than that of the second symptom; The first processing module is used to generate weight values ​​for drug attributes in the pre-built drug knowledge graph according to the user attention input by the front end; A query module, configured to query a first drug group corresponding to a first symptom and a second drug group corresponding to a second symptom from the knowledge graph based on the weight values; The second processing module is used to generate a recommendation scheme based on the medicinal properties characteristics of the drug entities in the first drug group and the second drug group by using a pre-trained random forest model.

[0014] In a third aspect, a device is provided, comprising: A memory, used for storing a medical plan recommendation program based on a knowledge base; A processor is used to implement the steps of the knowledge-based medical regimen recommendation method provided in the first aspect when executing the knowledge-based medical regimen recommendation program.

[0015] In a fourth aspect, a computer-readable storage medium is provided, on which a knowledge base-based medical regimen recommendation program is stored. When the knowledge base-based medical regimen recommendation program is executed by a processor, the steps of the knowledge base-based medical regimen recommendation method provided in the first aspect are implemented.

[0016] The beneficial effect of the present invention is that the medical plan recommendation method, system, device and storage medium based on the knowledge base provided by the present invention dynamically generates weight values ​​for the drug attributes in the knowledge graph according to the user's attention, and the dynamically generated weight values ​​participate in the subsequent diagnosis and treatment plan retrieval, so that a multi-dimensional evaluation system can be established through drug attributes and weight values, and the dynamic weight values ​​adapt to the individualized data of patients, thereby achieving differentiated recommendations. In addition, since the drug attributes contain the number of citations, the combination relationship between drugs can be characterized by the number of citations to improve the safety of drug combination. When there are multiple diseases, the feasibility of the combined drugs is checked through the pre-trained random forest model, further eliminating the risks caused by the wrong combination of drugs.

[0017] In addition, the invention has a reliable design principle, a simple structure and a very broad application prospect. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 is a schematic flow chart of a method according to an embodiment of the present invention.

[0020] Figure 2 is another schematic flow chart of a method according to an embodiment of the present invention.

[0021] Figure 3 is a schematic block diagram of a system according to an embodiment of the present invention.

[0022] Figure 4 A schematic diagram of the structure of a device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0023] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0024] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0025] The key terms appearing in the present invention are explained below.

[0026] Random forest is an ensemble learning algorithm that consists of multiple decision trees and implements classification, regression, and anomaly detection tasks through voting or mean calculation. Its core idea is to improve model stability and prediction accuracy through collaborative decision-making of multiple trees.

[0027] The knowledge-based medical solution recommendation method provided in the embodiment of the present invention is executed by a computer device, and accordingly, the knowledge-based medical solution recommendation system runs in the computer device.

[0028] Figure 1 is a schematic flow chart of a method according to an embodiment of the present invention. Figure 1 The execution subject may be a medical plan recommendation system based on a knowledge base. According to different requirements, the order of the steps in the flow chart may be changed, and some may be omitted.

[0029] like Figure 1 As shown, the method includes: S1. Obtain a first symptom and a second symptom, wherein the priority of the first symptom is higher than that of the second symptom.

[0030] The first symptom and the second symptom may be directly input by the doctor from the front end, such as the main symptom and the patient's underlying disease.

[0031] The output of the diagnostic model may also be connected, for example, the first symptom and the second symptom output by the diagnostic model may be input into the system.

[0032] In addition, natural language processing technology can be used to extract the first and second symptoms from the patient's medical record data. When limiting the priority of symptoms, the setting of the priority of symptoms is based on a set of pre-established medical rules and clinical experience. For example, life-threatening conditions such as severe heart attacks (first symptoms) must have a higher priority than some relatively mild chronic diseases such as mild arthritis (second symptoms). This priority judgment plays a key role in the subsequent process, ensuring that high-priority symptoms are treated first when resources are limited or there are conflicts.

[0033] S2. Generate weight values ​​for drug attributes in the pre-built drug knowledge graph based on the user attention input by the front-end.

[0034] The pre-built drug knowledge graph is a structured database containing a large amount of drug-related information, in which drug attributes cover many aspects such as efficacy, side effects, price, applicable population, etc. When users express their concerns about certain aspects on the front-end interface, such as being more concerned about the size of drug side effects, the system will convert this concern into a corresponding weight value.

[0035] In the specific implementation process, through the front-end interactive design, users can choose the degree of attention to different attributes through sliders, radio buttons, etc. These choices will be converted into numerical signals and transmitted to the back-end. The back-end algorithm quantifies the importance of each drug attribute in the knowledge graph based on these signals. For example, if the user pays great attention to the side effects of the drug, the weight value of the side effect attribute will be set to 0.8, while the weight values ​​of other attributes such as price will be reduced to 0.2 accordingly.

[0036] S3. Based on the weight values, query the first drug group corresponding to the first disease and the second drug group corresponding to the second disease from the knowledge graph respectively.

[0037] Using the weight values ​​generated in the previous step, the system conducts targeted queries in the drug knowledge graph. The query process uses the query language of the graph database, such as Cypher (used in the Neo4j graph database). Taking the query of the first drug group corresponding to the first symptom as an example, the system will search for all drug nodes associated with the first symptom in the knowledge graph and perform weighted calculations on the attributes of each drug node according to the set weight value.

[0038] For example, for a drug that treats heart disease (the first symptom), the efficacy attribute has a higher weight. The system will focus on the drug's effectiveness score in treating heart disease and combine it with other attributes such as side effects (which have a lower weight at this time) to comprehensively evaluate whether the drug should be included in the first drug group. In the same way, a similar query operation is performed for the second symptom to generate the second drug group.

[0039] S4. Generate a recommendation based on the medicinal properties of the drug entities in the first drug group and the second drug group using a pre-trained random forest model.

[0040] The pre-trained random forest model is an ensemble learning algorithm based on decision trees. In this step, the model first extracts the medicinal properties of drug entities from the first drug group and the second drug group, including drug ingredients, mechanism of action, metabolic pathways, etc.

[0041] The model uses these features as input and evaluates the suitability of each drug through classification and regression operations of many decision trees in the random forest. For example, the decision tree will make judgments based on factors such as whether the composition of the drug conflicts with the patient's allergy history and whether the mechanism of action is compatible with the patient's physical condition. Finally, the model combines the results of all decision trees to generate personalized drug recommendations for the first and second symptoms, which may include detailed information such as the type of drug, dosage, and time of administration.

[0042] In an embodiment of the present invention, based on step S2, an example is given below to illustrate its specific implementation scheme in a non-limiting manner.

[0043] Specifically, the method for constructing a drug knowledge graph includes: 1. Obtain case data and extract cure time and cure duration from the case data; Read case data from the electronic medical record system (EMR) or other databases. Assuming that Python's pandas library is used to process the data, the sample code for connecting to the database is as follows (taking MySQL database as an example): import pandas as pd# Import the pandas library for data processing and analysis; import mysql.connector# Import the mysql.connector library to connect to the MySQL database; # To connect to the MySQL database, you need to provide the host, username, password and database name; mydb = mysql.connector.connect( host="your_host", user="your_user", password="your_password", database="your_database"); # Define the SQL query statement to select all data from the medical_records table; query = "SELECT * FROM medical_records" # Use pandas's read_sql function to execute SQL queries and store the results in a DataFrame; df = pd.read_sql(query, mydb); The case data contains a field called treatment_end_time, which records the end time of treatment, and a field called treatment_start_time, which records the start time of treatment. You can use the pandas library to perform the following operations: Convert the treatment_end_time field to datetime type and store it in a new cure_time column: df['cure_time'] = pd.to_datetime(df['treatment_end_time']); Convert the treatment_start_time field to datetime type and store it in a new start_time column: df['start_time'] = pd.to_datetime(df['treatment_start_time']); Calculate the cure duration, which is the time difference between cure_time and start_time, and convert it into days and store it in the cure_duration column: df['cure_duration']=(df['cure_time']-df['start_time']).dt.days.

[0044] 2. Perform cluster analysis on the cure time of case data and generate time labels for the case data based on the clusters.

[0045] The K-Means clustering algorithm is used to cluster the healing time. The K-Means algorithm is a distance-based clustering algorithm that aims to divide data points into K clusters so that the sum of the distances between each data point and the centroid of its cluster is minimized.

[0046] Use Python's scikit-learn library to implement K-Means clustering. The code is as follows: from sklearn.cluster import KMeans# Import the KMeans clustering algorithm from the scikit-learn library; import numpy as np# Import the numpy library for numerical calculations; # Extract the healing time data and convert it into a shape suitable for clustering algorithm input (two-dimensional array); cure_duration = df['cure_duration'].values.reshape(-1, 1); # Initialize the K-Means model, set the number of clusters to 3 (can be adjusted according to actual conditions), and set the random seed to 0 to ensure that the results are reproducible; kmeans = KMeans(n_clusters = 3, random_state = 0).fit(cure_duration); # Add the clustering results (labels) to the duration_label column of the original DataFrame; df['duration_label'] = kmeans.labels_.

[0047] 3. Extract drug entities and disease entities from case data, construct treatment triples of drug entities and disease entities, and construct joint triples for drug entities in the same case data.

[0048] Use the named entity recognition (NER) method in natural language processing (NLP) technology to extract drug entities and disease entities. For example, use the NER model based on conditional random field (CRF), which can be implemented in Python using the sklearn-crfsuite library.

[0049] There is already a trained NER model ner_model. The sample code for entity extraction from the text description field medical_note in the case data is as follows: import sklearn_crfsuite# Import sklearn - crfsuite library for NER model based on conditional random fields; from sklearn_crfsuite import metrics# Import the evaluation indicator module in the sklearn-crfsuite library; # Assuming that medical_note is the text description field in the case data, convert it into a list form; texts = df['medical_note'].tolist(); extracted_entities = [] # Initialize an empty list to store extracted entities; for text in texts: # Use the trained NER model to predict each text and get the entity labeling result; entities = ner_model.predict([text]); # Add the annotation results to the extracted_entities list; extracted_entities.append(entities).

[0050] The format of the treatment triplet is (drug entity, treatment, disease entity), and the format of the combination triplet is (drug entity 1, combination, drug entity 2).

[0051] treatment_triples = [] # Initialize an empty list to store treatment triplets; co_use_triples = [] # Initialize an empty list to store the co-use triplets; for index, row in df.iterrows(): # Assume that the drug entity list drug_entities and the disease entity list disease_entities have been extracted; drug_entities = extracted_entities[index]['drug']; disease_entities= extracted_entities[index]['disease']; for drug in drug_entities: for disease in disease_entities: # Construct treatment triplets and add them to the treatment_triples list; treatment_triples.append((drug,'treatment',disease)); for i in range(len(drug_entities)): for j in range(i + 1, len(drug_entities)): # Build the co-use triples and add them to the co_use_triples list; co_use_triples.append((drug_entities[i], 'combination', drug_entities[j])).

[0052] 4. Construct a knowledge graph based on the treatment triples and the combination triples, use the number of repetitions of the triples as the number of references of the corresponding edge in the knowledge graph, and set the duration identifier of the case data as the duration attribute of the corresponding drug entity; Build knowledge graphs in Python using the networkx library.

[0053] import networkx as nx# Import the networkx library for building and manipulating graph structures; # Create a directed multigraph object to represent the knowledge graph; kg = nx.MultiDiGraph(); # Add treatment triplet; for triple in treatment_triples: # If there is no edge from triple[0] to triple[2] in the knowledge graph, add the edge and set the relationship and reference count to 1; if not kg.has_edge(triple[0], triple[2]): kg.add_edge(triple[0], triple[2], relation = triple[1], count = 1); else: # If the edge already exists, increase the number of references to the edge by 1; kg[triple[0]][triple[2]][0]['count']+=1; # Add the combined triples; for triple in co_use_triples: # If there is no edge from triple[0] to triple[1] in the knowledge graph, add the edge and set the relationship and reference count to 1; if not kg.has_edge(triple[0], triple[1]): kg.add_edge(triple[0], triple[1], relation = triple[1], count = 1); else: # If the edge already exists, increase the number of references to the edge by 1; kg[triple[0]][triple[1]][0]['count']+=1; # Set the duration attribute of the drug entity; for drug in kg.nodes(): # Filter out the records containing the current drug entity from the original DataFrame and extract its duration_label; relevant_duration_labels = df[df['drug_entities'].str.contains(drug)]['duration_label']; if not relevant_duration_labels.empty: # If the screening result is not empty, set the first duration_label to the duration attribute of the drug entity in the knowledge graph; kg.nodes[drug]['duration_label']= relevant_duration_labels.iloc[0].

[0054] 5. Extract drug attributes and drug properties from a pre-built drug dictionary. The drug attributes include price, severity of adverse reactions, and indications; the drug properties include drug contraindication information, chemical structure, and metabolic enzyme targets.

[0055] Assume that the pre-built drug dictionary is a JSON file with the following format: {"drug1": { "price": 10.0, "adverse_reaction_severity": "low", "indications": "disease1, disease2", "drug_contraindications": "contraindication1", "chemical_structure": "structure1", "metabolic_enzyme_targets": "target1"}, "drug2": { ...}}.

[0056] Extract attributes and features using Python code: import json# Import the json library to process JSON format data; # Open and read the JSON file of the drug dictionary; with open('drug_dictionary.json', 'r') as f: drug_dict = json.load(f); drug_attributes = {}# Initialize an empty dictionary to store the extracted drug attributes and features; for drug, info in drug_dict.items(): attributes = { "price": info["price"], # Extract drug prices; "adverse_reaction_severity": info["adverse_reaction_severity"], # Extract the severity of adverse reactions; "indications": info["indications"], # Extract indications; "drug_contraindications": info["drug_contraindications"], # Extract drug contraindications information; "chemical_structure": info["chemical_structure"], # Extract chemical structure; "metabolic_enzyme_targets": info["metabolic_enzyme_targets"]# Extract metabolic enzyme targets}; # Store the extracted attributes and features into the drug_attributes dictionary, with the key being the drug name; drug_attributes[drug] = attributes.

[0057] 6. Set the drug attributes and medicinal properties characteristics as the node attribute values ​​of the corresponding drug entities in the knowledge graph.

[0058] Property settings: for drug, attrs in drug_attributes.items(): if drug in kg.nodes(): for attr, value in attrs.items(): # Set the drug attributes and features to the attribute values ​​of the corresponding drug entity nodes in the knowledge graph; kg.nodes[drug][attr]= value.

[0059] The method for constructing the drug dictionary in step 5 includes: 5.1 Obtain the identity information of the drug, including name, manufacturer, and batch.

[0060] Drug identity information can be obtained from multiple channels, such as the hospital's drug management system, electronic data sheets provided by drug suppliers, label information on drug packaging (extracted through optical character recognition (OCR) technology), etc.

[0061] Get data from the hospital's drug management database and use Python's pandas library and the corresponding database connection library (such as psycopg2 for PostgreSQL database) to read the data. The following is a sample code for reading data from the PostgreSQL database: import pandas as pd# Import the pandas library for data processing and analysis; import psycopg2# Import the psycopg2 library for connecting to the PostgreSQL database; # Connect to the PostgreSQL database. You need to provide the database host, name, username, password, and port. conn = psycopg2.connect( host="your_host", database="your_database", user="your_user", password="your_password", port="your_port") # Define an SQL query statement to select drug name, manufacturer, and batch information from the table named drugs; query = "SELECT drug_name, manufacturer, batch_number FROM drugs" # Use pandas's read_sql function to execute SQL queries and store the results in a DataFrame; df = pd.read_sql(query, conn).

[0062] The read data may have missing values, inconsistent formats, and other issues. For example, drug names may have different abbreviations or aliases, and manufacturer names may have multiple ways of expression. Therefore, pandas methods are used to clean the data.

[0063] # Remove the leading and trailing spaces of each value in the drug name field and convert it to lowercase; df['drug_name'] = df['drug_name'].str.strip().str.lower(); # Delete rows with missing values ​​in the drug_name, manufacturer, and batch_number fields in the DataFrame; df = df.dropna(subset=['drug_name','manufacturer', 'batch_number']).

[0064] 5.2 Calculate the hash value of the identity information and use the hash value as the identity code of the drug.

[0065] Common hash algorithms include MD5, SHA-1, SHA-256, etc. This application chooses the SHA-256 algorithm because it is relatively secure. In Python, you can use the hashlib library to implement hash calculations.

[0066] import hashlib# Import the hashlib library for hash calculation; # Define a function to generate a hash value for drug identity information; def generate_hash(drug_name, manufacturer, batch_number): # Concatenate the drug name, manufacturer and batch information into a string; data = f"{drug_name}{manufacturer}{batch_number}" # Use the SHA-256 algorithm to perform hash calculation on the concatenated string; hash_object = hashlib.sha256(data.encode()); # Returns the hexadecimal representation of the hash value; return hash_object.hexdigest(); # For each row of data in the DataFrame, apply the generate_hash function to generate the identity code and store the result in a new identity_code column; df['identity_code'] = df.apply(lambda row: generate_hash(row['drug_name'], row['manufacturer'], row['batch_number']), axis = 1).

[0067] 5.3 Use natural language processing technology to extract indications, adverse reaction information, drug contraindications, chemical structure, and metabolic enzyme targets from drug instructions.

[0068] Drug instructions are usually in PDF, text, and other formats. For instructions in PDF format, you can use the pymupdf library to convert them to text. The following is a sample code to convert PDF to text: import fitz# Import the pymupdf library, here the alias fitz is used; # Define a function to convert drug instructions in PDF format into text; def pdf_to_text(pdf_path): # Use fitz library to open PDF file; doc = fitz.open(pdf_path); text = ""# Initialize an empty string to store the converted text; # Traverse each page of the PDF file; for page in doc: # Append the text content of each page to the text string; text+=page.get_text(); # Return the converted complete text; return text.

[0069] For extracting indications, adverse reaction information, and drug contraindications, rule-based methods or machine learning / deep learning models can be used. Rule-based methods can use regular expressions to match key phrases. For example, the regular expression example for extracting indications: import re# Import re library for regular expression operations; # Define a function to extract indication information from text; def extract_indications(text): # Define a regular expression pattern to match the content after "Indications:" until a period is encountered; pattern = r'Indications: ([^.]*)' # Search for matching patterns in text; match = re.search(pattern, text); # If a match is found, return the matched content (i.e. indication information); if match: return match.group(1) (i.e., return the data of the matching group(1)); # If no match is found, return None; return None.

[0070] For more complex extraction tasks, such as extracting chemical structures and metabolic enzyme targets, deep learning models such as models based on the Transformer architecture (such as BERT, GPT, etc.) may be needed for training and prediction. In Python, this can be achieved using the transformers library. The following is a simple example code framework for using BERT for text classification (here it can be used to classify whether it is chemical structure-related text): from transformers import AutoTokenizer, AutoModelForSequenceClassification# Import the automatic tokenizer and sequence classification model from the transformers library; import torch# Import the torch library for deep learning calculations; # Load the tokenizer from the pre-trained BERT model; tokenizer = AutoTokenizer.from_pretrained('bert - base - uncased'); # Load the sequence classification model from the pre-trained BERT model; model = AutoModelForSequenceClassification.from_pretrained('bert -base - uncased'); # Define a function to classify the input text; def classify_text(text): # Use the tokenizer to encode the text and return the data in PyTorch tensor format; inputs = tokenizer(text, return_tensors='pt'); # Input the encoded data into the model for forward propagation; outputs = model(**inputs); # Get the unnormalized prediction scores (logits) output by the model; logits = outputs.logits; # Perform argmax operation on logits to get the predicted category index; prediction = torch.argmax(logits, dim = 1); # Return the predicted category index; return prediction.item().

[0071] 5.4 Generate the severity level of adverse reactions of drugs based on the pre-set correspondence between the severity level of adverse reactions and the adverse reaction information, and the adverse reactions of the drugs.

[0072] The preset correspondence between the severity level of adverse reactions and the adverse reaction information can be stored in a dictionary. For example: severity_mapping = { "Mild rash": "Low",# Mild rash corresponds to low severity level "Severe allergic reaction": "High",# Severe allergic reaction corresponds to high severity level "Nausea and vomiting": "Medium" # Nausea and vomiting corresponds to medium severity level}; Assuming that the adverse reaction information of the drug adverse_reaction has been extracted, the severity level is generated through the following code: def get_severity(adverse_reaction): # Traverse the preset corresponding relationship dictionary; for key, value in severity_mapping.items(): # If the adverse reaction information in the dictionary is included in the extracted adverse drug reaction information; if key in adverse_reaction: # Returns the corresponding severity level; return value; # If no matching adverse reaction information is found, return "unknown"; return "unknown".

[0073] 5.5 Store the drug’s identity code, indications, adverse reaction level, drug contraindication information, chemical structure and metabolic enzyme target in the drug dictionary.

[0074] All the required information extracted is integrated into a dictionary, and then the dictionary can be saved as a drug dictionary in JSON format.

[0075] drug_dict = {}# Initialize an empty dictionary to store drug information; for index, row in df.iterrows(): drug_info = { "identity_code": row['identity_code'],# Drug identity code "indications": extract_indications(row['instruction_text']),# Extracted indication information "adverse_reaction_severity": get_severity(row['adverse_reaction_text']),# Generated adverse reaction severity level "drug_contraindications": extract_contraindications(row['instruction_text']),# Extracted drug contraindications information "chemical_structure": extract_chemical_structure(row['instruction_text']),# Extracted chemical structure information "metabolic_enzyme_targets": extract_metabolic_enzyme_targets(row['instruction_text'])#Extracted metabolic enzyme target information}; # Add the drug information dictionary to the total drug dictionary, using the drug name as the key; drug_dict[row['drug_name']] = drug_info; import json# Import the json library to process JSON format data; # Open the file named drug_dictionary.json in write mode; with open('drug_dictionary.json', 'w') as f: # Write the drug dictionary to a file in JSON format and set the indentation to 4 to make the file easier to read; json.dump(drug_dict, f, indent = 4).

[0076] In an embodiment of the present invention, based on step S2, an example is given below to illustrate its specific implementation scheme in a non-limiting manner.

[0077] S201. Generate a quantitative value for a drug attribute, and normalize the quantitative value to obtain a quantitative value of the attribute.

[0078] Drug attributes may have different data types and value ranges. For example, price is a numeric value, and adverse reaction severity is a categorical value (such as "low", "medium", "high"). For numeric attributes, such as price, you can directly use its value as the basis for quantitative values. For categorical attributes, you need to encode them. For example, use one-hot encoding to encode the adverse reaction severity "low", "medium", "high" as [1, 0, 0], [0, 1, 0], [0, 0, 1].

[0079] For example, a DataFrame drug_df containing drug attributes, with columns "price" and "adverse_reaction_severity", the following is the sample code: import pandas as pd; import numpy as np; # Assume drug_df is a DataFrame containing drug attributes; # Extract the price column as a quantitative value; drug_df['price_quantified'] = drug_df['price']; # One-hot encode the severity of adverse reactions; adverse_severity_dummies = pd.get_dummies(drug_df['adverse_reaction_severity']); drug_df = pd.concat([drug_df, adverse_severity_dummies], axis = 1).

[0080] The purpose of normalization is to convert quantitative values ​​of different ranges to the same range, usually [0, 1]. For numerical attributes, such as price, the minimum-maximum normalization method can be used. The formula is: x_{norm}=\frac{x - x_{min}}{x_{max}-x_{min}}, where x is the original value, x_{min} and x_{max} are the minimum and maximum values ​​of the attribute respectively.

[0081] #Perform minimum-maximum normalization on the price quantization value; price_min = drug_df['price_quantified'].min(); price_max = drug_df['price_quantified'].max(); drug_df['price_normalized'] = (drug_df['price_quantified']- price_min) / (price_max - price_min); # For the severity level of adverse reactions after one-hot encoding, it is already in the range of 0 - 1 and no additional normalization is required.

[0082] S202. Obtain the user's attention to the attribute, and set a weight factor of the corresponding attribute quantization value according to the attention.

[0083] Through the front-end interface design, users can express their attention to the attribute in a variety of ways. For example, using a slider, the slider value range is 0-100, representing the user's attention to the attribute from low to high. Suppose the user's attention to the price is set to 80 through the slider, and the attention to the severity of adverse reactions is set to 60.

[0084] To convert user attention to weight factors, the attention values ​​need to be normalized to the range of 0 - 1. For example, the weight factor of price is \frac{80}{100}=0.8, and the weight factor of adverse reaction severity is \frac{60}{100}=0.6. Store these weight factors in a dictionary weight_factors.

[0085] # Assume that the user's concern for price is 80, and the concern for the severity of adverse reactions is 60; weight_factors = { 'price': 80 / 100, 'adverse_reaction_severity': 60 / 100}.

[0086] S203. Calculate the weighted sum of the attribute quantization values ​​to obtain the weight value of the drug entity.

[0087] For each drug entity, calculate the weighted sum of its attribute quantification values ​​according to the set weight factor. Assume that the attribute quantification values ​​of the drug entity are stored in drug_df and the weight factor is stored in weight_factors. Taking price and adverse reaction severity as examples, the weight value calculation formula of the drug entity is: weight = price_{normalized} \timesweight_{price}+adverse_{normalized} \times weight_{adverse}.

[0088] # Calculate the weight value of the drug entity; drug_df['weight'] = ( drug_df['price_normalized'] * weight_factors['price']+ drug_df['low'] * weight_factors['adverse_reaction_severity']+ drug_df['medium'] * weight_factors['adverse_reaction_severity']+ drug_df['high'] * weight_factors['adverse_reaction_severity']).

[0089] In an embodiment of the present invention, based on step S3, an example is given below to illustrate its specific implementation scheme in a non-limiting manner.

[0090] S301. Query from the knowledge graph a plurality of main drug entities whose weight values ​​corresponding to the target disease are the highest and whose indications match the target disease, wherein the target disease is the first disease or the second disease.

[0091] Assume that the knowledge graph is built using the networkx library and the node attributes include "weight" and "indications". First, it is necessary to traverse all drug entity nodes connected to the target disease.

[0092] Here is a sample code for querying using the networkx library: import networkx as nx; def find_main_drugs(kg, target_disease): main_drugs = []; for drug in kg.nodes(): # Check if there is an edge from the drug node to the target disease node; if kg.has_edge(drug, target_disease): # Get the weight value and indication of the drug; weight = kg.nodes[drug].get('weight') Indications= kg.nodes[drug].get('indications'); # Check if the indication matches the target condition; if target_disease in indications: main_drugs.append((drug, weight)); # Sort by weight from high to low; main_drugs.sort(key = lambda x: x[1], reverse = True); # Assume that the top 5 drug entities with the highest weight values ​​are taken as the main drug entities; top_main_drugs = [drug for drug, _ in main_drugs[:5]]; return top_main_drugs.

[0093] S302. Query a drug entity set corresponding to a target disease from the knowledge graph, wherein the drug entity set includes all drug entities connected to the first disease.

[0094] Also based on the networkx library, first find all drug entity nodes connected to the first symptom, and then filter out the drug entities connected to the target symptom (the first symptom or the second symptom).

[0095] def find_drug_set(kg, target_disease): all_drugs_connected_to_first_disease = []; for drug in kg.nodes(): if kg.has_edge(drug, 'First symptom'): all_drugs_connected_to_first_disease.append(drug); drug_set = []; for drug in all_drugs_connected_to_first_disease: if kg.has_edge(drug, target_disease): drug_set.append(drug); return drug_set.

[0096] S303. Obtain a secondary drug entity having an associated edge with the primary drug entity, wherein the number of citations of the associated edge reaches a set citation number threshold.

[0097] The edge attributes of the knowledge graph contain "count" (number of citations). For each primary drug entity (primary drug entity), traverse all its outgoing edges to find the secondary drug entities whose citation counts reach the set threshold.

[0098] def find_secondary_drugs(kg, main_drugs, threshold): secondary_drugs = []; for main_drug in main_drugs: for neighbor in kg.neighbors(main_drug): edge_data = kg.get_edge_data(main_drug, neighbor); for data in edge_data.values(): count = data.get('count', 0); if count>= threshold: secondary_drugs.append(neighbor); return secondary_drugs.

[0099] S304. Eliminate drug entities whose duration attributes do not match the primary drug entity from the secondary drug entities.

[0100] The knowledge graph node attributes include "duration_label". For each primary drug entity, compare its duration attribute with the duration attribute of the secondary drug entity and remove it accordingly. Get the duration attribute of the primary drug entity; remove the secondary drug entities whose duration attribute is greater than the duration attribute of the primary drug entity.

[0101] def filter_secondary_drugs(kg, main_drugs, secondary_drugs): filtered_secondary_drugs = []; for main_drug in main_drugs: main_duration= kg.nodes[main_drug].get('duration_label'); for secondary_drug in secondary_drugs: secondary_duration= kg.nodes[secondary_drug].get('duration_label'); if secondary_duration == main_duration and secondary_duration<= main_duration: filtered_secondary_drugs.append(secondary_drug); return filtered_secondary_drugs.

[0102] S305. Store the updated drug entity and the main drug entity as a drug group corresponding to the target disease.

[0103] Store the primary drug entity and the updated secondary drug entity in a dictionary with the key being the target condition and the value being a list of drug entities.

[0104] def store_drug_group(target_disease, main_drugs, filtered_secondary_drugs): drug_group = { target_disease: main_drugs + filtered_secondary_drugs}; return drug_group.

[0105] In a specific example, the execution method is as follows: # Assume that the knowledge graph kg has been constructed; # Assume the target disease is 'target_disease'; # Assume that the reference count threshold is set to 10; main_drugs = find_main_drugs(kg, target_disease); drug_set = find_drug_set(kg, target_disease); secondary_drugs = find_secondary_drugs(kg, main_drugs, 10); filtered_secondary_drugs = filter_secondary_drugs(kg, main_drugs,secondary_drugs); drug_group = store_drug_group(target_disease, main_drugs, filtered_secondary_drugs).

[0106] In an embodiment of the present invention, based on step S4, an embodiment will be given below to non - restrictively elaborate on its specific implementation.

[0107] S401. Obtain the reference count of the association edges between the drug entities in the first drug group and the drug entities in the second drug group.

[0108] Using the Cypher query language of a graph database (such as Neo4j), traverse all the association edges between the first drug group (Group_A) and the second drug group (Group_B) in the knowledge graph, and extract the value of the reference_count attribute of the edges.

[0109] MATCH (a:DrugGroup {id: "Group_A"})-[r:CO_USE]->(b:DrugGroup {id: "Group_B"}); RETURN r.reference_count. The reference count comes from the co - occurrence frequency of the "co - used triple" counted during the construction of the knowledge graph.

[0110] S402. If there is no association edge between the first drug entity and the second drug entity or the reference count of the association edge does not reach the set reference count threshold, then obtain the pharmacological property characteristics of the first drug entity and the pharmacological property characteristics of the second drug entity; the first drug entity belongs to the first drug group, and the second drug entity belongs to the second drug group.

[0111] If the association edge does not exist or reference_count < threshold (the threshold is set according to clinical data, such as < 10 times), then trigger the pharmacological property feature extraction process.

[0112] Obtain the pharmacological property characteristics from the knowledge graph node attributes: Chemical structure: SMILES encoding (parsed through the RDKit library); Metabolic enzyme target: CYP450 enzyme family number (such as CYP3A4); ‌Drug contraindications‌: For example, aspirin cannot be used at the same time as anticoagulants. ‌

[0113] S403. Input the medicinal property characteristics of the first drug entity and the medicinal property characteristics of the second drug entity into the pre-trained random forest model to confirm whether the first drug entity and the second drug entity can be used in combination.

[0114] The medicinal property characteristics of the first drug entity and the medicinal property characteristics of the second drug entity extracted in step S402 are input into the pre-trained random forest model as feature vectors.

[0115] Build a random forest classifier using the scikit-learn library: 1. Install necessary Python libraries such as scikit-learn, pandas, and numpy.

[0116] 2. Use RandomForestClassifier to build a random forest model and set n_estimators=100 and max_depth=5.

[0117] # Build a random forest classifier model = RandomForestClassifier(n_estimators=100,max_depth=5, random_state=42); n_estimators=100: indicates that the number of decision trees in the random forest is 100.

[0118] max_depth=5: indicates that the maximum depth of each decision tree is 5.

[0119] random_state=42: Set the random seed to ensure that the model results are reproducible each time the code is run.

[0120] The training process of the random forest model includes: using 200,000 historical drug combination records (from the Clinical Pharmacology Database), labeled as "combinable" (adverse reaction rate <5%) or "not combinable" (adverse reaction rate ≥5%).

[0121] The parameter configuration of the random forest model includes: model = RandomForestClassifier( n_estimators=200, # Number of trees (balance accuracy and computational cost) ‌:ml-citation{ref="1"data="citationList"} max_depth=15,# Control overfitting and limit tree complexity ‌:ml-citation{ref="1" data="citationList"} criterion='gini',# splitting criterion (Gini impurity) ‌:ml-citation{ref="1" data="citationList"} class_weight='balanced' # Handle class imbalance (small number of samples that cannot be combined) ‌:ml-citation{ref="1" data="citationList"}).

[0122] Input feature vector to random forest model: # Example feature vector (after normalization) features = [ tanimoto_score,# Chemical structure similarity ‌:ml-citation{ref="1" data="citationList"} enzyme_competition_flag, # Metabolic enzyme competition flag (1 / 0) ‌:ml-citation{ref="1"data="citationList"} contraindication_flag# contraindication flag (1 / 0) ‌:ml-citation{ref="1" data="citationList"}].

[0123] Then, build feature engineering: Chemical structure characteristics: SMILES code parsing: The RDKit library was used to convert the SMILES codes of the two drugs into molecular descriptors (such as the number of atoms, bond type, ring structure, etc.), and the Tanimoto coefficients (chemical similarity scores based on molecular fingerprints) of the two were calculated.

[0124] Key pharmacophore matching: Identify structural fragments in drug molecules that are related to pharmacological activity (such as the 3,5-dihydroxycarboxylic acid fragment of hydroxymethylglutaryl-CoA reductase inhibitors) to determine whether there is a pharmacophore conflict between the two drugs.

[0125] Metabolic enzyme target characteristics: CYP450 enzyme family interaction analysis: If the metabolic enzyme targets of two drugs belong to the same CYP family (such as CYP3A4 and CYP2D6), it is marked as "metabolic competition"; if there is no intersection, it is marked as "no competition".

[0126] Metabolic pathway conflict detection: Evaluate whether metabolic rates inhibit each other based on enzyme reaction kinetic parameters (such as Km value).

[0127] ‌Drug contraindications:‌ ‌Contraindication conflict flag‌: Based on a known contraindication database (such as DrugBank), determine whether two drugs belong to a contraindication combination (such as anticoagulants and aspirin), and generate a binary feature (1 = contraindication exists, 0 = no contraindication). ‌

[0128] In a specific example, the prediction process includes: Input the feature vectors of two drugs, and the model outputs the probability of combined use (0~1). Set the threshold to 0.7: Probability ≥ 0.7: Judged as “can be used in combination” (high confidence).

[0129] Probability < 0.7: Judged as "cannot be used together" (manual review required).

[0130] S404. If the first drug entity and the second drug entity cannot be used in combination, the second drug entity is eliminated.

[0131] If the model prediction result is "cannot be used in combination", the corresponding entity is removed from the second drug group (Group_B) and the reason for removal is recorded (such as "CYP3A4 metabolic conflict").

[0132] The knowledge graph is updated dynamically, and the removed associations are marked as high-risk edges.

[0133] S405. Output the first drug group and the second drug group as a recommended solution after eliminating drug entities that cannot be used in combination.

[0134] Perform Cartesian product combination on Group_A and filtered Group_B to generate the final recommendation list.

[0135] Output format: { "group_a": ["Drug_A1", "Drug_A2"], "group_b": ["Drug_B3", "Drug_B5"], "co_use_score": [0.89, 0.76] # Weighted value of the number of references to associated edges}.

[0136] Use a cache mechanism to store high-frequency combinations and reduce real-time computing load.

[0137] Please refer to Figure 2 In one embodiment, the diagnosis and treatment plan recommendation process includes: 1. Obtain case data.

[0138] 100,000 records of medical records from a tertiary hospital (format: JSON), including symptoms, medication records, and recovery time (days).

[0139] 2. Construct treatment triads and combination triads based on case data.

[0140] Use the BERT-NER model to identify disease entities (such as "hypertension") and drug entities (such as "amlodipine").

[0141] Extract the treatment triplet <hypertension, therapeutic drug, amlodipine>.

[0142] ‌Clustering of healing time‌: K-means clustering (n_clusters=3) is performed on the cure time of "hypertension" cases to generate time labels (short / medium / long term).

[0143] ‌Join triple statistics‌: Count the drug combinations used in the same case (such as "amlodipine + hydrochlorothiazide") and record the number of co-occurrences as the number of citations.

[0144] 3. Build a drug dictionary.

[0145] Obtain drug inserts (PDF / TXT) and drug batch data (name, manufacturer, batch number).

[0146] Generate an ‌identity code‌ and calculate the SHA-256 hash value of the drug name + manufacturer + batch number (example: a3f5...d89).

[0147] Extract attributes and use the BioBERT model to extract indications and contraindications from the instructions (e.g., "contraindicated in patients with severe liver damage"). Match the severity of adverse reactions through rules (e.g., "liver enzymes increased 3 times" → level 2).

[0148] Store data, store hash values, indications, contraindications, etc. in MongoDB, and the index field is the hash value.

[0149] 4. Build a knowledge graph. ‌

[0150] Define the graph structure: node types include symptoms and drugs (attributes: price, adverse reaction level, duration identifier); edge types include treatment (attribute: number of citations) and combination (attribute: number of citations).

[0151] Use Neo4j's LOAD CSV command to import triples into the graph structure. Example: CREATE (:Disease {name: 'hypertension'}); CREATE (:Drug {name: 'Amlodipine', duration: 'mid-term', price: 50}); MATCH (d:Disease {name: 'Hypertension'}), (dr:Drug {name: 'Amlodipine'}); CREATE (d)-[:TREAT {references: 1200}]->(dr).

[0152] 5. Generate dynamic weights. ‌‌

[0153] User input focuses on “price” and “adverse reaction level” (weight distribution: price = 0.6, adverse reaction = 0.4).

[0154] Normalize the attributes, for example: Price: Min-Max normalization (assuming the price range is 50-200 yuan → 0.0-1.0).

[0155] Adverse reaction grade: Direct mapping (grade 1 → 0.2, grade 2 → 0.5, grade 3 → 1.0).

[0156] Calculate weights: drug_score=(normalized_price*0.6)+ (normalized_adr_level * 0.4).

[0157] 6. Query the drug group.

[0158] Target diseases: “hypertension” (first disease), “diabetes” (second disease).

[0159] Query logic (taking hypertension as an example): Retrieve the top 10 drugs with the highest weights from the knowledge graph (sorted by drug_score).

[0160] Screening related drugs: MATCH (d:Disease {name: 'hypertension'})-[t:TREAT]->(main:Drug); OPTIONAL MATCH (main)-[r:CO_USE]->(sub:Drug); WHERE r.references>10 AND sub.duration<= main.duration; RETURN main, COLLECT(sub) AS subs.

[0161] Output the first drug group: [amlodipine, hydrochlorothiazide] and related drugs [atorvastatin].

[0162] 7. Verify the combination of drugs.

[0163] The random forest model is used to predict whether drugs whose citation counts do not reach the threshold can be used in combination. Taking amlodipine + metformin as an example, the characteristics of the two drugs are shown in Table 1.

[0164] Table 1 Input characteristics of amlodipine + metformin

[0165] Model output: Combination probability = 0.83 (> threshold 0.7 → can be combined).

[0166] When querying drug entities, we filter out secondary drug entities that have an associated edge with the main drug entity, that is, the number of citations can reach the citation threshold. Therefore, the number of citations between the drug entities in the first group and the drug entities in the second group usually does not reach the number threshold. Therefore, it is necessary to perform a threshold check on the number of citations of the drug entities in the first group and the drug entities in the second group, and perform a joint verification on the corresponding drug entities that have not passed the check. In this way, there is no need to traverse all drug entity relationships, which reduces the amount of calculation.

[0167] When it is predicted that two drug entities cannot be used in combination, the drug entity belonging to the second group (corresponding to the secondary disease) will be eliminated from the second group to prioritize the therapeutic effect on the primary disease.

[0168] Generate recommendations based on prediction results: Drug group after filtering: Group 1 (hypertension): amlodipine, hydrochlorothiazide, atorvastatin; Group 2 (diabetes): metformin, sitagliptin; Final recommendation (Cartesian product combination): {"recommendations": [ {"hypertension": "amlodipine", "diabetes": "metformin", "score": 0.83}, {"hypertension": "amlodipine", "diabetes": "sitagliptin", "score":0.79}]}.

[0169] Implementation effect: ‌Accuracy‌: In a pilot study at one hospital, the adverse reaction rate of the recommended regimen dropped from 12% to 4%.

[0170] ‌Efficiency‌: Single recommended response time <400ms (Neo4j+Redis cache).

[0171] Customized recommendations: By combining dynamic adjustment of weight values ​​and separate queries of primary and secondary entities, customized recommendation solutions are implemented to meet user needs. ‌‌

[0172] In some embodiments, the medical plan recommendation system based on the knowledge base may include multiple functional modules composed of computer program segments. The computer program of each program segment in the medical plan recommendation system based on the knowledge base may be stored in the memory of the computer device and executed by at least one processor to perform (see Figure 1 Description) The function of recommending medical solutions based on the knowledge base.

[0173] In this embodiment, the medical plan recommendation system based on the knowledge base can be divided into multiple functional modules according to the functions it performs, such as Figure 3 As shown. The functional modules of the system may include: an acquisition module, a first processing module, a query module, and a second processing module. The module referred to in the present invention refers to a series of computer program segments that can be executed by at least one processor and can complete fixed functions, which are stored in a memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.

[0174] An acquisition module, configured to acquire a first symptom and a second symptom, wherein the priority of the first symptom is higher than that of the second symptom; The first processing module is used to generate weight values ​​for drug attributes in the pre-built drug knowledge graph according to the user attention input by the front end; A query module, configured to query a first drug group corresponding to a first symptom and a second drug group corresponding to a second symptom from the knowledge graph based on the weight values; The second processing module is used to generate a recommendation scheme based on the medicinal properties characteristics of the drug entities in the first drug group and the second drug group by using a pre-trained random forest model.

[0175] Figure 4The medical scheme recommendation method based on the knowledge base provided for the embodiment of the present application can be applied to equipment. It will be appreciated by those skilled in the art that the equipment structure involved in the embodiment of the present invention does not constitute a limitation on the equipment, and the equipment may include more or less components than shown, or combine certain components, or different component arrangements. In an embodiment of the present invention, the equipment includes but is not limited to laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The equipment may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples, and are not intended to limit the implementation of the embodiments of the present application described herein and / or required.

[0176] The device 400 may include: a processor 410, a memory 420 and a communication unit 430. These components communicate via one or more buses. Those skilled in the art will appreciate that the server structure shown in the figure does not limit the present invention, and it may be a bus structure or a star structure, and may include more or fewer components than shown in the figure, or combine certain components, or arrange components differently.

[0177] The memory 420 may be used to store the execution instructions of the processor 410, and the memory 420 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. When the execution instructions in the memory 420 are executed by the processor 410, the device 400 is enabled to perform some or all of the steps in the following method embodiments.

[0178] The processor 410 is the control center of the storage device, and uses various interfaces and lines to connect various parts of the entire electronic device. It runs or executes software programs and / or modules stored in the memory 420, and calls data stored in the memory to perform various functions of the electronic device and / or process data. The processor can be composed of an integrated circuit (IC), for example, it can be composed of a single packaged IC, or it can be composed of a plurality of packaged ICs with the same or different functions. For example, the processor 410 can include only a central processing unit (CPU). In an embodiment of the present invention, the CPU can be a single computing core or multiple computing cores.

[0179] The communication unit 430 is used to establish a communication channel so that the storage device can communicate with other devices, receive user data sent by other devices or send user data to other devices.

[0180] The present invention also provides a computer storage medium, wherein the computer storage medium may store a program, and when the program is executed, the program may include some or all of the steps in each embodiment provided by the present invention. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).

[0181] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes, including several instructions for enabling a computer device (which can be a personal computer, a server, or a second device, a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.

[0182] In this specification, the same or similar parts between the various embodiments can be referred to each other. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment.

[0183] In the several embodiments provided by the present invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or modules, which can be electrical, mechanical or other forms.

[0184] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0185] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.

[0186] Although the present invention has been described in detail with reference to the accompanying drawings and in combination with the preferred embodiments, the present invention is not limited thereto. Without departing from the spirit and essence of the present invention, a person of ordinary skill in the art may make various equivalent modifications or substitutions to the embodiments of the present invention, and these modifications or substitutions shall be within the scope of the present invention. Any person of ordinary skill in the art may easily think of changes or substitutions within the technical scope disclosed by the present invention, and these shall be within the scope of protection of the present invention.

Claims

1. A medical plan recommendation method based on a knowledge base, characterized in that: include: Acquire a first symptom and a second symptom, wherein the first symptom has a higher priority than the second symptom; Generate weight values ​​for drug attributes in the pre-built drug knowledge graph based on user attention input from the front-end; Based on the weight values, query the knowledge graph for a first drug group corresponding to the first disease and a second drug group corresponding to the second disease respectively; A pre-trained random forest model is used to generate recommended regimens based on the medicinal properties of drug entities in the first drug group and the second drug group.

2. The method according to claim 1, characterized in that The method for constructing the drug knowledge graph includes: Obtain case data, and extract cure time and cure duration from the case data; Perform cluster analysis on the cure time of case data, and generate a time identifier for the case data based on the clusters; Extract drug entities and disease entities from case data, construct treatment triples of drug entities and disease entities, and construct joint triples for drug entities in the same case data; Constructing a knowledge graph based on the treatment triples and the combination triples, using the number of repetitions of the triples as the number of references of the corresponding edge in the knowledge graph, and setting the duration identifier of the case data as the duration attribute of the corresponding drug entity; Extracting drug attributes and drug property characteristics from a pre-built drug dictionary, wherein the drug attributes include price, severity of adverse reactions, and indications; and the drug property characteristics include drug contraindication information, chemical structure, and metabolic enzyme targets; The drug attributes and medicinal properties characteristics are set as node attribute values ​​of the corresponding drug entities in the knowledge graph.

3. The method according to claim 2, characterized in that The method for constructing the drug dictionary includes: Obtaining the identity information of the drug, including name, manufacturer, and batch; Calculate a hash value of the identity information and use the hash value as the identity code of the drug; Use natural language processing technology to extract indications, adverse reaction information, drug contraindications, chemical structure, and metabolic enzyme targets from drug instructions; Generate the severity level of adverse reactions of drugs according to the preset correspondence between the severity level of adverse reactions and the adverse reaction information and the adverse reactions of drugs; The drug's identity code, indication, adverse reaction level, drug contraindication information, chemical structure and metabolic enzyme target are stored in the drug dictionary.

4. The method according to claim 1, characterized in that: Generate weight values ​​for drug attributes in the pre-built drug knowledge graph based on the user attention input by the front-end, including: Generate quantitative values ​​for drug attributes, and normalize the quantitative values ​​to obtain attribute quantitative values; Obtaining the user's attention to the attribute, and setting a weight factor of the corresponding attribute quantization value according to the attention; Calculate the weighted sum of the attribute quantization values ​​to obtain the weight value of the drug entity.

5. The method according to claim 1, characterized in that Based on the weight values, respectively querying the first drug group corresponding to the first symptom and the second drug group corresponding to the second symptom from the knowledge graph includes: Querying the knowledge graph for a plurality of main drug entities whose weight values ​​are the highest and whose indications match the target disease, wherein the target disease is the first disease or the second disease; Querying a drug entity set corresponding to a target disease from the knowledge graph, wherein the drug entity set includes all drug entities connected to the first disease; Acquire a secondary drug entity having an associated edge with the primary drug entity, wherein the number of citations of the associated edge reaches a set citation number threshold; Eliminate drug entities whose duration attributes do not match those of the primary drug entity from the secondary drug entity; The updated drug entity is stored with the main drug entity as a drug group corresponding to the target condition.

6. The method according to claim 5, characterized in that Eliminate drug entities from the secondary drug entity whose duration attributes do not match the primary drug entity, including: Get the duration attribute of the main drug entity; The secondary drug entities whose duration attribute is greater than the duration attribute of the primary drug entity are eliminated.

7. The method according to claim 5, characterized in that The pre-trained random forest model is used to generate a recommendation based on the medicinal properties of the drug entities in the first drug group and the second drug group, including: Obtain the number of references of the associated edge between the drug entity in the first drug group and the drug entity in the second drug group; Confirming that there is no association edge between the first drug entity and the second drug entity or the number of citations of the association edge does not reach a set citation number threshold, obtaining the drug property characteristics of the first drug entity and the drug property characteristics of the second drug entity; the first drug entity belongs to the first drug group, and the second drug entity belongs to the second drug group; Inputting the medicinal property characteristics of the first drug entity and the medicinal property characteristics of the second drug entity into a pre-trained random forest model to determine whether the first drug entity and the second drug entity can be used in combination; If the first drug entity and the second drug entity cannot be used in combination, the second drug entity is eliminated; The first drug group and the second drug group after eliminating the drug entities that cannot be used in combination are output as recommended solutions.

8. A medical plan recommendation system based on a knowledge base, characterized in that: include: An acquisition module, configured to acquire a first symptom and a second symptom, wherein the priority of the first symptom is higher than that of the second symptom; The first processing module is used to generate weight values ​​for drug attributes in the pre-built drug knowledge graph according to the user attention input by the front end; A query module, configured to query a first drug group corresponding to a first symptom and a second drug group corresponding to a second symptom from the knowledge graph based on the weight values; The second processing module is used to generate a recommendation scheme based on the medicinal properties characteristics of the drug entities in the first drug group and the second drug group by using a pre-trained random forest model.

9. A medical plan recommendation device based on a knowledge base, characterized in that: include: A memory, used for storing a medical plan recommendation program based on a knowledge base; A processor is used to implement the steps of the knowledge-based medical plan recommendation method according to any one of claims 1 to 7 when executing the knowledge-based medical plan recommendation program.

10. A computer-readable storage medium storing a computer program, characterized in that: The readable storage medium stores a medical solution recommendation program based on a knowledge base, and when the medical solution recommendation program based on a knowledge base is executed by a processor, the steps of the medical solution recommendation method based on a knowledge base as described in any one of claims 1-7 are implemented.

Citation Information

Patent Citations

  • Combined medication recommendation method, system and device for non-small cell lung cancer

    CN110349681A

  • Method, system and equipment for intelligently recommending antimicrobial drugs

    CN112233745A

  • Drug recommendation method, device and system, electronic equipment and storage medium

    CN114765075A

  • Health management method and device based on knowledge graph

    CN114925216A

  • Medication data processing method and device, computer equipment and storage medium

    CN116403674A

Cited By

  • Drug adverse event grading prediction method and device based on local data

    CN121790017A

  • A method and apparatus for predicting and grading adverse drug events based on local data

    CN121790017B