Major features finished

This commit is contained in:
Jason Jordan
2026-04-15 08:12:47 -04:00
parent 9f306d3150
commit 247a075c9c
112 changed files with 3700 additions and 379 deletions
+142 -13
View File
@@ -1,3 +1,6 @@
require "vips"
require "image_processing/vips"
def determine_id_card_templates(pl_plan_key)
case pl_plan_key
when "2"
@@ -42,7 +45,19 @@ def determine_id_card_network(pl_plan_key)
end
def determine_divisions(pl_plan_key)
if pl_plan_key == "16"
division_employers = ["2", "16"]
if division_employers.include?(pl_plan_key)
true
else
false
end
end
def determine_dental(pl_plan_key)
dental_employers = ["2", "3"]
if dental_employers.include?(pl_plan_key)
true
else
false
@@ -57,6 +72,111 @@ def determine_card_color(pl_plan_key)
end
end
def determine_field_exceptions(pl_plan_key)
exceptions_map = {
"3" => [{
exception_type: "state",
exception_values: ["AZ", "MO", "IL"],
field_exception_items_attributes: [
{field_name: "provider_section", provider_section_id: 3},
{field_name: "network_logo", network_logo_id: 8}
]
}],
"13" => [{
exception_type: "zipcode",
exception_values: ["14422", "14623", "14624"],
field_exception_items_attributes: [
{field_name: "network_logo", network_logo_id: 3}
]
}],
"16" => [{
exception_type: "state",
exception_values: ["VA"],
field_exception_items_attributes: [
{field_name: "medical_eff_date", field_value: "12/01/2025"},
{field_name: "provider_section", provider_section_id: 7},
{field_name: "network_logo", network_logo_id: 6}
]
}],
"21" => [{
exception_type: "state",
exception_values: ["VA"],
field_exception_items_attributes: [
{field_name: "network_logo", network_logo_id: 3}
]
}],
"51" => [{
exception_type: "zipcode",
exception_values: ["41456", "41149", "41124"],
field_exception_items_attributes: [
{field_name: "network_logo", network_logo_id: 4}
]
}],
"55" => [{
exception_type: "state",
exception_values: ["CA", "GA"],
field_exception_items_attributes: [
{field_name: "provider_section", provider_section_id: 8},
{field_name: "network_logo", network_logo_id: 5}
]
}],
"62" => [
{
exception_type: "zipcode",
exception_values: ["49420", "48167"],
field_exception_items_attributes: [
{field_name: "network_logo", network_logo_id: 2}
]
},
{
exception_type: "zipcode",
exception_values: ["55419", "55379"],
field_exception_items_attributes: [
{field_name: "network_logo", network_logo_id: 1}
]
}
],
"65" => [
{
exception_type: "zipcode",
exception_values: ["48430", "44842", "48649"],
field_exception_items_attributes: [
{field_name: "network_logo", network_logo_id: 2}
]
},
{
exception_type: "zipcode",
exception_values: ["55372", "55021"],
field_exception_items_attributes: [
{field_name: "network_logo", network_logo_id: 1}
]
},
{
exception_type: "zipcode",
exception_values: ["18042", "18080"],
field_exception_items_attributes: [
{field_name: "network_logo", network_logo_id: 10}
]
}
],
"66" => [{
exception_type: "state",
exception_values: ["GA"],
field_exception_items_attributes: [
{field_name: "provider_section", provider_section_id: 8},
{field_name: "network_logo", network_logo_id: 5}
]
}]
}
if exceptions_map[pl_plan_key].present?
exceptions_map[pl_plan_key]
else
nil
end
end
puts "[**** IMPORT ID CARD TABLES ****]"
## SET UP DEFAULT LEVEL360 PLANS FOR PLAN PICKER
@@ -160,18 +280,18 @@ Rake::Task["employer:vhcs_sync_all"].invoke
##---------------- Import Employers (Word Docs) ------------------------------------
puts "Importing Employers From Word Docs"
folder_path = Rails.root.join('employer_word_docs')
file_names = Dir.children(folder_path)
# puts "Importing Employers From Word Docs"
# folder_path = Rails.root.join('employer_word_docs')
# file_names = Dir.children(folder_path)
file_names.each do |word_doc|
puts "-- Processing #{word_doc}"
new_employer = BenefitsWordDocService::WordDocProcessor.new("employer_word_docs/#{word_doc}").call
if new_employer.save
puts "Imported #{new_employer.name}"
end
# file_names.each do |word_doc|
# puts "-- Processing #{word_doc}"
# new_employer = BenefitsWordDocService::WordDocProcessor.new("employer_word_docs/#{word_doc}").call
# if new_employer.save
# puts "Imported #{new_employer.name}"
# end
end
# end
##---------------- Update ID Card Setups------------------------------------
@@ -180,6 +300,7 @@ IdCard::Setup.all.each do |setup|
setup.card_template = determine_id_card_templates(setup.pl_plan_key)
setup.card_color = determine_card_color(setup.pl_plan_key)
setup.has_divisions = determine_divisions(setup.pl_plan_key)
setup.has_dental = determine_dental(setup.pl_plan_key)
network_information = determine_id_card_network(setup.pl_plan_key)
setup.network_provider = network_information[:provider]
@@ -192,7 +313,7 @@ IdCard::Setup.all.each do |setup|
rs = IdCard::RxSection.find_by(title: rx_title)
setup.rx_section_id = rs.id
employer_name = setup.employer.employer_trim_name
employer_name = Employer.employer_trim_name(setup.employer.name)
name_segments = employer_name.titleize.split
name_segments.each do |segment|
logo = IdCard::EmployerLogo.where("filename LIKE ?", "%#{segment}%")
@@ -202,10 +323,18 @@ IdCard::Setup.all.each do |setup|
end
end
card_exceptions = determine_field_exceptions(setup.pl_plan_key)
if card_exceptions.present?
setup.field_exceptions.create(card_exceptions)
# card_exceptions.each do |exc|
# setup.field_exceptions.create(exc)
# end
end
if setup.pl_plan_key.present?
setup.active = true
end
setup.save
end