Hospital Management Python Source Code
Hospital Management Python Source Code
DB_config.py
import constant
HOST = constant.grab_constant(True,"HOST")
PORT = int(constant.grab_constant(True,"PORT"))
ADMIN_DATABASE = constant.grab_constant(True,"ADMIN_DATABASE")
DATABASE = constant.grab_constant(True,"DATABASE")
USER = constant.grab_constant(True,"USER")
PASSWORD = constant.grab_constant(True,"PASSWORD")
def admin_config():
config_dict = {"host":HOST, "port":PORT, "database":ADMIN_DATABASE,
"user":USER, "password":PASSWORD}
return config_dict
def config():
config_dict = {"host":HOST, "port":PORT, "database":DATABASE, "user":USER,
"password":PASSWORD}
return config_dict
[Link]
import psycopg2
from doctor import salary as doctor_salary
from patient import cost as patient_cost
from employee import salary as employee_salary
from DB_config import config
import constant
def see_info(logged_in,category,username):
if logged_in:
username = [Link]().lower()
with [Link](**config()) as info_check:
cur1 = info_check.cursor()
[Link](f"""
SELECT * FROM {category} WHERE username = '{username}';
""")
info = [Link]()
[Link]()
info_check.close()
return info
def total_earning(logged_in):
if logged_in:
initial_earning = 0
with [Link](**config()) as earning:
cur1 = [Link]()
[Link]("""
SELECT username FROM employee;
""")
list_of_employee = [Link]()
[Link]()
earned_from_employee = 0
for row in list_of_employee:
earned_from_employee += int(employee_salary(row[0],True)[1])
initial_earning += earned_from_employee
cur2 = [Link]()
[Link]("""
SELECT username FROM patient;
""")
list_of_patient = [Link]()
[Link]()
earned_from_patient = 0
for row in list_of_patient:
earned_from_patient += int(patient_cost(row[0],True)[1])
initial_earning += earned_from_patient
initial_earning -=
int(constant.grab_constant(True,"FIXED_COST_OF_HOSPITAL"))
given_to_employees = 0
cur3 = [Link]()
[Link]("""
SELECT salary FROM employee WHERE work_of_doctors LIKE '%admin
%';
""")
salary_list = [Link]()
for salary in salary_list:
given_to_employees += int(salary[0])
[Link]()
initial_earning -= given_to_employees
[Link]()
return (earned_from_employee, earned_from_patient,
int(constant.grab_constant(True,"FIXED_COST_OF_HOSPITAL")), employee_pre_salary,
given_to_employees, initial_earning)
work_of_doctors = [Link]()[0][0]
work_of_doctors += ", " + "admin"
[Link]()
cur1 = adding_employee.cursor()
[Link]("""
UPDATE employee SET work_of_doctors = %s WHERE username = %s;
""", [work_of_doctors, employee_username])
print([Link])
[Link]()
adding_employee.commit()
adding_employee.close()
return "Employee Added"
def see_my_employee(logged_in):
if logged_in:
with [Link](**config()) as my_employee:
cur1 = my_employee.cursor()
[Link]("""
SELECT username, fullname, email, date_of_birth, work, salary
FROM employee WHERE work_of_doctors LIKE '%admin%'
""")
list_of_employees = [Link]()
# print part
# for row in list_of_employees:
# print("Username:", row[0], "\tFullname:", row[1], "\tEmail:",
row[2], "\tWork:", row[3], "\tSalary:", row[4])
[Link]()
my_employee.close()
return list_of_employees
work_of_doctors_string = [Link]()[0][0]
work_of_doctors_list = work_of_doctors_string.split(", ")
work_of_doctors_list.remove("admin")
new_work_of_doctors_string = ", ".join(work_of_doctors_list)
[Link]()
cur1 = removing_employee.cursor()
[Link]("""
UPDATE employee SET work_of_doctors = %s WHERE username = %s;
""", [new_work_of_doctors_string, employee_username])
print([Link])
[Link]()
removing_employee.commit()
removing_employee.close()
return "Employee Removed"
def show_all_doctor(logged_in):
if logged_in:
with [Link](**config()) as doctor:
cur1 = [Link]()
[Link]("""
SELECT username, fullname, email, date_of_birth, specialty,
price FROM doctor;
""")
rows = [Link]()
new_rows = []
for row in rows:
row = list(row)
[Link](doctor_salary(row[0],True)[2])
new_rows.append(row)
# print(part)
# for row in rows:
# print("Username:", row[0], "\tFullname:", row[1], "\tEmail:",
row[2], "\tspecialty:", row[3], "\tPrice:", row[4], "\tTotal Earned:", row[5])
[Link]()
[Link]()
return new_rows
def show_all_patient(logged_in):
if logged_in:
with [Link](**config()) as patient:
cur1 = [Link]()
[Link]("""
SELECT username, fullname, email, date_of_birth, problem,
requested_doctor_username, approved_doctor_username FROM patient;
""")
rows = [Link]()
new_rows = []
for row in rows:
row = list(row)
[Link](patient_cost(row[0], True)[2])
new_rows.append(row)
# print part
# for row in rows:
# print("Username:", row[0], "\tFullname:", row[1], "\tEmail:",
row[2], "\tProblem:", row[3], "\tRequested:", row[4], "\tApproved:", row[5], "\
tTotal Cost:", row[6])
[Link]()
[Link]()
return new_rows
def show_all_employee(logged_in):
if logged_in:
with [Link](**config()) as employee:
cur1 = [Link]()
[Link]("""
SELECT username, fullname, email, date_of_birth, work,
work_of_doctors, salary FROM employee;
""")
rows = [Link]()
new_rows = []
for row in rows:
row = list(row)
[Link](employee_salary(row[0],True)[2])
new_rows.append(row)
# print part
# for row in rows:
# print("Username:", row[0], "\tFullname:", row[1], "\tEmail:",
row[2], "\tWork:", row[3], "\tDoctors:", row[4], "\tSalary:", row[5], "\tTotal
Earned:", row[6])
[Link]()
[Link]()
return new_rows
def all_doctor_username(logged_in):
if logged_in:
with [Link](**config()) as doctor:
cur1 = [Link]()
[Link]("""
SELECT username FROM doctor;
""")
rows = [Link]()
new_rows = []
for row in rows:
new_rows.append(row[0])
[Link]()
[Link]()
return new_rows
def all_patient_username(logged_in):
if logged_in:
with [Link](**config()) as patient:
cur1 = [Link]()
[Link]("""
SELECT username FROM patient;
""")
rows = [Link]()
new_rows = []
for row in rows:
new_rows.append(row[0])
[Link]()
[Link]()
return new_rows
def all_employee_username(logged_in):
if logged_in:
with [Link](**config()) as employee:
cur1 = [Link]()
[Link]("""
SELECT username FROM employee;
""")
rows = [Link]()
new_rows = []
for row in rows:
new_rows.append(row[0])
[Link]()
[Link]()
return new_rows
cur0 = [Link]()
[Link]("""
DROP VIEW IF EXISTS patient_view;
""")
[Link]()
[Link]()
cur1 = [Link]()
[Link]("""
CREATE VIEW patient_view AS SELECT username, fullname, email,
date_of_birth, problem, approved_doctor_username, appointment_timestamp FROM
patient WHERE approved_doctor_username != 'hpt';
""")
[Link]()
cur2 = [Link]()
[Link]("""
DROP VIEW IF EXISTS doctor_view;
""")
[Link]()
[Link]()
cur3 = [Link]()
[Link]("""
CREATE VIEW doctor_view AS SELECT username AS doctor_username,
fullname AS doctor_fullname, email AS doctor_email, specialty, price FROM
doctor;
""")
[Link]()
[Link]()
[Link]()
cur1 = [Link]()
[Link](f"""
CREATE VIEW final_view AS (SELECT * FROM patient_view
{join_type} doctor_view ON patient_view.approved_doctor_username =
doctor_view.doctor_username);
""")
[Link]()
[Link]()
[Link]()
# print part
# for row in rows:
# print(row)
[Link]()
return rows
backup_restore.py
import psycopg2
from DB_config import config
from constant import MAIN_FILE
def backup_to_csv(logged_in):
if logged_in:
with [Link](**config()) as backup:
ADMIN_FILE = [Link](MAIN_FILE, "backup_&_restore_folder",
"[Link]")
DOCTOR_FILE = [Link](MAIN_FILE, "backup_&_restore_folder",
"[Link]")
PATIENT_FILE = [Link](MAIN_FILE, "backup_&_restore_folder",
"[Link]")
EMPLOYEE_FILE = [Link](MAIN_FILE, "backup_&_restore_folder",
"[Link]")
cur0 = [Link]()
[Link]("""
COPY (SELECT * FROM admin) TO %s DELIMITER ',' CSV;
""", [ADMIN_FILE])
[Link]()
cur1 = [Link]()
[Link]("""
COPY (SELECT * FROM doctor) TO %s DELIMITER ',' CSV;
""", [DOCTOR_FILE])
[Link]()
cur2 = [Link]()
[Link]("""
COPY (SELECT * FROM patient) TO %s DELIMITER ',' CSV;
""", [PATIENT_FILE])
[Link]()
cur3 = [Link]()
[Link]("""
COPY (SELECT * FROM employee) TO %s DELIMITER ',' CSV;
""", [EMPLOYEE_FILE])
[Link]()
[Link]()
[Link]()
return "Backup Successful"
def restore_from_csv(logged_in):
if logged_in:
with [Link](**config()) as restore:
ADMIN_FILE = [Link](MAIN_FILE, "backup_&_restore_folder",
"[Link]")
DOCTOR_FILE = [Link](MAIN_FILE, "backup_&_restore_folder",
"[Link]")
PATIENT_FILE = [Link](MAIN_FILE, "backup_&_restore_folder",
"[Link]")
EMPLOYEE_FILE = [Link](MAIN_FILE, "backup_&_restore_folder",
"[Link]")
cur0 = [Link]()
[Link]("""
COPY admin FROM %s DELIMITER ',' CSV NULL AS '';
""", [ADMIN_FILE])
[Link]()
cur1 = [Link]()
[Link]("""
COPY doctor FROM %s DELIMITER ',' CSV NULL AS '';
""", [DOCTOR_FILE])
[Link]()
cur2 = [Link]()
[Link]("""
COPY patient FROM %s DELIMITER ',' CSV NULL AS '';
""", [PATIENT_FILE])
[Link]()
cur3 = [Link]()
[Link]("""
COPY employee FROM %s DELIMITER ',' CSV NULL AS '';
""", [EMPLOYEE_FILE])
[Link]()
[Link]()
[Link]()
return "Restoration Successful"
[Link]
MAIN_FILE = [Link]()
CONSTANT_FILE = [Link](MAIN_FILE, "backup_&_restore_folder",
"[Link]")
constants ={}
condition = True
with open(CONSTANT_FILE, "r") as read_constant:
while condition:
try:
reader = read_constant.readline()
reader_split = [Link](",")
name, value = reader_split
constants[name] = value[:-1]
except:
condition = False
[Link]
import psycopg2
from DB_config import config
import constant
import webbrowser as web
total_patient = len([Link]())
[Link]()
cur1 = my_salary.cursor()
[Link]("""
SELECT price FROM doctor WHERE username = %s;
""", [username])
my_price = [Link]()[0][0]
[Link]()
total_earning = total_patient * int(my_price)
cur2 = my_salary.cursor()
[Link](f"""
SELECT salary FROM employee WHERE work_of_doctors LIKE '%
{username}%';
""")
salary_list = [Link]()
total_cost = 0
if username == "hpt":
for salary in salary_list:
total_cost +=
(int(salary[0])*int(constant.grab_constant(True,"PRE_SALARY")))//100
else:
for salary in salary_list:
total_cost += int(salary[0])
[Link]()
my_salary.close()
return (total_earning, total_cost, nit_salary)
def show_all_employee(logged_in):
if logged_in:
with [Link](**config()) as all_employee:
cur1 = all_employee.cursor()
[Link]("""
SELECT username, fullname, email, date_of_birth, work, salary
FROM employee;
""")
rows = [Link]()
# print part
# for row in rows:
# print("Username:", row[0], "\tFullname:", row[1], "\tEmail:",
row[2], "\tSalary:", row[3])
[Link]()
all_employee.close()
return rows
temporary = [Link]()
work_of_doctors = temporary[0][0]
work_of_doctors += ", " + my_username
[Link]()
cur1 = adding_employee.cursor()
[Link]("""
UPDATE employee SET work_of_doctors = %s WHERE username = %s;
""", [work_of_doctors, employee_username])
print([Link])
[Link]()
adding_employee.commit()
adding_employee.close()
return "Employee Added"
work_of_doctors_string = [Link]()[0][0]
work_of_doctors_list = work_of_doctors_string.split(", ")
work_of_doctors_list.remove(my_username)
new_work_of_doctors_string = ", ".join(work_of_doctors_list)
[Link]()
cur1 = removing_employee.cursor()
[Link]("""
UPDATE employee SET work_of_doctors = %s WHERE username = %s;
""", [new_work_of_doctors_string, employee_username])
print([Link])
[Link]()
removing_employee.commit()
removing_employee.close()
return "Employee Removed"
rows = [Link]()
# print part
# for row in rows:
# print("Username:", row[0], "\tFullname:", row[1], "\tEmail:",
row[2], "\tProblem:", row[3])
[Link]()
all_requested_patient.close()
return rows
cur1 = all_under_specialty.cursor()
[Link]("""
SELECT username, fullname, email, date_of_birth,
requested_doctor_username, approved_doctor_username FROM patient WHERE problem =
%s;
""", [specialty])
rows = [Link]()
# for row in rows:
# print("Username:", row[0], "\tFullname:", row[1], "\tEmail:",
row[2], "\tRequested Doctor:", row[3], "\tApproved Doctor:", row[4])
[Link]()
all_under_specialty.close()
return rows
rows = [Link]()
# print part
# for row in rows:
# print("Username:", row[0], "\tFullname:", row[1], "\tEmail:",
row[2], "\tProblem:", row[3])
[Link]()
my_patient.close()
return rows
def see_patients_report(patient_username,report_name,logged_in):
if logged_in:
with [Link](**config()) as report:
cur1 = [Link]()
[Link]("""
SELECT reports FROM patient WHERE username = %s;
""", [patient_username])
reports_string = [Link]()[0][0]
reports_list = reports_string.split("+++")
for reports_substring in reports_list:
report_tuple_without_b = reports_substring[1:-1]
report_sublist = report_tuple_without_b.split("++")
name = report_sublist[0]
url = report_sublist[1]
if [Link]() == report_name.lower():
[Link](url)
return ("Opening",name,"In Web Browser")
[Link]
import psycopg2
from DB_config import config
from constant import grab_constant
import datetime
if "hpt" in list_of_doctors:
initial_salary = (number_of_doctors * my_price) -
(my_price*(100-int(grab_constant(True,"PRE_SALARY"))))//100
else:
initial_salary = number_of_doctors * my_price
hospital_cost = (initial_salary * int(grab_constant(True,
"CUT_FROM_EMPLOYEE"))) // 100
final_salary = initial_salary - hospital_cost
my_salary.close()
return (initial_salary, hospital_cost, final_salary)
doctors_bucket = []
for doctor_username in list_of_doctors:
cur2 = my_doctor.cursor()
if doctor_username != "admin":
[Link]("""
SELECT username, fullname, email, date_of_birth,
specialty FROM doctor WHERE username = %s;
""", [doctor_username])
temporary = [Link]()
doctors_bucket.append(temporary[0])
[Link]()
else:
doctors_bucket.append(('adm',
'admin','admin@[Link]',"2004-12-28", 'all'))
# print part
# for row in doctors_bucket:
# print("Username:", row[0], "\tFullname:", row[1], "\tEmail:",
row[2], "\tspecialty:", row[3])
my_doctor.close()
return doctors_bucket
[Link]
# All Imports
import kivy
from [Link] import App
from [Link] import ObjectProperty
from [Link] import FloatLayout
from [Link] import GridLayout
from [Link] import Builder
from [Link] import Window
from [Link] import Screen, ScreenManager
from [Link] import Popup
import webbrowser as web
from [Link] import Widget
from [Link] import Color
from [Link] import Line
from [Link] import Label
from [Link] import Button
from [Link] import Carousel
from [Link] import Image
from [Link] import SlideTransition
from [Link] import NoTransition
from [Link] import Config
from [Link] import TextInput
from [Link] import Rectangle
from [Link] import ScrollView
from [Link] import runTouchApp
import setup_engine
import login
import constant
import admin
import datetime
import doctor
import patient
import employee
class Holder():
username = "Default"
logged_in = True
counter = 0
pre_counter = 0
# SignUp Classes
class GetStarted(Screen):
first_start = True if (constant.grab_constant(True, "IS_START")=="0") else
False
def start_program(self):
if GetStarted.first_start:
[Link] = SlideTransition(direction = "up")
[Link] = "ConstantFixing"
else:
[Link] = SlideTransition(direction = "up")
[Link] = "PatientSignUp"
def go_to_website(self):
web.open_new_tab("[Link]
class ConstantFixing(Screen):
host = ObjectProperty()
port = ObjectProperty()
user = ObjectProperty()
password = ObjectProperty()
cut_from_patient = ObjectProperty()
cut_from_employee = ObjectProperty()
fixed_cost_of_hospital = ObjectProperty()
pre_salary = ObjectProperty()
doctor_max_checkup_price = ObjectProperty()
employee_max_salary = ObjectProperty()
hospital_year = ObjectProperty()
hospital_total_bed = ObjectProperty()
hospital_remaining_bed = ObjectProperty()
hospital_total_employee = ObjectProperty()
hospital_total_doctor = ObjectProperty()
hospital_total_patient = ObjectProperty()
hospital_current_patient = ObjectProperty()
hospital_motto = ObjectProperty()
hospital_location = ObjectProperty()
hospital_title = ObjectProperty()
restore_previous = ObjectProperty()
def set_constant_function(self):
try:
constants_bucket = dict()
constants_bucket["HOST"] = [Link]
constants_bucket["PORT"] = [Link]
constants_bucket["ADMIN_DATABASE"] = "postgres"
constants_bucket["DATABASE"] ="hms"
constants_bucket["USER"] = [Link]
constants_bucket["PASSWORD"] = [Link]
constants_bucket["CUT_FROM_PATIENT"] = self.cut_from_patient.text
constants_bucket["CUT_FROM_EMPLOYEE"] = self.cut_from_employee.text
constants_bucket["FIXED_COST_OF_HOSPITAL"] =
self.fixed_cost_of_hospital.text
constants_bucket["PRE_SALARY"] = self.pre_salary.text
constants_bucket["DOCTOR_MAX_CHECKUP_PRICE"] =
self.doctor_max_checkup_price.text
constants_bucket["EMPLOYEE_MAX_SALARY"] =
self.employee_max_salary.text
constants_bucket["HOSPITAL_YEAR"] = self.hospital_year.text
constants_bucket["HOSPITAL_TOTAL_BED"] =
self.hospital_total_bed.text
constants_bucket["HOSPITAL_REMAINING_BED"] =
self.hospital_remaining_bed.text
constants_bucket["HOSPITAL_TOTAL_EMPLOYEE"] =
self.hospital_total_employee.text
constants_bucket["HOSPITAL_TOTAL_DOCTOR"] =
self.hospital_total_doctor.text
constants_bucket["HOSPITAL_TOTAL_PATIENT"] =
self.hospital_total_patient.text
constants_bucket["HOSPITAL_CURRENT_PATIENT"] =
self.hospital_current_patient.text
constants_bucket["HOSPITAL_MOTTO"] = self.hospital_motto.text
constants_bucket["HOSPITAL_LOCATION"] = self.hospital_location.text
constants_bucket["HOSPITAL_TITLE"] = self.hospital_title.text
constants_bucket["IS_START"] = "1"
constant.set_constant(True, constants_bucket)
[Link]()
if self.restore_previous.text == "yes":
setup_engine.start_program()
except:
show_ConstantFixingPop()
[Link] = "localhost"
[Link] = "5432"
[Link] = "postgres"
[Link] = "12345678"
self.cut_from_patient.text = "50"
self.cut_from_employee.text = "20"
self.fixed_cost_of_hospital.text = "5000"
self.pre_salary.text = "10"
self.doctor_max_checkup_price.text = "4000"
self.employee_max_salary.text = "15000"
self.hospital_year.text = "2004"
self.hospital_total_bed.text = "200"
self.hospital_remaining_bed.text = "120"
self.hospital_total_employee.text = "16"
self.hospital_total_doctor.text = "10"
self.hospital_total_patient.text = "2000"
self.hospital_current_patient.text = "40"
self.hospital_motto.text = "serve the nation at large"
self.hospital_location.text = "Dhaka-Bangladesh"
self.hospital_title.text = "The AS8 Hospital"
self.restore_previous.text = "no"
def proceed(self):
[Link] = SlideTransition(direction = "up")
[Link] = "PatientSignUp"
class ConstantFixingPop(FloatLayout):
pass
def show_ConstantFixingPop():
show = ConstantFixingPop()
popup_window = Popup(title = "Constant Fixing Error", content = show,
size_hint = (0.6, 0.3))
popup_window.open()
class AdminSignUp(Screen):
username = ObjectProperty()
fullname = ObjectProperty()
email = ObjectProperty()
date_of_birth = ObjectProperty()
password = ObjectProperty()
def signup_to_database(self):
try:
category = "admin"
username = [Link]().lower()
fullname = [Link]().title()
email = [Link]()
date_of_birth = self.date_of_birth.[Link]()
password = [Link]()
[Link] = ""
[Link] = ""
[Link] = ""
self.date_of_birth.text = "YYYY-MM-DD"
[Link] = ""
class DoctorSignUp(Screen):
username = ObjectProperty()
fullname = ObjectProperty()
email = ObjectProperty()
date_of_birth = ObjectProperty()
password = ObjectProperty()
specialty = ObjectProperty()
price = ObjectProperty()
def signup_to_database(self):
try:
category = "doctor"
username = [Link]().lower()
fullname = [Link]().title()
email = [Link]()
date_of_birth = self.date_of_birth.[Link]()
password = [Link]()
specialty = [Link]().lower()
price = int([Link]())
[Link] = ""
[Link] = ""
[Link] = ""
self.date_of_birth.text = "YYYY-MM-DD"
[Link] = ""
[Link] = ""
[Link] = ""
class PatientSignUp(Screen):
username = ObjectProperty()
fullname = ObjectProperty()
email = ObjectProperty()
date_of_birth = ObjectProperty()
password = ObjectProperty()
problem = ObjectProperty()
def signup_to_database(self):
try:
category = "patient"
username = [Link]().lower()
fullname = [Link]().title()
email = [Link]()
date_of_birth = self.date_of_birth.[Link]()
password = [Link]()
problem = [Link]().lower()
[Link] = ""
[Link] = ""
[Link] = ""
self.date_of_birth.text = "YYYY-MM-DD"
[Link] = ""
[Link] = ""
class EmployeeSignUp(Screen):
username = ObjectProperty()
fullname = ObjectProperty()
email = ObjectProperty()
date_of_birth = ObjectProperty()
password = ObjectProperty()
work = ObjectProperty()
salary = ObjectProperty()
def signup_to_database(self):
try:
category = "employee"
username = [Link]().lower()
fullname = [Link]().title()
email = [Link]()
date_of_birth = self.date_of_birth.[Link]()
password = [Link]()
work = [Link]().lower()
salary = int([Link]())
[Link] = ""
[Link] = ""
[Link] = ""
self.date_of_birth.text = "YYYY-MM-DD"
[Link] = ""
[Link] = ""
[Link] = ""
class SignUpPop(FloatLayout):
pass
def show_SignUpPop():
show = SignUpPop()
popup_window = Popup(title = "SignUp Error", content = show, size_hint =
(0.6, 0.3))
popup_window.open()
# Login Classes
class AdminLogin(Screen):
username = ObjectProperty()
password = ObjectProperty()
def login_to_database(self):
try:
category = "admin"
username = [Link]().lower()
[Link] = username
password = [Link]()
logged_in = [Link](category,username,password)
if logged_in:
[Link] = "AdminAfterLogin"
else:
show_LoginPop()
except:
show_LoginPop()
[Link] = ""
[Link] = ""
class DoctorLogin(Screen):
username = ObjectProperty()
password = ObjectProperty()
def login_to_database(self):
try:
category = "doctor"
username = [Link]().lower()
[Link] = username
password = [Link]()
logged_in = [Link](category,username,password)
if logged_in:
[Link] = "DoctorAfterLogin"
else:
show_LoginPop()
except:
show_LoginPop()
[Link] = ""
[Link] = ""
class PatientLogin(Screen):
username = ObjectProperty()
password = ObjectProperty()
def login_to_database(self):
try:
category = "patient"
username = [Link]().lower()
[Link] = username
password = [Link]()
logged_in = [Link](category,username,password)
print(logged_in)
if logged_in:
[Link] = "PatientAfterLogin"
else:
show_LoginPop()
except:
show_LoginPop()
[Link] = ""
[Link] = ""
class EmployeeLogin(Screen):
username = ObjectProperty()
password = ObjectProperty()
def login_to_database(self):
try:
category = "employee"
username = [Link]().lower()
[Link] = username
password = [Link]()
logged_in = [Link](category,username,password)
if logged_in:
[Link] = "EmployeeAfterLogin"
else:
show_LoginPop()
except:
show_LoginPop()
[Link] = ""
[Link] = ""
class LoginPop(FloatLayout):
pass
def show_LoginPop():
show = LoginPop()
popup_window = Popup(title = "Login Error", content = show, size_hint =
(0.6, 0.3))
popup_window.open()
# After Login
# Common Functions
def go_to_website(instance):
web.open_new_tab("[Link]
# AboutHospital class
class AboutHospital(Screen):
def __init__(self,**kwargs):
super().__init__(**kwargs)
with [Link]:
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
[Link] = Label(text="About Hospital", font_size=40, color=(1,1,1,1))
[Link].pos_hint= {"x":0.05, "top": 1.45}
self.add_widget([Link])
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
self.close_button = Button(background_normal="resources/[Link]",
background_down="resources/close_down.png")
self.close_button.size_hint = (None, None)
self.close_button.width = 60
self.close_button.height = 60
self.close_button.color = (0,0,0,1)
self.close_button.pos_hint = {"x": 0.85, "top": 0.99}
self.add_widget(self.close_button)
self.close_button.bind(on_release = self.go_back)
self.hospital_name_label =
Label(text=constant.grab_constant(True,"HOSPITAL_TITLE").upper(), font_size=20,
color=(0,0,0,1))
self.hospital_name_label.pos_hint = {"x":0.21, "top": 1.2}
self.add_widget(self.hospital_name_label)
self.hospital_motto_label =
Label(text=constant.grab_constant(True,"HOSPITAL_MOTTO").upper(), font_size=18,
color=(51/255, 153/255, 255/255,1))
self.hospital_motto_label.pos_hint = {"x":0.255, "top": 1.16}
self.add_widget(self.hospital_motto_label)
self.hospital_location_label =
Label(text=constant.grab_constant(True,"HOSPITAL_LOCATION"), font_size=13,
color=(0,0,0,1))
self.hospital_location_label.pos_hint = {"x":0.17, "top": 1.13}
self.add_widget(self.hospital_location_label)
self.info_grid = GridLayout()
self.info_grid.cols = 2
self.info_grid.size_hint = 0.6,0.25
self.info_grid.pos_hint = {"x": 0.25, "top": 0.4}
self.year_name = Label(text= "Founded in:", color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.year_name)
self.year_value = Label(text= constant.grab_constant(True,
"HOSPITAL_YEAR"), color = (0,0,0,1), font_size=13)
self.info_grid.add_widget(self.year_value)
self.total_bed_name = Label(text= "Total Bed Number:", color =
(0,0,0,1), font_size=13)
self.info_grid.add_widget(self.total_bed_name)
self.total_bed_value = Label(text=
constant.grab_constant(True,"HOSPITAL_TOTAL_BED"), color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.total_bed_value)
self.remainning_bed_name = Label(text= "Number of Available Beds:",
color = (0,0,0,1), font_size=13)
self.info_grid.add_widget(self.remainning_bed_name)
self.remainning_bed_value = Label(text=
constant.grab_constant(True,"HOSPITAL_REMAINING_BED"), color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.remainning_bed_value)
self.doctors_number_name = Label(text= "Total Doctors:", color =
(0,0,0,1), font_size=13)
self.info_grid.add_widget(self.doctors_number_name)
self.doctors_number_value = Label(text=
constant.grab_constant(True,"HOSPITAL_TOTAL_DOCTOR"), color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.doctors_number_value)
self.patient_number_name = Label(text= "Total Treated Patient:", color =
(0,0,0,1), font_size=13)
self.info_grid.add_widget(self.patient_number_name)
self.patient_number_value = Label(text=
constant.grab_constant(True,"HOSPITAL_TOTAL_PATIENT"), color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.patient_number_value)
self.patient_current_name = Label(text= "Number of Current Patient:",
color = (0,0,0,1), font_size=13)
self.info_grid.add_widget(self.patient_current_name)
self.patient_current_value = Label(text=
constant.grab_constant(True,"HOSPITAL_CURRENT_PATIENT"), color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.patient_current_value)
self.employee_number_name = Label(text= "Total Employee:", color =
(0,0,0,1), font_size=13)
self.info_grid.add_widget(self.employee_number_name)
self.employee_number_value = Label(text=
constant.grab_constant(True,"HOSPITAL_TOTAL_EMPLOYEE"), color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.employee_number_value)
self.add_widget(self.info_grid)
class DoctorAboutHospital(AboutHospital):
def go_back(self, instance):
[Link] = SlideTransition(direction = "right")
[Link] = "DoctorAfterLogin"
class PatientAboutHospital(AboutHospital):
def go_back(self, instance):
[Link] = SlideTransition(direction = "right")
[Link] = "PatientAfterLogin"
class EmployeeAboutHospital(AboutHospital):
def go_back(self, instance):
[Link] = SlideTransition(direction = "right")
[Link] = "EmployeeAfterLogin"
# Documentation class
class Documentation(Screen):
def __init__(self, **kwargs):
super().__init__(**kwargs)
[Link] = self.find_my_category()
with [Link]:
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
[Link] = Label(text=[Link]()+ " Documentaion",
font_size=40, color=(1,1,1,1))
[Link].pos_hint= {"x":0.05, "top": 1.45}
self.add_widget([Link])
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
self.close_button = Button(background_normal="resources/[Link]",
background_down="resources/close_down.png")
self.close_button.size_hint = (None, None)
self.close_button.width = 60
self.close_button.height = 60
self.close_button.color = (0,0,0,1)
self.close_button.pos_hint = {"x": 0.85, "top": 0.99}
self.add_widget(self.close_button)
self.close_button.bind(on_release = self.go_back)
def go_back(self):
pass
def find_my_category(self):
return "Doctor"
def all_instructions(self):
return "Default"
def find_my_category(self):
return "admin"
def all_instructions(self):
text = """
00. SignUp or Login to the application to use it.
01. Send others notification using + button.
02. See all of your notification as well as profile.
03. In "Functions" secion, you have a set of functions.
04. Use those functions providing necessary information.
05. In "Settings" you can edit your profile.
06. Read more about the hospital in "About Hospital" section.
07. You are currently reading the docs in the "Documentation" section.
08. Visit creators webpage by clicking on his name at the bottom-right
corner.
09. Promote this "Hospital Management System" application in social
network.
10. Be active in your workflow and have a great day.
"""
return text
class DoctorDocumentation(Documentation):
def go_back(self, instance):
[Link] = SlideTransition(direction = "right")
[Link] = "DoctorAfterLogin"
def find_my_category(self):
return "doctor"
def all_instructions(self):
text = """
00. SignUp or Login to the application to use it.
01. Send notifications to admin using + button.
02. See all of your notification as well as profile.
03. In "Functions" secion, you have a set of functions.
04. Use those functions providing necessary information.
05. In "Settings" you can edit your profile.
06. Read more about the hospital in "About Hospital" section.
07. You are currently reading the docs in the "Documentation" section.
08. Visit creators webpage by clicking on his name at the bottom-right
corner.
09. Promote this "Hospital Management System" application in social
network.
10. Be active in your workflow and have a great day.
"""
return text
class PatientDocumentation(Documentation):
def go_back(self, instance):
[Link] = SlideTransition(direction = "right")
[Link] = "PatientAfterLogin"
def find_my_category(self):
return "patient"
def all_instructions(self):
text = """
00. SignUp or Login to the application to use it.
01. Send notifications to admin using + button.
02. See all of your notification as well as profile.
03. In "Functions" secion, you have a set of functions.
04. Use those functions providing necessary information.
05. In "Settings" you can edit your profile.
06. Read more about the hospital in "About Hospital" section.
07. You are currently reading the docs in the "Documentation" section.
08. Visit creators webpage by clicking on his name at the bottom-right
corner.
09. Promote this "Hospital Management System" application in social
network.
10. Be active in your workflow and have a great day.
"""
return text
class EmployeeDocumentation(Documentation):
def go_back(self, instance):
[Link] = SlideTransition(direction = "right")
[Link] = "EmployeeAfterLogin"
def find_my_category(self):
return "employee"
def all_instructions(self):
text = """
00. SignUp or Login to the application to use it.
01. Send notifications to admin using + button.
02. See all of your notification as well as profile.
03. In "Functions" secion, you have a set of functions.
04. Use those functions providing necessary information.
05. In "Settings" you can edit your profile.
06. Read more about the hospital in "About Hospital" section.
07. You are currently reading the docs in the "Documentation" section.
08. Visit creators webpage by clicking on his name at the bottom-right
corner.
09. Promote this "Hospital Management System" application in social
network.
10. Be active in your workflow and have a great day.
"""
return text
# Profile class
class Profile(Screen):
def __init__(self, **kwargs):
super().__init__(**kwargs)
[Link] = self.find_my_username()
[Link] = self.find_my_category()
if [Link] == "admin":
[Link], [Link], self.date_of_birth, *others =
self.get_my_profile([Link], [Link])[0][1:]
[Link], [Link] = others
elif [Link] == "doctor":
[Link], [Link], self.date_of_birth, *others =
self.get_my_profile([Link], [Link])[0][1:]
[Link], [Link], [Link], [Link] =
others
elif [Link] == "patient":
[Link], [Link], self.date_of_birth, *others =
self.get_my_profile([Link], [Link])[0][1:]
[Link], [Link], self.requested_doctor_username,
self.approved_doctor_username, self.appointment_timestamp, [Link],
[Link] = others
else:
[Link], [Link], self.date_of_birth, *others =
self.get_my_profile([Link], [Link])[0][1:]
[Link], [Link], self.work_of_doctors, [Link],
[Link] = others
with [Link]:
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
[Link] = Label(text=self.find_my_category().capitalize()+ "
Profile", font_size=40, color=(1,1,1,1))
[Link].pos_hint= {"x":0.05, "top": 1.45}
self.add_widget([Link])
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
self.close_button = Button(background_normal="resources/[Link]",
background_down="resources/close_down.png")
self.close_button.size_hint = (None, None)
self.close_button.width = 60
self.close_button.height = 60
self.close_button.color = (0,0,0,1)
self.close_button.pos_hint = {"x": 0.85, "top": 0.99}
self.add_widget(self.close_button)
self.close_button.bind(on_release = self.go_back)
self.info_grid = GridLayout()
self.info_grid.cols = 2
self.info_grid.size_hint = 0.6,0.3
self.info_grid.pos_hint = {"x": 0.2, "top": 0.5}
self.username_name = Label(text = "Username:", color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.username_name)
self.username_value = Label(text = [Link], color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.username_value)
self.fullname_name = Label(text = "Fullname:", color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.fullname_name)
self.fullname_value = Label(text = [Link], color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.fullname_value)
self.email_name = Label(text = "Email Address:", color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.email_name)
self.email_value = Label(text = [Link], color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.email_value)
self.date_of_birth_name = Label(text = "Date of Birth", color =
(0,0,0,1), font_size=13)
self.info_grid.add_widget(self.date_of_birth_name)
self.date_of_birth_value = Label(text =
[Link](self.date_of_birth, format = "%d %b,%Y" ), color =
(0,0,0,1), font_size=13)
self.info_grid.add_widget(self.date_of_birth_value)
if [Link] == "doctor":
self.specialty_name = Label(text = "Specialty:", color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.specialty_name)
self.specialty_value = Label(text = [Link], color =
(0,0,0,1), font_size=13)
self.info_grid.add_widget(self.specialty_value)
self.price_name = Label(text = "Per CheckUp Fee:", color =
(0,0,0,1), font_size=13)
self.info_grid.add_widget(self.price_name)
self.price_value = Label(text = str([Link]), color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.price_value)
elif [Link] == "patient":
self.problem_name = Label(text = "Problem:", color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.problem_name)
self.problem_value = Label(text = [Link], color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.problem_value)
self.requested_doctor_username_name = Label(text = "Requested
Doctor:", color = (0,0,0,1), font_size=13)
self.info_grid.add_widget(self.requested_doctor_username_name)
self.requested_doctor_username_value = Label(text =
(self.requested_doctor_username if not self.requested_doctor_username==None else
"None"), color = (0,0,0,1), font_size=13)
self.info_grid.add_widget(self.requested_doctor_username_value)
self.approved_doctor_username_name = Label(text = "Approved
Doctor:", color = (0,0,0,1), font_size=13)
self.info_grid.add_widget(self.approved_doctor_username_name)
self.approved_doctor_username_value = Label(text =
(self.approved_doctor_username if not self.approved_doctor_username==None else
"None"), color = (0,0,0,1), font_size=13)
self.info_grid.add_widget(self.approved_doctor_username_value)
self.appointment_timestamp_name = Label(text = "Appointment
Timestamp:", color = (0,0,0,1), font_size=13)
self.info_grid.add_widget(self.appointment_timestamp_name)
self.appointment_timestamp_value =
Label(text=([Link](self.appointment_timestamp, format="%d
%b, %Y %H:%M:%S") if self.appointment_timestamp != None else "None"), color =
(0,0,0,1), font_size=13)
self.info_grid.add_widget(self.appointment_timestamp_value)
self.reports_name = Label(text = "Reports:", color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.reports_name)
self.report_bucket = [Link]("+++")
self.report_string = [[Link]("++", ",") for item in
self.report_bucket]
self.reports_value = Label(text = str(self.report_string), color =
(0,0,0,1), font_size=13)
self.info_grid.add_widget(self.reports_value)
elif [Link] =="employee":
self.work_name = Label(text = "Work:", color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.work_name)
self.work_value = Label(text = [Link], color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.work_value)
self.work_of_doctors_name = Label(text = "Work of Doctors:", color =
(0,0,0,1), font_size=13)
self.info_grid.add_widget(self.work_of_doctors_name)
self.work_of_doctors_value = Label(text = self.work_of_doctors,
color = (0,0,0,1), font_size=13)
self.info_grid.add_widget(self.work_of_doctors_value)
self.salary_name = Label(text = "Salary:", color = (0,0,0,1),
font_size=13)
self.info_grid.add_widget(self.salary_name)
self.salary_value = Label(text = str([Link]), color =
(0,0,0,1), font_size=13)
self.info_grid.add_widget(self.salary_value)
self.add_widget(self.info_grid)
def find_my_category(self):
return "doctor"
def find_my_username(self):
return "hpt"
def go_back(self):
pass
def find_my_username(self):
return [Link]
def go_back(self, instance):
for screen in [Link]:
if [Link] == "AdminProfile":
[Link](screen)
[Link] = SlideTransition(direction = "right")
[Link] = "AdminAfterLogin"
class DoctorProfile(Profile):
def find_my_category(self):
return "doctor"
def find_my_username(self):
return [Link]
class PatientProfile(Profile):
def find_my_category(self):
return "patient"
def find_my_username(self):
return [Link]
class EmployeeProfile(Profile):
def find_my_category(self):
return "employee"
def find_my_username(self):
return [Link]
[Link] = self.find_my_username()
[Link] = self.find_my_category()
[Link] = self.get_my_notification([Link],
[Link])
with [Link]:
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
[Link] = Label(text=self.find_my_category().capitalize()+ "
Notifications", font_size=40, color=(1,1,1,1))
[Link].pos_hint= {"x":0.05, "top": 1.45}
self.add_widget([Link])
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
self.close_button = Button(background_normal="resources/[Link]",
background_down="resources/close_down.png")
self.close_button.size_hint = (None, None)
self.close_button.width = 60
self.close_button.height = 60
self.close_button.color = (0,0,0,1)
self.close_button.pos_hint = {"x": 0.85, "top": 0.99}
self.add_widget(self.close_button)
self.close_button.bind(on_release = self.go_back)
self.info_grid = GridLayout()
self.info_grid.cols = 1
self.info_grid.pos_hint = {"x": 0.2, "top": 0.5}
self.note_length = len([Link])
if self.note_length > 6:
[Link] = 0.3
elif self.note_length > 3:
[Link] = 0.2
else:
[Link] = 0.1
self.info_grid.size_hint = 0.6, [Link]
self.add_widget(self.info_grid)
def find_my_category(self):
return "doctor"
def find_my_username(self):
return "hpt"
def go_back(self):
pass
def find_my_username(self):
return [Link]
class DoctorNotifications(Notifications):
def find_my_category(self):
return "doctor"
def find_my_username(self):
return [Link]
class PatientNotifications(Notifications):
def find_my_category(self):
return "patient"
def find_my_username(self):
return [Link]
class EmployeeNotifications(Notifications):
def find_my_category(self):
return "employee"
def find_my_username(self):
return [Link]
# AddNotifications class
class AddNotifications(Screen):
receiver = ObjectProperty()
body = ObjectProperty()
receiver_category = ObjectProperty()
def __init__(self, **kwargs):
super().__init__(**kwargs)
[Link] = self.find_my_username()
[Link] = self.find_my_category()
with [Link]:
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
[Link] = Label(text=self.find_my_category().capitalize()+ " Add
Notifications", font_size=40, color=(1,1,1,1))
[Link].pos_hint= {"x":0.05, "top": 1.45}
self.add_widget([Link])
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
self.close_button = Button(background_normal="resources/[Link]",
background_down="resources/close_down.png")
self.close_button.size_hint = (None, None)
self.close_button.width = 60
self.close_button.height = 60
self.close_button.color = (0,0,0,1)
self.close_button.pos_hint = {"x": 0.85, "top": 0.99}
self.add_widget(self.close_button)
self.close_button.bind(on_release = self.go_back)
self.info_grid = GridLayout()
self.info_grid.cols = 2
self.info_grid.pos_hint = {"x": 0.2, "top": 0.7}
self.info_grid.size_hint = 0.6, 0.3
if [Link] == "admin":
self.receiver_username_name = Label(text= "Receiver's username:",
font_size=15, color = (0,0,0,1))
self.info_grid.add_widget(self.receiver_username_name)
self.receiver_username_value = TextInput(multiline = False)
self.info_grid.add_widget(self.receiver_username_value)
self.receiver_category_name = Label(text= "Receiver's category:",
font_size=15, color = (0,0,0,1))
self.info_grid.add_widget(self.receiver_category_name)
self.receiver_category_value = TextInput(multiline = False)
self.info_grid.add_widget(self.receiver_category_value)
else:
self.receiver_username_name = Label(text= "Admin's username:",
font_size=15, color = (0,0,0,1))
self.info_grid.add_widget(self.receiver_username_name)
self.receiver_username_value = TextInput(multiline = False)
self.info_grid.add_widget(self.receiver_username_value)
self.notification_body_name = Label(text= "Notification's Body: ",
font_size=15, color = (0,0,0,1))
self.info_grid.add_widget(self.notification_body_name)
self.notification_body_value = TextInput(multiline = False)
self.info_grid.add_widget(self.notification_body_value)
self.add_widget(self.info_grid)
self.receiver_username_value.text = ""
self.notification_body_value.text = ""
def send_notifications(self,body,receiver,username):
return "Default"
def find_my_category(self):
return "doctor"
def find_my_username(self):
return "hpt"
def go_back(self):
pass
# Subclasses of AddNotifications class
class AdminAddNotifications(AddNotifications):
def find_my_category(self):
return "admin"
def find_my_username(self):
return [Link]
self.receiver_username_value.text = ""
self.notification_body_value.text = ""
self.receiver_category_value.text = ""
try:
admin.add_notification(body,category,receiver, True)
except:
show_NotificationPop()
class DoctorAddNotifications(AddNotifications):
def find_my_category(self):
return "doctor"
def find_my_username(self):
return [Link]
try:
return doctor.notify_admin([Link], [Link], [Link],
True)
except:
show_NotificationPop()
class PatientAddNotifications(AddNotifications):
def find_my_category(self):
return "patient"
def find_my_username(self):
return [Link]
try:
return patient.notify_admin([Link], [Link], [Link],
True)
except:
show_NotificationPop()
class EmployeeAddNotifications(AddNotifications):
def find_my_category(self):
return "employee"
def find_my_username(self):
return [Link]
class NotificationPop(FloatLayout):
pass
def show_NotificationPop():
show = NotificationPop()
popup_window = Popup(title = "Add Notification Error", content = show,
size_hint = (0.6, 0.3))
popup_window.open()
# Settings class
class Settings(Screen):
def __init__(self, **kwargs):
super().__init__(**kwargs)
[Link] = self.find_my_username()
[Link] = self.find_my_category()
with [Link]:
Color(1, 1, 1,1,mode="rgba")
Rectangle(pos = [Link], size = (800,600))
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
[Link] = Label(text=self.find_my_category().capitalize()+ "
Settings", font_size=40, color=(1,1,1,1))
[Link].pos_hint= {"x":0.05, "top": 1.45}
self.add_widget([Link])
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
self.close_button = Button(background_normal="resources/[Link]",
background_down="resources/close_down.png")
self.close_button.size_hint = (None, None)
self.close_button.width = 60
self.close_button.height = 60
self.close_button.color = (0,0,0,1)
self.close_button.pos_hint = {"x": 0.85, "top": 0.99}
self.add_widget(self.close_button)
self.close_button.bind(on_release = self.go_back)
[Link] = Label(text= "Only change the profile values which you need
to change. Otherswise, leave it blank.", font_size=15, color = (51/255, 153/255,
255/255,1))
[Link].pos_hint = {"x": 0.015, "top": 1}
self.add_widget([Link])
self.info_grid = GridLayout()
self.info_grid.cols = 2
self.info_grid.pos_hint = {"x": 0.2, "top": 0.45}
self.info_grid.size_hint = 0.6, 0.2
def find_my_category(self):
return "doctor"
def find_my_username(self):
return "hpt"
def go_back(self):
pass
fullname_pass = False
email_pass = False
date_of_birth_pass = False
if fullname != "":
fullname_pass = True
if email != "":
email_pass = True
if date_of_birth != "":
date_of_birth_pass = True
if fullname_pass:
admin.update_db([Link], [Link], "fullname", fullname,
True)
if email_pass:
admin.update_db([Link], [Link], "email", email, True)
if date_of_birth_pass:
admin.update_db([Link], [Link], "date_of_birth",
date_of_birth, True)
def find_my_username(self):
return [Link]
def find_my_username(self):
return [Link]
class PatientSettings(Settings):
def find_my_category(self):
return "patient"
def find_my_username(self):
return [Link]
class EmployeeSettings(Settings):
def find_my_category(self):
return "employee"
def find_my_username(self):
return [Link]
# Admin Functions
class AdminFunctions(Screen):
def __init__(self, **kwargs):
super().__init__(**kwargs)
[Link] = self.find_my_username()
[Link] = "admin"
with [Link]:
Color(1, 1, 1,1,mode="rgba")
Rectangle(pos = [Link], size = (800,600))
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
[Link] = Label(text="Admin Functions", font_size=40,
color=(1,1,1,1))
[Link].pos_hint= {"x":0.05, "top": 1.45}
self.add_widget([Link])
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
self.close_button = Button(background_normal="resources/[Link]",
background_down="resources/close_down.png")
self.close_button.size_hint = (None, None)
self.close_button.width = 60
self.close_button.height = 60
self.close_button.color = (0,0,0,1)
self.close_button.pos_hint = {"x": 0.85, "top": 0.99}
self.add_widget(self.close_button)
self.close_button.bind(on_release = self.go_back)
self.info_grid = GridLayout()
self.info_grid.cols = 1
self.info_grid.pos_hint = {"x": 0.2, "top": 0.82}
self.info_grid.size_hint = 0.6, 0.7
self.add_widget(self.info_grid)
def find_my_username(self):
return [Link]
class AdminDisplayFunction(Screen):
def __init__(self, function_name, **kwargs):
super().__init__(**kwargs)
[Link] = self.find_my_username()
[Link] = "admin"
self.function_name = function_name
with [Link]:
Color(1, 1, 1,1,mode="rgba")
Rectangle(pos = [Link], size = (800,600))
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
[Link] = Label(text="Admin Functions", font_size=40,
color=(1,1,1,1))
[Link].pos_hint= {"x":0.05, "top": 1.45}
self.add_widget([Link])
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
self.close_button = Button(background_normal="resources/[Link]",
background_down="resources/close_down.png")
self.close_button.size_hint = (None, None)
self.close_button.width = 60
self.close_button.height = 60
self.close_button.color = (0,0,0,1)
self.close_button.pos_hint = {"x": 0.85, "top": 0.99}
self.add_widget(self.close_button)
self.close_button.bind(on_release = self.go_back)
if self.function_name == "total_earning_function":
final_function = self.total_earning_function
elif self.function_name == "add_employee_function":
final_function = self.add_employee_function
elif self.function_name == "see_my_employee_function":
final_function = self.see_my_employee_function
elif self.function_name == "remove_employee_function":
final_function = self.remove_employee_function
elif self.function_name == "show_all_doctor_function":
final_function = self.show_all_doctor_function
elif self.function_name == "show_all_patient_function":
final_function = self.show_all_patient_function
elif self.function_name == "show_all_employee_function":
final_function = self.show_all_employee_function
elif self.function_name == "remove_doctor_parmanently_function":
final_function = self.remove_doctor_parmanently_function
elif self.function_name == "remove_patient_parmanently_function":
final_function = self.remove_patient_parmanently_function
elif self.function_name == "remove_employee_parmanently_function":
final_function = self.remove_employee_parmanently_function
else:
final_function = self.patient_joins_doctor_function
def next_button_function(self,function_name):
self.remove_widget(self.previous_button)
self.remove_widget(self.next_button)
if self.function_name == "total_earning_function":
final_function = self.total_earning_function
elif self.function_name == "add_employee_function":
final_function = self.add_employee_function
elif self.function_name == "see_my_employee_function":
final_function = self.see_my_employee_function
elif self.function_name == "remove_employee_function":
final_function = self.remove_employee_function
elif self.function_name == "show_all_doctor_function":
final_function = self.show_all_doctor_function
elif self.function_name == "show_all_patient_function":
final_function = self.show_all_patient_function
elif self.function_name == "show_all_employee_function":
final_function = self.show_all_employee_function
elif self.function_name == "remove_doctor_parmanently_function":
final_function = self.remove_doctor_parmanently_function
elif self.function_name == "remove_patient_parmanently_function":
final_function = self.remove_patient_parmanently_function
elif self.function_name == "remove_employee_parmanently_function":
final_function = self.remove_employee_parmanently_function
else:
final_function = self.patient_joins_doctor_function
self.remove_widget(self.info_grid)
[Link], size_hint, pos_hint = final_function()
[Link].size_hint = size_hint
[Link].pos_hint = pos_hint
self.add_widget([Link])
if (self.function_name == "show_all_patient_function") or
(self.function_name == "patient_joins_doctor_function"):
if [Link] != 0:
self.previous_button = Button(text = "Previous")
self.previous_button.font_size = 18
self.previous_button.color = (1, 1, 1, 1)
self.previous_button.italic = True
self.previous_button.background_color = (0/255, 153/255,
204/255, 1)
self.previous_button.size_hint = (0.1,0.05)
self.previous_button.pos_hint = {"x":0.05, "top": 0.14}
self.add_widget(self.previous_button)
self.previous_button.bind(on_release = lambda x:
self.next_button_function(function_name), on_press = lambda x:
self.add_Holder_counter(-1))
if [Link] != -1:
self.next_button = Button(text = "Next")
self.next_button.font_size = 18
self.next_button.color = (1, 1, 1, 1)
self.next_button.italic = True
self.next_button.background_color = (0/255, 153/255, 204/255, 1)
self.next_button.size_hint = (0.1,0.05)
self.next_button.pos_hint = {"x":0.85, "top": 0.14}
self.add_widget(self.next_button)
self.next_button.bind(on_release = lambda x:
self.next_button_function(function_name), on_press = lambda x :
self.add_Holder_counter(1))
def add_Holder_counter(self,add_int):
if [Link] == -1:
[Link] = Holder.pre_counter
[Link] += add_int
def find_my_username(self):
return [Link]
def total_earning_function(self):
total_earning_list = admin.total_earning(True)
earned_from_employee = total_earning_list[0]
earned_from_patient = total_earning_list[1]
fixed_cost_of_hospital = total_earning_list[2]
employee_pre_salary = total_earning_list[3]
given_to_employees = total_earning_list[4]
initial_earning = total_earning_list[5]
self.info_grid = GridLayout()
self.info_grid.cols = 2
size_hint = 0.6, 0.5
pos_hint = {"x": 0.2, "top": 0.715}
def add_employee_function(self):
def current_function():
try:
admin.add_employee(self.employee_username.text, True)
except:
show_add_employee_popup()
self.employee_username.text = ""
def show_add_employee_popup():
popup_layout = FloatLayout()
first_line = Label(text = "Sorry, Something went Wrong :(",
size_hint= (0.6, 0.2), pos_hint= {"x": 0.2, "top":0.9})
popup_layout.add_widget(first_line)
second_line = Label(text="Invalid Username", size_hint= (0.6, 0.2),
pos_hint= {"x": 0.21, "top":0.5})
popup_layout.add_widget(second_line)
popup_window = Popup(title = "Add Employee Error", content =
popup_layout, size_hint = (0.6, 0.3))
popup_window.open()
self.info_grid = GridLayout()
self.info_grid.cols = 1
size_hint = 0.6, 0.2
pos_hint = {"x": 0.2, "top": 0.6}
def see_my_employee_function(self):
self.info_grid = GridLayout()
self.info_grid.cols = 6
pos_hint = {"x": 0.05, "top": 0.75}
employee_infos = admin.see_my_employee(True)
if len(employee_infos) > 7:
size_hint = 0.9, 0.6
elif len(employee_infos) > 3:
size_hint = 0.9, 0.45
else:
size_hint = 0.9, 0.2
def remove_employee_function(self):
def current_function():
try:
admin.remove_employee(self.employee_username.text, True)
except:
show_remove_employee_popup()
self.employee_username.text = ""
def show_remove_employee_popup():
popup_layout = FloatLayout()
first_line = Label(text = "Sorry, Something went Wrong :(",
size_hint= (0.6, 0.2), pos_hint= {"x": 0.2, "top":0.9})
popup_layout.add_widget(first_line)
second_line = Label(text="Invalid Username", size_hint= (0.6, 0.2),
pos_hint= {"x": 0.21, "top":0.5})
popup_layout.add_widget(second_line)
popup_window = Popup(title = "Remove Employee Error", content =
popup_layout, size_hint = (0.6, 0.3))
popup_window.open()
self.info_grid = GridLayout()
self.info_grid.cols = 1
size_hint = 0.6, 0.2
pos_hint = {"x": 0.2, "top": 0.6}
def show_all_doctor_function(self):
self.info_grid = GridLayout()
self.info_grid.cols = 7
pos_hint = {"x": 0.05, "top": 0.85}
user_infos = admin.show_all_doctor(True)
if len(user_infos) > 15:
size_hint = 0.9, 0.8
elif len(user_infos) > 8:
size_hint = 0.9, 0.5
else:
size_hint = 0.9, 0.3
def show_all_patient_function(self):
self.info_grid = GridLayout()
self.info_grid.cols = 8
pos_hint = {"x": 0.05, "top": 0.85}
counter = [Link]
old_user_infos = admin.show_all_patient(True)
user_infos = old_user_infos[counter*15 : counter*15 + 15]
if len(old_user_infos) < (counter*15+15):
Holder.pre_counter = [Link]
[Link] = -1
size_hint = 0.9,0.7
if len(user_infos) < 5:
size_hint = 0.9, 0.35
def show_all_employee_function(self):
self.info_grid = GridLayout()
self.info_grid.cols = 8
pos_hint = {"x": 0.05, "top": 0.85}
user_infos = admin.show_all_employee(True)
if len(user_infos) > 20:
size_hint = 0.9, 8
elif len(user_infos) > 10:
size_hint = 0.9, 0.6
else:
size_hint = 0.9, 0.35
def remove_doctor_parmanently_function(self):
def current_function():
if self.final_decision_answer.text == "yes":
final_decision = True
else:
final_decision = False
self.doctor_username.text = ""
self.final_decision_answer.text = ""
def show_remove_doctor_parmanently_popup():
popup_layout = FloatLayout()
first_line = Label(text = "Sorry, Something went Wrong :(",
size_hint= (0.6, 0.2), pos_hint= {"x": 0.2, "top":0.9})
popup_layout.add_widget(first_line)
second_line = Label(text="Invalid Username", size_hint= (0.6, 0.2),
pos_hint= {"x": 0.21, "top":0.5})
popup_layout.add_widget(second_line)
popup_window = Popup(title = "Remove Doctor Parmanently Error",
content = popup_layout, size_hint = (0.6, 0.3))
popup_window.open()
self.info_grid = GridLayout()
self.info_grid.cols = 2
size_hint = 0.6, 0.2
pos_hint = {"x": 0.2, "top": 0.65}
def remove_patient_parmanently_function(self):
def current_function():
if self.final_decision_answer.text == "yes":
final_decision = True
else:
final_decision = False
if self.patient_username.text not in
admin.all_patient_username(True):
show_remove_patient_parmanently_popup()
else:
admin.remove_patient_parmanently(self.patient_username.text,
True, final_decision)
self.patient_username.text = ""
self.final_decision_answer.text = ""
def show_remove_patient_parmanently_popup():
popup_layout = FloatLayout()
first_line = Label(text = "Sorry, Something went Wrong :(",
size_hint= (0.6, 0.2), pos_hint= {"x": 0.2, "top":0.9})
popup_layout.add_widget(first_line)
second_line = Label(text="Invalid Username", size_hint= (0.6, 0.2),
pos_hint= {"x": 0.21, "top":0.5})
popup_layout.add_widget(second_line)
popup_window = Popup(title = "Remove Patient Parmanently Error",
content = popup_layout, size_hint = (0.6, 0.3))
popup_window.open()
self.info_grid = GridLayout()
self.info_grid.cols = 2
size_hint = 0.6, 0.2
pos_hint = {"x": 0.2, "top": 0.65}
def remove_employee_parmanently_function(self):
def current_function():
if self.final_decision_answer.text == "yes":
final_decision = True
else:
final_decision = False
if self.employee_username.text not in
admin.all_employee_username(True):
show_remove_employee_parmanently_popup()
else:
admin.remove_employee_parmanently(self.employee_username.text,
True, final_decision)
self.employee_username.text = ""
self.final_decision_answer.text = ""
def show_remove_employee_parmanently_popup():
popup_layout = FloatLayout()
first_line = Label(text = "Sorry, Something went Wrong :(",
size_hint= (0.6, 0.2), pos_hint= {"x": 0.2, "top":0.9})
popup_layout.add_widget(first_line)
second_line = Label(text="Invalid Username", size_hint= (0.6, 0.2),
pos_hint= {"x": 0.21, "top":0.5})
popup_layout.add_widget(second_line)
popup_window = Popup(title = "Remove Employee Parmanently Error",
content = popup_layout, size_hint = (0.6, 0.3))
popup_window.open()
self.info_grid = GridLayout()
self.info_grid.cols = 2
size_hint = 0.6, 0.2
pos_hint = {"x": 0.2, "top": 0.65}
def patient_joins_doctor_function(self):
self.info_grid = GridLayout()
self.info_grid.cols = 6
pos_hint = {"x": 0.05, "top": 0.85}
counter = [Link]
old_user_infos = admin.patient_joins_doctor(True)
user_infos = old_user_infos[counter*15 : counter*15 + 15]
if len(old_user_infos) < (counter*15+15):
Holder.pre_counter = [Link]
[Link] = -1
size_hint = 0.9,0.7
if len(user_infos) < 5:
size_hint = 0.9, 0.35
# Doctor Functions
class DoctorFunctions(Screen):
def __init__(self, **kwargs):
super().__init__(**kwargs)
[Link] = self.find_my_username()
[Link] = "doctor"
with [Link]:
Color(1, 1, 1,1,mode="rgba")
Rectangle(pos = [Link], size = (800,600))
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
[Link] = Label(text="Doctor Functions", font_size=40,
color=(1,1,1,1))
[Link].pos_hint= {"x":0.05, "top": 1.45}
self.add_widget([Link])
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
self.close_button = Button(background_normal="resources/[Link]",
background_down="resources/close_down.png")
self.close_button.size_hint = (None, None)
self.close_button.width = 60
self.close_button.height = 60
self.close_button.color = (0,0,0,1)
self.close_button.pos_hint = {"x": 0.85, "top": 0.99}
self.add_widget(self.close_button)
self.close_button.bind(on_release = self.go_back)
self.info_grid = GridLayout()
self.info_grid.cols = 1
self.info_grid.pos_hint = {"x": 0.2, "top": 0.82}
self.info_grid.size_hint = 0.6, 0.7
self.add_widget(self.info_grid)
def find_my_username(self):
return [Link]
class DoctorDisplayFunction(Screen):
def __init__(self, function_name, **kwargs):
super().__init__(**kwargs)
[Link] = self.find_my_username()
[Link] = "doctor"
self.function_name = function_name
with [Link]:
Color(1, 1, 1,1,mode="rgba")
Rectangle(pos = [Link], size = (800,600))
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
[Link] = Label(text="Doctor Functions", font_size=40,
color=(1,1,1,1))
[Link].pos_hint= {"x":0.05, "top": 1.45}
self.add_widget([Link])
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
self.close_button = Button(background_normal="resources/[Link]",
background_down="resources/close_down.png")
self.close_button.size_hint = (None, None)
self.close_button.width = 60
self.close_button.height = 60
self.close_button.color = (0,0,0,1)
self.close_button.pos_hint = {"x": 0.85, "top": 0.99}
self.add_widget(self.close_button)
self.close_button.bind(on_release = self.go_back)
if self.function_name == "salary_function":
final_function = self.salary_function
elif self.function_name == "show_all_employee_function":
final_function = self.show_all_employee_function
elif self.function_name == "add_employee_function":
final_function = self.add_employee_function
elif self.function_name == "see_my_employee_function":
final_function = self.see_my_employee_function
elif self.function_name == "remove_employee_function":
final_function = self.remove_employee_function
elif self.function_name == "see_all_requested_patient_function":
final_function = self.see_all_requested_patient_function
elif self.function_name == "see_all_patients_of_my_specialty_function":
final_function = self.see_all_patients_of_my_specialty_function
elif self.function_name == "see_my_patient_function":
final_function = self.see_my_patient_function
elif self.function_name == "see_patients_report_function":
final_function = self.see_patients_report_function
else:
final_function = self.remove_patient_function
def find_my_username(self):
return [Link]
def salary_function(self):
total_earning_list = [Link]([Link], True)
total_earning = total_earning_list[0]
total_cost = total_earning_list[1]
nit_salary = total_earning_list[2]
self.info_grid = GridLayout()
self.info_grid.cols = 2
size_hint = 0.6, 0.3
pos_hint = {"x": 0.2, "top": 0.6}
def show_all_employee_function(self):
self.info_grid = GridLayout()
self.info_grid.cols = 6
pos_hint = {"x": 0.05, "top": 0.85}
user_infos = doctor.show_all_employee(True)
if len(user_infos) > 20:
size_hint = 0.9, 8
elif len(user_infos) > 10:
size_hint = 0.9, 0.6
else:
size_hint = 0.9, 0.35
def add_employee_function(self):
def current_function():
try:
doctor.add_employee([Link],self.employee_username.text,
True)
except:
show_add_employee_popup()
self.employee_username.text = ""
def show_add_employee_popup():
popup_layout = FloatLayout()
first_line = Label(text = "Sorry, Something went Wrong :(",
size_hint= (0.6, 0.2), pos_hint= {"x": 0.2, "top":0.9})
popup_layout.add_widget(first_line)
second_line = Label(text="Invalid Username", size_hint= (0.6, 0.2),
pos_hint= {"x": 0.21, "top":0.5})
popup_layout.add_widget(second_line)
popup_window = Popup(title = "Add Employee Error", content =
popup_layout, size_hint = (0.6, 0.3))
popup_window.open()
self.info_grid = GridLayout()
self.info_grid.cols = 1
size_hint = 0.6, 0.2
pos_hint = {"x": 0.2, "top": 0.6}
def see_my_employee_function(self):
self.info_grid = GridLayout()
self.info_grid.cols = 6
pos_hint = {"x": 0.05, "top": 0.75}
employee_infos = doctor.see_my_employee([Link],True)
if len(employee_infos) > 7:
size_hint = 0.9, 0.6
elif len(employee_infos) > 3:
size_hint = 0.9, 0.45
else:
size_hint = 0.9, 0.2
self.username_topic = Button(text = "Username", font_size = 15, color =
(1,1,1,1), background_color = (0/255, 153/255, 204/255, 1))
self.info_grid.add_widget(self.username_topic)
self.fullname_topic = Button(text = "Fullname", font_size = 15, color =
(1,1,1,1), background_color = (0/255, 153/255, 204/255, 1))
self.info_grid.add_widget(self.fullname_topic)
self.email_topic = Button(text = "Email", font_size = 15, color =
(1,1,1,1), background_color = (0/255, 153/255, 204/255, 1), size_hint_x=None,
width=200)
self.info_grid.add_widget(self.email_topic)
self.date_of_birth_topic = Button(text = "Date of Birth", font_size =
15, color = (1,1,1,1), background_color = (0/255, 153/255, 204/255, 1))
self.info_grid.add_widget(self.date_of_birth_topic)
self.work_topic = Button(text = "Work", font_size = 15, color =
(1,1,1,1), background_color = (0/255, 153/255, 204/255, 1))
self.info_grid.add_widget(self.work_topic)
self.salary_topic = Button(text = "Salary", font_size = 15, color =
(1,1,1,1), background_color = (0/255, 153/255, 204/255, 1))
self.info_grid.add_widget(self.salary_topic)
def remove_employee_function(self):
def current_function():
try:
doctor.remove_employee([Link],
self.employee_username.text, True)
except:
show_remove_employee_popup()
self.employee_username.text = ""
def show_remove_employee_popup():
popup_layout = FloatLayout()
first_line = Label(text = "Sorry, Something went Wrong :(",
size_hint= (0.6, 0.2), pos_hint= {"x": 0.2, "top":0.9})
popup_layout.add_widget(first_line)
second_line = Label(text="Invalid Username", size_hint= (0.6, 0.2),
pos_hint= {"x": 0.21, "top":0.5})
popup_layout.add_widget(second_line)
popup_window = Popup(title = "Remove Employee Error", content =
popup_layout, size_hint = (0.6, 0.3))
popup_window.open()
self.info_grid = GridLayout()
self.info_grid.cols = 1
size_hint = 0.6, 0.2
pos_hint = {"x": 0.2, "top": 0.6}
def see_all_requested_patient_function(self):
self.info_grid = GridLayout()
self.info_grid.cols = 5
pos_hint = {"x": 0.05, "top": 0.75}
patient_infos = doctor.see_all_requested_patient([Link],True)
if len(patient_infos) > 7:
size_hint = 0.9, 0.6
elif len(patient_infos) > 3:
size_hint = 0.9, 0.45
else:
size_hint = 0.9, 0.2
def see_all_patients_of_my_specialty_function(self):
self.info_grid = GridLayout()
self.info_grid.cols = 6
pos_hint = {"x": 0.05, "top": 0.75}
patient_infos =
doctor.see_all_patients_of_my_specialty([Link],True)
if len(patient_infos) > 7:
size_hint = 0.9, 0.6
elif len(patient_infos) > 3:
size_hint = 0.9, 0.45
else:
size_hint = 0.9, 0.2
def see_my_patient_function(self):
self.info_grid = GridLayout()
self.info_grid.cols = 6
pos_hint = {"x": 0.05, "top": 0.75}
patient_infos = doctor.see_my_patient([Link],True)
if len(patient_infos) > 7:
size_hint = 0.9, 0.6
elif len(patient_infos) > 3:
size_hint = 0.9, 0.45
else:
size_hint = 0.9, 0.2
def see_patients_report_function(self):
def current_function():
try:
doctor.see_patients_report(self.patient_username.text,
self.report_name.text, True)
except:
show_see_patients_report_popup()
self.patient_username.text = ""
self.report_name.text = ""
def show_see_patients_report_popup():
popup_layout = FloatLayout()
first_line = Label(text = "Sorry, Something went Wrong :(",
size_hint= (0.6, 0.2), pos_hint= {"x": 0.2, "top":0.9})
popup_layout.add_widget(first_line)
second_line = Label(text="Invalid Username or Report Name",
size_hint= (0.6, 0.2), pos_hint= {"x": 0.21, "top":0.5})
popup_layout.add_widget(second_line)
popup_window = Popup(title = "Show Patient Report Error", content =
popup_layout, size_hint = (0.6, 0.3))
popup_window.open()
self.info_grid = GridLayout()
self.info_grid.cols = 2
size_hint = 0.6, 0.2
pos_hint = {"x": 0.2, "top": 0.62}
def remove_patient_function(self):
def current_function():
try:
doctor.remove_patient(self.patient_username.text, True)
except:
show_remove_patient_popup()
self.patient_username.text = ""
def show_remove_patient_popup():
popup_layout = FloatLayout()
first_line = Label(text = "Sorry, Something went Wrong :(",
size_hint= (0.6, 0.2), pos_hint= {"x": 0.2, "top":0.9})
popup_layout.add_widget(first_line)
second_line = Label(text="Invalid Username", size_hint= (0.6, 0.2),
pos_hint= {"x": 0.21, "top":0.5})
popup_layout.add_widget(second_line)
popup_window = Popup(title = "Remove Patient Error", content =
popup_layout, size_hint = (0.6, 0.3))
popup_window.open()
self.info_grid = GridLayout()
self.info_grid.cols = 1
size_hint = 0.6, 0.2
pos_hint = {"x": 0.2, "top": 0.6}
# Patient Functions
class PatientFunctions(Screen):
def __init__(self, **kwargs):
super().__init__(**kwargs)
[Link] = self.find_my_username()
[Link] = "patient"
with [Link]:
Color(1, 1, 1,1,mode="rgba")
Rectangle(pos = [Link], size = (800,600))
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
[Link] = Label(text="Patient Functions", font_size=40,
color=(1,1,1,1))
[Link].pos_hint= {"x":0.05, "top": 1.45}
self.add_widget([Link])
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
self.close_button = Button(background_normal="resources/[Link]",
background_down="resources/close_down.png")
self.close_button.size_hint = (None, None)
self.close_button.width = 60
self.close_button.height = 60
self.close_button.color = (0,0,0,1)
self.close_button.pos_hint = {"x": 0.85, "top": 0.99}
self.add_widget(self.close_button)
self.close_button.bind(on_release = self.go_back)
self.info_grid = GridLayout()
self.info_grid.cols = 1
self.info_grid.pos_hint = {"x": 0.2, "top": 0.82}
self.info_grid.size_hint = 0.6, 0.7
self.add_widget(self.info_grid)
def find_my_username(self):
return [Link]
class PatientDisplayFunction(Screen):
def __init__(self, function_name, **kwargs):
super().__init__(**kwargs)
[Link] = self.find_my_username()
[Link] = "patient"
self.function_name = function_name
with [Link]:
Color(1, 1, 1,1,mode="rgba")
Rectangle(pos = [Link], size = (800,600))
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
[Link] = Label(text="Patient Functions", font_size=40,
color=(1,1,1,1))
[Link].pos_hint= {"x":0.05, "top": 1.45}
self.add_widget([Link])
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
self.close_button = Button(background_normal="resources/[Link]",
background_down="resources/close_down.png")
self.close_button.size_hint = (None, None)
self.close_button.width = 60
self.close_button.height = 60
self.close_button.color = (0,0,0,1)
self.close_button.pos_hint = {"x": 0.85, "top": 0.99}
self.add_widget(self.close_button)
self.close_button.bind(on_release = self.go_back)
if self.function_name == "cost_function":
final_function = self.cost_function
elif self.function_name == "remaining_appointment_time_function":
final_function = self.remaining_appointment_time_function
elif self.function_name == "add_report_function":
final_function = self.add_report_function
elif self.function_name == "see_all_doctors_for_my_problem_function":
final_function = self.see_all_doctors_for_my_problem_function
elif self.function_name == "request_doctor_function":
final_function = self.request_doctor_function
elif self.function_name == "remove_request_function":
final_function = self.remove_request_function
else:
final_function = self.see_my_doctors_stat_function
def find_my_username(self):
return [Link]
def cost_function(self):
total_earning_list = [Link]([Link], True)
doctor_charge = total_earning_list[0]
hospital_charge = total_earning_list[1]
total_charge = total_earning_list[2]
self.info_grid = GridLayout()
self.info_grid.cols = 2
size_hint = 0.6, 0.3
pos_hint = {"x": 0.2, "top": 0.6}
def remaining_appointment_time_function(self):
timestamp = str(patient.remaining_appointment_time([Link],
True))
self.info_grid = GridLayout()
self.info_grid.cols = 2
size_hint = 0.6, 0.3
pos_hint = {"x": 0.2, "top": 0.62}
def add_report_function(self):
def current_function():
if self.report_name.text == "" or self.report_url.text == "":
show_add_report_popup()
try:
patient.add_report(self.report_name.text, self.report_url.text,
[Link], True)
except:
show_add_report_popup()
self.report_name.text = ""
self.report_url.text = ""
def show_add_report_popup():
popup_layout = FloatLayout()
first_line = Label(text = "Sorry, Something went Wrong :(",
size_hint= (0.6, 0.2), pos_hint= {"x": 0.2, "top":0.9})
popup_layout.add_widget(first_line)
second_line = Label(text="Invalid Username or Report Name",
size_hint= (0.6, 0.2), pos_hint= {"x": 0.21, "top":0.5})
popup_layout.add_widget(second_line)
popup_window = Popup(title = "Add Report Error", content =
popup_layout, size_hint = (0.6, 0.3))
popup_window.open()
self.info_grid = GridLayout()
self.info_grid.cols = 2
size_hint = 0.6, 0.2
pos_hint = {"x": 0.2, "top": 0.62}
def see_all_doctors_for_my_problem_function(self):
self.info_grid = GridLayout()
self.info_grid.cols = 5
pos_hint = {"x": 0.05, "top": 0.75}
doctor_infos =
patient.see_all_doctors_for_my_problem([Link],True)
if len(doctor_infos) > 7:
size_hint = 0.9, 0.6
elif len(doctor_infos) > 3:
size_hint = 0.9, 0.45
else:
size_hint = 0.9, 0.2
def request_doctor_function(self):
def current_function():
try:
patient.request_doctor([Link],self.doctor_username.text,
True)
except:
show_request_doctor_popup()
self.doctor_username.text = ""
def show_request_doctor_popup():
popup_layout = FloatLayout()
first_line = Label(text = "Sorry, Something went Wrong :(",
size_hint= (0.6, 0.2), pos_hint= {"x": 0.2, "top":0.9})
popup_layout.add_widget(first_line)
second_line = Label(text="Invalid Username", size_hint= (0.6, 0.2),
pos_hint= {"x": 0.21, "top":0.5})
popup_layout.add_widget(second_line)
popup_window = Popup(title = "Request Doctor Error", content =
popup_layout, size_hint = (0.6, 0.3))
popup_window.open()
self.info_grid = GridLayout()
self.info_grid.cols = 1
size_hint = 0.6, 0.2
pos_hint = {"x": 0.2, "top": 0.6}
def remove_request_function(self):
patient.remove_request([Link], True)
doctor_info = patient.see_my_doctors_stat([Link],True)
size_hint = 0.5, 0.4
# Employee Functions
class EmployeeFunctions(Screen):
def __init__(self, **kwargs):
super().__init__(**kwargs)
[Link] = self.find_my_username()
[Link] = "employee"
self.is_receptionist = [Link]([Link], True)
with [Link]:
Color(1, 1, 1,1,mode="rgba")
Rectangle(pos = [Link], size = (800,600))
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
[Link] = Label(text="Employee Functions", font_size=40,
color=(1,1,1,1))
[Link].pos_hint= {"x":0.05, "top": 1.45}
self.add_widget([Link])
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
self.close_button = Button(background_normal="resources/[Link]",
background_down="resources/close_down.png")
self.close_button.size_hint = (None, None)
self.close_button.width = 60
self.close_button.height = 60
self.close_button.color = (0,0,0,1)
self.close_button.pos_hint = {"x": 0.85, "top": 0.99}
self.add_widget(self.close_button)
self.close_button.bind(on_release = self.go_back)
self.info_grid = GridLayout()
self.info_grid.cols = 1
self.info_grid.pos_hint = {"x": 0.2, "top": 0.82}
self.info_grid.size_hint = 0.6, 0.7
self.add_widget(self.info_grid)
def find_my_username(self):
return [Link]
class EmployeeDisplayFunction(Screen):
def __init__(self, function_name, **kwargs):
super().__init__(**kwargs)
[Link] = self.find_my_username()
[Link] = "employee"
self.function_name = function_name
with [Link]:
Color(1, 1, 1,1,mode="rgba")
Rectangle(pos = [Link], size = (800,600))
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
[Link] = Label(text="Employee Functions", font_size=40,
color=(1,1,1,1))
[Link].pos_hint= {"x":0.05, "top": 1.45}
self.add_widget([Link])
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
self.close_button = Button(background_normal="resources/[Link]",
background_down="resources/close_down.png")
self.close_button.size_hint = (None, None)
self.close_button.width = 60
self.close_button.height = 60
self.close_button.color = (0,0,0,1)
self.close_button.pos_hint = {"x": 0.85, "top": 0.99}
self.add_widget(self.close_button)
self.close_button.bind(on_release = self.go_back)
if self.function_name == "salary_function":
final_function = self.salary_function
elif self.function_name == "see_my_doctors_function":
final_function = self.see_my_doctors_function
else:
final_function = self.appoint_doctor_function
def find_my_username(self):
return [Link]
def salary_function(self):
total_earning_list = [Link]([Link], True)
initial_salary = total_earning_list[0]
hospital_cost = total_earning_list[1]
nit_salary = total_earning_list[2]
self.info_grid = GridLayout()
self.info_grid.cols = 2
size_hint = 0.6, 0.3
pos_hint = {"x": 0.2, "top": 0.6}
def see_my_doctors_function(self):
self.info_grid = GridLayout()
self.info_grid.cols = 5
pos_hint = {"x": 0.05, "top": 0.75}
doctor_infos = employee.see_my_doctors([Link],True)
if len(doctor_infos) > 7:
size_hint = 0.9, 0.6
elif len(doctor_infos) > 3:
size_hint = 0.9, 0.45
else:
size_hint = 0.9, 0.2
def appoint_doctor_function(self):
def current_function():
try:
employee.appoint_doctor([Link],
self.doctor_username.text, self.patient_username.text,
self.appointment_timestamp.text, True)
except:
show_appoint_doctor_popup()
self.doctor_username.text = ""
self.patient_username.text = ""
self.appointment_timestamp.text = "YYYY-MM-DD HH:MM:SS"
def show_appoint_doctor_popup():
popup_layout = FloatLayout()
first_line = Label(text = "Sorry, Something went Wrong :(",
size_hint= (0.6, 0.2), pos_hint= {"x": 0.2, "top":0.9})
popup_layout.add_widget(first_line)
second_line = Label(text="Invalid Username or Date Format",
size_hint= (0.6, 0.2), pos_hint= {"x": 0.21, "top":0.5})
popup_layout.add_widget(second_line)
popup_window = Popup(title = "Appoint Doctor Error", content =
popup_layout, size_hint = (0.6, 0.3))
popup_window.open()
self.info_grid = GridLayout()
self.info_grid.cols = 2
size_hint = 0.6, 0.2
pos_hint = {"x": 0.2, "top": 0.65}
# AdminAfterLogin Class
class AdminAfterLogin(Screen, Widget):
def __init__(self,**kwargs):
super().__init__(**kwargs)
with [Link]:
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
Color(0.4, 0.4, 0.4,1,mode="rgba")
Line(points = ((410, 80),(410, 280)), width = 2)
Line(points = ((180, 175),(620, 175)), width = 2)
[Link] = Label(text="Admin Panel", font_size=40, color=(1,1,1,1))
[Link].pos_hint= {"top": 1.45}
self.add_widget([Link])
self.add_notifications_button =
Button(background_normal="resources/add_notifications.png",
background_down="resources/add_notifications_down.png")
self.add_notifications_button.size_hint = (None, None)
self.add_notifications_button.width = 70
self.add_notifications_button.height = 70
self.add_notifications_button.color = (0,0,0,1)
self.add_notifications_button.pos_hint = {"x": 0.72, "top": 1}
self.add_widget(self.add_notifications_button)
self.add_notifications_button.bind(on_release =
self.go_to_add_notifications)
self.notifications_button =
Button(background_normal="resources/[Link]",
background_down="resources/notifications_down.png")
self.notifications_button.size_hint = (None, None)
self.notifications_button.width = 70
self.notifications_button.height = 70
self.notifications_button.color = (0,0,0,1)
self.notifications_button.pos_hint = {"x": 0.80, "top": 1}
self.add_widget(self.notifications_button)
self.notifications_button.bind(on_release = self.go_to_notifications)
self.profile_button = Button(background_normal="resources/[Link]",
background_down="resources/profile_down.png")
self.profile_button.size_hint = (None, None)
self.profile_button.width = 70
self.profile_button.height = 70
self.profile_button.color = (0,0,0,1)
self.profile_button.pos_hint = {"x": 0.88, "top": 1}
self.add_widget(self.profile_button)
self.profile_button.bind(on_release = self.go_to_profile)
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
def go_to_settings(self):
[Link] = (1,1,1,1)
sm.add_widget(AdminSettings(name = "AdminSettings"))
[Link] = SlideTransition(direction = "left")
[Link] = "AdminSettings"
def go_to_functions(self):
sm.add_widget(AdminFunctions(name = "AdminFunctions"))
[Link] = SlideTransition(direction = "left")
[Link] = "AdminFunctions"
# DoctorAfterLogin Class
class DoctorAfterLogin(Screen, Widget):
def __init__(self,**kwargs):
super().__init__(**kwargs)
with [Link]:
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
Color(0.4, 0.4, 0.4,1,mode="rgba")
Line(points = ((410, 80),(410, 280)), width = 2)
Line(points = ((180, 175),(620, 175)), width = 2)
[Link] = Label(text="Doctor Panel", font_size=40, color=(1,1,1,1))
[Link].pos_hint= {"top": 1.45}
self.add_widget([Link])
self.add_notifications_button =
Button(background_normal="resources/add_notifications.png",
background_down="resources/add_notifications_down.png")
self.add_notifications_button.size_hint = (None, None)
self.add_notifications_button.width = 70
self.add_notifications_button.height = 70
self.add_notifications_button.color = (0,0,0,1)
self.add_notifications_button.pos_hint = {"x": 0.72, "top": 1}
self.add_widget(self.add_notifications_button)
self.add_notifications_button.bind(on_release =
self.go_to_add_notifications)
self.notifications_button =
Button(background_normal="resources/[Link]",
background_down="resources/notifications_down.png")
self.notifications_button.size_hint = (None, None)
self.notifications_button.width = 70
self.notifications_button.height = 70
self.notifications_button.color = (0,0,0,1)
self.notifications_button.pos_hint = {"x": 0.80, "top": 1}
self.add_widget(self.notifications_button)
self.notifications_button.bind(on_release = self.go_to_notifications)
self.profile_button = Button(background_normal="resources/[Link]",
background_down="resources/profile_down.png")
self.profile_button.size_hint = (None, None)
self.profile_button.width = 70
self.profile_button.height = 70
self.profile_button.color = (0,0,0,1)
self.profile_button.pos_hint = {"x": 0.88, "top": 1}
self.add_widget(self.profile_button)
self.profile_button.bind(on_release = self.go_to_profile)
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
[Link] = Label(text="Built with Python, PostgreSQL, Psycopg2, and
Kivy", font_size=13, color=(1,1,1,1))
[Link].pos_hint = {"x":-0.27, "top": 0.525}
self.add_widget([Link])
def go_to_settings(self):
sm.add_widget(DoctorSettings(name = "DoctorSettings"))
[Link] = SlideTransition(direction = "left")
[Link] = "DoctorSettings"
def go_to_functions(self):
sm.add_widget(DoctorFunctions(name = "DoctorFunctions"))
[Link] = SlideTransition(direction = "left")
[Link] = "DoctorFunctions"
# PatientAfterLogin Class
class PatientAfterLogin(Screen, Widget):
def __init__(self,**kwargs):
super().__init__(**kwargs)
with [Link]:
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
Color(0.4, 0.4, 0.4,1,mode="rgba")
Line(points = ((410, 80),(410, 280)), width = 2)
Line(points = ((180, 175),(620, 175)), width = 2)
[Link] = Label(text="Patient Panel", font_size=40, color=(1,1,1,1))
[Link].pos_hint= {"top": 1.45}
self.add_widget([Link])
self.add_notifications_button =
Button(background_normal="resources/add_notifications.png",
background_down="resources/add_notifications_down.png")
self.add_notifications_button.size_hint = (None, None)
self.add_notifications_button.width = 70
self.add_notifications_button.height = 70
self.add_notifications_button.color = (0,0,0,1)
self.add_notifications_button.pos_hint = {"x": 0.72, "top": 1}
self.add_widget(self.add_notifications_button)
self.add_notifications_button.bind(on_release =
self.go_to_add_notifications)
self.notifications_button =
Button(background_normal="resources/[Link]",
background_down="resources/notifications_down.png")
self.notifications_button.size_hint = (None, None)
self.notifications_button.width = 70
self.notifications_button.height = 70
self.notifications_button.color = (0,0,0,1)
self.notifications_button.pos_hint = {"x": 0.80, "top": 1}
self.add_widget(self.notifications_button)
self.notifications_button.bind(on_release = self.go_to_notifications)
self.profile_button = Button(background_normal="resources/[Link]",
background_down="resources/profile_down.png")
self.profile_button.size_hint = (None, None)
self.profile_button.width = 70
self.profile_button.height = 70
self.profile_button.color = (0,0,0,1)
self.profile_button.pos_hint = {"x": 0.88, "top": 1}
self.add_widget(self.profile_button)
self.profile_button.bind(on_release = self.go_to_profile)
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
def go_to_settings(self):
sm.add_widget(PatientSettings(name = "PatientSettings"))
[Link] = SlideTransition(direction = "left")
[Link] = "PatientSettings"
def go_to_functions(self):
sm.add_widget(PatientFunctions(name = "PatientFunctions"))
[Link] = SlideTransition(direction = "left")
[Link] = "PatientFunctions"
# EmployeeAfterLogin Class
class EmployeeAfterLogin(Screen, Widget):
def __init__(self,**kwargs):
super().__init__(**kwargs)
with [Link]:
Color(51/255, 153/255, 255/255,1,mode="rgba")
Line(points = ((0, 580),(1000, 580)), width = 50)
Line(points = ((0, 0),(1000, 0)), width = 35)
Color(0.4, 0.4, 0.4,1,mode="rgba")
Line(points = ((410, 80),(410, 280)), width = 2)
Line(points = ((180, 175),(620, 175)), width = 2)
[Link] = Label(text="Employee Panel", font_size=40, color=(1,1,1,1))
[Link].pos_hint= {"top": 1.45}
self.add_widget([Link])
self.add_notifications_button =
Button(background_normal="resources/add_notifications.png",
background_down="resources/add_notifications_down.png")
self.add_notifications_button.size_hint = (None, None)
self.add_notifications_button.width = 70
self.add_notifications_button.height = 70
self.add_notifications_button.color = (0,0,0,1)
self.add_notifications_button.pos_hint = {"x": 0.72, "top": 1}
self.add_widget(self.add_notifications_button)
self.add_notifications_button.bind(on_release =
self.go_to_add_notifications)
self.notifications_button =
Button(background_normal="resources/[Link]",
background_down="resources/notifications_down.png")
self.notifications_button.size_hint = (None, None)
self.notifications_button.width = 70
self.notifications_button.height = 70
self.notifications_button.color = (0,0,0,1)
self.notifications_button.pos_hint = {"x": 0.80, "top": 1}
self.add_widget(self.notifications_button)
self.notifications_button.bind(on_release = self.go_to_notifications)
self.profile_button = Button(background_normal="resources/[Link]",
background_down="resources/profile_down.png")
self.profile_button.size_hint = (None, None)
self.profile_button.width = 70
self.profile_button.height = 70
self.profile_button.color = (0,0,0,1)
self.profile_button.pos_hint = {"x": 0.88, "top": 1}
self.add_widget(self.profile_button)
self.profile_button.bind(on_release = self.go_to_profile)
[Link] = Button(background_normal="resources/short_logo.png",
background_down="resources/short_logo.png")
[Link].size_hint = (None, None)
[Link] = 120
[Link] = 90
[Link] = (0,0,0,1)
[Link].pos_hint = {"x": 0.1, "top": 1.02}
self.add_widget([Link])
def go_to_settings(self):
sm.add_widget(EmployeeSettings(name = "EmployeeSettings"))
[Link] = SlideTransition(direction = "left")
[Link] = "EmployeeSettings"
def go_to_functions(self):
sm.add_widget(EmployeeFunctions(name = "EmployeeFunctions"))
[Link] = SlideTransition(direction = "left")
[Link] = "EmployeeFunctions"
# Main Class
class HMSApp(App):
def build(self):
[Link] = (1,1,1,1)
return sm
[Link]
import psycopg2
import os
from getpass import getpass
from DB_config import config
import datetime
else:
username, fullname, email, date_of_birth, password, work, salary = args
date_of_birth = [Link](date_of_birth.strip(),"%Y-%m-
%d")
work_of_doctors = "hpt"
notifications = "Logged in"
return True
[Link]
import psycopg2
import os
import doctor
import patient
import employee
import login
import admin
import constant
import setup_engine
import backup_restore
import kivy
print([Link].__version__)
[Link]
import psycopg2
from constant import grab_constant
from DB_config import config
import datetime
cur2 = total_cost.cursor()
if approved_doctor_username != "hpt":
[Link]("""
SELECT price FROM doctor WHERE username = %s;
""", [approved_doctor_username])
doctors_salary = int([Link]()[0][0])
final_cost = (doctors_salary * (100 +
int(grab_constant(True,"CUT_FROM_PATIENT"))))//100
else:
doctors_salary = 0
final_cost = 0
total_cost.close()
hospital_cost = final_cost - doctors_salary
cur2 = doctors_as_problem.cursor()
[Link]("""
SELECT username, fullname, email, date_of_birth, price FROM
doctor WHERE specialty = %s;
""", [problem])
rows = [Link]()
# print part
# for row in rows:
# print("Username:", row[0], "\tFullname:", row[1], "\tEmail:",
row[2], "\tPrice:", row[3])
[Link]()
doctors_as_problem.close()
return rows
cur2 = my_doctor.cursor()
[Link]("""
SELECT username, fullname, email, date_of_birth, specialty,
price FROM doctor WHERE username = %s;
""", [approved_doctor_username])
rows = list([Link]()[0])
[Link](appointment_timestamp)
# print part
# for row in rows:
# print("Doctor's Information")
# print("Fullname:", row[1])
# print("Email:", row[2])
# print("specialty:", row[3])
# print("Price:", row[4])
# print("Appointment Timestamp:", row[5])
[Link]()
my_doctor.close()
return rows
setup_engine.py
import psycopg2
from [Link] import ISOLATION_LEVEL_AUTOCOMMIT
import constant
from DB_config import config, admin_config
from backup_restore import restore_from_csv
def start_program():
delete_database(True,True)
create_database(True)
delete_admin_table(True,True)
create_admin_table(True)
delete_doctor_table(True,True)
create_doctor_table(True)
delete_employee_table(True,True)
create_employee_table(True)
delete_patient_table(True,True)
create_patient_table(True)
add_unique_constraint(True)
add_check_constraint(True)
restore_from_csv(True)
return "You are ready to go!"
def create_database(logged_in):
if logged_in:
with [Link](**admin_config()) as database_creator:
database_creator.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
cur1 = database_creator.cursor()
[Link]("""
CREATE DATABASE hms;
""")
print([Link])
[Link]()
database_creator.commit()
database_creator.close()
return "Database Created"
def create_admin_table(logged_in):
if logged_in:
with [Link](**config()) as create_admin:
cur1 = create_admin.cursor()
[Link]("""
CREATE TABLE admin (
username VARCHAR(5) NOT NULL PRIMARY KEY,
fullname TEXT NOT NULL,
email VARCHAR(32) NOT NULL,
date_of_birth DATE NOT NULL,
password VARCHAR(15) NOT NULL,
notifications TEXT NOT NULL
);
""")
print([Link])
[Link]()
create_admin.commit()
create_admin.close()
return "Admin Table Created"
def create_doctor_table(logged_in):
if logged_in:
with [Link](**config()) as create_doctor:
cur1 = create_doctor.cursor()
[Link]("""
CREATE TABLE doctor (
username VARCHAR(5) NOT NULL PRIMARY KEY,
fullname TEXT NOT NULL,
email VARCHAR(32) NOT NULL,
date_of_birth DATE NOT NULL,
password VARCHAR(5) NOT NULL,
specialty TEXT NOT NULL,
price INT NOT NULL,
notifications TEXT NOT NULL
);
""")
print([Link])
[Link]()
create_doctor.commit()
create_doctor.close()
return "Doctor Table Created"
def create_patient_table(logged_in):
if logged_in:
with [Link](**config()) as create_patient:
cur1 = create_patient.cursor()
[Link]("""
CREATE TABLE patient (
username VARCHAR(5) NOT NULL PRIMARY KEY,
fullname TEXT NOT NULL,
email VARCHAR(32) NOT NULL,
date_of_birth DATE NOT NULL,
password VARCHAR(5) NOT NULL,
problem TEXT NOT NULL,
requested_doctor_username VARCHAR(5),
approved_doctor_username VARCHAR(5) REFERENCES doctor
(username),
appointment_timestamp TIMESTAMP,
reports TEXT,
notifications TEXT NOT NULL
);
""")
print([Link])
[Link]()
create_patient.commit()
create_patient.close()
return "Patient Table Created"
def delete_patient_table(logged_in, final_decision = False):
if final_decision and logged_in:
with [Link](**config()) as delete_patient:
cur0 = delete_patient.cursor()
[Link]("""
DROP TABLE IF EXISTS patient;
""")
print([Link])
[Link]()
delete_patient.commit()
delete_patient.close()
return "Patient Table Deleted"
def create_employee_table(logged_in):
if logged_in:
with [Link](**config()) as create_employee:
cur1 = create_employee.cursor()
[Link]("""
CREATE TABLE employee (
username VARCHAR(5) NOT NULL PRIMARY KEY,
fullname TEXT NOT NULL,
email VARCHAR(32) NOT NULL,
date_of_birth DATE NOT NULL,
password VARCHAR(5) NOT NULL,
work TEXT NOT NULL,
work_of_doctors TEXT,
salary INT NOT NULL,
notifications TEXT NOT NULL
);
""")
print([Link])
[Link]()
create_employee.commit()
create_employee.close()
return "Employee Table Created"
def add_unique_constraint(logged_in):
if logged_in:
with [Link](**config()) as admin_constraint:
cur1 = admin_constraint.cursor()
[Link]("""
ALTER TABLE admin ADD CONSTRAINT unique_admin_email
UNIQUE(email);
""")
[Link]()
admin_constraint.commit()
admin_constraint.close()
def add_check_constraint(logged_in):
if logged_in:
with [Link](**config()) as doctor_salary_constraint:
cur1 = doctor_salary_constraint.cursor()
[Link](f"""
ALTER TABLE doctor ADD CONSTRAINT doctor_price_check_constraint
CHECK(price < {int(constant.grab_constant(True,"DOCTOR_MAX_CHECKUP_PRICE"))})
""")
doctor_salary_constraint.commit()
doctor_salary_constraint.close()