def patients(): st.header('PATIENTS') option_list = ['', 'Add patient', 'Update patient', 'Delete patient', 'Show complete patient record', 'Search patient'] option = st.sidebar.selectbox('Select function', option_list) p = Patient() if (option == option_list[1] or option == option_list[2] or option == option_list[3]) and verify_edit_mode_password(): if option == option_list[1]: st.subheader('ADD PATIENT') p.add_patient() elif option == option_list[2]: st.subheader('UPDATE PATIENT') p.update_patient() elif option == option_list[3]: st.subheader('DELETE PATIENT') try: p.delete_patient() except sql.IntegrityError: # handles foreign key constraint failure issue (due to integrity error) st.error('This entry cannot be deleted as other records are using it.') elif option == option_list[4]: st.subheader('COMPLETE PATIENT RECORD') p.show_all_patients() elif option == option_list[5]: st.subheader('SEARCH PATIENT') p.search_patient()