def remove_user(self, user): content = self.ids.scrnContents content.clear_widgets() self.users.remove({'user_name': user}) users = self.get_users() usersTable = datatableWindow(table=users) content.add_widget(usersTable)
def remove_patient(self, pid): content = self.ids.scrnPatientContents content.clear_widgets() self.patients.remove({'pid': pid}) pats = self.get_patients() patientsTable = datatableWindow(table=pats) content.add_widget(patientsTable)
def __init__(self, **kwargs): super().__init__(**kwargs) client = MongoClient() db = client.database #I named the database 'database' like a dum dum. self.users = db.users # The collections of the database are users and patients self.patients = db.patients #print(self.get_users()) #users content = self.ids.scrnContents users = self.get_users() usersTable = datatableWindow(table=users) content.add_widget(usersTable) #patients patientScrn = self.ids.scrnPatientContents patients = self.get_patients() patientsTable = datatableWindow(table=patients) patientScrn.add_widget(patientsTable)
def add_patient(self, checkin, pid, rn, emg, risk, rfid): content = self.ids.scrnPatientContents content.clear_widgets() self.patients.insert_one({ 'checkin': checkin, 'pid': pid, 'rn': rn, 'emg': emg, 'risk': risk, 'rfid': rfid }) pats = self.get_patients() patientsTable = datatableWindow(table=pats) content.add_widget(patientsTable)
def add_user(self, first, last, user, pwd, des): content = self.ids.scrnContents content.clear_widgets() pwd = hashlib.sha256(pwd.encode()).hexdigest() self.users.insert_one({ 'first_name': first, 'last_name': last, 'user_name': user, 'password': pwd, 'designation': des, 'date': datetime.now() }) users = self.get_users() usersTable = datatableWindow(table=users) content.add_widget(usersTable)