def ecase_care_plans(): """ Opens a selenium browser with ecase_login, and downloads eCase reports, creates an excel file with a sheet for each area, showing careplans for each resident. """ wings = ['HOUSE 1 - Hector', 'HOUSE 2 - Marion Ross', 'HOUSE 3 - Bruce', 'HOUSE 4 - Douglas', 'HOUSE 5 - Henry Campbell', 'Stirling', 'Iona', 'Balmoral', 'Braemar'] if file_available(rf'{constants.OUTPUTS_DIR}\Care Plans\eCaseCareplans.xlsx'): ecase_driver = ecase_downloader.ecase_login() ecase_data_import.care_plans_setup() for wing in wings: try: ecase_downloader.care_plan_audits_download(ecase_driver, wing) ecase_data_import.care_plans_import(wing) except NoSuchElementException: print(f'{wing} care plans could not be downloaded') ecase_driver.quit() ecase_data_import.care_plans_missing_audits()
def pi_risks(): """ Creates a file of all resident's Risk factor. The file pir_code.csv needs to be manually generated and cleaned, as the natural pir_code.csv from eCase has too many duplicates """ ecase_driver = ecase_downloader.ecase_login() ecase_downloader.ecase_pi_risk(ecase_driver) printing_documents.pi_risk_levels(ecase_driver) ecase_driver.quit()
def podiatry_list(): """ Opens a selenium browser, with ecase_login, and prints, or opens, and excel file with a list of Resident’s and their care levels per area """ ecase_driver = ecase_downloader.ecase_login() ecase_downloader.care_level_csv(ecase_driver) time.sleep(1.5) ecase_driver.quit() ecase_data_import.care_level_list()
def resident_birthday_list(only_village=False): """ Opens a selenium browser with ecase_login, and downloads eCase reports with eCase_Birthdays. Then creates an excel file with all current residents and their birthdates """ if file_available(rf'{constants.OUTPUTS_DIR}\Resident Birthdays\ResidentBirthdays.xlsx'): ecase_driver = ecase_downloader.ecase_login() ecase_downloader.ecase_birthdays(ecase_driver) time.sleep(4) ecase_driver.quit() printing_documents.village_birthdays(only_village=only_village)
def temp_movements(): r""" Opens a selenium browser with ecase_login, and downloads eCase reports with eCase_Movements, then appends new temporary movements to G:\eCase\Downloads\eCaseTempMoves.xlsx """ if file_available(rf'{constants.OUTPUTS_DIR}\eCaseTempMoves.xlsx'): ecase_driver = ecase_downloader.ecase_login() ecase_downloader.ecase_movements(ecase_driver) # waits for the download to finish time.sleep(3) ecase_driver.quit() printing_documents.temp_movements_print()
def printing_resident_sheets(entry, file): """ Checks if the NHI is valid, then downloads the contacts file from ecase Downloads the preferred name and image. Then quits the selenium browser. :param entry: :param file: :return: """ nhi = entry.get() if re.match("^[A-Za-z]{3}[0-9]{4}$", nhi): pass else: popup_error("Incorrect NHI format entered, please try again") if file_available(file): ecase_driver = ecase_downloader.ecase_login() ecase_downloader.resident_contacts(ecase_driver, nhi) ecase_downloader.preferred_name_and_image(ecase_driver, nhi) ecase_driver.quit()
def ecase_data_download(): r""" Opens a selenium browser with ecase_login, and downloads eCase data reports, then writes this data into eCaseData.xlsx in J:\Quality Data\Clinical Data. eCaseGraphs.xlsx has a collection of pivot tables to analyse this data. """ if file_available(rf'{constants.MAIN_DATA_DIR}\Clinical Data\eCaseData.xlsx'): ecase_driver = ecase_downloader.ecase_login() try: ecase_downloader.ecase_data(ecase_driver) except NoSuchElementException: print("Data report can't be downloaded") ecase_driver.quit() try: ecase_data_import.ecase_data_import() except FileNotFoundError: pass
def doctor_allocations(): """ Opens a selenium browser with ecase_login, and downloads eCase reports, then creates two reports, one with a list of residents and who their doctor is. The second file is a summary of each doctor and how many resident’s they are looking after """ doctors = rf'{constants.DOWNLOADS_DIR}\doctor_Allocation_Numbers.xlsx' sort_doc = rf'{constants.DOWNLOADS_DIR}\sorted_doctor_Numbers.csv' # ##Error checking for if the file is open already. # ##Calls the function file_available to save space, rather than # ##try and except blocks. if file_available(doctors) and file_available(sort_doc): ecase_driver = ecase_downloader.ecase_login() ecase_downloader.doctor_numbers_download(ecase_driver) time.sleep(3) ecase_driver.quit() ecase_data_import.doctor_numbers()
def setUpClass(cls): """ Downloading files and creating frontsheet :return: """ nhi = 'PJY2787' cls.driver = ecase_downloader.ecase_login() ecase_downloader.resident_contacts(cls.driver, nhi) cls.driver.quit() with open(rf'{constants.DOWNLOADS_DIR}\fs_Res.csv') as data: cls.res_data = csv.reader(data, delimiter=',') cls.res_data = list(cls.res_data)[1] with open(rf'{constants.DOWNLOADS_DIR}\fs_Con.csv') as data: cls.con_data = csv.reader(data, delimiter=',') cls.con_data = list(cls.con_data) printing_documents.create_front_sheet(no_print=True) cls.front_sheet_book = load_workbook(rf'{constants.OUTPUTS_DIR}\front_sheet.xlsx') cls.front_sheet = cls.front_sheet_book['Sheet']
def ecase_bowel_report(age: int): """ Opens a selenium browser with ecase_login, and downloads the bowel eCase reports. Creates an excel file with a sheet for each area, for this month’s Resident’s bowel records """ wings = ['HOUSE 1 - Hector', 'HOUSE 2 - Marion Ross', 'HOUSE 3 - Bruce', 'HOUSE 4 - Douglas', 'HOUSE 5 - Henry Campbell', 'Stirling', 'Iona', 'Balmoral', 'Braemar'] ecase_driver = ecase_downloader.ecase_login() ecase_data_import.bowel_setup() for wing in wings: ecase_downloader.main_bowel_report(ecase_driver, wing, age) ecase_data_import.bowel_import(wing) ecase_driver.quit() ecase_data_import.bowel_report_cleanup()