<commit_before>system "rake empty_dest" # clean destination database on every call

require 'data-anonymization'

FS = DataAnon::Strategy::Field

DataAnon::Utils::Logging.logger = Logger.new(STDOUT)
ActiveRecord::Base.logger = DataAnon::Utils::Logging.logger
DataAnon::Utils::Logging.progress_logger = Logger.new(STDOUT)
DataAnon::Utils::Logging.logger.level = Logger::INFO

database 'Chinook' do
  strategy DataAnon::Strategy::Whitelist
  source_db :adapter => 'sqlite3', :database => 'sample-data/chinook.sqlite'
  destination_db :adapter => 'sqlite3', :database => 'sample-data/chinook-empty.sqlite'

  table 'Genre' do |t|
    t.primary_key 'GenreId'
    t.whitelist 'GenreId'
    t.anonymize 'Name'
    #t.anonymize 'FieldName' do |data|
    #
    #end
  end

  table 'MediaType' do |t|
    t.primary_key 'MediaTypeId'
    t.whitelist 'MediaTypeId'
    t.anonymize('Name').using FS::StringTemplate.new('Media Type #{row_number}')

  end

end
<commit_msg>To test datetime anonymization on test data<commit_after>system "rake empty_dest" # clean destination database on every call

require 'data-anonymization'

FS = DataAnon::Strategy::Field

DataAnon::Utils::Logging.logger = Logger.new(STDOUT)
ActiveRecord::Base.logger = DataAnon::Utils::Logging.logger
DataAnon::Utils::Logging.progress_logger = Logger.new(STDOUT)
DataAnon::Utils::Logging.logger.level = Logger::INFO

database 'Chinook' do
  strategy DataAnon::Strategy::Whitelist
  source_db :adapter => 'sqlite3', :database => 'sample-data/chinook.sqlite'
  destination_db :adapter => 'sqlite3', :database => 'sample-data/chinook-empty.sqlite'

  table 'Genre' do |t|
    t.primary_key 'GenreId'
    t.whitelist 'GenreId'
    t.anonymize 'Name'
    #t.anonymize 'FieldName' do |data|
    #
    #end
  end

  table 'MediaType' do |t|
    t.primary_key 'MediaTypeId'
    t.whitelist 'MediaTypeId'
    t.anonymize('Name').using FS::StringTemplate.new('Media Type #{row_number}')

  end

  table 'Employee' do |t|
    t.primary_key 'EmployeeId'
    t.whitelist 'EmployeeId'
    t.anonymize('BirthDate').using FS::DateTimeDelta.new(1,1)
  end

end

{'fraction_non_alphanumeric': 0.1359961959106039, 'fraction_numerical': 0.0028530670470756064, 'mean_word_length': 4.844444444444444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '5476776', 'n_tokens_mistral': 759, 'n_tokens_neox': 736, 'n_words': 149}