<commit_before>module Seek
  #A mixin for DataFiles to handle aspects of data file extraction
  module DataFileExtraction
    include SpreadsheetUtil
    include Seek::MimeTypes
    include SysMODB::SpreadsheetExtractor

    #returns an instance of Seek::Treatment, populated according to the contents of the spreadsheet if it matches a known template
    def treatments
      begin
        if is_spreadsheet?
          Seek::Treatments.new spreadsheet_xml
        else
          Seek::Treatments.new
        end
      rescue Exception=>e
        Rails.logger.error("Error reading spreadsheet #{e.message}")
        Seek::Treatments.new
      end
    end

    #returns an array of all cell content within the workbook.
    def spreadsheet_contents_for_search obj=self
      if obj.content_blob.file_exists?
        content = Rails.cache.fetch("#{obj.content_blob.cache_key}-ss-content-for-search") do<commit_msg>temporarily switched off extraction of treatments<commit_after>module Seek
  #A mixin for DataFiles to handle aspects of data file extraction
  module DataFileExtraction
    include SpreadsheetUtil
    include Seek::MimeTypes
    include SysMODB::SpreadsheetExtractor

    #returns an instance of Seek::Treatment, populated according to the contents of the spreadsheet if it matches a known template
    def treatments
      Seek::Treatments.new
      #begin
      #  if is_spreadsheet?
      #    Seek::Treatments.new spreadsheet_xml
      #  else
      #    Seek::Treatments.new
      #  end
      #rescue Exception=>e
      #  Rails.logger.error("Error reading spreadsheet #{e.message}")
      #  Seek::Treatments.new
      #end
    end

    #returns an array of all cell content within the workbook.
    def spreadsheet_contents_for_search obj=self
      if obj.content_blob.file_exists?
        content = Rails.cache.fetch("#{obj.content_blob.cache_key}-ss-content-for-search") do
{'fraction_non_alphanumeric': 0.06589351607801792, 'fraction_numerical': 0.0, 'mean_word_length': 3.1082251082251084, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '1762759', 'n_tokens_mistral': 549, 'n_tokens_neox': 513, 'n_words': 159}