nnfee/collector/src/utils.rb
def preview_output path
  puts `head #{path}`

  last_columns = []
  open(path) do |csv|
    csv.each_line do |line|
      last_columns.push(line.split(',').last.strip)
    end
  end
  p Hash[last_columns.sort.group_by {|x| x}.map {|k,v| [k,v.count]}]
end
# To verify data integrity, its a good idea to easily check headers and how
# many unique elements there are on the last column of the CSV
To verify data integrity, its a good idea to easily check headers and how
many unique elements there are on the last column of the CSV
To verify data integrity its a good idea to easily check headers and how many unique elements there are on the last column of the CSV
def preview_output path
  puts `head #{path}`
  last_columns = []
  open(path) do |csv|
    csv.each_line do |line|
      last_columns.push(line.split(',').last.strip)
    end
  end
  p Hash[last_columns.sort.group_by {|x| x}.map {|k,v| [k,v.count]}]
end
def preview_output path puts ` head  #{ path } ` last_columns = [ ] open ( path ) do | csv | csv . each_line do | line | last_columns . push ( line . split ( ',' ) . last . strip ) end end p Hash [ last_columns . sort . group_by { | x | x } . map { | k , v | [ k , v . count ] } ] end
To verify data integrity, its a good idea to easily check headers and how
many unique elements there are on the last column of the CSV
To verify data integrity its a good idea to easily check headers and how many unique elements there are on the last column of the CSV
path