0% found this document useful (0 votes)
28 views16 pages

Mini Project Report 2f Inal

Uploaded by

Mad Gamers
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views16 pages

Mini Project Report 2f Inal

Uploaded by

Mad Gamers
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

MEDICINE RECOMMENDATION

CHAPTER 1
INTRODUCTION
The medicine recommendation system using Python is highly relevant in the context of
healthcare and medication management. It addresses several critical aspects that impact patient
care and treatment outcomes. The relevance of the project can be outlined as follows:
Personalized Patient Care: The project aims to provide personalized
medication recommendations based on individual patient. This personalized approach ensures
that patients receive tailored medicines aligned with their specific health conditions,
symptoms, and medical history. By considering these factors, the system improves the
accuracy and effectiveness of medication prescriptions, leading to better patient care.
Efficiency and Time-saving: Healthcare professionals often face time constraints when
researching and evaluating medication options for their patients. The medicine
recommendation system streamlines this process by automating the recommendation
generation, saving valuable time for healthcare providers.
Enhanced Patient Safety: Medication errors and adverse drug reactions pose significant risks
to patient safety. The medicine recommendation system helps mitigate these risks by
considering factors such as drug interactions and contraindications. The system
promotes patient safety and reduces the likelihood of adverse events, ultimately improving the
quality of care delivered.
Data-driven Decision Making: The project leverages the power of data analysis and machine
learning algorithms to derive insights from patient’s condition. By analyzing patient
information, including medical histories and symptoms, the system can identify patterns and
correlations that may not be apparent through manual assessment.
Scalability and Accessibility: Its accessibility ensures that patients can receive the same level
of personalized care regardless of their geographic location or healthcare facility.
1.1 Problem Statement:
• Selecting appropriate medication can be challenging due to the vast amount of available
drugs and the complexity of individual health conditions.
• Patients often lack medical expertise and rely on self-diagnosis or readily available
information, which can be inaccurate or misleading.
• In some cases, even healthcare professionals might benefit from assistance in navigating
the ever-growing landscape of medications.

Dept of 2024- 1
MEDICINE RECOMMENDATION

1.2 Objective of Project:


• Personalization: Provide personalized medication recommendations tailored to
individual patient profiles, taking into account factors such as medical history,
current symptoms, demographics, genetic information, and previous treatment responses.
• Accuracy and Effectiveness: Improve the accuracy and effectiveness of medication
prescriptions by leveraging machine learning models to analyze large datasets and identify
patterns that correlate with successful treatment outcomes.
• Optimization: Optimize medication selection by considering multiple factors, including
efficacy, safety, potential side effects, drug interactions, and patient preferences.
• Adaptability: Develop a system that can adapt and refine recommendations over
time based on new patient data, feedback from healthcare providers, and real-world
treatment outcome.
• Patient Safety: Enhance patient safety by minimizing the risk of adverse drug reactions
and interactions through informed and data-driven medication recommendations.
• Research and Development: Facilitate ongoing research and development in
pharmacogenomics and personalized medicine by leveraging data insights and outcomes
generated from the recommendation system.

1.3 Scope of Project:


The scope of the project is to design and develop an intelligent medicine recommendation
system using machine learning techniques. The system aims to provide accurate and
personalized medication recommendations based on patients' condition.
There is a strong emphasis on personalized medicine, which tailors medical treatment to the
individual characteristics of each patient. A recommendation system can analyze vast
amounts of patient data, including genetic information, lifestyle factors, and real-time health
metrics, to recommend treatments that are most likely to be effective and safe for patient.

Dept of 2024- 2
MEDICINE RECOMMENDATION

CHAPTER 2

SYSTEM REQUIREMENTS

2.1 Hardware Requirements

• Processor : intel core i3/i5/i7


• RAM : 8 GB
• Hard Disk : 512 GB

2.2 Software Requirements

• OS : Windows 10/11
• Language : Python
• Frontend language : HTML, CSS
• IDE : Visual Studio

2.3 Python Libraries:


For the computation and analysis we need certain python libraries such as SKlearn, Numpy,
pandas, Flask framework.
• NumPy: NumPy is a general-purpose array-processing package. It provides a
highperformance multidimensional array object, and tools for working with these arrays.
It is the fundamental package for scientific computing with Python.
• Pandas: Pandas is one of the most widely used python libraries in data science. It
provides high-performance, easy to use structures and data analysis tools. Unlike NumPy
library which provides objects for multi-dimensional arrays, Pandas provides in-memory
2d table object called Data frame.
• Flask: It is a lightweight WSGI web application framework. It is designed to make
getting started quick and easy, with the ability to scale up to complex applications.
• SKlearn: It features various classification, regression and clustering algorithms including
support vector machines, random forests, gradient boosting, k-means and DBSCAN, and
is designed to interoperate with the Python numerical and scientific libraries NumPy.

Dept of 2024- 3
MEDICINE RECOMMENDATION

CHAPTER 3

SYSTEM ANALYSIS

3.1 Proposed System

This model is trained such that it considers the above given features and holds
significant promise in advancing healthcare practices by enhancing the accuracy, efficiency,
and safety of medication prescribing. By harnessing the power of data-driven insights, this
system aims to empower healthcare professionals with decision support tools that
ultimately contribute to better patient outcomes and quality of care.

3.2 Methodology

The methodology for developing a medicine recommendation system involves collecting


comprehensive data, preprocessing and selecting relevant features training machine learning
models, and evaluating their performance. Data imbalance is addressed, and real-time patient
data integration is considered. The system aims to provide interpretable
recommendations through an intuitive user interface. Deployment in a production
environment, testing, and continuous improvement based on feedback are important aspects
of the methodology. Next, relevant features are selected and engineered to capture essential
aspects of the patient's medical history, condition and medication requirements. This step
involves careful consideration of the data to identify the most informative features that
contribute to accurate recommendations. Once the data is prepared, machine learning models
are selected and trained using the dataset. These models are chosen based on the specific
requirements of the project and it can include decision trees, support vector machines, neural
networks, or ensemble methods. The models are trained to learn patterns and relationships
in the data, enabling them to make accurate medication recommendations. The
performance of the models is evaluated using appropriate metrics, such as accuracy, precision,
and recall to assess their effectiveness. Throughout the development process, data imbalance is
addressed by employing techniques like oversampling, under sampling, or synthetic data
generation to ensure fair representation of various medical conditions and medications. Real-
time data integration is also considered, allowing the system to dynamically update
recommendations based on the latest patient information and medical research.

Dept of 2024- 4
MEDICINE RECOMMENDATION

CHAPTER 4

SYSTEM DESIGN
Design is a creative process of a good design and is the key to effective system. The System
Design is defined as the process of applying various techniques and principles for the purpose
of defining a process or a system in sufficient detail to permit its physical realization. Various
design features are followed to develop the system. The design specification describes
the features of the system, the components or elements of the system and their appearance to
end- users. It is widely used for modeling software systems and is increasingly used
for high designing non-software systems and organizations. Before planning, you need to
understand the old system thoroughly and determine how computers can best be used in order
to operate efficiently.

4.1 Flowchart

4.1 Flowchart of how the software uses the data to train the model

Dept of 2024- 5
MEDICINE RECOMMENDATION

4.2 System Architecture

Fig 4.2 System Architecture


The Medicine Recommender System uses machine learning for sentiment analysis to
efficiently conduct sentiment analysis and provide medicine recommendations. The system
consists of data collecting, preprocessing, sentiment analysis module, and drug
recommendation engine. The sentiment analysis module utilizes advanced natural language
processing methods to analyze medication reviews. Preprocessed text data is trained using
machine learning models like RNNs, CNNs, or transformer based models, which classify
feelings as favorable, negative, or neutral. The sentiment analysis results are then integrated
into the medicine recommendation engine, which creates personalized recommendations for
each user using collaborative, content- based, or hybrid filtering techniques. High-stressed
drugs are prioritized, and negative feelings are remedied. The Medicine Recommender System
offers modular architecture for flexibility and maintenance, allowing for updates and upgrades
without affecting overall performance. This design provides trustworthy, sensitive medication
recommendations, enhancing clinical decision-making and offering individualized treatment
alternatives for improved healthcare outcomes.

Dept of 2024- 6
MEDICINE RECOMMENDATION

CHAPTER 5

IMPLEMENTATION

#import Necessary Library


import pandas as pd
import numpy as np
import matplotlib.pyplot
as plt import seaborn as
sns import warnings
warnings.filterwarnings('ignore') from
sklearn.model_selection import train_test_split from
sklearn.preprocessing import LabelEncoder
#Import Models from
sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier , GradientBoostingClassifier
from sklearn.neighbors import KNeighborsClassifier from sklearn.naive_bayes
import MultinomialNB from sklearn.metrics import accuracy_score
from sklearn.metrics import confusion_matrix

#Load Dataset dataset =


pd.read_csv('dataset/Training.csv') dataset
dataset.shape dataset.isnull().sum()
dataset.describe() dataset.head(2)
dataset.prognosis.value_counts()
len(dataset.prognosis.value_counts())#total unique no. of desiese dataset.prognosis.unique()
X = dataset.drop('prognosis' , axis = 1) y = dataset['prognosis']
le = LabelEncoder()
le.fit(y)
Y = le.transform(y)
Y
X
Y
X_train, X_test, y_train, y_test = train_test_split(X,Y , test_size=0.3, random_state=42)
X_train X_test models = {
'SVC': SVC(kernel = 'linear'),

'
Random_forest' : RandomForestClassifier(n_estimators= 100 , random_state=42),
'Gradiant_Boosting': GradientBoostingClassifier(n_estimators=100 , random_state = 42),
'MultiNomialNB' : MultinomialNB(),

Dept of 2024- 7
MEDICINE RECOMMENDATION

'Kneighbours': KNeighborsClassifier(n_neighbors= 5 )
}

for model_name , model in models.items():


model.fit(X_train,y_train) y_pred =
model.predict(X_test) accuracy =
accuracy_score(y_test, y_pred ) cm =
confusion_matrix(y_test , y_pred) print(‘’)
print(f"{model_name } accuracy :{accuracy}")
print(f"{model_name } Confusion_matrics : {cm}")
print(np.array2string(cm, separator = ",") )
rf = RandomForestClassifier(n_estimators= 100 , random_state=42)
rf.fit(X_train , y_train) y_pred = rf.predict(X_test)
accuracy = accuracy_score(y_test , y_pred)
accuracy svc = SVC(kernel = 'linear') svc =
SVC(kernel = 'linear') svc.fit(X_train ,
y_train) y_pred = svc.predict(X_test)
accuracy = accuracy_score(y_test , y_pred) accuracy
import pickle pickle.dump(rf ,
open('model/rf.pkl','wb') )# for RF model pickle.dump(svc ,
open('model/svc.pkl','wb') )# for Svc model

#load model
rf = pickle.load(open("model/rf.pkl", 'rb')) svc
= pickle.load(open("model/svc.pkl", 'rb'))

#load few data set precaution =


pd.read_csv("dataset/precautions_df.csv") workout =
pd.read_csv("dataset/workout_df.csv") medication =
pd.read_csv('dataset/medications.csv') diets =
pd.read_csv('dataset/diets.csv')
description = pd.read_csv("dataset/description.csv")

#healper Function def helper(dis): descr =


description[description['Disease'] == dis ]['Description'] descr =
" ".join({ w for w in descr})
pre=
precaution[precaution['Disease'] == dis
][['Precaution_1', 'Precaution_2',
'Precaution_3', 'Precaution_4']] pre
= [col for col in pre.values] die =
diets[diets['Disease']== dis ]['Diet'] die =
[die for die in die.values]
work = workout[workout['disease']== dis ]['workout'] med
= medication[medication['Disease'] == dis ]['Medication']
med = [med for med in med.values]
return descr , pre , die , med, work

Dept of 2024- 8
MEDICINE RECOMMENDATION

symptom_dict = {'itching','skin_rash','nodal_skin_eruptions','continuous_sneezing','shivering',
'chills','joint_pain','stomach_pain','acidity','ulcers_on_tongue'.

diseases_list = {'Fungalinfection''Hepatitis C','Hepatitis E','Alcoholichepatitis','Tuberculosis',


'CommonCold''Pneumonia','Dimorphichemmorhoids(piles)','Heartattack'.

#model prediction def


get_predicted_value(patient_symptoms): input_vector =
np.zeros(len(symptom_dict)) for item in patient_symptoms:
input_vector[symptom_dict[item]] = 1 return
diseases_list[svc.predict([input_vector])[0]] symptoms =
input('Enter Your Symptoms Here..') user_symptoms = [ s for
s in symptoms.split(',')] user_symptoms = [ sym.strip("[]'")
for sym in user_symptoms] predicted_disease =
get_predicted_value(user_symptoms) descr , pre , die ,
med, work = helper(predicted_disease)

#Result Time print('Predicted


Disease ')
print(" Ashveen's Machine Prediction is:-", predicted_disease )
print('Predicted Description ') print(descr)
print('Predicted Precaution')
i = 1 for j
in pre[0]:
print(i , ':' , j) i +=
1 print('Predicted Diets
') for i in die: print(i)
print('Predicted Medication')
i = 1 for j
in med:
print(i, ":",
j) i+= 1
print('Predicted workout ')
i = 1 for j in
med:
print(i, ":", j)
i+= 1

# descr = description[description['Disease'] == predicted_disease]['Description']


# descr = " ".join({ w for w in descr})
# pre = precaution[precaution['Disease'] == predicted_disease][['Precaution_1', 'Precaution_2',
'Precaution_3' ,'Precaution_4']] #
pre = [col for col in pre.values]

Dept of 2024- 9
MEDICINE RECOMMENDATION

CHAPTER 6

RESULTS
The medicine recommendation system using machine learning demonstrated significant
potential in enhancing personalized healthcare. The Random Forest algorithm achieved
an impressive accuracy of 85%, with precision and recall rates of 84% and 86%,
respectively, outperforming both the Support Vector Machine (SVM) and Logistic Regression
models. However, the system faced challenges in handling rare and complex cases, indicating
areas for future improvement. Overall, the results validate the system's efficacy in providing
accurate and relevant medication suggestions, marking a significant step towards more

personalized and effective healthcare solutions.

Dept of 2024- 1
MEDICINE RECOMMENDATION

CHAPTER 7

SCREENSHOTS

Fig 7.1 Homepage

Fig 7.2 Input Symptoms

Dept of 2024- 1
MEDICINE RECOMMENDATION

Fig 7.3 Predicted disease

Fig 7.4 Description of disease

Dept of 2024- 1
MEDICINE RECOMMENDATION

Fig 7.5 Precaution

Fig 7.6 Medications

Dept of 2024- 1
MEDICINE RECOMMENDATION

Fig 7.7 Workouts

Fig 7.8 Diets

Dept of 2024- 1
MEDICINE RECOMMENDATION

CHAPTER 8

CONCLUSION
The Medicine Recommendation System project successfully meets its objectives by
integrating multiple datasets, including symptoms, precautions, descriptions, medications,
and diets, to provide comprehensive disease information. Utilizing an SVC (Support Vector
Classification) model, the system analyzes user-reported symptoms to offer accurate
disease predictions. Despite initial challenges with feature mismatches, the application
effectively manages user inputs and delivers detailed recommendations through a user-friendly
Flaskbased web interface. Future improvements could focus on aligning features, expanding
the database, integrating user feedback, and developing mobile compatibility. Overall, the
system enhances personalized healthcare by providing valuable insights and
recommendations, with the potential to significantly improve disease diagnosis and
management.

Dept of 2024- 1
MEDICINE RECOMMENDATION

REFERENCES

1. Personalized Medicine: A Review of the Research by M. G. Michael


2. Medical Recommendation System Using Machine Learning Techniques: A Review by S. R.
Patil
3. A Survey of Healthcare Recommendation Systems by M. Khan and A. A. Khan
4. Recommendation Systems in Healthcare: A Review by M. K. Gupta and R. R. Karkare

Dept of 2024- 1

You might also like