<commit_before>require 'csv'

module TrackParser
  class Flysight
    TIME              = 0
    LATITUDE          = 1
    LONGITUDE         = 2
    ALTITUDE          = 3
    SPEED_NORTH       = 4
    SPEED_EAST        = 5
    SPEED_VERTICAL    = 6
    VERTICAL_ACCURACY = 8

    MAX_ACCURACY = 70

    MS_IN_KMH = 3.6

    def initialize(args = {})
      @file_path = args[:path]
    end

    def parse
      track_points = []
      CSV.foreach(file_path, skip_lines: /^[^0-9]{4}/) do |row|
        next if row[VERTICAL_ACCURACY].to_f > MAX_ACCURACY
        track_points << parse_row(row)
      end

      track_points
    end

    private

    def parse_row(row)
      PointRecord.new.tap do |r|
        r.latitude     = BigDecimal(row[LATITUDE]).truncate(10)
        r.longitude    = BigDecimal(row[LONGITUDE]).truncate(10)<commit_msg>disable filtering rows by vertical accuracy<commit_after>require 'csv'

module TrackParser
  class Flysight
    TIME              = 0
    LATITUDE          = 1
    LONGITUDE         = 2
    ALTITUDE          = 3
    SPEED_NORTH       = 4
    SPEED_EAST        = 5
    SPEED_VERTICAL    = 6
    VERTICAL_ACCURACY = 8

    MAX_ACCURACY = 70

    MS_IN_KMH = 3.6

    def initialize(args = {})
      @file_path = args[:path]
    end

    def parse
      track_points = []
      CSV.foreach(file_path, skip_lines: /^[^0-9]{4}/) do |row|
        # next if row[VERTICAL_ACCURACY].to_f > MAX_ACCURACY
        track_points << parse_row(row)
      end

      track_points
    end

    private

    def parse_row(row)
      PointRecord.new.tap do |r|
        r.latitude     = BigDecimal(row[LATITUDE]).truncate(10)
        r.longitude    = BigDecimal(row[LONGITUDE]).truncate(10)
{'fraction_non_alphanumeric': 0.09085580304806565, 'fraction_numerical': 0.022274325908558032, 'mean_word_length': 1.8883248730964468, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2959866', 'n_tokens_mistral': 666, 'n_tokens_neox': 605, 'n_words': 120}