Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
app-frontend/.env
app-frontend/app.json
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,31 @@
# S6-mini project
S6 mini project.
# MedChat

## Description
MedChat is a chatbot designed to provide medical assistance and information. It leverages machine learning techniques and natural language processing (NLP) algorithms to understand user queries, offer relevant responses, and provide guidance on various medical topics.

The chatbot utilizes a machine learning model trained on a dataset of medical diseases and symptoms.

## Installation
1. Clone the repository.
2. Navigate to the project directory app-frontend and app-backend in two terminals.
3. Install the required dependencies.
4. Run the front-end on the ExpoGo app and the back-end simultaneously.
5. Success!

## Features
- **Disease Prediction**: The ML model will predict the disease based on the symptoms entered. We only provide a predictive diagnosis and always recommend the user to visit a doctor.
- **Medical Information**: Obtain detailed information about diseases, causes, and precautions. Data is fetched from NIH-NLM(National Institute of Health, National Library of Medicine) API.
- **Hospital Finder**: Find Nearby Hospitals using this option which is dedicated specially for nearby hospitals. Helpful during emergency situations.

## Screenshots
<p float="left">
<img src="ss/ss6.jpg" width="220">&nbsp;&nbsp;&nbsp;
<img src = "ss/sss1.jpg" width = "220" >&nbsp;&nbsp;&nbsp;
<img src = "ss/sss2.jpg" width = "220" >&nbsp;&nbsp;&nbsp;
<img src = "ss/sss3.jpg" width = "220" >&nbsp;&nbsp;&nbsp;
<img src = "ss/sss4.jpg" width = "220" >&nbsp;&nbsp;&nbsp;
<img src = "ss/sss5.jpg" width = "220" >&nbsp;&nbsp;&nbsp;
</p>



9 changes: 0 additions & 9 deletions app-backend/.gitignore

This file was deleted.

43 changes: 43 additions & 0 deletions app-backend/DataPreProcessing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier

df1=pd.read_csv("dataset.csv")
df1.shape

df1 = df1.replace(np.nan, '', regex=True)

df3=df1.drop(['Disease'],axis='columns') # remove disease col from dataset
df3 = df1['Symptom_1'].map(str) + ' ' + df1['Symptom_2'].map(str) + ' ' + df1['Symptom_3'].map(str)+ ' ' + df1['Symptom_4'].map(str)+ ' ' + df1['Symptom_5'].map(str)+ ' ' + df1['Symptom_6'].map(str)+ ' ' + df1['Symptom_7'].map(str)+ ' ' + df1['Symptom_8'].map(str)+ ' ' + df1['Symptom_9'].map(str)+ ' ' + df1['Symptom_10'].map(str)+ ' ' + df1['Symptom_11'].map(str)+ ' ' + df1['Symptom_12'].map(str)+ ' ' + df1['Symptom_13'].map(str)+ ' ' + df1['Symptom_14'].map(str)+ ' ' + df1['Symptom_15'].map(str)+ ' ' + df1['Symptom_16'].map(str)+ ' ' + df1['Symptom_17'].map(str)


corpus = df3.tolist()
vectorizer = CountVectorizer()
X = vectorizer.fit_transform(corpus)
headings=vectorizer.get_feature_names_out()
symptoms_list=headings



# headings.append('prognosis')
headings = np.concatenate((headings, ['prognosis']))

print("symptoms_list : ",symptoms_list)

X=X.toarray() # stored in matrix

df4 = pd.DataFrame(X)
df5=pd.concat([df4,df1.Disease],axis='columns')
df5.columns=headings
# df5.drop_duplicates(keep='first',inplace=True)
df5.to_csv('disease_symptom_mapping.csv',index=False) #df5 has diseases and last col as prognosis

#adding symptoms list to a .csv file
symp=pd.DataFrame(symptoms_list)
symp.columns=['Symptoms']
last_row = len(symp)-1
symp = symp.drop(symp.index[last_row])
symp.to_csv('Symptoms.csv',index=False)
Loading