def __init__(self, input_dir, output_dir):
        self.input_dir = input_dir
        self.output_dir = output_dir

        Utils.clean_output(self.output_dir)

        self.read_data()
    def __init__(self, input_dir, output_dir):
        self.input_dir = input_dir
        self.output_dir = output_dir

        from commit_utils import Utils
        Utils.clean_output(self.output_dir)

        self.read_data()
def main():
    staar_filter = join('..', "3_staar_filtered")
    staar_merged = join('..', "4_staar_merged")

    # clean output directory
    from commit_utils import Utils
    Utils.clean_output(staar_merged)

    for item_dir in listdir(staar_filter):
        input_dir = join(staar_filter, item_dir)
        # output_dir = join(staar_merged, item_dir)
        output_dir = staar_merged
        StaarMergeAll(input_dir, output_dir)
    print("Finished")
    def Process(self):
        print ("Processing started")
        print(self.data_dir_district)
        if not exists(self.data_dir_district):
            print ("\t Data Directory District Does Not Exist")
            exit()

        elif not exists(self.data_dir_state):
            print ("\t Data Directory State Does Not Exist")
            exit()

        else:
            data_frames = list()
            # List directory containing the .csv files
            for district_item in listdir(self.data_dir_district):
                # Check only .csv files
                if (splitext(district_item)[1] == ".csv"
                        and "_district_reference" not in district_item
                        and "_district_finance" not in district_item):
                    district_file_path = join(self.data_dir_district,
                                              district_item)
                    district_filename = splitext(district_item)[0]

                    # Find proper state file
                    state_file_path = Utils.find_proper_state_file_2(
                        district_filename, self.data_dir_state)

                    if state_file_path is not None:
                        data_frame_output = self.ConcatenateFiles(
                                                        district_file_path,
                                                        state_file_path)
                        self.WriteData(data_frame_output, district_item)
 def __init__(self):
     Utils.clean_output(AddStateRow.data_dir_output)
     self.Process()