<commit_before>require 'pp'

class PartialFlow < ApplicationRecord
  belongs_to :device

  def self.import(file)
    ActiveRecord::Base.logger.silence do
      packets = JSON.parse(File.read(file), symbolize_names: true)
      packets.each do |pkt|
        pp pkt

        PartialFlow.first_or_create  src_ip: pkt[:src_ip],
                                     dst_ip: pkt[:dst_ip],
                                     src_port: pkt[:src_port],
                                     dst_port: pkt[:dst_port],
                                     src_seq: pkt[:seq],
                                     src_ack: pkt[:ack],
                                     is_syn: pkt[:syn],
                                     is_fin: pkt[:fin],
                                     is_rst: pkt[:rst],
                                     mac_address: '01:02:03:04:05:06',
                                     timestamp: Time.at(pkt[:time]).to_datetime
      end
    end
  end
end<commit_msg>git rid of debug message<commit_after>require 'pp'

class PartialFlow < ApplicationRecord
  belongs_to :device

  def self.import(file)
    ActiveRecord::Base.logger.silence do
      packets = JSON.parse(File.read(file), symbolize_names: true)
      packets.each do |pkt|
        PartialFlow.create  src_ip: pkt[:src_ip],
                                     dst_ip: pkt[:dst_ip],
                                     src_port: pkt[:src_port],
                                     dst_port: pkt[:dst_port],
                                     src_seq: pkt[:seq],
                                     src_ack: pkt[:ack],
                                     is_syn: pkt[:syn],
                                     is_fin: pkt[:fin],
                                     is_rst: pkt[:rst],
                                     mac_address: '01:02:03:04:05:06',
                                     timestamp: Time.at(pkt[:time]).to_datetime
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09137577002053388, 'fraction_numerical': 0.012320328542094456, 'mean_word_length': 1.0472689075630253, 'pattern_counts': {'":': 0, '<': 5, '<?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': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6169752', 'n_tokens_mistral': 524, 'n_tokens_neox': 513, 'n_words': 95}