pip install knowledge_graph_rag
# Creating KG on medical documents
documents = ["Cardiovascular disease ...",
"Emerging therapeutic interventions ...",
"The epidemiological burden ...
"Cardiovascular disease also ...",
"Advanced imaging techniques, ...",
"Role of novel biomarkers ..."
]
knowledge_graph = KnowledgeGraph(documents)
knowledge_graph.create()
knowledge_graph.plot()
documents_graph = DocumentsGraph(documents=documents)
documents_graph.plot()
knowledge_graph.search_document(user_query)
>> Entity: cardiovascular disease
-> antihypertensive agents (Relationship: involves treatment with)
-> statins (Relationship: used to modulate dyslipidemia)
-> antiplatelet therapy (Relationship: utilized to mitigate thrombosis risk)
-> biomarkers (Relationship: detection and prognostication of acute coronary syndromes and heart failure)
-> high-sensitivity troponins (Relationship: detection of acute coronary syndromes and heart failure)
-> natriuretic peptides (Relationship: prognostication of acute coronary syndromes and heart failure)
documents_containing_connected_terminology = documents_graph.find_connected_documents(vectordb_search_result)
documents_containing_connected_terminology
>> [{'document': 'emerging therapeutic intervention ...'},
{'document': 'management cardiovascular ...'},
{'document': 'role novel biomarkers ...'}]