def calling_campaign(self): """ Function for Calling Campaign Filters """ pretty_print("CALLING CAMPAIGN FILTER", "*") pretty_print("To access data BEFORE last contact date: 1", "-") pretty_print("To access data AFTER last contact date press: 2", "-") pretty_print("To access data with no last contact date press: 3", "-") index = get_int_input() if index == 1: date_input = input("Enter a date: Format MM/DD/YY \n") try: date = pd.to_datetime(date_input) except ValueError: print("ERROR: Enter a valid date: Format MM/DD/YY ...") return self.excel.compare_date_before(date) self.save_quit() if index == 2: date_input = input("Enter a date: Format MM/DD/YY \n") try: date = pd.to_datetime(date_input) except ValueError: print("ERROR: Enter a valid date: Format MM/DD/YY ...") return self.excel.compare_date_after(date) self.save_quit() if index == 3: pretty_print("Filtering", "_") self.excel.no_last_contact() self.save_quit()
def get_emails(print_list, email_dict): """ Function to get emails """ email_list = [] again = True contact_table = PrettyTable() contact_table.field_names = ["Command", "Advisor Name", "Email"] for row in print_list: contact_table.add_row(row) while again: print(contact_table) pretty_print(email_list, ":") pretty_print("To Add Receiving Emails Enter the corresponding command number", "-") pretty_print("To Send Mail press any number key:", "-") choice = get_int_input() if choice in email_dict.keys(): email_list.append(email_dict[choice]) else: if len(email_list) != 0: again = False else: again = True pretty_print("No Email Added", "-") clear() return email_list
def call_result(self, row_list): """ Function to update call result """ pretty_print("How was your call?", "*") pretty_print("If you talked to the student enter: 200", "-") pretty_print("If the call was not answered enter: 500", "-") pretty_print("If you did not call the person enter: 999", "-") pretty_print( "If the student wants to Decline/Withdraw application enter: 404", "-") again = True while again: result = get_int_input() if result == 200: self.called += 1 again = False self.called_list.append(row_list) elif result == 500: self.not_answered += 1 again = False self.no_answer_list.append(row_list) elif result == 999: again = False elif result == 404: self.declines += 1 again = False self.decline_list.append(row_list) else: print("You can't get out of this! Enter a valid number!")
def main_df_split(): """ Main function to split data files """ clear() pretty_print("You can split the file in equal parts here:", "#") try: name = get_file() pretty_print("How many chunks do you need?", "-") number = get_int_input() data_frame = pd.read_excel(name) split_df = np.array_split(data_frame, number) for index, dataframe in enumerate(split_df, 1): file_name = get_file_name() dataframe.to_excel(f"{file_name}.xlsx", index=False) pretty_print(f"File {index} {file_name}.xlsx Saved", "*") pretty_print("Have a Nice Day! - @MrunalSalvi", "&") sleep(5) except FileNotFoundError: clear() pretty_print("The File Does not Exist.", ":") pretty_print("Make Sure your place the file in the working directory.", ":") sleep(2) main_df_split() except Exception as log_error: print("Oops something went wrong...") print(log_error) sleep(10)
def main(): """ Main App Function """ pretty_print("Welcome to EXCELSIOR", "#") pretty_print("For International Student Data Filters press: 1", "-") pretty_print("For Domestic Student Data Filters press: 2", "-") pretty_print("To split an excel file in equal parts: 3", "-") pretty_print("To combine multiple excel files in a single file press: 4", "-") pretty_print("For GA Calling Campaign Assist: 5", "-") pretty_print("Press any key to exit the application", "-") choice = get_int_input() if choice == 1: main_international() elif choice == 2: main_domestic() elif choice == 3: main_df_split() elif choice == 4: concat_data_main() elif choice == 5: ga_assist_main() else: raise SystemExit
def bin_filter(self): """ Function to filter through bin """ pretty_print("BIN FILTER", "*") pretty_print("To access Admits/Conditional Admits press: 1", "-") pretty_print("To continue press any number key:", "-") bin_options = get_int_input() self.excel.admitted_info(bin_options)
def test_utils_all(): from utils import isint, set_at, get_int_input print("testing: isint:", isint([5])) print("testing: set_at:", set_at("ABS!", 2, "C")) print( "testing: get_int_input:", get_int_input(prompt="GIVE ME IINNTT!!", error_message="F**K YOU, INT I TOLD!"))
def fellowship_filter(self): """ Function to filter through student fellowship data """ pretty_print("FELLOWSHIP FILTER", "*") pretty_print("To *delete* Students with Fellowships press: 1", "-") pretty_print("To continue press any number key:", "-") fellowship_options = get_int_input() self.excel.fellowship_info(fellowship_options)
def transfer_filter(self): """ Function to filter through transfer student data """ pretty_print("TRANSFER FILTER", "*") pretty_print("To *delete* Transfer Student Data press: 1", "-") pretty_print("To continue press any number key:", "-") transfer_options = get_int_input() self.excel.transfer_info(transfer_options)
def on_campus_filter(self): """ Function to filter through on-campus data """ pretty_print("ON CAMPUS FILTER", "*") pretty_print("To filter through On Campus Student Data press: 1", "-") pretty_print("To continue press any number key:", "-") on_campus_options = get_int_input() self.excel.on_campus_info(on_campus_options)
def decline_filter(self): """ Function to filter through declines """ pretty_print("DECLINE FILTER", "*") pretty_print("To exclude Declined Applications press: 1", "-") pretty_print("To continue press any number key:", "-") decline_options = get_int_input() self.excel.declines_info(decline_options)
def reporting_filter(self): """ Function to filter through reporting classifications """ pretty_print("REPORTING CLASSIFICATION FILTER", "*") pretty_print("For International Reporting Classification press: 1", "-") pretty_print("To continue press any number key:", "-") reporting_options = get_int_input() self.excel.reporting_info(reporting_options)
def enrollment_status_filter(self): """ Function to filter through enrollment status """ pretty_print("ENROLLMENT STATUS FILTER", "*") pretty_print("For Full-Time student data press : 1", "-") pretty_print("For Part-Time student data press: 2", "-") pretty_print("For all student data press any key:", "-") enrollment_status = get_int_input() self.excel.enrollment_info(enrollment_status)
def citizenship_filter(self): """ Function to filter through citizenship """ pretty_print("CITIZENSHIP FILTER", "*") pretty_print("For Non-China Citizenship Info press: 1", "-") pretty_print("For Chinese Citizenship Info press: 2", "-") pretty_print("To continue press any number key:", "-") citizenship_options = get_int_input() self.excel.citizenship_info(citizenship_options)
def looping(self): """ Function to loop again """ pretty_print("To Exit enter: 101", ":") pretty_print("To continue press any number key:", ":") decision = get_int_input() if decision == 101: self.again = False
def enrollment_options_filter(self): """ Function to filter through enrollment options """ pretty_print("ENROLLMENT OPTIONS FILTER", "*") pretty_print("For filtering through Masters/Graduate Certificate Applications press : 1", "-") pretty_print("For filtering through PhD Applications press: 2", "-") pretty_print("For Filtering through all applications press any key:", "-") enrollment_options = get_int_input() self.excel.enrollment_options(enrollment_options)
def school_filter(self): """ Function to filter through school """ pretty_print("SCHOOL FILTER", "*") pretty_print("To get SOB Applications press: 1", "-") pretty_print("To get SES Applications press: 2", "-") pretty_print("To get SSE Applications press: 3", "-") pretty_print("To continue press any number key:", "-") school_options = get_int_input() self.excel.school_info(school_options)
def concat_data_main(): """ Main Concat Data Function """ clear() pretty_print("You can combine two or more excel files here:", "#") pretty_print("How many files do you want to combine:", "-") file_list = [] try: number = get_int_input() if number <= 1: raise ValueError if number >= 10: raise ArithmeticError for i in range(number): name = get_file() data_frame = pd.read_excel(name) file_list.append(data_frame) clear() full_df = concat_ordered_columns(file_list) new_name = get_file_name() full_df.to_excel(f"{new_name}.xlsx", index=False) pretty_print(f"File Saved as {new_name}.xlsx", "-") pretty_print("Have a Nice Day! - @Mrunal", "&") sleep(5) except FileNotFoundError: clear() pretty_print("The File Does not Exist.", ":") pretty_print("Make Sure your place the file in the working directory.", ":") sleep(2) concat_data_main() except ValueError: pretty_print("You can't combine a single file or no file... How sad!", ":") pretty_print("Try Again!", ":") sleep(5) concat_data_main() except ArithmeticError: pretty_print("I can combine more than 10 excel files together but I just don't want to ;-)", ":") pretty_print("Try Again", ":") sleep(5) concat_data_main() except Exception as log_error: print("Oops something went wrong") print(log_error) sleep(10)
def coa_filter(self): """ Function to filter through students submitted / not submitted COA """ pretty_print("COA FILTER", "*") pretty_print("To access students who have not submitted COA press: 1", "-") pretty_print( "To access students who have submitted COA and attending Stevens press: 2", "-") coa_options = get_int_input() self.excel.coa_info(coa_options)
def deposit_filter(self): """ Function to filter through deposit paid or not paid """ pretty_print("DEPOSIT FILTER", "*") pretty_print("To include students who have not paid deposit press: 1", "-") pretty_print("To include students who have paid the deposit press: 2", "-") pretty_print("To continue press any number key:", "-") deposit_options = get_int_input() self.excel.deposit_info(deposit_options)
def defer_filter(self): """ Function to filter through deferrals """ pretty_print("DEFER FILTER", "*") pretty_print( "To include deferred applications to a specific term press: 1", "-") pretty_print("To continue press any number key:", "-") defer_options = get_int_input() if defer_options == 1: string = input('Enter the term: Format - Fall 2019 \n') self.excel.deferral_info(string)
def email_options(self): pretty_print("To send Email updates press: 200", "*") pretty_print("To continue press any number key:", "*") choice = get_int_input() if choice == 200: try: main_email(self.ga_name, self.total, self.called, self.not_answered, self.declines, self.not_called) except Exception as log_error: pretty_print("Server error...Couldn't send the email updates", ":") print(log_error)
def displayUI(self): for log in self.excel.stack: pretty_print(log, "/") print(self.domestic_table) pretty_print("Choose an option from the Column and enter the corresponding command", "-") pretty_print("For Calling Campaign Filters enter: 1500", "-") if len(self.excel.stack) != 0: pretty_print("To Save and Quit enter: 101", "-") choice = get_int_input() try: if choice == 101 and len(self.excel.stack) == 0: raise ValueError self.main_function_dict[choice]() clear() except KeyError: pretty_print("Please enter a valid input number.", ":") sleep(3) self.again = True clear() except ValueError: pretty_print("You have not applied any filters yet.", ":") sleep(3) self.again = True clear() except IndexError: pretty_print("Check data file", ":") sleep(3) self.again = True clear() except SystemExit: self.again = False pretty_print("Have a Nice Day! - @MrunalSalvi", "&") sleep(5) except Exception as log_error: self.again = False pretty_print("Oops something went wrong", ":") print(log_error) sleep(10) clear()
def i20_filter(self): """ Function to filter through I-20 Options """ pretty_print("I-20 FILTER", "*") pretty_print("To access students with no I20 press: 1", "-") pretty_print("To access students with I20 issued press: 2", "-") i20_options = get_int_input() i20_issued = self.excel.i20_info(i20_options) if not i20_issued: clear() again = True que_len = len(self.excel.stack) while again: for log in self.excel.stack: pretty_print(log, "/") print(self.i20NotIssued_table) pretty_print("Enter Command Number for your Filter of Choice", "-") pretty_print("For Calling Campaign Filters enter: 1500", "-") pretty_print("To Save and Quit enter: 101", "-") pretty_print("To Return to Main Screen enter any number key", "-") choice = get_int_input() if choice == 101 and len(self.excel.stack) == 0: raise ValueError if choice in self.i20NotIssued_function_dict.keys(): self.i20NotIssued_function_dict[choice]() else: again = False if (len(self.excel.stack) - que_len) >= 3: again = False clear() if i20_issued: clear() again = True que_len = len(self.excel.stack) while again: for log in self.excel.stack: pretty_print(log, "/") print(self.i20Issued_table) pretty_print("Enter Command Number for your Filter of Choice", "-") pretty_print("For Calling Campaign Filters enter: 1500", "-") pretty_print("To Save and Quit enter: 101", "-") pretty_print("To Return to Main Screen enter any number key", "-") choice = get_int_input() if choice == 101 and len(self.excel.stack) == 0: raise ValueError if choice in self.i20issued_function_dict.keys(): self.i20issued_function_dict[choice]() else: again = False if (len(self.excel.stack) - que_len) >= 2: again = False clear()