Method and device for detecting safety of medication
By aligning drug names with standard drug names and utilizing a medication knowledge graph for graph retrieval, the accuracy and safety issues of medication recommendations from medical intelligent agents are resolved, enabling systematic risk detection and correction of medication recommendations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
- Filing Date
- 2026-02-25
- Publication Date
- 2026-07-28
AI Technical Summary
When providing medication advice, medical AI agents may lack accuracy, standardization, and safety, potentially leading to incorrect advice and harming users' health.
By aligning the drug names in medication recommendations with standard drug names in the drug knowledge base, an information graph containing user disease entities and relationships is constructed. Graph retrieval is then performed using the medication knowledge graph to determine whether the medication recommendations pose any risks.
It can identify medication risks in complex scenarios, provide more accurate and safer medication advice, improve the systematicness and comprehensiveness of medication advice, and reduce underreporting and false alarms.
Smart Images

Figure CN121725974B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to one or more embodiments in the field of computer technology, and more particularly to methods and apparatus for detecting the safety of medication. Background Technology
[0002] Large Language Models (LLMs) are complex neural network models trained using deep learning techniques that are capable of understanding and generating human natural language. These models typically have hundreds of millions to trillions of parameters, enabling them to excel in a wide range of natural language processing tasks, including but not limited to text generation, translation, question answering, summarizing, and dialogue. LLMs are generally used in two modes: direct inference and fine-tuning. In direct inference mode, users can design prompts to guide the LLM to generate specific outputs. Prompts can be task descriptions or instructions in text form, used to stimulate the LLM's semantic understanding and generation capabilities. In fine-tuning mode, the LLM is further trained on small datasets within a specific domain to optimize its performance on specific tasks.
[0003] With the development of large language models, health and medical professional intelligent agents (hereinafter referred to as "medical intelligent agents") based on large language models have developed rapidly, providing users with convenient health consultation services. However, when these medical intelligent agents provide medication advice, there are significant potential risks to the accuracy, standardization, and safety of their responses. If the intelligent agent provides incorrect medication advice (such as incorrect dosage, ignoring contraindications, or failing to consider drug interactions), it may cause serious harm to the user's health. Therefore, automating and scaling up the safety testing of medication advice generated by intelligent agents has become a key technical problem that must be solved before the application of medication advice technology by medical intelligent agents. Summary of the Invention
[0004] This specification describes one or more embodiments of a method and apparatus for detecting drug safety, in order to solve one or more problems mentioned in the background art.
[0005] According to the first aspect, a method for detecting medication safety is provided, comprising: obtaining a drug name from a first medication recommendation for a first user, wherein the first medication recommendation is generated by a large model; aligning the drug name with standard drug names in a drug knowledge base to obtain a standard drug name corresponding to the drug name; constructing a first information graph for the first user, including drug entities identified by the standard drug names, disease entities obtained from the first user's health profile information, and the relationships between the entities; and performing graph retrieval in a medication knowledge graph based on the first information graph to determine whether the first medication recommendation has any risk, wherein the medication knowledge graph contains risk knowledge of drug use.
[0006] In some embodiments, the method further includes aligning each drug name with a standard drug name in a drug knowledge base based on multiple alignment methods, specifically including: for any first drug name, recalling standard drug names through multiple alignment methods to obtain several candidate drug names; scoring the several candidate drug names through a pre-trained scoring model to determine the first standard drug name corresponding to the first drug name.
[0007] In some further embodiments, each drug name includes a first drug name; each drug name is aligned with a standard drug name in a drug knowledge base based on multiple alignment methods, including at least one of the following: alignment by vector retrieval, including: calculating the vector similarity between the first semantic embedding vector corresponding to the first drug name and the reference semantic embedding vector corresponding to the standard drug name in the drug knowledge base, and recalling several standard drug names according to the size of the vector similarity with the first drug name; alignment based on edit distance, including: calculating the edit distance between the first drug name and the standard drug name in the drug knowledge base, and recalling several standard drug names according to the size of the edit distance; alignment by querying an alias dictionary, including: for the first drug name, if it is detected that it is an alias of any standard drug name, recalling the corresponding standard drug name.
[0008] In some embodiments, the medication knowledge graph includes at least the following entities and the edges connecting them: drug entities identified by standard drug names and disease entities; performing graph retrieval in the medication knowledge graph to determine whether the first medication recommendation has a risk includes: mapping each entity in the first information graph to a target entity in the medication knowledge graph; obtaining relevant risk knowledge based on the edges and / or attribute information of the target entity; and determining whether the first medication recommendation has a risk based on the relevant risk knowledge and the first information graph.
[0009] In a further embodiment, the relevant risk knowledge includes risk association edges between target entities that indicate contraindications or harmful effects; determining whether the first medication recommendation has a risk based on the relevant risk knowledge and the first information graph includes: for the first entity and the second entity in the first information graph that indicate simultaneous action on the first user, if there is a risk association edge between the mapped first target entity and the second target entity, then it is determined that the first medication recommendation has a risk.
[0010] In a further embodiment, the risk association edge includes a first association edge representing a contraindication relationship between a drug entity and a disease entity; and / or a second association edge representing a health-harmful interaction relationship between two drug entities.
[0011] In another further embodiment, the relevant risk knowledge includes medication description information recorded in the attribute information of the drug entity, including safe medication rules and / or risky medication rules; determining whether the first medication recommendation has a risk based on the relevant risk knowledge and the first information graph includes: for the first entity identified by the first standard drug name in the first information graph, obtaining the corresponding first medication description, the first medication description being extracted from the first medication recommendation; if the first medication description does not conform to the safe medication rules of the target drug entity mapped by the first entity, and / or conforms to the risky medication rules of the target drug entity, determining that the first medication recommendation has a risk.
[0012] In some further embodiments, the medication description information includes medication rules for at least one of the following: dosage, frequency, duration of treatment, and route of administration.
[0013] In some embodiments, the entities in the first infographic may further include at least one of the following: gender, age, population type, medical history, allergy history, smoking and drinking history, and other medications currently in use.
[0014] In some embodiments, aligning the drug name with the standard drug name in the drug knowledge base includes: in response to confirming that the first drug name obtained from the first medication recommendation is the name of a compound drug, obtaining multiple active ingredients corresponding to the first drug name; aligning each active ingredient with the standard drug name in the drug knowledge base to obtain the standard drug name corresponding to each active ingredient, and classifying it into the first standard drug name corresponding to the first drug name.
[0015] In a further embodiment, confirming that the first drug name is the name of a compound drug includes: detecting a predetermined keyword containing a characterization of the compound drug in the first drug name; or, being unable to recall the standard drug name corresponding to the first drug name from the standard drug names in the drug knowledge base.
[0016] In another further embodiment, obtaining multiple active ingredients corresponding to the first drug name includes: parsing and extracting several active ingredients from the first drug name; and / or retrieving drug description information corresponding to the first drug name and extracting several active ingredients from the drug description information.
[0017] According to the second aspect, an apparatus for detecting the safety of medication is provided, comprising:
[0018] The acquisition unit is configured to acquire the drug name from the first medication recommendation for the first user, wherein the first medication recommendation is generated by a large model;
[0019] The alignment unit is configured to align the drug name with the standard drug name in the drug knowledge base to obtain the standard drug name corresponding to the drug name.
[0020] The construction unit is configured to construct a first information graph for a first user, including drug entities identified by the standard drug names, disease entities obtained from the health profile information of the first user, and the relationships between the entities.
[0021] The determining unit is configured to perform graph retrieval in the medication knowledge graph based on the first information graph to determine whether the first medication recommendation has any risks, wherein the medication knowledge graph contains risk knowledge of drug use.
[0022] According to a third aspect, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of the first aspect.
[0023] According to a fourth aspect, a computing device is provided, including a memory and a processor, characterized in that the memory stores executable code, and when the processor executes the executable code, it implements the method of the first aspect.
[0024] The methods and apparatus provided in the embodiments of this specification allow for the acquisition of drug names from medication recommendations to detect medication safety. These drug names are then aligned with standard drug names in a drug knowledge base to obtain the corresponding standard drug names. Next, an information graph containing disease entities and drug entities is constructed using disease entities obtained from user profile information and the standard drug names. Graph retrieval is performed on a pre-constructed medication knowledge graph based on this information graph. This medication knowledge graph can contain risk knowledge related to drug use, thereby determining whether the medication recommendations pose any medication safety risks. This facilitates the identification of medication risks in complex scenarios. Attached Figure Description
[0025] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 The diagram illustrates an application scenario for detecting medication risks.
[0027] Figure 2 This is a schematic diagram of a process for testing the safety of medication according to one embodiment of this specification;
[0028] Figure 3 A user information diagram showing a specific example;
[0029] Figure 4 This diagram illustrates the workflow structure for drug safety testing in a specific example.
[0030] Figure 5 This is a schematic block diagram of a device for detecting drug safety according to one embodiment of this specification. Detailed Implementation
[0031] The solution provided in this specification will now be described with reference to the accompanying drawings.
[0032] Figure 1 This illustrates a specific application scenario for medication advice. Specifically, it's a medical Q&A platform. Its architecture can include a client and a server. The client can be a user terminal or a Q&A platform application running on the user terminal. The client can obtain user questions through interaction between the user and the user terminal. User questions can be various questions, instructions, or requests raised by the user seeking answers, such as... Figure 1 Examples of medication recommendations include "What medicine should I take for stomach acid?". The client sends user questions to the server via the network, and the server uses a computing platform equipped with generative models (such as large language models) to generate corresponding medication suggestions.
[0033] The server-side can perform safety checks on the generated medication recommendations. These recommendations can include the recommended medications and methods of administration. The recommendations can be fed back to the client from the server. It's worth noting that the medication safety check results can be used as prompts along with the medication recommendations, or the recommendations can be monitored and improved during generation before being provided to the user. Figure 1As shown, the client dialog box displays the user's question "What medicine is good for stomach acid?", the server's answer (i.e., medication suggestions, such as "Drug recommendation: Omeprazole, *********"), and medication safety tips, such as "Precautions: Omeprazole is a proton pump inhibitor (PPI), common side effects are as follows: *********", etc.
[0034] Understandable. Figure 1 A simple application architecture example is given. In real-world scenarios, there can be multiple clients, or the computing platform can be set up on the user terminal without a server. Specific scenarios are not limited to question-and-answer, but can also include various scenarios for completing instructions, tasks, etc.
[0035] To verify the safety of medication recommendations, conventional technologies include several solutions: manual sampling review, keyword- or rule-based detection, and basic natural language processing methods. Manual sampling review relies on pharmacists or doctors, which is costly, inefficient, and has limited coverage, making it difficult to meet the needs of large-scale processing and real-time detection. Keyword- or rule-based detection, which matches keywords (such as "prohibited" or "use with caution") with simple rules, is relatively rigid, struggles to incorporate contextual understanding, and is prone to false negatives and false negatives. For example, it cannot accurately identify non-standard drug names (such as various brand names, common names, and aliases) and cannot handle complex medication scenarios. Basic natural language processing methods acquire user information and medication recommendations through conventional information extraction techniques, and then compare them with standard knowledge bases using methods such as vector retrieval. While this approach solves some text understanding problems, it still has limitations. For example, the information source is singular and unreliable, failing to effectively integrate information from multiple channels such as user dialogues, electronic medical records, and examination reports, and unable to handle potential conflicts and uncertainties between information. Medication recommendations are only superficially understood, extracting only fragmented medication information (such as drug name and dosage), and unable to understand complex, conditional medication logic such as "A first, then B" or "A / B choice." The ability to align drug concepts is weak, with poor matching and recognition capabilities for common names, misspellings, and especially compound preparations not explicitly included in the knowledge base. Risk detection dimensions are limited, mostly performing "point-to-point" verification (such as "population-drug" contraindications), failing to discover systemic and hidden risks caused by multiple drugs and diseases.
[0036] In view of this, this specification provides a technical solution for detecting medication safety, aiming to address one or more deficiencies in the aforementioned conventional techniques. Specifically, one or more drug names can be obtained from medication recommendations. Then, each drug name is aligned with standard drug names in a drug knowledge base. This allows for the construction of an information graph using disease entities obtained based on user profile information and drug entities identified by the aligned standard drug names. The information graph is then used for graph retrieval within a pre-constructed medication knowledge graph containing risk knowledge related to drug use, thereby determining whether any safety risks exist. In this way, a more comprehensive user information graph can be constructed using user profile information, enabling the understanding of medication plans with complex logic such as conditions and sequences, rather than isolated medication instructions, thus more closely resembling real-world medical scenarios. Furthermore, this elevates the process from "point-to-point" rule checks to "systematic" risk discovery based on graph computation, effectively revealing hidden risks caused by the coupling of multiple factors, such as drug-drug and drug-disease interactions.
[0037] The technical concept of this specification is described in detail below with reference to the accompanying drawings.
[0038] Figure 2 This specification illustrates a procedure for detecting drug safety according to one embodiment. The entity executing this procedure can be a computer, device, or server with a certain computing power; more specifically, for example… Figure 1 This process can be applied to any service platform that includes medical Q&A, providing medication advice to users. Medication safety test results can be displayed to users, for example, along with the medication advice, or they can be omitted. For example, before providing medication advice, the advice can be repeatedly revised through safety testing until a safe and reasonable recommendation is given, or, if no safe and reasonable recommendation is available, the user can be informed that no medication advice can be provided.
[0039] like Figure 2 As shown, the procedure for detecting drug safety provided in this instruction manual may include: Step 201, obtaining the drug name from the first medication recommendation for the first user, which is generated by a large model; Step 202, aligning the drug name with the standard drug name in the drug knowledge base to obtain the standard drug name corresponding to the drug name; Step 203, constructing a first information graph for the first user, including each drug entity identified by the standard drug name, disease entities obtained from the first user's health profile information, and the relationships between entities; Step 204, based on the first information graph, performing graph retrieval in the medication knowledge graph to determine whether the first medication recommendation has any risks, wherein the medication knowledge graph contains risk knowledge of drug use.
[0040] First, in step 201, the drug name is obtained from the first medication recommendation for the first user.
[0041] Medication recommendations are suggestions for drug use based on user questions and requests on current Q&A platforms, consultation platforms, etc. Here, the primary medication recommendation can be a recommendation regarding the safety of the drug to be tested, determined for the first user. The first user can be any user on the current Q&A platform, consultation platform, etc.
[0042] In some embodiments, the first medication recommendation is a drug use suggestion generated by the current question-and-answer platform, consultation platform, etc., and provided to the user. For example, the first user uploads multimodal information such as a CT scan (Computed Tomography) and a description of symptoms, and the medication recommendation is generated by the current question-and-answer platform, consultation platform, etc., through a medical intelligent agent. Here, the multimodal information can include one or more modalities such as images (e.g., medical images), pictures, text (e.g., dialogue records), and voice. The medical intelligent agent can be an auxiliary medical intelligent agent used for medical consultation, drug recommendation, etc., and can be various software, hardware, or software-hardware combined products, such as a multimodal large model (a large language model capable of processing multimodal information, a type of large model), a medical large model (such as a large language model trained with medical knowledge for the medical question-and-answer field, a large model applied in the medical field), an auxiliary medical robot, etc. Taking a multimodal large model as an example, it can be a large language model trained with multimodal information and medical tags (including at least one of treatment plans and medication recommendations). By using a pre-trained multimodal large model as a medical intelligent agent to process the multimodal information input by the first user, the multimodal large model can provide the first user with current medication recommendations, i.e., the first medication recommendation. As described above, this first medication recommendation can be a medication recommendation provided to the first user, or it can be an intermediate medication recommendation generated before providing medication recommendations to the first user; no limitation is made here.
[0043] In some alternative embodiments, the first medication recommendation may also be determined based on information entered by the first user, such as a consultation question entered by the first user including "I have ***** disease, have been taking ******* for many years, and now I have stomach acid, is taking omeprazole effective", etc.
[0044] In other embodiments, the medication advice may be obtained through other means, which will not be elaborated here. Parsing the first medication advice can identify key medication information within it, which at least includes the drug name.
[0045] Typically, a drug's name is a unique identifier. In other words, a drug's name is the basic information that identifies it. Its ingredients and effects are usually known. Otherwise, it may lead to misuse when buying medicine, causing serious consequences. For example, mentioning "Motrin" usually refers specifically to an antipyretic containing ibuprofen.
[0046] Drug names can be extracted using natural language processing models (such as large language models) or predefined rules. Predefined rules can be, for example, by matching keywords or sentence structures. Sentence structures in which drug names appear can include, but are not limited to: eat ***, take ****, take orally ****, inject ******, suggest trying *****; etc. In these sentence structures, the object following the verbs "eat," "take," "take orally," "register," "try," etc., is usually the drug name.
[0047] In optional embodiments, the medication recommendations are parsed to extract not only the drug name but also medication details. Medication details may include, but are not limited to, at least one of the following: dosage, frequency, course of treatment, route of administration, etc. Dosage is typically the amount of medication taken at one time, such as 10 ml of oral liquid or 3 tablets, etc. Frequency can be the frequency of administration, such as three times a day. Course of treatment can be the duration of a course of treatment (e.g., 7 days) or the number of courses of treatment. Route of administration may be, for example, oral, injection, etc.
[0048] Similar to drug names, medication information can be extracted using natural language processing models (such as large language models) or predefined rules. Predefined rules can be used to match predefined sentence structures or keywords. For example, keywords for dosage might be "each time" (** / time), keywords for frequency might be "daily" (*times / day), "daily" (*times / day), or "every hour" (*times / *hour), keywords for treatment duration are "treatment course," and keywords for route of administration include oral, injection, topical, rectal, etc.
[0049] When using a large language model for parsing, the first medication recommendation can be used as a prompt, along with an information extraction task and a few examples of extracting effective information (drug name, or drug name and medication instructions) from the recommendation. The large language model is then invoked to extract relevant information from the first medication recommendation. The design of the prompt is related to the specific large language model and will not be elaborated upon here.
[0050] Next, in step 202, the drug name is aligned with the standard drug name in the drug knowledge base to obtain the standard drug name corresponding to the drug name.
[0051] It is easy to understand that a single drug name can uniquely correspond to one drug or a combination of multiple drugs (the active ingredients constituting the drug are indicated in this instruction manual). However, a drug may have different names under different brands or due to naming conventions. For example, the drug names "Tylenol" and "Panaxetine" both contain the drug "acetaminophen" as their active ingredient and have the same efficacy. The drug names "Advil" and "Motrin" both contain the drug "ibuprofen" as their active ingredient and have the same efficacy. "***Sustained-Release Tablets" and "***Capsules" have the same active ingredient and the same efficacy, and so on.
[0052] To avoid data redundancy and omissions caused by using different drug names for the same medication, drug names can be aligned with standard drug names in a drug knowledge base, or in other words, the drug names in the first-line medication recommendations can be standardized. The standard drug names in the drug knowledge base can be obtained by removing morphological descriptions such as "tablet" or "capsule" from the drug's ingredients and name. Aligning drug names with standard drug names in the drug knowledge base can be done through a predetermined alignment method.
[0053] The predetermined alignment methods between drug names and standard drug names may include, but are not limited to, at least one of the following: alignment via vector retrieval, alignment based on edit distance, alignment by querying an alias dictionary, etc. Various alignment methods can be used to recall standard drug names in a standard drug knowledge base. The following describes various alignment methods using any first drug name as an example.
[0054] It's understandable that vector retrieval is typically performed using semantic vectors. For the first drug name, semantic embedding is performed to obtain a corresponding first semantic embedding vector. Each standard drug name in the drug knowledge base also has its own pre-defined reference semantic embedding vector. The vector similarity between the first semantic embedding vector and each reference semantic embedding vector is calculated, and a number of standard drug names are recalled based on their vector similarity to the first drug name. For example, standard drug names whose vector similarity to the first drug name is greater than a predetermined similarity threshold are recalled, or a predetermined number (e.g., 10) of standard drug names with the highest vector similarity to the first drug name are recalled.
[0055] Edit distance (e.g., Levenshtein Distance) describes the minimum number of editing operations required to transform one string into another. Allowed editing operations include, for example, replacing one character with another, inserting a character, and deleting a character. A metric for measuring edit distance is: Where sum refers to the total length of string 1 (e.g., drug name A) and string 2 (e.g., standard drug name B). This refers to the class edit distance. In determining the class edit distance, deletion and insertion each increase the value by 1, while replacement increases it by 2. A larger class edit distance indicates more modifications and a smaller edit distance index *r*. Therefore, for the first drug name, we can recall standard drug names whose edit distance index *r* is less than a predetermined threshold, or standard drug names with the smallest edit distance index *r* (e.g., 10). The purpose of edit distance is primarily for spell correction.
[0056] The method for querying an alias dictionary for alignment is typically string matching. An alias dictionary can include various aliases for standard drug names. For example, aliases for Panax notoginseng include Tianqi, Jinbuhuan, Xueshen, Dianqi, Panlongqi, Housanqi, Shanqi, and Shensanqi, while aliases for Corydalis include Yanhusuo, Xuanhusuo, and Yuanhusuo, etc. Different drug names may use different medicinal material names, such as Panax notoginseng tablets, Tianqi powder, and Jinbuhuan capsules. By searching in an alias dictionary, you can determine if the first drug name is an alias for a standard drug name. If so, the corresponding standard drug name can be retrieved.
[0057] In practice, other recall methods can also be used to recall drug names, which will not be elaborated here.
[0058] To avoid omissions, in one optional implementation, for any first drug name, standard drug names can be recalled through multiple alignment methods to obtain several candidate drug names. Then, a pre-trained scoring model is used to score these candidate drug names to determine the first standard drug name corresponding to the first drug name. The scoring model here can be a large language model, or a pre-trained classification or prediction model, which judges the recall results to determine the best-matching (e.g., highest score) standard drug name for alignment. In an optional embodiment, the score of the standard drug name aligned with the first drug name also needs to be higher than a predetermined threshold, such as 0.6. This is to avoid aligning the first drug name with a mismatched standard drug name when the match between the candidate drug names and the first drug name is low.
[0059] Considering that different approaches to align with standard drug names may result in the same candidate drug names, in one embodiment, deduplication can be performed on drug names recalled through various approaches before scoring using a scoring model.
[0060] It is understandable that the medications recommended in the medication recommendations may also be compound drugs. Compound drugs can be preparations made by mixing two or more drugs, such as compound glycyrrhiza tablets or compound methoxyphenamine capsules. The determination of compound drugs can be achieved, for example, by detecting predetermined keywords representing compound drugs, such as "compound," in the first drug name; or by failing to retrieve the standard drug name corresponding to the first drug name from the standard drug name database, such as when various alignment methods fail to obtain candidate drug names that meet the corresponding conditions, or when the scores of the obtained candidate drug names obtained by the scoring model are all below a predetermined threshold.
[0061] According to a possible design, for compound drugs, various active ingredients can be identified, and each active ingredient can be aligned with a standard drug name in a drug knowledge base according to a predetermined alignment method described above. Specifically, when the first drug name is a compound drug, all aligned standard drug names can be categorized under the first standard drug name corresponding to the first drug name. The method for identifying the active ingredients corresponding to the first drug name involves parsing and extracting several active ingredients from the first drug name (e.g., the drug name contains active ingredients), and / or retrieving relevant drug instructions to obtain the active ingredients. This drug instructions can be, for example, obtained through online-assisted searches of the drug's instructions or pre-stored ingredient information in a pre-built drug database. If medication instructions are also obtained, the medication instructions for a single active ingredient are consistent with those of the original compound drug.
[0062] In this way, by breaking down the drug into its components, we can effectively utilize each active ingredient to uncover its potential risks.
[0063] Further, in step 203, a first information graph is constructed for the first user.
[0064] The first information graph here can be viewed as a small relational network, which can contain various entities and their relationships, where relationships can be identified by edges. The entities included in the first information graph may include the first user, the disease entity, and the drug entity (described by standard drug names).
[0065] Disease entities can be obtained from the first user's health profile information. This health profile information can describe the user's image, needs, etc., from multiple dimensions. These dimensions vary across different scenarios. Here, the dimensions describing a user's health profile may include, but are not limited to, at least one of the following: age, gender, disease, medical history, population type, allergy history, smoking and drinking history, current medication status (e.g., medications already being taken), etc. In some cases, current medication status may also include currently taken medications and their dosage, frequency, etc. Optionally, at least one of the following can also be extracted from the first user's health profile information: gender, age, population type (e.g., at least one of child, pregnant woman, elderly, or chronic disease patient), medical history, allergic drugs, smoking and drinking habits, other medications currently in use, etc. For compound drugs, there can be corresponding drug entities for each standard drug name. Additionally, the first information graph may also include drug entities (described by drug name, such as the first drug name), symptom entities, etc. Figure 3 The infographic contains entities such as: the questioner (e.g., the first user), hypertension (disease entity), elderly (population type), ibuprofen capsules (drug entity), warfarin (drug entity), ibuprofen (drug entity), and so on.
[0066] User profile information can be constructed based on the first multimodal information describing the first user (such as the multimodal information used to generate suggestions for the first user mentioned above). The first multimodal information may include, but is not limited to, at least one of the following: medical images, examination report images (examination results, analysis conclusions, etc. given by doctors, which can be obtained as text through OCR recognition), historical dialogues (in text form), user health records (in image or text form, such as health records provided by hospitals to users, or health questionnaires filled out by users on the current platform, etc.), and so on.
[0067] The process of extracting entities from user health profile information can be performed using predefined rules or natural language processing models (such as large language models), without limitation here. Disease entities can be determined through user-inputted diseases, diseases mentioned in examination reports, or diseases with high probabilities predicted based on the first multimodal information. Disease prediction can be performed using large language models or other prediction models.
[0068] For the extracted entities, relationships between them can also be detected. For example, the detection of relationships between diseases or symptoms and drugs can be performed using a large language model. In an optional implementation, relationship and entity detection can be performed together in a single call to the large language model. In this case, the following information can be provided to the large language model as prompts: the user's health profile information, aligned standard drug names, entity and relationship extraction tasks, and a small number of examples described by text and the extracted entities and relationships. The types of relationships between entities can be predefined, such as the relationship between a user and a disease being "has," and the relationship between a disease and a drug being "treats," "relieves," etc.
[0069] Then, in step 204, based on the first information graph, a graph search is performed in the medication knowledge graph to determine whether the first medication recommendation has any risks.
[0070] Graph retrieval is a technique for efficiently finding, matching, or analyzing information from graph-structured data. It is widely used in fields such as social networks, chemical molecular structures, knowledge graphs, and recommender systems. Its core objective is to quickly locate the desired information using the features of the graph structure (nodes, edges, subgraphs, paths, etc.).
[0071] Under the technical concept described in this specification, a drug use knowledge graph can be constructed using medical background knowledge. The drug use knowledge graph can at least include the following entities: disease entities, drug entities, and the edges between them (describing the relationships between entities). Drug entities can be described using standard drug names. The knowledge graph construction process can be carried out using various techniques in this field, and is not limited here. The drug use knowledge graph can contain rich medical knowledge (including knowledge of drug use risks), such as drug interactions (antagonism, toxicity, etc.), knowledge of the treatment, hindrance, induction, and contraindications between drugs and diseases, and knowledge of contraindications between drugs and population types (such as children, pregnant women, etc.), etc.
[0072] In relational networks or knowledge graphs, paths can be formed by entities moving along connecting edges. Under the technical concept of this specification, the first information graph is simpler and smaller than a medication knowledge graph, and is a personalized relational network for the first user, which can be used as a temporary relational network in the current process. For example... Figure 3As shown, the first information graph can contain multiple paths. These paths are disease information relationship graphs constructed based on the information corresponding to the first user. However, various relationships such as drug interactions, risk relationships between drugs and diseases, and contraindications between drugs and populations may not be reflected in the first information graph and require strong medical background knowledge as support. Therefore, entity matching can be used to map entities in the first information graph to target entities in a pre-constructed medication knowledge graph. Then, graph retrieval can be performed based on the target entities to determine whether medication risks exist in the first information graph.
[0073] The matching process between entities in the first information graph and entities in the medication knowledge graph can be performed through character matching, which will not be elaborated here. When a common entity is matched, a mapping relationship can be established between the entities in the first information graph and the target entity in the medication knowledge graph. Thus, for the target entity in the medication knowledge graph, graph retrieval and other methods can be used to determine whether the first medication recommendation carries a risk, based on the target entity's relevant risk knowledge and the first information graph. Typically, obtaining the first medication recommendation carries a risk, which may include situations that are harmful to the user's health.
[0074] In some optional implementations, the relevant risk knowledge includes risk association edges between target entities that indicate contraindications or harmful effects. Risk association edges can be, for example, edges describing a harmful health interaction between two drugs (connecting drug entities), edges describing a drug as a contraindication to a disease (connecting drug and disease entities), edges describing a drug posing a risk to a population type (connecting drug and population type entities), and so on. Association edges containing risk knowledge can be predefined or left undefined. Optionally, risk paths in the medication knowledge graph can be pre-labeled. In this case, it is only necessary to detect whether a risk path exists between target entities.
[0075] The first medication recommendation may only describe adding medications, or it may describe adding or removing medications, such as discontinuing medication A and taking medication B. Therefore, when constructing the first information graph, there may be entities that do not simultaneously affect the first user. For example, the medication entity corresponding to medication A and the medication entity corresponding to medication B may not simultaneously affect the first user. For the first entity (e.g., the added medication B) and the second entity (e.g., the added medication C) in the first information graph that simultaneously affect the first user, if there is a risk-related edge between the mapped first target entity and the second target entity, then the first medication recommendation is determined to have a risk.
[0076] In some alternative implementations, the relevant risk knowledge includes medication description information recorded in the attribute information of the drug entity, including safe medication rules and / or risk medication rules. Safe medication rules and / or risk medication rules are, for example, related to dosage. Safe medication rules describe how the corresponding drug is used safely, such as no more than 12 tablets per day, while risk medication rules describe how the corresponding drug is used with risks, such as exceeding 20 mg posing a risk. In this case, for the first entity identified by the first standard drug name in the first information graph, a corresponding medication description can be obtained from the first medication recommendation, denoted as the first medication description, which may include at least one of dosage, frequency, course of treatment, etc. The system checks whether the first medication description conforms to the safe medication rules and / or risk medication rules of the target drug entity mapped from the first entity to the medication knowledge graph. If the first medication description does not conform to the safe medication rules of the target drug entity mapped from the first entity, and / or conforms to the risk medication rules of the target drug entity, it is determined that the first medication recommendation has a risk. If the first medication description conforms to the safe medication rules of the target drug entity mapped by the first entity, and / or does not conform to the risk medication rules of the target drug entity, the first medication recommendation is determined to be safe.
[0077] As an example, see reference Figure 3 The image shows a specific example of a first information graph. Assuming that based on entity matching in the first information graph and the drug knowledge graph, the detected target entities include "ibuprofen" and "warfarin," a mapping relationship can be established between these two entities and their corresponding entities in the drug knowledge graph. Thus, graph retrieval can be performed in the drug knowledge graph. For example, if a relationship is found between these two drug entities, specifically an edge indicating "high-risk interaction" with a note indicating "bleeding risk," this is a risky relationship edge. In other words, a risky path exists in the first information graph. Figure 3 The area is circled in dashed circles. Therefore, it can be determined that the corresponding medication recommendations carry a risk.
[0078] Based on this, the risk assessment results can be displayed to users, or the primary medication recommendation can be revised according to the risk assessment results, which will not be elaborated here.
[0079] To further clarify the technical solutions in this specification Figure 4 A more specific application example is shown. For example... Figure 4As shown, for a specific user, such as the first user mentioned earlier, two types of information are obtained: user profile information and current medication recommendations. This includes retrieving at least one item from historical conversations, hospital examination reports, health records, etc., and organizing it into the user's health profile information. The health profile information may include items such as gender, age, population type, past illnesses, allergy history, and medication history. For the current medication recommendations, medication events can be extracted and formatted (stored according to a predetermined format). Formatted medication events may include drug names and medication details, such as dosage, frequency, and course of treatment. The drug names in the medication events can be aligned with standard drug names. This alignment process is performed through various methods, including alignment via vector retrieval, alignment based on edit distance, and alignment by querying an alias dictionary. It is worth noting that for compound drugs (containing two or more drugs as active ingredients), each active ingredient can be broken down and aligned with the standard drug name. The standard drug names recalled through various channels are identified or sorted (usually for the same drug) to determine the standard drug names corresponding to the final number of effective drugs.
[0080] Based on the aligned standard drug names and user health profile information, entities and their relationships can be extracted to construct a medication information graph (as described in the first information graph above). Based on this graph, entities can be matched with entities in a pre-constructed medication knowledge graph, thus establishing a mapping between common entities in the relevant information graph and the medication knowledge graph. These common entities can be denoted as target entities in the medication knowledge graph. Graph retrieval is then performed on the target entities within the medication knowledge graph to determine the presence of risk, thereby assessing the risk level of the current medication recommendation.
[0081] To review the above process, in order to detect the safety of medication recommendations, the drug names can be obtained and then aligned with standard drug names in a drug knowledge base. Next, using user profile information and the aligned standard drug names, an information graph is constructed that includes at least disease entities, drug entities, and the relationships between them. Based on this information graph, graph retrieval is performed in a pre-constructed medication knowledge graph. Utilizing the rich knowledge of drug use risks contained in the medication knowledge graph, it can be determined whether the medication recommendation carries any safety risks. In this way, the text of the medication recommendation can be transformed into a graph structure for graph computation. During the drug recall process, multiple recall strategies can be used to reduce missed concept recall, thereby facilitating the identification of medication risks in complex scenarios.
[0082] According to another embodiment, a device for detecting drug safety is also provided, which can be installed in a computer, device, or server with a certain computing power. Figure 5A drug safety detection device 500 according to one embodiment is shown. Figure 5 As shown, the medication safety detection device 500 may include: an acquisition unit 501, configured to acquire drug names from a first medication recommendation for a first user, the first medication recommendation being generated by a large model; an alignment unit 502, configured to align the drug names with standard drug names in a drug knowledge base to obtain the standard drug names corresponding to the drug names; a construction unit 503, configured to construct a first information graph for the first user, including drug entities identified by standard drug names, disease entities acquired from the first user's health profile information, and the relationships between entities; and a determination unit 504, configured to perform graph retrieval in a medication knowledge graph based on the first information graph to determine whether the first medication recommendation carries a risk, wherein the medication knowledge graph contains risk knowledge about drug use.
[0083] It is worth noting that, Figure 5 The device 500 shown is Figure 2 The method embodiment shown corresponds to this, therefore, Figure 2 The corresponding descriptions in the method embodiments can also be applied to... Figure 5 The device 500 shown will not be described in detail here.
[0084] According to another embodiment, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed in a computer, causes the computer to perform a combination Figure 2 The methods described above.
[0085] According to another embodiment, a computing device is also provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements a combination... Figure 2 The methods described above.
[0086] Those skilled in the art will recognize that the functions described in the embodiments of this specification in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented in software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium.
[0087] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the technical concept in this specification. It should be understood that the above description is only a specific embodiment of the technical concept in this specification and is not intended to limit the scope of protection of the technical concept in this specification. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solutions of the embodiments in this specification should be included within the scope of protection of the technical concept in this specification.
Claims
1. A method for detecting the safety of medication, comprising: The drug name is obtained from the first medication recommendation for the first user, which is generated by a large model; Align the drug name with the standard drug name in the drug knowledge base to obtain the standard drug name corresponding to the drug name; Construct a temporary first information graph for the first user, including each drug entity identified by the standard drug name, disease entities obtained from the first user's health profile information, and the relationships between the entities; Based on the first information graph, each entity in the first information graph is mapped to a target entity in the medication knowledge graph, so as to perform graph retrieval in the medication knowledge graph and determine whether the first medication recommendation has any risks, wherein the medication knowledge graph contains risk knowledge of drug use.
2. The method as described in claim 1, further comprising aligning each drug name with the standard drug name in the drug knowledge base based on multiple alignment methods, specifically including: For any given first drug name, standard drug names are recalled through multiple alignment methods to obtain several alternative drug names; The first standard drug name corresponding to the first drug name is determined by scoring the candidate drug names using a pre-trained scoring model.
3. The method as described in claim 2, wherein, Each drug name includes the primary drug name; each drug name is aligned with the standard drug names in the drug knowledge base based on multiple alignment methods, including at least one of the following: Alignment is achieved through vector retrieval, including: calculating the vector similarity between the first semantic embedding vector corresponding to the first drug name and the reference semantic embedding vector corresponding to the standard drug name in the drug knowledge base, and recalling several standard drug names according to the size of the vector similarity with the first drug name. Alignment is performed based on edit distance, including: for the first drug name, calculating its edit distance with the standard drug names in the drug knowledge base, and recalling a number of standard drug names according to the size of the edit distance; Alignment is performed by querying an alias dictionary, which includes: for the first drug name, if it is detected as an alias of any standard drug name, recalling the corresponding standard drug name.
4. The method of claim 1, wherein, A medication knowledge graph should include at least the following entities and the edges connecting them: drug entities identified by standard drug names, and disease entities; The step of performing graph retrieval in the medication knowledge graph to determine whether the first medication recommendation carries a risk includes: Based on the associated edges and / or attribute information of the target entity, relevant risk knowledge is obtained; Based on the relevant risk knowledge and the first infographic, determine whether the first medication recommendation carries any risk.
5. The method of claim 4, wherein, The relevant risk knowledge includes risk association edges between target entities that indicate taboos or harmful effects; Based on the relevant risk knowledge and the first infographic, determine whether the first medication recommendation carries any risk, including: For the first entity and the second entity that simultaneously act on the first user in the first information graph, if there is a risk-related edge between the mapped first target entity and the second target entity, then it is determined that the first medication recommendation has a risk.
6. The method of claim 5, wherein, The risk association edges include a first association edge representing a contraindication relationship between a drug entity and a disease entity; and / or a second association edge representing a health-harming interaction relationship between two drug entities.
7. The method of claim 4, wherein, The relevant risk knowledge includes medication description information recorded in the attribute information of the drug entity, including safe medication rules and / or risky medication rules; Based on the relevant risk knowledge and the first infographic, determine whether the first medication recommendation carries any risk, including: For the first entity identified by the first standard drug name in the first information graph, obtain the corresponding first medication description, which is extracted from the first medication recommendation; If the first medication description does not conform to the safe medication rules of the target drug entity mapped by the first entity, and / or conforms to the risk medication rules of the target drug entity, it is determined that the first medication recommendation has a risk.
8. The method according to claim 7, wherein, The medication description information includes medication rules for at least one of the following: dosage, frequency, course of treatment, and route of administration.
9. The method of claim 1, wherein, The entities in the first infographic also include at least one of the following: gender, age, population type, medical history, allergy history, smoking and drinking history, and other medications currently in use.
10. The method of claim 1, wherein, The alignment of drug names with standard drug names in the drug knowledge base includes: In response to confirming that the first drug name obtained from the first medication recommendation is the name of a compound drug, multiple active ingredients corresponding to the first drug name are obtained; Each active ingredient is aligned with the standard drug name in the drug knowledge base to obtain the standard drug name corresponding to each active ingredient, and then classified into the first standard drug name corresponding to the first drug name.
11. The method of claim 10, wherein, The name of the first drug is confirmed to be the name of a compound drug, including: The first drug name contains a predetermined keyword characterizing the compound drug; or, The standard drug name corresponding to the first drug name cannot be retrieved from the standard drug names in the drug knowledge base.
12. The method of claim 10, wherein, Obtain multiple active ingredients corresponding to the name of the first drug, including: Extract several active ingredients from the first drug name; and / or, The drug description information corresponding to the first drug name is retrieved, and several active ingredients are extracted from the drug description information.
13. A device for detecting the safety of medication use, comprising: The acquisition unit is configured to acquire the drug name from the first medication recommendation for the first user, wherein the first medication recommendation is generated by a large model; The alignment unit is configured to align the drug name with the standard drug name in the drug knowledge base to obtain the standard drug name corresponding to the drug name. The construction unit is configured to construct a temporary first information graph for the first user, including drug entities identified by the standard drug names, disease entities obtained from the health profile information of the first user, and the relationships between the entities. The determining unit is configured to map each entity in the first information graph to a target entity in a medication knowledge graph based on the first information graph, so as to perform graph retrieval in the medication knowledge graph and determine whether the first medication recommendation has any risks, wherein the medication knowledge graph contains risk knowledge of drug use.
14. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of any one of claims 1-12.
15. A computing device, comprising a memory and a processor, characterized in that, The memory stores executable code, and when the processor executes the executable code, it implements the method of any one of claims 1-12.