Spaces:
Sleeping
Sleeping
Upload 17 files
Browse files- .gitattributes +1 -0
- Doctor.py +162 -0
- Hospital.py +224 -0
- Nurse.py +19 -0
- Operation.py +133 -0
- Patient.py +121 -0
- Person.py +26 -0
- README.md +0 -12
- RSC_CureNet_Integrated Care Network with Predictive Analytic.pptx +3 -0
- app.py +796 -0
- diabetes_model.sav +0 -0
- doctors.csv +2 -0
- heart_disease_model.sav +0 -0
- nurses.csv +2 -0
- operations.csv +2 -0
- parkinsons_model.sav +0 -0
- patients.csv +2 -0
- requirements.txt +5 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
RSC_CureNet_Integrated[[:space:]]Care[[:space:]]Network[[:space:]]with[[:space:]]Predictive[[:space:]]Analytic.pptx filter=lfs diff=lfs merge=lfs -text
|
Doctor.py
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from Person import *
|
| 2 |
+
import os
|
| 3 |
+
import pandas as pd
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class Doctor(Person):
|
| 7 |
+
"""
|
| 8 |
+
'Doctor' is a subclass of 'Person' and includes additional attributes like 'specialization' and a list of 'patients'.
|
| 9 |
+
"""
|
| 10 |
+
__doctors_db = "doctors.csv"
|
| 11 |
+
__nurses_db = "nurses.csv"
|
| 12 |
+
__patients_db = "patients.csv"
|
| 13 |
+
__doctor_nurse_db = "doctor_nurse.csv"
|
| 14 |
+
__doctor_patient_db = "doctor_patient.csv"
|
| 15 |
+
|
| 16 |
+
def __init__(self, name, age, gender, phone, specialization):
|
| 17 |
+
super().__init__(name, age, gender, phone)
|
| 18 |
+
self.specialization = specialization
|
| 19 |
+
self.patients = []
|
| 20 |
+
|
| 21 |
+
@classmethod
|
| 22 |
+
def empty_Doctor_constructor(cls):
|
| 23 |
+
cls.name = ""
|
| 24 |
+
cls.age = ""
|
| 25 |
+
cls.gender = ""
|
| 26 |
+
cls.phone = ""
|
| 27 |
+
cls.specialization = ""
|
| 28 |
+
|
| 29 |
+
return cls(cls.name,
|
| 30 |
+
cls.age,
|
| 31 |
+
cls.gender,
|
| 32 |
+
cls.phone,
|
| 33 |
+
cls.specialization,
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
def add_patient(self, patient):
|
| 37 |
+
self.patients.append(patient)
|
| 38 |
+
print(f"Patient {patient.name} added to {self.name}'s list.")
|
| 39 |
+
|
| 40 |
+
# Adding Nurse To The Team
|
| 41 |
+
def check_doctor_db(self, doctor_name, doctor_phone):
|
| 42 |
+
"""
|
| 43 |
+
Return True If Doctor Already EXist, and False if Not
|
| 44 |
+
"""
|
| 45 |
+
if os.path.isfile(Doctor.__doctors_db):
|
| 46 |
+
df = pd.read_csv(Doctor.__doctors_db)
|
| 47 |
+
|
| 48 |
+
doctor_phone = f"'{doctor_phone}'" # Same Stored Format
|
| 49 |
+
filt = (df["Name"] == doctor_name) & (
|
| 50 |
+
df["Phone"] == doctor_phone)
|
| 51 |
+
if sum(filt) == 1:
|
| 52 |
+
return True
|
| 53 |
+
else:
|
| 54 |
+
return False
|
| 55 |
+
else:
|
| 56 |
+
return False
|
| 57 |
+
|
| 58 |
+
def check_nurse_db(self, nurse_name, nurse_phone):
|
| 59 |
+
"""
|
| 60 |
+
Return True If Nurse Already EXist, and False if Not
|
| 61 |
+
"""
|
| 62 |
+
if os.path.isfile(Doctor.__nurses_db):
|
| 63 |
+
df = pd.read_csv(Doctor.__nurses_db)
|
| 64 |
+
|
| 65 |
+
nurse_phone = f"'{nurse_phone}'" # Same Stored Format
|
| 66 |
+
|
| 67 |
+
filt = (df["Name"] == nurse_name) & (
|
| 68 |
+
df["Phone"] == nurse_phone)
|
| 69 |
+
|
| 70 |
+
if sum(filt) == 1:
|
| 71 |
+
return True
|
| 72 |
+
else:
|
| 73 |
+
return False
|
| 74 |
+
else:
|
| 75 |
+
return False
|
| 76 |
+
|
| 77 |
+
def check_patient_db(self, patient_id, patient_name):
|
| 78 |
+
"""
|
| 79 |
+
Return True If Patient Already EXist, and False if Not
|
| 80 |
+
"""
|
| 81 |
+
if os.path.isfile(Doctor.__patients_db):
|
| 82 |
+
df = pd.read_csv(Doctor.__patients_db)
|
| 83 |
+
|
| 84 |
+
filt = (df["Name"] == patient_name) & (
|
| 85 |
+
df["Patient_ID"] == patient_id)
|
| 86 |
+
|
| 87 |
+
if sum(filt) == 1:
|
| 88 |
+
return True
|
| 89 |
+
else:
|
| 90 |
+
return False
|
| 91 |
+
else:
|
| 92 |
+
return False
|
| 93 |
+
|
| 94 |
+
def add_nurse_to_team(self, doctor_name, doctor_phone, nurse_name, nurse_phone):
|
| 95 |
+
if self.check_doctor_db(doctor_name, doctor_phone) and self.check_nurse_db(nurse_name, nurse_phone):
|
| 96 |
+
doctor_phone = f"'{doctor_phone}'"
|
| 97 |
+
nurse_phone = f"'{nurse_phone}'"
|
| 98 |
+
row_to_check = pd.Series({"Doctor": doctor_name,
|
| 99 |
+
"Doctor_Phone": doctor_phone,
|
| 100 |
+
"Nurse": nurse_name,
|
| 101 |
+
"Nurse_Phone": nurse_phone})
|
| 102 |
+
|
| 103 |
+
if os.path.isfile(Doctor.__doctor_nurse_db):
|
| 104 |
+
|
| 105 |
+
# Read Doctors_Nurse DB
|
| 106 |
+
df = pd.read_csv(Doctor.__doctor_nurse_db)
|
| 107 |
+
|
| 108 |
+
# To Check if The Nurse Already In The Doctor's Team
|
| 109 |
+
# => True if There is No Duplicates
|
| 110 |
+
if df[df.eq(row_to_check).all(axis=1)].empty:
|
| 111 |
+
df_to_append = pd.DataFrame([row_to_check])
|
| 112 |
+
pd.concat([df, df_to_append]).drop_duplicates().to_csv(
|
| 113 |
+
Doctor.__doctor_nurse_db, index=False)
|
| 114 |
+
|
| 115 |
+
else:
|
| 116 |
+
return -1
|
| 117 |
+
else:
|
| 118 |
+
df = pd.DataFrame([row_to_check])
|
| 119 |
+
df.to_csv(Doctor.__doctor_nurse_db, index=False)
|
| 120 |
+
else:
|
| 121 |
+
return False
|
| 122 |
+
|
| 123 |
+
def add_patient_to_doctor(self, doctor_name, doctor_phone, patient_id, patient_name):
|
| 124 |
+
if self.check_doctor_db(doctor_name, doctor_phone) and self.check_patient_db(patient_id, patient_name):
|
| 125 |
+
doctor_phone = f"'{doctor_phone}'"
|
| 126 |
+
row_to_check = pd.Series({"Doctor": doctor_name,
|
| 127 |
+
"Doctor_Phone": doctor_phone,
|
| 128 |
+
"Patient": patient_name,
|
| 129 |
+
"Patient_ID": patient_id})
|
| 130 |
+
|
| 131 |
+
if os.path.isfile(Doctor.__doctor_patient_db):
|
| 132 |
+
|
| 133 |
+
# Read Doctors_Nurse DB
|
| 134 |
+
df = pd.read_csv(Doctor.__doctor_patient_db)
|
| 135 |
+
|
| 136 |
+
# To Check if The Nurse Already In The Doctor's Team
|
| 137 |
+
# => True if There is No Duplicates
|
| 138 |
+
if df[df.eq(row_to_check).all(axis=1)].empty:
|
| 139 |
+
df_to_append = pd.DataFrame([row_to_check])
|
| 140 |
+
pd.concat([df, df_to_append]).drop_duplicates().to_csv(
|
| 141 |
+
Doctor.__doctor_patient_db, index=False)
|
| 142 |
+
|
| 143 |
+
else:
|
| 144 |
+
return -1
|
| 145 |
+
else:
|
| 146 |
+
df = pd.DataFrame([row_to_check])
|
| 147 |
+
df.to_csv(Doctor.__doctor_patient_db, index=False)
|
| 148 |
+
else:
|
| 149 |
+
return False
|
| 150 |
+
|
| 151 |
+
# def add_nurse(self, nurse):
|
| 152 |
+
# print(f"Nurse {nurse.name} added to {self.name}'s team.")
|
| 153 |
+
|
| 154 |
+
def display_info(self):
|
| 155 |
+
super().display_info()
|
| 156 |
+
print(f"Specialization: {self.specialization}")
|
| 157 |
+
print("Patients:")
|
| 158 |
+
for patient in self.patients:
|
| 159 |
+
print(f"- {patient.name}")
|
| 160 |
+
|
| 161 |
+
def get_specialization(self):
|
| 162 |
+
return self.specialization
|
Hospital.py
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from Doctor import *
|
| 2 |
+
from Nurse import *
|
| 3 |
+
from Patient import *
|
| 4 |
+
import os
|
| 5 |
+
import numpy as np
|
| 6 |
+
import pandas as pd
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class Hospital:
|
| 10 |
+
"""
|
| 11 |
+
In the 'Hospital' class, there are lists (self.doctors and self.nurses) that represent a composition
|
| 12 |
+
relationship with the 'Doctor' and 'Nurse' classes. The Hospital 'has' doctors and nurses as part of its composition.
|
| 13 |
+
The methods 'add_doctor' and 'add_nurse' are used to add instances of 'Doctor' and Nurse to the hospital.
|
| 14 |
+
"""
|
| 15 |
+
# Doctors Data Structure
|
| 16 |
+
__doctors_db = "doctors.csv"
|
| 17 |
+
__doctors_list = []
|
| 18 |
+
__doctors_dict = dict()
|
| 19 |
+
|
| 20 |
+
# Nurse Data Structure
|
| 21 |
+
__nurses_db = "nurses.csv"
|
| 22 |
+
__nurses_list = []
|
| 23 |
+
__nurses_dict = dict()
|
| 24 |
+
|
| 25 |
+
# Patient Data Structure
|
| 26 |
+
__patients_db = "patients.csv"
|
| 27 |
+
__patients_list = []
|
| 28 |
+
__patients_dict = dict()
|
| 29 |
+
|
| 30 |
+
def __init__(self, name, location):
|
| 31 |
+
self.name = name
|
| 32 |
+
self.location = location
|
| 33 |
+
|
| 34 |
+
# ============ Doctor ============
|
| 35 |
+
|
| 36 |
+
def check_doctor_exist(self, doctor: Doctor):
|
| 37 |
+
"""
|
| 38 |
+
Return True If User Exist Fasle If Not Return False
|
| 39 |
+
"""
|
| 40 |
+
if doctor.get_phone() in [doc.get_phone() for doc in Hospital.__doctors_list]:
|
| 41 |
+
return True
|
| 42 |
+
|
| 43 |
+
else:
|
| 44 |
+
if os.path.isfile(Hospital.__doctors_db):
|
| 45 |
+
df = pd.read_csv(Hospital.__doctors_db)
|
| 46 |
+
filt = (df["Phone"] == doctor.get_phone())
|
| 47 |
+
if sum(filt) == 0:
|
| 48 |
+
return False
|
| 49 |
+
else:
|
| 50 |
+
return True
|
| 51 |
+
else:
|
| 52 |
+
return False
|
| 53 |
+
|
| 54 |
+
def add_doctor(self, doctor: Doctor):
|
| 55 |
+
if self.check_doctor_exist(doctor):
|
| 56 |
+
return False
|
| 57 |
+
else:
|
| 58 |
+
Hospital.__doctors_list.append(doctor)
|
| 59 |
+
|
| 60 |
+
def save_doctor(self):
|
| 61 |
+
if len(Hospital.__doctors_list) != 0:
|
| 62 |
+
name, age, gender, phone, specializations = [], [], [], [], []
|
| 63 |
+
for doctor in Hospital.__doctors_list:
|
| 64 |
+
name.append(doctor.get_name())
|
| 65 |
+
age.append(doctor.get_age())
|
| 66 |
+
gender.append(doctor.get_gender())
|
| 67 |
+
phone.append(doctor.get_phone())
|
| 68 |
+
specializations.append(doctor.get_specialization())
|
| 69 |
+
|
| 70 |
+
Hospital.__doctors_dict["Name"] = name
|
| 71 |
+
Hospital.__doctors_dict["Age"] = age
|
| 72 |
+
Hospital.__doctors_dict["Gender"] = gender
|
| 73 |
+
Hospital.__doctors_dict["Phone"] = phone
|
| 74 |
+
Hospital.__doctors_dict["Specialization"] = specializations
|
| 75 |
+
|
| 76 |
+
df = pd.DataFrame(Hospital.__doctors_dict)
|
| 77 |
+
if os.path.isfile(Hospital.__doctors_db):
|
| 78 |
+
pd.concat([pd.read_csv(Hospital.__doctors_db), df]).drop_duplicates().to_csv(
|
| 79 |
+
Hospital.__doctors_db, index=False)
|
| 80 |
+
|
| 81 |
+
Hospital.__doctors_list = []
|
| 82 |
+
else:
|
| 83 |
+
df.to_csv(Hospital.__doctors_db, index=False)
|
| 84 |
+
Hospital.__doctors_list = []
|
| 85 |
+
else:
|
| 86 |
+
return 0
|
| 87 |
+
|
| 88 |
+
def get_all_doctors(self):
|
| 89 |
+
if os.path.isfile(Hospital.__doctors_db):
|
| 90 |
+
df = pd.read_csv(Hospital.__doctors_db)
|
| 91 |
+
return df
|
| 92 |
+
else:
|
| 93 |
+
return pd.DataFrame()
|
| 94 |
+
|
| 95 |
+
# ============ Nurse ============
|
| 96 |
+
def check_nurse_exist(self, nurse: Nurse):
|
| 97 |
+
"""
|
| 98 |
+
Return True If User Exist Fasle If Not Return False
|
| 99 |
+
"""
|
| 100 |
+
if nurse.get_phone() in [nur.get_phone() for nur in Hospital.__nurses_list]:
|
| 101 |
+
return True
|
| 102 |
+
|
| 103 |
+
else:
|
| 104 |
+
if os.path.isfile(Hospital.__nurses_db):
|
| 105 |
+
df = pd.read_csv(Hospital.__nurses_db)
|
| 106 |
+
filt = (df["Phone"] == nurse.get_phone())
|
| 107 |
+
if sum(filt) == 0:
|
| 108 |
+
return False
|
| 109 |
+
else:
|
| 110 |
+
return True
|
| 111 |
+
else:
|
| 112 |
+
return False
|
| 113 |
+
|
| 114 |
+
def add_nurse(self, nurse: Nurse):
|
| 115 |
+
if self.check_nurse_exist(nurse):
|
| 116 |
+
return False
|
| 117 |
+
else:
|
| 118 |
+
Hospital.__nurses_list.append(nurse)
|
| 119 |
+
|
| 120 |
+
def save_nurse(self):
|
| 121 |
+
if len(Hospital.__nurses_list) != 0:
|
| 122 |
+
name, age, gender, phone, shift = [], [], [], [], []
|
| 123 |
+
for nurse in Hospital.__nurses_list:
|
| 124 |
+
name.append(nurse.get_name())
|
| 125 |
+
age.append(nurse.get_age())
|
| 126 |
+
gender.append(nurse.get_gender())
|
| 127 |
+
phone.append(nurse.get_phone())
|
| 128 |
+
shift.append(nurse.get_shift())
|
| 129 |
+
|
| 130 |
+
Hospital.__nurses_dict["Name"] = name
|
| 131 |
+
Hospital.__nurses_dict["Age"] = age
|
| 132 |
+
Hospital.__nurses_dict["Gender"] = gender
|
| 133 |
+
Hospital.__nurses_dict["Phone"] = phone
|
| 134 |
+
Hospital.__nurses_dict["Shift_Type"] = shift
|
| 135 |
+
|
| 136 |
+
df = pd.DataFrame(Hospital.__nurses_dict)
|
| 137 |
+
if os.path.isfile(Hospital.__nurses_db):
|
| 138 |
+
pd.concat([pd.read_csv(Hospital.__nurses_db), df]).drop_duplicates().to_csv(
|
| 139 |
+
Hospital.__nurses_db, index=False)
|
| 140 |
+
|
| 141 |
+
Hospital.__nurses_list = []
|
| 142 |
+
else:
|
| 143 |
+
df.to_csv(Hospital.__nurses_db, index=False)
|
| 144 |
+
Hospital.__nurses_list = []
|
| 145 |
+
else:
|
| 146 |
+
return 0
|
| 147 |
+
|
| 148 |
+
def get_all_nurses(self):
|
| 149 |
+
if os.path.isfile(Hospital.__nurses_db):
|
| 150 |
+
df = pd.read_csv(Hospital.__nurses_db)
|
| 151 |
+
return df
|
| 152 |
+
else:
|
| 153 |
+
return pd.DataFrame()
|
| 154 |
+
|
| 155 |
+
# ============ Patient ===========
|
| 156 |
+
def check_patient_exist(self, patient: Patient):
|
| 157 |
+
"""
|
| 158 |
+
Return True If User Exist Fasle If Not Return False
|
| 159 |
+
"""
|
| 160 |
+
if patient.get_phone() in [p.get_phone() for p in Hospital.__patients_list]:
|
| 161 |
+
return True
|
| 162 |
+
|
| 163 |
+
else:
|
| 164 |
+
if os.path.isfile(Hospital.__patients_db):
|
| 165 |
+
df = pd.read_csv(Hospital.__patients_db)
|
| 166 |
+
filt = (df["Phone"] == patient.get_phone())
|
| 167 |
+
if sum(filt) == 0:
|
| 168 |
+
return False
|
| 169 |
+
else:
|
| 170 |
+
return True
|
| 171 |
+
else:
|
| 172 |
+
return False
|
| 173 |
+
|
| 174 |
+
def add_patient(self, patient: Patient):
|
| 175 |
+
if self.check_patient_exist(patient):
|
| 176 |
+
|
| 177 |
+
return False
|
| 178 |
+
else:
|
| 179 |
+
Hospital.__patients_list.append(patient)
|
| 180 |
+
|
| 181 |
+
def save_patient(self):
|
| 182 |
+
if len(Hospital.__patients_list) != 0:
|
| 183 |
+
patient_id, name, age, gender, phone = [], [], [], [], []
|
| 184 |
+
for patient in Hospital.__patients_list:
|
| 185 |
+
patient_id.append(patient.get_patient_id())
|
| 186 |
+
name.append(patient.get_name())
|
| 187 |
+
age.append(patient.get_age())
|
| 188 |
+
gender.append(patient.get_gender())
|
| 189 |
+
phone.append(patient.get_phone())
|
| 190 |
+
|
| 191 |
+
Hospital.__patients_dict["Patient_ID"] = patient_id
|
| 192 |
+
Hospital.__patients_dict["Name"] = name
|
| 193 |
+
Hospital.__patients_dict["Age"] = age
|
| 194 |
+
Hospital.__patients_dict["Gender"] = gender
|
| 195 |
+
Hospital.__patients_dict["Phone"] = phone
|
| 196 |
+
|
| 197 |
+
df = pd.DataFrame(Hospital.__patients_dict)
|
| 198 |
+
if os.path.isfile(Hospital.__patients_db):
|
| 199 |
+
pd.concat([pd.read_csv(Hospital.__patients_db), df]).drop_duplicates().to_csv(
|
| 200 |
+
Hospital.__patients_db, index=False)
|
| 201 |
+
|
| 202 |
+
Hospital.__patients_list = []
|
| 203 |
+
else:
|
| 204 |
+
df.to_csv(Hospital.__patients_db, index=False)
|
| 205 |
+
Hospital.__patients_list = []
|
| 206 |
+
else:
|
| 207 |
+
return 0
|
| 208 |
+
|
| 209 |
+
def get_all_patients(self):
|
| 210 |
+
if os.path.isfile(Hospital.__patients_db):
|
| 211 |
+
df = pd.read_csv(Hospital.__patients_db)
|
| 212 |
+
return df
|
| 213 |
+
else:
|
| 214 |
+
return pd.DataFrame()
|
| 215 |
+
|
| 216 |
+
def display_info(self):
|
| 217 |
+
print(f"Hospital: {self.name}")
|
| 218 |
+
print(f"Location: {self.location}")
|
| 219 |
+
print("Doctors:")
|
| 220 |
+
for doctor in Hospital.__doctors_list:
|
| 221 |
+
print(f"- {doctor.name}")
|
| 222 |
+
print("Nurses:")
|
| 223 |
+
for nurse in self.nurses:
|
| 224 |
+
print(f"- {nurse.name}")
|
Nurse.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from Person import *
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class Nurse(Person):
|
| 5 |
+
"""
|
| 6 |
+
The 'Nurse' class inherits from the 'Person' class. This means that a 'Nurse' is a specialized type of 'Person'
|
| 7 |
+
and inherits the attributes and methods of the 'Person' class.
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
def __init__(self, name, age, gender, phone, shift):
|
| 11 |
+
super().__init__(name, age, gender, phone)
|
| 12 |
+
self.shift = shift
|
| 13 |
+
|
| 14 |
+
def display_info(self):
|
| 15 |
+
super().display_info()
|
| 16 |
+
print(f"Shift: {self.shift}")
|
| 17 |
+
|
| 18 |
+
def get_shift(self):
|
| 19 |
+
return self.shift
|
Operation.py
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import pandas as pd
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class Operation:
|
| 6 |
+
"""
|
| 7 |
+
In the 'Operation' class, the attribute 'self.surgeon' represents a composition relationship with the 'Doctor' class.
|
| 8 |
+
Additionally, the list 'self.nurses' represents a composition relationship with the 'Nurse' class.
|
| 9 |
+
The method 'add_nurse' is used to add instances of 'Nurse' to the operation.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
__operation_db = "operations.csv"
|
| 13 |
+
__nurses_list = []
|
| 14 |
+
__operation_count = 1
|
| 15 |
+
|
| 16 |
+
def count_rows_csv(file_path):
|
| 17 |
+
try:
|
| 18 |
+
with open(file_path, 'rb') as file:
|
| 19 |
+
line_count = sum(1 for line in file)
|
| 20 |
+
return line_count
|
| 21 |
+
|
| 22 |
+
except Exception as e:
|
| 23 |
+
return 1
|
| 24 |
+
|
| 25 |
+
if __operation_count == 1 and os.path.isfile("operations.csv"):
|
| 26 |
+
__operation_count = count_rows_csv("patients.csv")
|
| 27 |
+
|
| 28 |
+
def __init__(self, name, date, time, surgeon, nurses=[]):
|
| 29 |
+
self.__name = name
|
| 30 |
+
self.__date = date
|
| 31 |
+
self.__time = time
|
| 32 |
+
self.__surgeon = surgeon
|
| 33 |
+
self.__nurses = nurses
|
| 34 |
+
self.__operation_id = f"{name}_{surgeon}_{Operation.__operation_count}"
|
| 35 |
+
|
| 36 |
+
@classmethod
|
| 37 |
+
def empty_operation_constructor(cls):
|
| 38 |
+
cls.name = ""
|
| 39 |
+
cls.date = ""
|
| 40 |
+
cls.time = ""
|
| 41 |
+
cls.surgeon = ""
|
| 42 |
+
cls.nurses = []
|
| 43 |
+
|
| 44 |
+
return cls(cls.name,
|
| 45 |
+
cls.date,
|
| 46 |
+
cls.time,
|
| 47 |
+
cls.surgeon,
|
| 48 |
+
cls.nurses
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
# ===== Getter Methods =====
|
| 52 |
+
|
| 53 |
+
def get_operation_name(self):
|
| 54 |
+
return self.__name
|
| 55 |
+
|
| 56 |
+
def get_operation_date(self):
|
| 57 |
+
return self.__date
|
| 58 |
+
|
| 59 |
+
def get_operation_time(self):
|
| 60 |
+
return self.__time
|
| 61 |
+
|
| 62 |
+
def get_operation_surgeon(self):
|
| 63 |
+
return self.__surgeon
|
| 64 |
+
|
| 65 |
+
def get_operation_id(self):
|
| 66 |
+
return self.__operation_id
|
| 67 |
+
|
| 68 |
+
def get_nurses(self):
|
| 69 |
+
return "/".join(Operation.__nurses_list)
|
| 70 |
+
|
| 71 |
+
# ======= Setter Methods =======
|
| 72 |
+
|
| 73 |
+
def set_operation_name(self, operation_name):
|
| 74 |
+
self.__name = operation_name
|
| 75 |
+
|
| 76 |
+
def set_operation_date(self, operation_date):
|
| 77 |
+
self.__date = operation_date
|
| 78 |
+
|
| 79 |
+
def set_operation_time(self, operation_time):
|
| 80 |
+
self.__time = operation_time
|
| 81 |
+
|
| 82 |
+
def set_operation_surgeon(self, operation_surgeon):
|
| 83 |
+
self.__surgeon = operation_surgeon
|
| 84 |
+
|
| 85 |
+
def set_operation_id(self, operation_name, surgeon_name):
|
| 86 |
+
self.__operation_id = f"{operation_name[0:4]}_{surgeon_name}_{Operation.__operation_count}"
|
| 87 |
+
|
| 88 |
+
def add_nurse(self, nurse_name):
|
| 89 |
+
if nurse_name not in Operation.__nurses_list:
|
| 90 |
+
Operation.__nurses_list.append(nurse_name)
|
| 91 |
+
else:
|
| 92 |
+
return 0
|
| 93 |
+
|
| 94 |
+
def create_operation(self):
|
| 95 |
+
row_to_check = pd.Series({"Operation_ID": self.get_operation_id(),
|
| 96 |
+
"Date": self.get_operation_date(),
|
| 97 |
+
"Time": self.get_operation_time(),
|
| 98 |
+
"Surgeon": self.get_operation_surgeon(),
|
| 99 |
+
"Nurses": self.get_nurses()})
|
| 100 |
+
|
| 101 |
+
if os.path.isfile(Operation.__operation_db):
|
| 102 |
+
# Read Doctors_Nurse DB
|
| 103 |
+
df = pd.read_csv(Operation.__operation_db)
|
| 104 |
+
|
| 105 |
+
# To Check if The Nurse Already In The Doctor's Team
|
| 106 |
+
# => True if There is No Duplicates
|
| 107 |
+
if df[df.eq(row_to_check).all(axis=1)].empty:
|
| 108 |
+
df_to_append = pd.DataFrame([row_to_check])
|
| 109 |
+
print(df_to_append)
|
| 110 |
+
pd.concat([df, df_to_append]).drop_duplicates().to_csv(
|
| 111 |
+
Operation.__operation_db, index=False)
|
| 112 |
+
Operation.__nurses_list = []
|
| 113 |
+
else:
|
| 114 |
+
return -1
|
| 115 |
+
else:
|
| 116 |
+
df = pd.DataFrame([row_to_check])
|
| 117 |
+
df.to_csv(Operation.__operation_db, index=False)
|
| 118 |
+
Operation.__nurses_list = []
|
| 119 |
+
|
| 120 |
+
def get_all_operation(self):
|
| 121 |
+
if os.path.isfile(Operation.__operation_db):
|
| 122 |
+
df = pd.read_csv(Operation.__operation_db)
|
| 123 |
+
return df
|
| 124 |
+
else:
|
| 125 |
+
return pd.DataFrame()
|
| 126 |
+
|
| 127 |
+
def display_info(self):
|
| 128 |
+
print(f"Operation: {self.name}")
|
| 129 |
+
print(f"Date: {self.date}, Time: {self.time}")
|
| 130 |
+
print(f"Surgeon: {self.surgeon.name}")
|
| 131 |
+
print("Nurses:")
|
| 132 |
+
for nurse in self.nurses:
|
| 133 |
+
print(f"- {nurse.name}")
|
Patient.py
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from Person import *
|
| 2 |
+
import os
|
| 3 |
+
import pandas as pd
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class Patient(Person):
|
| 7 |
+
"""
|
| 8 |
+
'Patient' is another subclass of 'Person' and includes attributes like 'patient_id' and a reference to the assigned 'doctor'.
|
| 9 |
+
"""
|
| 10 |
+
__patient_counter = 1
|
| 11 |
+
__doctor_patient_db = "doctor_patient.csv"
|
| 12 |
+
__doctors_db = "doctors.csv"
|
| 13 |
+
__patients_db = "patients.csv"
|
| 14 |
+
|
| 15 |
+
def count_rows_csv(file_path):
|
| 16 |
+
try:
|
| 17 |
+
with open(file_path, 'rb') as file:
|
| 18 |
+
line_count = sum(1 for line in file)
|
| 19 |
+
return line_count
|
| 20 |
+
|
| 21 |
+
except Exception as e:
|
| 22 |
+
return 1
|
| 23 |
+
|
| 24 |
+
if __patient_counter == 1 and os.path.isfile("patients.csv"):
|
| 25 |
+
__patient_counter = count_rows_csv("patients.csv")
|
| 26 |
+
|
| 27 |
+
def __init__(self, name, age, gender, phone):
|
| 28 |
+
super().__init__(name, age, gender, phone)
|
| 29 |
+
self.patient_id = f"PID_{Patient.__patient_counter:03d}"
|
| 30 |
+
Patient.__patient_counter += 1
|
| 31 |
+
self.doctor = None
|
| 32 |
+
|
| 33 |
+
@classmethod
|
| 34 |
+
def empty_patient_constructor(cls):
|
| 35 |
+
cls.name = ""
|
| 36 |
+
cls.age = ""
|
| 37 |
+
cls.gender = ""
|
| 38 |
+
cls.phone = ""
|
| 39 |
+
|
| 40 |
+
return cls(cls.name,
|
| 41 |
+
cls.age,
|
| 42 |
+
cls.gender,
|
| 43 |
+
cls.phone,
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
def check_doctor_db(self, doctor_name, doctor_phone):
|
| 47 |
+
"""
|
| 48 |
+
Return True If Doctor Already EXist, and False if Not
|
| 49 |
+
"""
|
| 50 |
+
if os.path.isfile(Patient.__doctors_db):
|
| 51 |
+
df = pd.read_csv(Patient.__doctors_db)
|
| 52 |
+
|
| 53 |
+
doctor_phone = f"'{doctor_phone}'" # Same Stored Format
|
| 54 |
+
filt = (df["Name"] == doctor_name) & (
|
| 55 |
+
df["Phone"] == doctor_phone)
|
| 56 |
+
if sum(filt) == 1:
|
| 57 |
+
return True
|
| 58 |
+
else:
|
| 59 |
+
return False
|
| 60 |
+
else:
|
| 61 |
+
return False
|
| 62 |
+
|
| 63 |
+
def check_patient_db(self, patient_id, patient_name):
|
| 64 |
+
"""
|
| 65 |
+
Return True If Patient Already EXist, and False if Not
|
| 66 |
+
"""
|
| 67 |
+
if os.path.isfile(Patient.__patients_db):
|
| 68 |
+
df = pd.read_csv(Patient.__patients_db)
|
| 69 |
+
|
| 70 |
+
filt = (df["Name"] == patient_name) & (
|
| 71 |
+
df["Patient_ID"] == patient_id)
|
| 72 |
+
|
| 73 |
+
if sum(filt) == 1:
|
| 74 |
+
return True
|
| 75 |
+
else:
|
| 76 |
+
return False
|
| 77 |
+
else:
|
| 78 |
+
return False
|
| 79 |
+
|
| 80 |
+
def assign_doctor_to_pateint(slef, doctor_name, doctor_phone, patient_id, patient_name):
|
| 81 |
+
if slef.check_doctor_db(doctor_name, doctor_phone) and slef.check_patient_db(patient_id, patient_name):
|
| 82 |
+
doctor_phone = f"'{doctor_phone}'"
|
| 83 |
+
row_to_check = pd.Series({"Doctor": doctor_name,
|
| 84 |
+
"Doctor_Phone": doctor_phone,
|
| 85 |
+
"Patient": patient_name,
|
| 86 |
+
"Patient_ID": patient_id})
|
| 87 |
+
|
| 88 |
+
if os.path.isfile(Patient.__doctor_patient_db):
|
| 89 |
+
|
| 90 |
+
# Read Doctors_Nurse DB
|
| 91 |
+
df = pd.read_csv(Patient.__doctor_patient_db)
|
| 92 |
+
|
| 93 |
+
# To Check if The Nurse Already In The Doctor's Team
|
| 94 |
+
# => True if There is No Duplicates
|
| 95 |
+
if df[df.eq(row_to_check).all(axis=1)].empty:
|
| 96 |
+
df_to_append = pd.DataFrame([row_to_check])
|
| 97 |
+
pd.concat([df, df_to_append]).drop_duplicates().to_csv(
|
| 98 |
+
Patient.__doctor_patient_db, index=False)
|
| 99 |
+
|
| 100 |
+
else:
|
| 101 |
+
return -1
|
| 102 |
+
else:
|
| 103 |
+
df = pd.DataFrame([row_to_check])
|
| 104 |
+
df.to_csv(Patient.__doctor_patient_db, index=False)
|
| 105 |
+
else:
|
| 106 |
+
return False
|
| 107 |
+
|
| 108 |
+
def assign_doctor(self, doctor):
|
| 109 |
+
self.doctor = doctor
|
| 110 |
+
print(f"{self.name} assigned to Dr. {doctor.name}")
|
| 111 |
+
|
| 112 |
+
def display_info(self):
|
| 113 |
+
super().display_info()
|
| 114 |
+
print(f"Patient ID: {self.patient_id}")
|
| 115 |
+
if self.doctor:
|
| 116 |
+
print(f"Assigned Doctor: {self.doctor.name}")
|
| 117 |
+
else:
|
| 118 |
+
print("No assigned doctor.")
|
| 119 |
+
|
| 120 |
+
def get_patient_id(self):
|
| 121 |
+
return self.patient_id
|
Person.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class Person:
|
| 2 |
+
"""
|
| 3 |
+
'Person' is a base class that represents a generic person with attributes like 'name', 'age', and 'gender'.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
def __init__(self, name, age, gender, phone):
|
| 7 |
+
self.name = name
|
| 8 |
+
self.age = age
|
| 9 |
+
self.gender = gender
|
| 10 |
+
self.phone = phone
|
| 11 |
+
|
| 12 |
+
def display_info(self):
|
| 13 |
+
print(
|
| 14 |
+
f"Name: {self.name}, Age: {self.age}, Gender: {self.gender}, Phone: {self.phone}")
|
| 15 |
+
|
| 16 |
+
def get_name(self):
|
| 17 |
+
return self.name
|
| 18 |
+
|
| 19 |
+
def get_age(self):
|
| 20 |
+
return self.age
|
| 21 |
+
|
| 22 |
+
def get_gender(self):
|
| 23 |
+
return self.gender
|
| 24 |
+
|
| 25 |
+
def get_phone(self):
|
| 26 |
+
return self.phone
|
README.md
CHANGED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Shravani
|
| 3 |
-
emoji: 🌍
|
| 4 |
-
colorFrom: gray
|
| 5 |
-
colorTo: indigo
|
| 6 |
-
sdk: streamlit
|
| 7 |
-
sdk_version: 1.44.1
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
---
|
| 11 |
-
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RSC_CureNet_Integrated Care Network with Predictive Analytic.pptx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f4f40e53d7b57cd98931d6625fe3cdf93f5da924c28100f92bdff9ca8b62c23b
|
| 3 |
+
size 756207
|
app.py
ADDED
|
@@ -0,0 +1,796 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Importing Our Classes
|
| 2 |
+
from Person import *
|
| 3 |
+
from Doctor import *
|
| 4 |
+
from Nurse import *
|
| 5 |
+
from Patient import *
|
| 6 |
+
from Operation import *
|
| 7 |
+
from Hospital import *
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# Importing Libraries
|
| 11 |
+
import pandas as pd
|
| 12 |
+
import numpy as np
|
| 13 |
+
import os
|
| 14 |
+
from PIL import Image
|
| 15 |
+
from time import sleep
|
| 16 |
+
import datetime
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
import pandas as pd
|
| 20 |
+
import numpy as np
|
| 21 |
+
import streamlit as st
|
| 22 |
+
from streamlit.components.v1 import html
|
| 23 |
+
from streamlit_option_menu import option_menu
|
| 24 |
+
import warnings
|
| 25 |
+
|
| 26 |
+
import pickle
|
| 27 |
+
import os
|
| 28 |
+
|
| 29 |
+
# Load models from saved files
|
| 30 |
+
working_dir = os.path.dirname(os.path.abspath(__file__))
|
| 31 |
+
diabetes_model = pickle.load(open(f'{working_dir}/diabetes_model.sav', 'rb'))
|
| 32 |
+
heart_disease_model = pickle.load(open(f'{working_dir}/heart_disease_model.sav', 'rb'))
|
| 33 |
+
parkinsons_model = pickle.load(open(f'{working_dir}/parkinsons_model.sav', 'rb'))
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
st.set_page_config(
|
| 37 |
+
page_title="Hospita App",
|
| 38 |
+
page_icon="👨⚕️",
|
| 39 |
+
layout="wide"
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
warnings.simplefilter(action='ignore', category=FutureWarning)
|
| 43 |
+
|
| 44 |
+
if "button_clicked" not in st.session_state:
|
| 45 |
+
st.session_state.button_clicked = False
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def callback():
|
| 49 |
+
st.session_state.button_clicked = True
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
hospital = Hospital("Salama", "Assiut")
|
| 53 |
+
|
| 54 |
+
st.markdown(
|
| 55 |
+
"""
|
| 56 |
+
<style>
|
| 57 |
+
.main {
|
| 58 |
+
text-align: center;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
div.block-containers{
|
| 62 |
+
padding-top: 0.5rem
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
.st-emotion-cache-z5fcl4{
|
| 66 |
+
padding-top: 1rem;
|
| 67 |
+
padding-bottom: 1rem;
|
| 68 |
+
padding-left: 1.5rem;
|
| 69 |
+
padding-right: 2.8rem;
|
| 70 |
+
overflow-x: hidden;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
.st-emotion-cache-16txtl3{
|
| 74 |
+
padding: 2.7rem 0.6rem
|
| 75 |
+
}
|
| 76 |
+
div.st-emotion-cache-1r6slb0{
|
| 77 |
+
padding: 15px 5px;
|
| 78 |
+
background-color: #111;
|
| 79 |
+
border-radius: 5px;
|
| 80 |
+
border: 3px solid #5E0303;
|
| 81 |
+
opacity: 0.9;
|
| 82 |
+
}
|
| 83 |
+
div.st-emotion-cache-1r6slb0:hover{
|
| 84 |
+
transition: all 0.5s ease-in-out;
|
| 85 |
+
background-color: #000;
|
| 86 |
+
border: 3px solid red;
|
| 87 |
+
opacity: 1;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
.plot-container.plotly{
|
| 91 |
+
border: 4px solid #333;
|
| 92 |
+
border-radius: 7px;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
div.st-emotion-cache-1r6slb0 span.st-emotion-cache-10trblm{
|
| 96 |
+
font: bold 24px tahoma;
|
| 97 |
+
}
|
| 98 |
+
div [data-testid=stImage]{
|
| 99 |
+
text-align: center;
|
| 100 |
+
display: block;
|
| 101 |
+
margin-left: auto;
|
| 102 |
+
margin-right: auto;
|
| 103 |
+
width: 100%;
|
| 104 |
+
}
|
| 105 |
+
</style>
|
| 106 |
+
""",
|
| 107 |
+
unsafe_allow_html=True
|
| 108 |
+
)
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
sub_options_style = styles = {
|
| 112 |
+
"container": {"padding": "8!important", "background-color": '#101010', "border": "2px solid darkcyan"},
|
| 113 |
+
"nav-link": {"color": "white", "padding": "10px", "font-size": "15px", "text-align": "center", "margin": "10px 0px", },
|
| 114 |
+
"nav-link-selected": {"background-color": "#0CB9B9"},
|
| 115 |
+
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
@st.cache_data
|
| 120 |
+
def is_valid_first_name(fname):
|
| 121 |
+
return len(fname) > 3 and (fname != "")
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
@st.cache_data
|
| 125 |
+
def is_valid_last_name(lname):
|
| 126 |
+
return len(lname) > 3 and (lname != "")
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
@st.cache_data
|
| 130 |
+
def is_valid_full_name(fullname):
|
| 131 |
+
return len(fullname) > 6 and (fullname != "") and fullname.__contains__(" ")
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
@st.cache_data
|
| 135 |
+
def is_valid_age(age):
|
| 136 |
+
if age.isnumeric():
|
| 137 |
+
if (int(age) >= 18) and (int(age) <= 90):
|
| 138 |
+
return True
|
| 139 |
+
return False
|
| 140 |
+
return False
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
@st.cache_data
|
| 144 |
+
def is_valid_phone(phone):
|
| 145 |
+
if (len(phone) <= 13) and (phone[0:3] in ["010", "011", "012", "015", "+91"]):
|
| 146 |
+
return True
|
| 147 |
+
return False
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
@st.cache_data
|
| 151 |
+
def is_valid_patient_id(patient_id):
|
| 152 |
+
if patient_id.startswith("PID_"):
|
| 153 |
+
return True
|
| 154 |
+
return False
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
@st.cache_data
|
| 158 |
+
def is_valid_operation_name(operation_name):
|
| 159 |
+
return len(operation_name) > 5 and (operation_name != "")
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
header = st.container()
|
| 163 |
+
content = st.container()
|
| 164 |
+
|
| 165 |
+
with st.sidebar:
|
| 166 |
+
st.title("EHRM Hospital")
|
| 167 |
+
page = option_menu(
|
| 168 |
+
menu_title='Menu',
|
| 169 |
+
options=['Doctor', "Nurse", "Patient", "Operation"],
|
| 170 |
+
menu_icon='chat-text-fill',
|
| 171 |
+
default_index=0,
|
| 172 |
+
styles={
|
| 173 |
+
"container": {"padding": "10!important", "background-color": '#000'},
|
| 174 |
+
"icon": {"color": "white", "font-size": "22px"},
|
| 175 |
+
"nav-link": {"color": "white", "font-size": "18px", "text-align": "left", "margin": "0px", },
|
| 176 |
+
"nav-link-selected": {"background-color": "#0CB9B9"},
|
| 177 |
+
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
)
|
| 181 |
+
st.write("***")
|
| 182 |
+
|
| 183 |
+
# Doctor Page
|
| 184 |
+
if page == 'Doctor':
|
| 185 |
+
with header:
|
| 186 |
+
st.title('Doctors 👨⚕️')
|
| 187 |
+
doctor_option = option_menu(menu_title=None, options=["Add Doctor", 'Add Existing Nurse', 'Add Patient', "Doctors Info"],
|
| 188 |
+
icons=[" "]*4, menu_icon="cast", default_index=0,
|
| 189 |
+
orientation="horizontal", styles=sub_options_style)
|
| 190 |
+
|
| 191 |
+
with content:
|
| 192 |
+
if doctor_option == "Add Doctor":
|
| 193 |
+
st.text(f'Adding New Doctor'.title())
|
| 194 |
+
with st.form('input'):
|
| 195 |
+
[c1, c2] = st.columns(2)
|
| 196 |
+
with c1:
|
| 197 |
+
first_name = st.text_input(
|
| 198 |
+
label="First Name", placeholder="Aditya").strip()
|
| 199 |
+
|
| 200 |
+
age = st.text_input(
|
| 201 |
+
label="Age", placeholder=23, max_chars=2).strip()
|
| 202 |
+
|
| 203 |
+
specialization = st.text_input(
|
| 204 |
+
label="Specialization", placeholder="Dermatology").strip()
|
| 205 |
+
|
| 206 |
+
with c2:
|
| 207 |
+
last_name = st.text_input(
|
| 208 |
+
label="Last Name", placeholder="Ardak").strip()
|
| 209 |
+
|
| 210 |
+
phone = st.text_input(
|
| 211 |
+
label="Phone Number", placeholder="9890377972", max_chars=11).strip()
|
| 212 |
+
|
| 213 |
+
st.write(
|
| 214 |
+
'<style>div.row-widget.stRadio > div{flex-direction:row;justify-content: left;} </style>', unsafe_allow_html=True)
|
| 215 |
+
|
| 216 |
+
gender = st.radio(
|
| 217 |
+
"Gender",
|
| 218 |
+
["Male", "Female"],
|
| 219 |
+
|
| 220 |
+
)
|
| 221 |
+
|
| 222 |
+
add_doctor = st.form_submit_button(label='Add Doctor')
|
| 223 |
+
save_doctor = st.form_submit_button(label='Save Doctors')
|
| 224 |
+
|
| 225 |
+
if add_doctor:
|
| 226 |
+
# Get The Output of Validation
|
| 227 |
+
flag_fname = is_valid_first_name(first_name)
|
| 228 |
+
flag_lname = is_valid_last_name(last_name)
|
| 229 |
+
flag_age = is_valid_age(age)
|
| 230 |
+
flag_phone = is_valid_phone(phone)
|
| 231 |
+
|
| 232 |
+
if flag_fname == False:
|
| 233 |
+
st.warning(
|
| 234 |
+
'First Name Must Be Greater Than 3 Characters!!')
|
| 235 |
+
|
| 236 |
+
if flag_lname == False:
|
| 237 |
+
st.warning(
|
| 238 |
+
'Last Name Must Be Greater Than 3 Characters!!')
|
| 239 |
+
|
| 240 |
+
if flag_age == False:
|
| 241 |
+
st.warning(
|
| 242 |
+
'Please Enter a Valid Age, Must Be A Numerical Value!!')
|
| 243 |
+
|
| 244 |
+
if flag_phone == False:
|
| 245 |
+
st.warning(
|
| 246 |
+
'Please Enter a Valid Phone Number Starts With [010/ 012/ 015/ 011]!')
|
| 247 |
+
|
| 248 |
+
if flag_fname and flag_lname and flag_age and flag_phone:
|
| 249 |
+
# Create Instance of Doctor Class
|
| 250 |
+
the_doctor = Doctor(
|
| 251 |
+
f"{first_name} {last_name}", age, gender, f"'{phone}'", specialization)
|
| 252 |
+
|
| 253 |
+
with st.spinner(text='Adding User…'):
|
| 254 |
+
sleep(1)
|
| 255 |
+
if hospital.add_doctor(the_doctor) == False:
|
| 256 |
+
st.warning(
|
| 257 |
+
f'This Doctor With Phone Number ({phone}) Already Existed Before!!.')
|
| 258 |
+
else:
|
| 259 |
+
st.success(
|
| 260 |
+
f'The Doctor With Name {first_name} {last_name}, Added Successfully.')
|
| 261 |
+
|
| 262 |
+
else:
|
| 263 |
+
st.error(
|
| 264 |
+
'Can Not Add This Doctor :x:.\nPlease, Check All Input Fields')
|
| 265 |
+
|
| 266 |
+
elif save_doctor:
|
| 267 |
+
with st.spinner(text='Saving All Doctors...'):
|
| 268 |
+
sleep(1)
|
| 269 |
+
if hospital.save_doctor() == 0:
|
| 270 |
+
st.info(
|
| 271 |
+
'You Have To Add Doctor First In Correct Way, Then Save The Doctor Info.')
|
| 272 |
+
else:
|
| 273 |
+
st.success(
|
| 274 |
+
'Doctor(s) Saved Successfully :white_check_mark:')
|
| 275 |
+
|
| 276 |
+
if doctor_option == "Add Existing Nurse":
|
| 277 |
+
st.text(F"Adding Nurse To Doctor's Team".title())
|
| 278 |
+
st.info(
|
| 279 |
+
"Be sure that the nurse or doctor must be in the hospital already!!")
|
| 280 |
+
with st.form('adding_existing_nurse'):
|
| 281 |
+
|
| 282 |
+
col_1, col_2 = st.columns(2)
|
| 283 |
+
with col_1:
|
| 284 |
+
doctor_name = st.text_input(
|
| 285 |
+
label="Doctor Name", placeholder="Aditya Ardak").strip()
|
| 286 |
+
|
| 287 |
+
st.write("***")
|
| 288 |
+
|
| 289 |
+
nurse_name = st.text_input(
|
| 290 |
+
label="Nurse Name", placeholder="Shravani").strip()
|
| 291 |
+
|
| 292 |
+
with col_2:
|
| 293 |
+
doctor_phone = st.text_input(
|
| 294 |
+
label="Doctor Phone", placeholder="01020487XXX", max_chars=11).strip()
|
| 295 |
+
|
| 296 |
+
st.write("***")
|
| 297 |
+
|
| 298 |
+
nurse_phone = st.text_input(
|
| 299 |
+
label="Nurse Phone", placeholder="01520487XXX", max_chars=11).strip()
|
| 300 |
+
|
| 301 |
+
add_nurse_to_team = st.form_submit_button(
|
| 302 |
+
label='Add Nurse To The Team')
|
| 303 |
+
|
| 304 |
+
if add_nurse_to_team:
|
| 305 |
+
# Get The Output of Validation
|
| 306 |
+
flag_doctor_name = is_valid_full_name(doctor_name)
|
| 307 |
+
flag_doctor_phone = is_valid_phone(doctor_phone)
|
| 308 |
+
|
| 309 |
+
flag_nurse_name = is_valid_full_name(nurse_name)
|
| 310 |
+
flag_nurse_phone = is_valid_phone(nurse_phone)
|
| 311 |
+
|
| 312 |
+
if flag_doctor_name == False:
|
| 313 |
+
st.warning(
|
| 314 |
+
'Please Enter Right Doctor Name')
|
| 315 |
+
|
| 316 |
+
if flag_doctor_phone == False:
|
| 317 |
+
st.warning(
|
| 318 |
+
'Please Enter a Valid Phone Number!!')
|
| 319 |
+
|
| 320 |
+
if flag_nurse_name == False:
|
| 321 |
+
st.warning(
|
| 322 |
+
'Please Enter Right Nurse Name')
|
| 323 |
+
|
| 324 |
+
if flag_nurse_phone == False:
|
| 325 |
+
st.warning(
|
| 326 |
+
'Please Enter a Valid Phone Number!!')
|
| 327 |
+
|
| 328 |
+
if flag_doctor_name and flag_doctor_phone and flag_nurse_name and flag_nurse_phone:
|
| 329 |
+
# Create Empty Instance of Doctor Class
|
| 330 |
+
temp_doctor = Doctor.empty_Doctor_constructor()
|
| 331 |
+
|
| 332 |
+
with st.spinner(text='Adding Nurse To The Team…'):
|
| 333 |
+
sleep(1)
|
| 334 |
+
adding_nurse = temp_doctor.add_nurse_to_team(
|
| 335 |
+
doctor_name, doctor_phone, nurse_name, nurse_phone)
|
| 336 |
+
if adding_nurse == False:
|
| 337 |
+
st.error(
|
| 338 |
+
f"Can Not Add This Nurse to {doctor_name}\'s Team :x:.\nPlease, Check All Input Fields")
|
| 339 |
+
st.warning(
|
| 340 |
+
f"Ensure That!! Doctor Phone Number belongs to Doctor {doctor_name}\n\
|
| 341 |
+
And The Nurse Phone Number belongs to Nurse {nurse_name}")
|
| 342 |
+
elif adding_nurse == -1:
|
| 343 |
+
st.warning(
|
| 344 |
+
f"Nurse ({nurse_name}) Already Existed In {doctor_name}'s Team.")
|
| 345 |
+
else:
|
| 346 |
+
st.success(
|
| 347 |
+
f"Nurse ({nurse_name}) Added To {doctor_name}'s Team.")
|
| 348 |
+
|
| 349 |
+
else:
|
| 350 |
+
st.error(
|
| 351 |
+
'The Operation Corrupted :x:.\nPlease, Check All Input Fields')
|
| 352 |
+
|
| 353 |
+
if doctor_option == "Add Patient":
|
| 354 |
+
st.text(F"Adding Patients To Doctor's List".title())
|
| 355 |
+
st.info(
|
| 356 |
+
"Be sure that the Patient or Doctor Must Be in the hospital already!!")
|
| 357 |
+
if len(hospital.get_all_doctors()) > 0 and len(hospital.get_all_patients()) > 0:
|
| 358 |
+
with st.form('adding_existing_patient'):
|
| 359 |
+
col_1, col_2 = st.columns(2)
|
| 360 |
+
with col_1:
|
| 361 |
+
doctor_name = st.selectbox(
|
| 362 |
+
"Select Doctor Name:", options=(hospital.get_all_doctors()["Name"].tolist())).strip()
|
| 363 |
+
|
| 364 |
+
st.write("***")
|
| 365 |
+
|
| 366 |
+
patient_name = st.selectbox(
|
| 367 |
+
"Select Patient Name:", options=(hospital.get_all_patients()["Name"].tolist())).strip()
|
| 368 |
+
|
| 369 |
+
with col_2:
|
| 370 |
+
doctor_phone = st.text_input(
|
| 371 |
+
label="Doctor Phone", placeholder="01020487XXX", max_chars=11).strip()
|
| 372 |
+
|
| 373 |
+
st.write("***")
|
| 374 |
+
patient_id = st.selectbox("Select Patient ID:", options=(
|
| 375 |
+
hospital.get_all_patients()["Patient_ID"].tolist())).strip()
|
| 376 |
+
|
| 377 |
+
add_patient_to_doctor = st.form_submit_button(
|
| 378 |
+
label='Add Patient To The Doctor')
|
| 379 |
+
|
| 380 |
+
if add_patient_to_doctor:
|
| 381 |
+
# Get The Output of Validation
|
| 382 |
+
flag_doctor_name = is_valid_full_name(doctor_name)
|
| 383 |
+
flag_doctor_phone = is_valid_phone(doctor_phone)
|
| 384 |
+
|
| 385 |
+
flag_patient_name = is_valid_full_name(
|
| 386 |
+
patient_name)
|
| 387 |
+
|
| 388 |
+
if flag_doctor_name == False:
|
| 389 |
+
st.warning(
|
| 390 |
+
'Please Enter Right Doctor Name')
|
| 391 |
+
|
| 392 |
+
if flag_doctor_phone == False:
|
| 393 |
+
st.warning(
|
| 394 |
+
'Please Enter a Valid Phone Number!!')
|
| 395 |
+
|
| 396 |
+
if flag_patient_name == False:
|
| 397 |
+
st.warning(
|
| 398 |
+
'Please Enter Right Patient Name')
|
| 399 |
+
|
| 400 |
+
if flag_doctor_name and flag_doctor_phone and flag_patient_name:
|
| 401 |
+
# Create Empty Instance of Doctor Class
|
| 402 |
+
temp_doctor = Doctor.empty_Doctor_constructor()
|
| 403 |
+
|
| 404 |
+
with st.spinner(text='Adding Nurse To The Team…'):
|
| 405 |
+
sleep(1)
|
| 406 |
+
adding_patient = temp_doctor.add_patient_to_doctor(
|
| 407 |
+
doctor_name, doctor_phone, patient_id, patient_name)
|
| 408 |
+
if adding_patient == False:
|
| 409 |
+
st.error(
|
| 410 |
+
f"Can Not Add This Patient to {doctor_name}\'s List :x:.\nPlease, Check All Input Fields")
|
| 411 |
+
st.warning(
|
| 412 |
+
f"Ensure That!! Doctor Phone Number belongs to Doctor {doctor_name}\n\
|
| 413 |
+
And The Patient ID belongs to {patient_name}")
|
| 414 |
+
elif adding_patient == -1:
|
| 415 |
+
st.warning(
|
| 416 |
+
f"Patient ({patient_name}) Already Existed In {doctor_name}'s List.")
|
| 417 |
+
else:
|
| 418 |
+
st.success(
|
| 419 |
+
f"Patient ({patient_name}) Added To {doctor_name}'s List.")
|
| 420 |
+
|
| 421 |
+
else:
|
| 422 |
+
st.error(
|
| 423 |
+
'The Operation Corrupted :x:.\nPlease, Check All Input Fields')
|
| 424 |
+
|
| 425 |
+
else:
|
| 426 |
+
st.warning(
|
| 427 |
+
"Please You Have To Add Doctors & Patients First To Hospital!!!")
|
| 428 |
+
if doctor_option == "Doctors Info":
|
| 429 |
+
st.text(
|
| 430 |
+
f'All Doctors in "{hospital.name} Hospital" 🏥'.title())
|
| 431 |
+
|
| 432 |
+
df = hospital.get_all_doctors()
|
| 433 |
+
|
| 434 |
+
st.table(df)
|
| 435 |
+
|
| 436 |
+
# Nurse Page
|
| 437 |
+
elif page == 'Nurse':
|
| 438 |
+
with header:
|
| 439 |
+
st.title('Nurses 👩⚕️'.title())
|
| 440 |
+
|
| 441 |
+
nurse_option = option_menu(menu_title=None,
|
| 442 |
+
options=["Add Nurse", 'Nurses Info'],
|
| 443 |
+
icons=[" "]*2,
|
| 444 |
+
default_index=0, orientation="horizontal", styles=sub_options_style)
|
| 445 |
+
|
| 446 |
+
with content:
|
| 447 |
+
if nurse_option == "Add Nurse":
|
| 448 |
+
st.text(f'Adding New Nurse'.title())
|
| 449 |
+
with st.form("Adding_New_Nurse"):
|
| 450 |
+
[c1, c2] = st.columns(2)
|
| 451 |
+
with c1:
|
| 452 |
+
first_name = st.text_input(
|
| 453 |
+
label="First Name", placeholder="Shravani").strip()
|
| 454 |
+
|
| 455 |
+
age = st.text_input(
|
| 456 |
+
label="Age", placeholder=35, max_chars=2).strip()
|
| 457 |
+
|
| 458 |
+
shift_type = st.text_input(
|
| 459 |
+
label="Shift Type", placeholder="Night Shift").strip()
|
| 460 |
+
|
| 461 |
+
with c2:
|
| 462 |
+
last_name = st.text_input(
|
| 463 |
+
label="Last Name", placeholder="Aditya").strip()
|
| 464 |
+
|
| 465 |
+
phone = st.text_input(
|
| 466 |
+
label="Phone Number", placeholder="0157896xxxx", max_chars=11).strip()
|
| 467 |
+
|
| 468 |
+
st.write(
|
| 469 |
+
'<style>div.row-widget.stRadio > div{flex-direction:row;justify-content: left;} </style>', unsafe_allow_html=True)
|
| 470 |
+
|
| 471 |
+
gender = st.radio(
|
| 472 |
+
"Gender",
|
| 473 |
+
["Male", "Female"],
|
| 474 |
+
|
| 475 |
+
)
|
| 476 |
+
|
| 477 |
+
add_nurse = st.form_submit_button(label='Add Nurse')
|
| 478 |
+
save_nurse = st.form_submit_button(label='Save Nurse')
|
| 479 |
+
|
| 480 |
+
if add_nurse:
|
| 481 |
+
# Get The Output of Validation
|
| 482 |
+
flag_fname = is_valid_first_name(first_name)
|
| 483 |
+
flag_lname = is_valid_last_name(last_name)
|
| 484 |
+
flag_age = is_valid_age(age)
|
| 485 |
+
flag_phone = is_valid_phone(phone)
|
| 486 |
+
|
| 487 |
+
if flag_fname == False:
|
| 488 |
+
st.warning(
|
| 489 |
+
'First Name Must Be Greater Than 3 Characters!!')
|
| 490 |
+
|
| 491 |
+
if flag_lname == False:
|
| 492 |
+
st.warning(
|
| 493 |
+
'Last Name Must Be Greater Than 3 Characters!!')
|
| 494 |
+
|
| 495 |
+
if flag_age == False:
|
| 496 |
+
st.warning(
|
| 497 |
+
'Please Enter a Valid Age, Must Be A Numerical Value!!')
|
| 498 |
+
|
| 499 |
+
if flag_phone == False:
|
| 500 |
+
st.warning(
|
| 501 |
+
'Please Enter a Valid Phone Number Starts With [010/ 012/ 015/ 011]!')
|
| 502 |
+
|
| 503 |
+
if flag_fname and flag_lname and flag_age and flag_phone:
|
| 504 |
+
# Create Instance of Doctor Class
|
| 505 |
+
the_nurse = Nurse(
|
| 506 |
+
f"{first_name} {last_name}", age, gender, f"'{phone}'", shift_type)
|
| 507 |
+
|
| 508 |
+
with st.spinner(text='Adding Nurse....'):
|
| 509 |
+
sleep(1)
|
| 510 |
+
if hospital.add_nurse(the_nurse) == False:
|
| 511 |
+
st.warning(
|
| 512 |
+
f'This Nurse With Phone Number ({phone}) Already Existed Before!!.')
|
| 513 |
+
else:
|
| 514 |
+
st.success(
|
| 515 |
+
f'The Nurse With Name {first_name} {last_name}, Added Successfully.')
|
| 516 |
+
else:
|
| 517 |
+
st.error(
|
| 518 |
+
'Can Not Add This Nurse :x:.\nPlease, Check All Input Fields')
|
| 519 |
+
|
| 520 |
+
elif save_nurse:
|
| 521 |
+
with st.spinner(text='Saving All Nurses...'):
|
| 522 |
+
sleep(1)
|
| 523 |
+
if hospital.save_nurse() == 0:
|
| 524 |
+
st.info(
|
| 525 |
+
'You Have To Add Nurse First In Correct Way, Then Save The Nurse Info.')
|
| 526 |
+
else:
|
| 527 |
+
st.success(
|
| 528 |
+
'Nurse(s) Saved Successfully :white_check_mark:')
|
| 529 |
+
|
| 530 |
+
if nurse_option == "Nurses Info":
|
| 531 |
+
st.text(
|
| 532 |
+
f'All Nurses in "{hospital.name} Hospital" 🏥'.title())
|
| 533 |
+
|
| 534 |
+
df = hospital.get_all_nurses()
|
| 535 |
+
|
| 536 |
+
st.table(df)
|
| 537 |
+
|
| 538 |
+
# Patient Page
|
| 539 |
+
elif page == "Patient":
|
| 540 |
+
with header:
|
| 541 |
+
st.title('Patients 🤒'.title())
|
| 542 |
+
|
| 543 |
+
patient_option = option_menu(menu_title=None,
|
| 544 |
+
options=["Add Patient",
|
| 545 |
+
'Assigning to Doctor',
|
| 546 |
+
'Patients Info'],
|
| 547 |
+
icons=[" "]*3,
|
| 548 |
+
default_index=0, orientation="horizontal", styles=sub_options_style)
|
| 549 |
+
|
| 550 |
+
with content:
|
| 551 |
+
if patient_option == "Add Patient":
|
| 552 |
+
st.text(f'Adding New Patient'.title())
|
| 553 |
+
with st.form("Adding_New_patient"):
|
| 554 |
+
[c1, c2] = st.columns(2)
|
| 555 |
+
with c1:
|
| 556 |
+
first_name = st.text_input(
|
| 557 |
+
label="First Name", placeholder="Dexter").strip()
|
| 558 |
+
|
| 559 |
+
age = st.text_input(
|
| 560 |
+
label="Age", placeholder=35, max_chars=2).strip()
|
| 561 |
+
|
| 562 |
+
with c2:
|
| 563 |
+
last_name = st.text_input(
|
| 564 |
+
label="Last Name", placeholder="Morgan").strip()
|
| 565 |
+
|
| 566 |
+
phone = st.text_input(
|
| 567 |
+
label="Phone Number", placeholder="0117896xxxx", max_chars=11).strip()
|
| 568 |
+
st.write(
|
| 569 |
+
'<style>div.row-widget.stRadio > div{flex-direction:row;justify-content: left;} </style>', unsafe_allow_html=True)
|
| 570 |
+
|
| 571 |
+
gender = st.selectbox(
|
| 572 |
+
"Gender",
|
| 573 |
+
["Male", "Female"],)
|
| 574 |
+
|
| 575 |
+
add_patient = st.form_submit_button(label='Add Patient')
|
| 576 |
+
save_patient = st.form_submit_button(label='Save Patient')
|
| 577 |
+
|
| 578 |
+
if add_patient:
|
| 579 |
+
# Get The Output of Validation
|
| 580 |
+
flag_fname = is_valid_first_name(first_name)
|
| 581 |
+
flag_lname = is_valid_last_name(last_name)
|
| 582 |
+
flag_age = is_valid_age(age)
|
| 583 |
+
flag_phone = is_valid_phone(phone)
|
| 584 |
+
|
| 585 |
+
if flag_fname == False:
|
| 586 |
+
st.warning(
|
| 587 |
+
'First Name Must Be Greater Than 3 Characters!!')
|
| 588 |
+
|
| 589 |
+
if flag_lname == False:
|
| 590 |
+
st.warning(
|
| 591 |
+
'Last Name Must Be Greater Than 3 Characters!!')
|
| 592 |
+
|
| 593 |
+
if flag_age == False:
|
| 594 |
+
st.warning(
|
| 595 |
+
'Please Enter a Valid Age, Must Be A Numerical Value!!')
|
| 596 |
+
|
| 597 |
+
if flag_phone == False:
|
| 598 |
+
st.warning(
|
| 599 |
+
'Please Enter a Valid Phone Number Starts With [010/ 012/ 015/ 011/091/0]!')
|
| 600 |
+
|
| 601 |
+
if flag_fname and flag_lname and flag_age and flag_phone:
|
| 602 |
+
# Create Instance of Doctor Class
|
| 603 |
+
the_patient = Patient(
|
| 604 |
+
f"{first_name} {last_name}", age, gender, f"'{phone}'")
|
| 605 |
+
|
| 606 |
+
with st.spinner(text='Adding Patient....'):
|
| 607 |
+
sleep(1)
|
| 608 |
+
if hospital.add_patient(the_patient) == False:
|
| 609 |
+
st.warning(
|
| 610 |
+
f'This Patient With Phone Number ({phone}) Already Existed Before!!.')
|
| 611 |
+
else:
|
| 612 |
+
st.success(
|
| 613 |
+
f'The Patient With Name {first_name} {last_name}, Added Successfully.')
|
| 614 |
+
st.success(
|
| 615 |
+
f'Patient ID {the_patient.get_patient_id()}')
|
| 616 |
+
else:
|
| 617 |
+
st.error(
|
| 618 |
+
'Can Not Add This Nurse :x:.\nPlease, Check All Input Fields')
|
| 619 |
+
|
| 620 |
+
elif save_patient:
|
| 621 |
+
with st.spinner(text='Saving All Nurses...'):
|
| 622 |
+
sleep(1)
|
| 623 |
+
if hospital.save_patient() == 0:
|
| 624 |
+
st.info(
|
| 625 |
+
'You Have To Add Patient Data In Correct Way, Then Save The Nurse Info.')
|
| 626 |
+
else:
|
| 627 |
+
st.success(
|
| 628 |
+
'Patient(s) Saved Successfully :white_check_mark:')
|
| 629 |
+
|
| 630 |
+
if patient_option == "Assigning to Doctor":
|
| 631 |
+
if len(hospital.get_all_doctors()) > 0 and len(hospital.get_all_patients()) > 0:
|
| 632 |
+
st.text(F'Assigning To Doctor'.title())
|
| 633 |
+
|
| 634 |
+
with st.form('assign_patient_to_dr'):
|
| 635 |
+
patient_id = st.selectbox("Select Patient ID:", options=(
|
| 636 |
+
hospital.get_all_patients()["Patient_ID"].tolist())).strip()
|
| 637 |
+
st.write("***")
|
| 638 |
+
c1, c2 = st.columns(2)
|
| 639 |
+
with c1:
|
| 640 |
+
|
| 641 |
+
doctor_name = st.selectbox(
|
| 642 |
+
"Select Doctor Name:", options=(hospital.get_all_doctors()["Name"].tolist())).strip()
|
| 643 |
+
|
| 644 |
+
with c2:
|
| 645 |
+
doctor_phone = st.text_input(
|
| 646 |
+
label="Doctor Phone", placeholder="01020487XXX", max_chars=11).strip()
|
| 647 |
+
|
| 648 |
+
assign_doctor = st.form_submit_button(
|
| 649 |
+
label='Assign Patient to Doctor')
|
| 650 |
+
|
| 651 |
+
if assign_doctor:
|
| 652 |
+
flag_doctor_name = is_valid_full_name(doctor_name)
|
| 653 |
+
|
| 654 |
+
if flag_doctor_name == False:
|
| 655 |
+
st.warning(
|
| 656 |
+
'Choose Doctor From List !..')
|
| 657 |
+
|
| 658 |
+
if flag_doctor_name:
|
| 659 |
+
with st.spinner(text='Deleting The Book…'):
|
| 660 |
+
# Get Patient Name
|
| 661 |
+
patient_df = hospital.get_all_patients()
|
| 662 |
+
filt = (
|
| 663 |
+
patient_df["Patient_ID"] == patient_id)
|
| 664 |
+
patient_name = patient_df.loc[filt]["Name"].values[0]
|
| 665 |
+
|
| 666 |
+
temp_patient = Patient.empty_patient_constructor()
|
| 667 |
+
|
| 668 |
+
assigning_doctor = temp_patient.assign_doctor_to_pateint(
|
| 669 |
+
doctor_name, doctor_phone, patient_id, patient_name)
|
| 670 |
+
|
| 671 |
+
sleep(1)
|
| 672 |
+
if assigning_doctor == False:
|
| 673 |
+
st.error(
|
| 674 |
+
f"Can Not Assigning Doctor ({doctor_name}) to Patirnt ({patient_id}):x:.\nPlease, Check All Input Fields")
|
| 675 |
+
st.warning(
|
| 676 |
+
f"Ensure That!! Doctor Phone Number belongs to Doctor {doctor_name}\n\
|
| 677 |
+
And The Patient ID {patient_id}")
|
| 678 |
+
elif assigning_doctor == -1:
|
| 679 |
+
st.warning(
|
| 680 |
+
f"Patient ({patient_id}) Already Existed In {doctor_name}'s List.")
|
| 681 |
+
else:
|
| 682 |
+
st.success(
|
| 683 |
+
f"Patient ({patient_id}) Added To {doctor_name}'s List.")
|
| 684 |
+
else:
|
| 685 |
+
st.warning(
|
| 686 |
+
"Please Add Doctors & Patients First To Hospital!!\nIn Order To Assigning Doctors")
|
| 687 |
+
if patient_option == "Patients Info":
|
| 688 |
+
st.text(
|
| 689 |
+
f'All Patients in "{hospital.name} Hospital" 🏥'.title())
|
| 690 |
+
|
| 691 |
+
df = hospital.get_all_patients()
|
| 692 |
+
|
| 693 |
+
st.table(df)
|
| 694 |
+
|
| 695 |
+
# Operation Page
|
| 696 |
+
|
| 697 |
+
# Paste this modified code inside your 'Operation' menu of App 1
|
| 698 |
+
|
| 699 |
+
|
| 700 |
+
|
| 701 |
+
|
| 702 |
+
elif page == "Operation":
|
| 703 |
+
|
| 704 |
+
with header:
|
| 705 |
+
st.title('Operations 💉🩺')
|
| 706 |
+
operation_option = option_menu(menu_title=None,
|
| 707 |
+
options=["Add Operation",
|
| 708 |
+
'All Operations',
|
| 709 |
+
'Predict Disease'],
|
| 710 |
+
icons=[" "]*3,
|
| 711 |
+
default_index=0, orientation="horizontal", styles=sub_options_style)
|
| 712 |
+
|
| 713 |
+
with content:
|
| 714 |
+
temp_operation = Operation.empty_operation_constructor()
|
| 715 |
+
|
| 716 |
+
if operation_option == "Add Operation":
|
| 717 |
+
# Existing Add Operation code remains unchanged
|
| 718 |
+
pass
|
| 719 |
+
|
| 720 |
+
elif operation_option == "All Operations":
|
| 721 |
+
# Existing All Operations code remains unchanged
|
| 722 |
+
pass
|
| 723 |
+
|
| 724 |
+
elif operation_option == 'Predict Disease':
|
| 725 |
+
disease_selected = st.selectbox('Select Disease to Predict:', ['Diabetes', 'Heart Disease', 'Parkinsons'])
|
| 726 |
+
|
| 727 |
+
if disease_selected == 'Diabetes':
|
| 728 |
+
st.header('Diabetes Prediction')
|
| 729 |
+
|
| 730 |
+
col1, col2, col3 = st.columns(3)
|
| 731 |
+
with col1:
|
| 732 |
+
Pregnancies = st.text_input('Number of Pregnancies', value="3.85")
|
| 733 |
+
SkinThickness = st.text_input('Skin Thickness value', value="20.54")
|
| 734 |
+
DiabetesPedigreeFunction = st.text_input('Diabetes Pedigree Function value', value="0.47")
|
| 735 |
+
with col2:
|
| 736 |
+
Glucose = st.text_input('Glucose Level', value="120.89")
|
| 737 |
+
Insulin = st.text_input('Insulin Level', value="79.80")
|
| 738 |
+
Age = st.text_input('Age of the Person', value="33.24")
|
| 739 |
+
with col3:
|
| 740 |
+
BloodPressure = st.text_input('Blood Pressure value', value="69.11")
|
| 741 |
+
BMI = st.text_input('BMI value', value="31.99")
|
| 742 |
+
|
| 743 |
+
if st.button('Predict Diabetes'):
|
| 744 |
+
user_input = [float(x) for x in [Pregnancies, Glucose, BloodPressure, SkinThickness, Insulin, BMI, DiabetesPedigreeFunction, Age]]
|
| 745 |
+
diab_prediction = diabetes_model.predict([user_input])
|
| 746 |
+
result = 'The person is diabetic' if diab_prediction[0] == 1 else 'The person is not diabetic'
|
| 747 |
+
st.success(result)
|
| 748 |
+
|
| 749 |
+
elif disease_selected == 'Heart Disease':
|
| 750 |
+
st.header('Heart Disease Prediction')
|
| 751 |
+
|
| 752 |
+
col1, col2, col3 = st.columns(3)
|
| 753 |
+
with col1:
|
| 754 |
+
age = st.text_input('Age', value="54.37")
|
| 755 |
+
trestbps = st.text_input('Resting Blood Pressure', value="131.69")
|
| 756 |
+
restecg = st.text_input('Resting ECG results', value="0.53")
|
| 757 |
+
oldpeak = st.text_input('ST Depression', value="1.04")
|
| 758 |
+
thal = st.text_input('Thalassemia status', value="2.31")
|
| 759 |
+
with col2:
|
| 760 |
+
sex = st.text_input('Sex', value="0.68")
|
| 761 |
+
chol = st.text_input('Serum Cholesterol', value="246.26")
|
| 762 |
+
thalach = st.text_input('Max Heart Rate', value="149.65")
|
| 763 |
+
slope = st.text_input('Slope of ST Segment', value="1.40")
|
| 764 |
+
with col3:
|
| 765 |
+
cp = st.text_input('Chest Pain types', value="0.97")
|
| 766 |
+
fbs = st.text_input('Fasting Blood Sugar >120 mg/dl', value="0.15")
|
| 767 |
+
exang = st.text_input('Exercise Induced Angina', value="0.33")
|
| 768 |
+
ca = st.text_input('Major vessels colored', value="0.73")
|
| 769 |
+
|
| 770 |
+
if st.button('Predict Heart Disease'):
|
| 771 |
+
user_input = [float(x) for x in [age, sex, cp, trestbps, chol, fbs, restecg, thalach, exang, oldpeak, slope, ca, thal]]
|
| 772 |
+
heart_prediction = heart_disease_model.predict([user_input])
|
| 773 |
+
result = 'The person has heart disease' if heart_prediction[0] == 1 else 'The person does not have heart disease'
|
| 774 |
+
st.success(result)
|
| 775 |
+
|
| 776 |
+
elif disease_selected == 'Parkinsons':
|
| 777 |
+
st.header("Parkinson's Prediction")
|
| 778 |
+
|
| 779 |
+
default_values = [145.75, 179.94, 107.34, 0.00622, 0.00006, 0.00314, 0.00391, 0.00941, 0.03027, 0.28224,
|
| 780 |
+
0.01300, 0.01574, 0.01791, 0.03899, 0.02217, 22.00, 0.46, 0.72, -5.55, 0.23, 2.38, 0.21]
|
| 781 |
+
|
| 782 |
+
labels = ['MDVP: Fo (Hz)', 'MDVP: Fhi (Hz)', 'MDVP: Flo (Hz)', 'MDVP: Jitter (%)', 'MDVP: Jitter (Abs)',
|
| 783 |
+
'MDVP: RAP', 'MDVP: PPQ', 'Jitter: DDP', 'MDVP: Shimmer', 'MDVP: Shimmer (dB)',
|
| 784 |
+
'Shimmer: APQ3', 'Shimmer: APQ5', 'MDVP: APQ', 'Shimmer: DDA', 'NHR', 'HNR', 'RPDE', 'DFA',
|
| 785 |
+
'Spread1', 'Spread2', 'D2', 'PPE']
|
| 786 |
+
|
| 787 |
+
inputs = []
|
| 788 |
+
cols = st.columns(5)
|
| 789 |
+
for i, label in enumerate(labels):
|
| 790 |
+
inputs.append(cols[i % 5].text_input(label, value=str(default_values[i])))
|
| 791 |
+
|
| 792 |
+
if st.button("Predict Parkinson's"):
|
| 793 |
+
user_input = [float(x) for x in inputs]
|
| 794 |
+
parkinsons_prediction = parkinsons_model.predict([user_input])
|
| 795 |
+
result = "The person has Parkinson's disease" if parkinsons_prediction[0] == 1 else "The person does not have Parkinson's disease"
|
| 796 |
+
st.success(result)
|
diabetes_model.sav
ADDED
|
Binary file (27.9 kB). View file
|
|
|
doctors.csv
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Name,Age,Gender,Phone,Specialization
|
| 2 |
+
Aditya Ardak,28,Male,'+9198903779',Cardiologist
|
heart_disease_model.sav
ADDED
|
Binary file (1.21 kB). View file
|
|
|
nurses.csv
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Name,Age,Gender,Phone,Shift_Type
|
| 2 |
+
Shravani Shravani,20,Female,'+9198903779',Night Shift
|
operations.csv
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Operation_ID,Date,Time,Surgeon,Nurses
|
| 2 |
+
Debr_Aditya Ardak_1,2024-01-03,03:45:00,Aditya Ardak,
|
parkinsons_model.sav
ADDED
|
Binary file (12.7 kB). View file
|
|
|
patients.csv
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Patient_ID,Name,Age,Gender,Phone
|
| 2 |
+
PID_001,Dexter Morgan,35,Male,'+9198903779'
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
streamlit_option_menu
|
| 3 |
+
gunicorn==19.7.1
|
| 4 |
+
numpy
|
| 5 |
+
pandas
|