<commit_before>module Hive
	class Diagnostic_Runner
		
		def initialize(options, diagnostic_type)
			@diagnostic = []
			@options = options
			@diagnostic_type = diagnostic_type
			@diagnostic_array = Hive.config.diagnostic[@diagnostic_type].keys 
        	initialize_diagnostic(Hive.config.diagnostic) 
        	run_diagnostic unless !should_run? 	
    	end

    	def initialize_diagnostic(diagnostic_details)
      		@diagnostic_array.each { |component|
      			Hive.logger.info("Initializing #{component.capitalize} component for #{@diagnostic_type.capitalize} diagnostic")
        		require "hive/diagnostic/#{@diagnostic_type}/#{component}"
        		@diagnostic << Object.const_get('Hive').const_get('Diagnostic').const_get(@diagnostic_type.capitalize).const_get(component.capitalize).new(diagnostic_details[@diagnostic_type][component])
        	}
    	end 

    	def should_run?
    		 # 	previous_timestamp = "2015-06-29 14:39:05 +UTC" # get_prev_timestamp
    			# current_timestamp = Time.new.getutc
    			# return ((current_timestamp - previous_timestamp)/30.minutes).round > 0 ? true : false
    			# # previous_timestamp ==> write method to get timestamp from db for particular device
    		return true
    	end

    	def run_diagnostic	
        	@diagnostic.each{ |diag|
        		diag.run(@options) 
           }
		end

		def repair
				# Should be either called from here or from within diagnostic ? 
		end
	end
end<commit_msg>Moved should_run? to diagnostic.rb<commit_after>module Hive
	class DiagnosticRunner
		
		def initialize(options, diagnostic_type)
			@diagnostics = []
			@options = options
			@diagnostic_type = diagnostic_type
			@diagnostic_array = Hive.config.diagnostic[@diagnostic_type].keys 
       end

    	def initialize_diagnostic(diagnostic_details)
      		@diagnostic_array.each { |component|
      			Hive.logger.info("Initializing #{component.capitalize} component for #{@diagnostic_type.capitalize} diagnostic")
        		require "hive/diagnostic/#{@diagnostic_type}/#{component}"
        		@diagnostics << Object.const_get('Hive').const_get('Diagnostic').const_get(@diagnostic_type.capitalize).const_get(component.capitalize).new(diagnostic_details[@diagnostic_type][component])
        	}
    	end 

    	def run	
        	@diagnostics.each{ |diagnostic|
        		diagnostic.run(@options) unless !diagnostic.should_run?
           }
		end

		def repair
				# Should be either called from here or from within diagnostic ? 
		end
	end
end
{'fraction_non_alphanumeric': 0.09702093397745572, 'fraction_numerical': 0.006843800322061192, 'mean_word_length': 3.4375, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5369541', 'n_tokens_mistral': 820, 'n_tokens_neox': 742, 'n_words': 139}