Muskan Project Report
Muskan Project Report
on
Medicine Recommendation System
in Python
CSE IV-Sem
(Mini project)
Submitted By : Submitted To :
Name :MUSKAN KOCHHAR Mr. Rahul
University Roll No. : 2219122 Chauhan
Class Roll No. : 39 Graphic Era Hill University
CSE-A2 (IV-Sem) DDN
Session : 2023-2024
CANDIDATE’S DECLARATION
I hereby certify that the work which is being presented in the project report entitled
“Medicine Recommendation System” in partial fulfillment of the requirements for the
award of the Degree of Bachelor of Technology in Computer Science and Engineering of the
Graphic Era Hill University, Dehradun has been carried out by me under my own guidance.
Hospitals have access to vast amount of data about patients and their health parameters. Thus,
there is a need for convenient way for medical professionals to utilize this information
effectively. An example would be the access to aggregated information from existing database
on a specific problem at the point of care when it is necessary. Moreover, there are more
drugs, tests, and treatment recommendations (e.g. evidence-based medicine or clinical
pathways) available for medical staff every day. Thus, it becomes increasingly difficult for
them to decide which treatment to provide to a patient based on her symptoms, test results or
previous medical history.
On the other hand, all these data can be used to strive personalized healthcare which is
currently on the rise and predicted to get a major disruptive trend in healthcare in the
upcoming years. Therefore, a recommendation engine for medical use could be employed to
fill this gap and support decision making during therapy. Based on a patient’s current health
status, prehistory, current medications, symptoms and past treatments, the engine can look for
individuals with similar parameters in the database. At the end, the recommender system
would suggest the drugs that were most successful for similar patients. With the help of such a
system, the doctor will be able to make a better-informed decision on how to treat a patient.
Abstract
Nowadays people are progressively started caring about the health and medical diagnosis problems.
However, according to the administration’s report, more than 1 crore people every year die due to
medication error done by novices (New doctors). More than 42% medication errors are caused by
doctors because they provide prescriptions according to their experience which are quite limited. And
sometimes they have left many parts of the book they have read Technologies as data mining and
recommender technologies provide possibilities to explore potential knowledge from diagnosis history
and help the doctors to prescribe medication correctly to decrease the medication error. In this
recommendation we will design and implement a universal medicine recommender system framework
that applies data mining technologies to the recommendation system. The medicine recommender
system consists of database system module, recommendation model module, model evaluation, and
data visualization module
AIM of this project
The aim of a medicine recommendation system is to improve the accuracy, efficiency, and
personalization of medication prescriptions. Key objectives include:
3. Safety and Accuracy: Minimize prescription errors and monitor potential drug interactions to
ensure patient safety.
5. Data Utilization: Leverage large datasets from electronic health records and clinical studies to
provide data-driven recommendations.
PROBLEM DEFINITION
Medicine recommendation is one of the most important and challenging tasks in the modern
world. As there are many new diseases which are discovered by the doctors sometime a
medicine for one disease can lead to the side- effects which can further lead to the discovery
of new diseases. Our goal is to build such a recommendation model which will help the
doctors to prescribe a medicine to the patient t even if they have not studied about that before
the doctor has to open the framework and has to search about the diseases of the patient it will
also help to the inexperienced doctors and patients for using the right drugs high accuracy and
efficiency is very critical for such a recommender system.
SYSTEM ARCHITECTURE
1. Interfaces
There is a single type of interface as such supported by our system namely
2. User Interfaces:
The product will exist on a real-life system. The Interface will be a simple and easy to use interface.
The user needs to give input of the diseases which they are looking for after that the medicine will be
predicted according to the symptoms entered the result box will display the result of the fired query.
3. Hardware Interfaces:
The system has minimal Hardware interfaces. A normal personal desktop or a laptop will be a good
choice to run the system. It is recommended for the system to have higher ram and processing power in
order to compute and predict quickly
4.Software Interface:
To apply machine learning libraries such as are Pandas, NumPy, Sklearn etc. are used to load and train
the dataset. VS Code or Jupyter Notebook is used to run the algorithms.
1. Personalized Treatment:
- Tailors medication suggestions to individual patient profiles, improving the effectiveness
of treatments.
2. Improved Accuracy:
- Reduces prescription errors by considering comprehensive patient data and potential drug
interactions.
3. Time Efficiency:
- Saves time for healthcare providers by quickly providing relevant medication options.
5. Cost Savings:
- Lowers healthcare costs by reducing adverse drug reactions and unnecessary treatments.
6. Decision Support:
- Assists doctors with data-driven insights, enhancing their decision-making process.
8. Consistency in Care:
- Ensures consistent and standardized medication prescribing practices across different
healthcare providers.
5. Enhanced Interoperability
- **Unified Health Records**: Seamless integration with various health information systems, ensuring
all relevant patient data is available for analysis.
- **Standardized Protocols**: Adoption of global standards for data exchange and system
interoperability.
6. Telemedicine Integration
- **Remote Recommendations**: Integration with telemedicine platforms to provide medication
recommendations during virtual consultations.
- **Global Reach**: Expanding access to expert recommendations for patients in remote or
underserved areas.
import pandas as pd
dataset = pd.read_csv('Training.csv')
print("Shape of the dataset = ", dataset.shape) from sklearn.model_selection import
train_test_split
from sklearn.preprocessing import LabelEncoder
import numpy as np
# ecoding
le = LabelEncoder()
le.fit(y)
Y = le.transform(y)
print ("Encoded Y =", np.unique(Y))
# selecting svc
svc = SVC(kernel='linear')
svc.fit(X_train,y_train)
ypred = svc.predict(X_test)
accuracy_score(y_test,ypred)
# save svc
import pickle
pickle.dump(svc,open('svc.pkl','wb'))
# load model
# Open the pickle file in read-binary mode ('rb')
with open('svc.pkl', 'rb') as f:
data = pickle.load(f)
# test 1:
print("predicted disease :",svc.predict(X_test.iloc[0].values.reshape(1,-1)))
print("Actual Disease :", y_test[0])
# test 2:
print("predicted disease :",svc.predict(X_test.iloc[15].values.reshape(1,-1)))
print("Actual Disease :", y_test[15])
# sym_des (contains information about symptoms loaded from symtoms_df.csv)
sym_des = pd.read_csv("symtoms_df.csv")
# diets (contains information about prescribed diet and is loaded from diets.csv)
diets = pd.read_csv("diets.csv")
def helper(dis):
desc = description[description['Disease'] == predicted_disease]['Description']
desc = " ".join([w for w in desc])
return desc,pre,med,die,wrkout
# making list
user_symptoms = [s.strip() for s in symptoms.split(',')]
print("=================predicted disease============")
print(predicted_disease)
print("=================description==================")
print(desc)
print("=================precautions==================")
i = 1
for p_i in pre[0]:
print(i, ": ", p_i)
i += 1
print("=================medications==================")
for m_i in med:
print(i, ": ", m_i)
i += 1
print("=================workout==================")
for w_i in wrkout:
print(i, ": ", w_i)
i += 1
print("=================diets==================")
for d_i in die:
print(i, ": ", d_i)
i += 1
Conclusion
We devise a universal medicine recommender system framework that applies data
mining technologies to the medical diagnosis, which consists of database system
module, data preparation module, recommendation model module, model evaluation
model, and data visualization module. And we give a concrete implementation of each
module based on an open dataset. Experiments are done to evaluate the models, finally,
SVM is selected for the medicine recommendation model for its high accuracy, good
efficiency and scalability in this open dataset. In consideration of the safety of the
patient, we also proposed a mistaken-check mechanism that ensures the safety and the
quality of service. In future work, we plan to build our own recommendation model to
improve the accuracy and efficiency of model further. We also plan to apply Map
Reduce parallel technologies to our medicine recommender System to enlarge the
ability of processing big diagnosis data