<commit_before>module HiveMom
  class DataFileGenerator
    attr_reader :file

    def initialize(file_pointer)
      @file = file_pointer
    end

    def call
      HiveMom.logger.info(self.class) { 'Generating Data File' }
      file.write(data)
    end

    private

    def data
      CSV.generate do |csv|
        csv << %w(probeid timestamp bot_temp bot_humidity)
        readings.find_each do |r|
          csv << data_row(r)
        end
      end
    end

    def data_row(reading)
      probeid = "HIVE_#{reading.hive_id}"
      [
        probeid,
        reading.created_at,
        reading.bot_temp.to_f / 10,
        reading.bot_humidity.to_f / 10
      ]
    end

    def readings
      Reading.where(['created_at > ?', 1.day.ago])
    end
  end
end<commit_msg>do temps in fahrenheit<commit_after>module HiveMom
  class DataFileGenerator
    attr_reader :file

    def initialize(file_pointer)
      @file = file_pointer
    end

    def call
      HiveMom.logger.info(self.class) { 'Generating Data File' }
      file.write(data)
    end

    private

    def data
      CSV.generate do |csv|
        csv << %w(probeid timestamp bot_temp bot_humidity)
        readings.find_each do |r|
          csv << data_row(r)
        end
      end
    end

    def data_row(reading)
      probeid = "HIVE_#{reading.hive_id}"
      [
        probeid,
        reading.created_at,
        fahrenheit(reading.bot_temp.to_f / 10),
        reading.bot_humidity.to_f / 10
      ]
    end

    def readings
      Reading.where(['created_at > ?', 1.day.ago])
    end

    def fahrenheit(c)
      (c * (9.0 / 5.0)) + 32
    end
  end
end
{'fraction_non_alphanumeric': 0.09135499693439608, 'fraction_numerical': 0.009809932556713672, 'mean_word_length': 1.935251798561151, 'pattern_counts': {'":': 0, '<': 11, '<?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': '3934415', 'n_tokens_mistral': 587, 'n_tokens_neox': 547, 'n_words': 121}