require 'pry'
require 'json'
require 'roo'
require 'roo'
fileHtml = File.new("cpcdsdict.html", "w+")
fileHtml.puts ""
fileHtml.puts "
"
fileHtml.puts ""
fileHtml.puts ""
fileHtml.puts ""
profiles = ["Coverage", "Patient", "EOB Outpatient Instituiontal", "EOB Inpatient Institutional", "EOB Pharmacy", "EOB Professional & Non-Clinician"]
xlsx = Roo::Spreadsheet.open(ARGV[0])
xlsx.default_sheet = xlsx.sheets[1] # NEED TO PARSE OTHER SHEETS, Not sheet Data Element Index
#binding.pry
names = xlsx.column(3)[1..].uniq
fileHtml.puts "
\n\n"
fileHtml.puts ""
fileHtml.puts "| MapID | "
fileHtml.puts "Name | "
# fileHtml.puts "Blue Button | "
fileHtml.puts "Description | "
fileHtml.puts "
"
names.each do |name|
ids = []
xlsx.each do |row|
# binding.pry
# puts "***** row[2] = #{row[2]} name = #{name}"
next if row[2] != name || ids.include?(row[0])
ids << row[0]
fileHtml.puts ""
bblist = ""
bblist = row[1].split(' ').join(", ") if row[1]
mapid = row[0]
description = row[3]
fileHtml.puts "| #{mapid} | "
fileHtml.puts "#{name} | "
# fileHtml.puts "#{bblist} | "
fileHtml.puts "#{description} | "
fileHtml.puts "
"
end
end
fileHtml.puts "
"
fileHtml.puts "
"
fileHtml.puts ""