<commit_before>require "csv"

module LocalLinksManager
  module Import
    class LocalCustodianCodesImporter
      LOCAL_CUSTODIAN_CODE_INDEX = 0
      AUTHORITY_HEADER_INDEX = 1

      def import_from_csv(csv_file)
        csv = CSV.read(csv_file, { headers: true, encoding: "bom|utf-8" })

        csv.each do |row|
          slug = row[AUTHORITY_HEADER_INDEX].parameterize
          code = row[LOCAL_CUSTODIAN_CODE_INDEX]
          begin
            local_authority = LocalAuthority.find_by!(slug: slug)
            local_authority.update!(local_custodian_code: code)
          rescue ActiveRecord::RecordNotFound
            Rails.logger.info("Not found #{row['Authority']}, not updated")
          end
        end
      end
    end
  end
end
<commit_msg>Fix logger message<commit_after>require "csv"

module LocalLinksManager
  module Import
    class LocalCustodianCodesImporter
      LOCAL_CUSTODIAN_CODE_INDEX = 0
      AUTHORITY_HEADER_INDEX = 1

      def import_from_csv(csv_file)
        csv = CSV.read(csv_file, { headers: true, encoding: "bom|utf-8" })

        csv.each do |row|
          slug = row[AUTHORITY_HEADER_INDEX].parameterize
          code = row[LOCAL_CUSTODIAN_CODE_INDEX]
          begin
            local_authority = LocalAuthority.find_by!(slug: slug)
            local_authority.update!(local_custodian_code: code)
          rescue ActiveRecord::RecordNotFound
            Rails.logger.info("Not found #{slug}, not updated")
          end
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.07677035076108538, 'fraction_numerical': 0.003970880211780278, 'mean_word_length': 2.5576470588235294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4154464', 'n_tokens_mistral': 483, 'n_tokens_neox': 467, 'n_words': 94}