def step2(): # ask if data is stored in a single bank or in individual files q_item_bank = hu.get_yes_no_response( "Item Bank Type", "Is the item to form pairing stored in a single item bank?") if q_item_bank: item_bank_file = hu.get_file("Select item bank file.") control_path = hu.get_folder("Select folder with control files in it.") hf.update_control_files_with_item_bank_key(item_bank_file, control_path) else: path_to_data = hu.get_folder("Where is data located?") destination_path = hu.get_folder( "Where would like the data to be placed?") hf.process_karen_data(path_to_data, destination_path)
def process_karen_data(): data_files = hu.get_all_data_files("Select data files", "Common component in data") test_bank_files = hu.get_all_data_files("Select test files", "Common component in test_bank") destination_path = hu.get_folder("Select destination folder") + "/" hf.process_karen_data(data_files, test_bank_files, destination_path)
def create_master_file(report_name = False, xCalibre_output_path = False, reports_path = False, master_folder = False): function_id = "h_2p_report_analysis|create_master_file" r_entries = [] # list of tuples constant, message if master_folder: #confirm master folder does not end in / if master_folder[-1] == '/': master_folder = master_folder[:-1] reports_path = master_folder + "/reports" xCalibre_output_path = master_folder + "/xCalibreOutput" search_name = master_folder[:-1] report_name = master_folder[search_name.rfind('/')+1:] if not report_name: u.get_string("What would you like to title the report?") path = xCalibre_output_path if not xCalibre_output_path: path = u.get_folder("Locate the xCalibreOutput reports folder", required=False) if not path: r_entries.append([R.PATH_INVALID,"Invalid xCalibrePath:" + path]) f = hfh.get_parent_folder(path) if not f == 'xCalibreOutput': r_entries.append([R.WRONG_FOLDER," must select xCalibreOutput folder"]) if not reports_path: reports_path = u.get_folder("Choose a folder for generated reports.", required=False) if not reports_path: r_entries.append([R.PATH_INVALID, "Invalid report path:" + path]) if hfh.get_parent_folder(reports_path) != "xCalibreOutput": r_entries.append([R.WRONG_FOLDER,"Not xCalibreOutput"]) if os.path.isdir(reports_path): stats_files = hfh.get_all_files(xCalibre_output_path, "Stats") if len(stats_files) == 0: r_entries.append([R.NO_STATS_FILES, "xCalibreOutput reports:" + path]) else: process_stats_files(stats_files, reports_path, report_name) if len(r_entries) == 0: r_entries.append([R.VALID,"create_master_file executed"]) return R(function_id,r_entries)
def step1(): destination_folder = hu.get_folder( "Where would you like formatted files stored?") + "/" files = hu.get_all_data_files() files = hf.purge_invalid_extensions(files, ["csv", "txt"]) validation_results = verify_files(files) valid = validation_results[0] invalid = validation_results[1] ignored = format_files(invalid, destination_folder, control_string=False) control_files = hu.get_yes_no_response( "Control Files", "Does your data already have control files?") control_string = False if control_files: control_string = hu.get_string( "What is a common naming component of your control files?") format_files(valid, destination_folder, control_string)
def ui_process_raw_data(): name = u.get_string("What is the name of this data set? e.g. LEX", "Name data set") parent_folder = u.get_folder("Where would you like the data stored?") raw_data = u.get_folder("Where is the raw data?") process_raw_data(name, parent_folder, raw_data)