Class: OpenmrsDataSanitizer::DataSanitizer

Inherits:
Object
  • Object
show all
Defined in:
app/services/openmrs_data_sanitizer/data_sanitizer.rb

Overview

rubocop:disable Metrics/ClassLength AWS DataSanitizer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sites: [], skip: true) ⇒ DataSanitizer

Returns a new instance of DataSanitizer.



18
19
20
21
22
23
24
25
# File 'app/services/openmrs_data_sanitizer/data_sanitizer.rb', line 18

def initialize(sites: [], skip: true)
  @concept_names = Concurrent::Hash.new
  @faker_names = Concurrent::Hash.new
  @regimen_combinations = {}
  @sites = sites
  @skip = skip
  load_regimen_combinations
end

Instance Attribute Details

#concept_namesObject

Returns the value of attribute concept_names.



16
17
18
# File 'app/services/openmrs_data_sanitizer/data_sanitizer.rb', line 16

def concept_names
  @concept_names
end

#faker_namesObject

Returns the value of attribute faker_names.



16
17
18
# File 'app/services/openmrs_data_sanitizer/data_sanitizer.rb', line 16

def faker_names
  @faker_names
end

#regimen_combinationsObject

Returns the value of attribute regimen_combinations.



16
17
18
# File 'app/services/openmrs_data_sanitizer/data_sanitizer.rb', line 16

def regimen_combinations
  @regimen_combinations
end

#sitesObject

Returns the value of attribute sites.



16
17
18
# File 'app/services/openmrs_data_sanitizer/data_sanitizer.rb', line 16

def sites
  @sites
end

#skipObject

Returns the value of attribute skip.



16
17
18
# File 'app/services/openmrs_data_sanitizer/data_sanitizer.rb', line 16

def skip
  @skip
end

Instance Method Details

#startObject



27
28
29
30
31
32
33
34
35
36
# File 'app/services/openmrs_data_sanitizer/data_sanitizer.rb', line 27

def start
  start_time = Time.now
  Rails.logger.info("DataSanitizer started at #{start_time}")
  clear_directory
  process_data_request
  end_time = Time.now
  time_taken = (end_time - start_time) / 60
  Rails.logger.info("DataSanitizer completed at #{end_time} and it took #{time_taken} minutes")
  { start_time:, end_time:, time_in_minutes: (end_time - start_time) / 60 }
end