Exemplo n.º 1
0
    def __init__(self,
                 input_file,
                 input_dir,
                 file_regex,
                 latest,
                 debug,
                 recursive=False):
        """
        Return an instance of JsonFileProcessor.

        Parameters:
            input_file (string): file (full path) to check for data
            input_dir (string): directory (full path) to check for data files
            latest (Boolean): check for latest files only
            debug (Boolean): enable debug logging
            recursive (Boolean): check the search directory recursively

        """
        self.debug = debug
        root_logger.info("Debug: %s", debug)
        if input_file:
            self.file_names = FileProcessor.match_file(input_file, file_regex)
            root_logger.info("Found %d json files for %s in %s",
                             self.file_count(), file_regex, input_file)
        if input_dir:
            self.file_names = FileProcessor.dir_to_files(
                input_dir, file_regex, latest, recursive)
            root_logger.info("Found %d json files for %s in %s",
                             self.file_count(), file_regex, input_dir)
Exemplo n.º 2
0
 def __init__(self, input_file, input_dir, db_params_dict, metric, debug):
     """Return a new instance of FitBitData given the location of the data files, paramters for accessing the database, and if the data should be stored in metric units."""
     self.metric = metric
     self.fitbitdb = FitBitDB.FitBitDB(db_params_dict, debug)
     if input_file:
         self.file_names = FileProcessor.match_file(input_file, r'.*\.csv')
     if input_dir:
         self.file_names = FileProcessor.dir_to_files(input_dir, r'.*\.csv')
Exemplo n.º 3
0
 def __init__(self, input_file, input_dir, db_params_dict, metric, debug):
     self.metric = metric
     self.mshealth_db = MSHealthDB.MSHealthDB(db_params_dict, debug)
     if input_file:
         self.file_names = FileProcessor.match_file(
             input_file, r'Daily_Summary_.*\.csv')
     if input_dir:
         self.file_names = FileProcessor.dir_to_files(
             input_dir, r'Daily_Summary_.*\.csv')
Exemplo n.º 4
0
 def __init__(self, input_file, input_dir, db_params_dict, metric, debug):
     """Return an instance of MSHealthData given an input file or files and information on the databse to put it in."""
     self.metric = metric
     self.mshealth_db = MSHealthDB.MSHealthDB(db_params_dict, debug)
     if input_file:
         self.file_names = FileProcessor.match_file(
             input_file, r'Daily_Summary_.*\.csv')
     if input_dir:
         self.file_names = FileProcessor.dir_to_files(
             input_dir, r'Daily_Summary_.*\.csv')
Exemplo n.º 5
0
 def __init__(self, input_file, input_dir, db_params_dict, metric, debug):
     self.metric = metric
     self.mshealth_db = MSHealthDB.MSHealthDB(db_params_dict, debug)
     self.cols_map = {
         'Date': ('timestamp', CsvImporter.map_mdy_date),
         'Weight': ('weight', MSVaultData.__map_weight),
     }
     if input_file:
         self.file_names = FileProcessor.match_file(
             input_file, r'HealthVault_Weight_.*\.csv')
     if input_dir:
         self.file_names = FileProcessor.dir_to_files(
             input_dir, r'HealthVault_Weight_.*\.csv')
Exemplo n.º 6
0
 def __init__(self, input_file, input_dir, db_params_dict, metric, debug):
     """Return an instance of MSVaultData given an input file or files and information on the databse to put it in."""
     self.metric = metric
     self.mshealth_db = MSHealthDB.MSHealthDB(db_params_dict, debug)
     self.cols_map = {
         'Date': ('timestamp', CsvImporter.map_mdy_date),
         'Weight': ('weight', MSVaultData.__map_weight),
     }
     if input_file:
         self.file_names = FileProcessor.match_file(
             input_file, r'HealthVault_Weight_.*\.csv')
     if input_dir:
         self.file_names = FileProcessor.dir_to_files(
             input_dir, r'HealthVault_Weight_.*\.csv')