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
@@ -13,4 +13,4 @@ class CreateEmployers < ActiveRecord::Migration[7.2]
t.timestamps
end
end
end
end
@@ -9,6 +9,7 @@ class CreateIdCardSetups < ActiveRecord::Migration[7.2]
t.string :pl_plan_key
t.boolean :active, default: false
t.boolean :has_divisions, default: false
t.boolean :has_dental, default: false
t.belongs_to :employer, null: false, foreign_key: true
t.belongs_to :employer_logo, null: true, foreign_key: { to_table: :id_card_employer_logos }
t.belongs_to :network_logo, null: true, foreign_key: { to_table: :id_card_network_logos }
@@ -10,6 +10,7 @@ class CreateIdCardPrintData < ActiveRecord::Migration[7.0]
t.string :full_name
t.string :rx_group
t.string :medical_eff_date
t.string :dental_coverage
t.string :network_provider
t.string :provider_line_1
t.string :provider_line_2
@@ -74,11 +75,12 @@ class CreateIdCardPrintData < ActiveRecord::Migration[7.0]
t.string :benefit_13
t.string :benefit_desc_14
t.string :benefit_14
t.integer :network_logo_id
t.string :precert_1
t.string :precert_2
t.string :precert_3
t.string :precert_4
t.string :network_logo_filename
t.string :employer_logo_filename
t.boolean :sample, default: false
t.string :sample_key
t.string :sample_plan_title
t.string :jasper_batch_id
@@ -7,7 +7,9 @@ class CreateMembers < ActiveRecord::Migration[7.2]
t.integer :pb_entity_key
t.integer :pl_plan_key
t.string :id_card_display_name
t.string :coverage_class
t.string :division
t.string :dental_plan_key
t.belongs_to :employer, foreign_key: true
t.belongs_to :id_card_plan, null: true, foreign_key: true
@@ -2,7 +2,7 @@ class CreateIdCardFieldExceptions < ActiveRecord::Migration[7.2]
def change
create_table :id_card_field_exceptions do |t|
t.string :exception_type
t.string :exception_value
t.string :exception_values
t.belongs_to :setup, null: false, foreign_key: { to_table: :id_card_setups }
t.timestamps
@@ -0,0 +1,14 @@
class CreateReportEmployerCardComparisons < ActiveRecord::Migration[7.2]
def change
create_table :report_employer_card_comparisons do |t|
t.string :employer_name
t.string :pl_plan_key
t.integer :new_cards_count
t.integer :old_cards_count
t.integer :total_errors_count
t.boolean :passed, default: false
t.timestamps
end
end
end
@@ -0,0 +1,12 @@
class CreateReportMemberCardComparisons < ActiveRecord::Migration[7.2]
def change
create_table :report_member_card_comparisons do |t|
t.integer :member_number
t.string :pl_plan_key
t.boolean :passed, default: false
t.belongs_to :employer_card_comparison, null: true, foreign_key: { to_table: :report_employer_card_comparisons }
t.timestamps
end
end
end
@@ -0,0 +1,14 @@
class CreateReportComparisonErrors < ActiveRecord::Migration[7.2]
def change
create_table :report_comparison_errors do |t|
t.string :card_field
t.string :new_value
t.string :old_value
t.boolean :disabled, default: false
t.belongs_to :employer_card_comparison, null: true, foreign_key: { to_table: :report_employer_card_comparisons }
t.belongs_to :member_card_comparison, null: true, foreign_key: { to_table: :report_member_card_comparisons }
t.timestamps
end
end
end
@@ -0,0 +1,80 @@
class CreateReportOldCardDuplicates < ActiveRecord::Migration[7.2]
def change
create_table :report_old_card_duplicates do |t|
t.string :employer_name
t.string :full_name
t.string :group_number
t.string :medical_eff_date
t.string :dental_coverage
t.string :provider_line_1
t.string :provider_line_2
t.string :provider_line_3
t.string :provider_line_4
t.string :provider_line_5
t.string :provider_line_6
t.string :provider_line_7
t.string :provider_line_8
t.string :provider_line_9
t.string :provider_line_10
t.string :provider_line_11
t.string :provider_line_12
t.string :claim_to_1
t.string :claim_to_2
t.string :claim_to_3
t.string :claim_to_4
t.string :claim_to_5
t.string :claim_to_6
t.string :claim_to_7
t.string :claim_to_8
t.string :claim_to_9
t.string :claim_to_10
t.string :claim_to_11
t.string :claim_to_12
t.string :family_id
t.string :rx_group
t.string :customer_service
t.string :web_url
t.string :benefit_desc_1
t.string :benefit_1
t.string :benefit_desc_2
t.string :benefit_2
t.string :benefit_desc_3
t.string :benefit_3
t.string :benefit_desc_4
t.string :benefit_4
t.string :benefit_desc_5
t.string :benefit_5
t.string :benefit_desc_6
t.string :benefit_6
t.string :benefit_desc_7
t.string :benefit_7
t.string :benefit_desc_8
t.string :benefit_8
t.string :benefit_desc_9
t.string :benefit_9
t.string :benefit_desc_10
t.string :benefit_10
t.string :benefit_desc_11
t.string :benefit_11
t.string :benefit_desc_12
t.string :benefit_12
t.string :benefit_desc_13
t.string :benefit_13
t.string :benefit_desc_14
t.string :benefit_14
t.string :dependent_1
t.string :dependent_2
t.string :dependent_3
t.string :dependent_4
t.string :dependent_5
t.string :dependent_6
t.string :dependent_7
t.string :dependent_8
t.string :pl_plan_key
t.string :primary_mb_member_key
t.timestamps
end
end
end
@@ -0,0 +1,5 @@
class AddDependentsToMember < ActiveRecord::Migration[7.2]
def change
add_column :members, :dependents, :text
end
end
@@ -0,0 +1,10 @@
class CreateBatchProcess < ActiveRecord::Migration[7.2]
def change
create_table :batch_processes do |t|
t.integer :total_jobs, default: 0, null: false
t.integer :completed_jobs, default: 0, null: false
t.timestamps
end
end
end
+124 -5
View File
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.2].define(version: 2026_03_20_152726) do
ActiveRecord::Schema[7.2].define(version: 2026_04_09_175359) do
create_table "employers", force: :cascade do |t|
t.string "name"
t.string "slug"
@@ -49,7 +49,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_03_20_152726) do
create_table "id_card_field_exceptions", force: :cascade do |t|
t.string "exception_type"
t.string "exception_value"
t.string "exception_values"
t.bigint "setup_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
@@ -98,6 +98,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_03_20_152726) do
t.string "full_name"
t.string "rx_group"
t.string "medical_eff_date"
t.string "dental_coverage"
t.string "network_provider"
t.string "provider_line_1"
t.string "provider_line_2"
@@ -162,11 +163,12 @@ ActiveRecord::Schema[7.2].define(version: 2026_03_20_152726) do
t.string "benefit_13"
t.string "benefit_desc_14"
t.string "benefit_14"
t.integer "network_logo_id"
t.string "precert_1"
t.string "precert_2"
t.string "precert_3"
t.string "precert_4"
t.string "network_logo_filename"
t.string "employer_logo_filename"
t.boolean "sample", default: false
t.string "sample_key"
t.string "sample_plan_title"
t.string "jasper_batch_id"
t.datetime "created_at", null: false
@@ -239,6 +241,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_03_20_152726) do
t.string "pl_plan_key"
t.boolean "active", default: false
t.boolean "has_divisions", default: false
t.boolean "has_dental", default: false
t.bigint "employer_id", null: false
t.bigint "employer_logo_id"
t.bigint "network_logo_id"
@@ -260,15 +263,128 @@ ActiveRecord::Schema[7.2].define(version: 2026_03_20_152726) do
t.integer "pb_entity_key"
t.integer "pl_plan_key"
t.string "id_card_display_name"
t.string "coverage_class"
t.string "division"
t.string "dental_plan_key"
t.bigint "employer_id"
t.bigint "id_card_plan_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "dependents"
t.index ["employer_id"], name: "index_members_on_employer_id"
t.index ["id_card_plan_id"], name: "index_members_on_id_card_plan_id"
end
create_table "report_comparison_errors", force: :cascade do |t|
t.string "card_field"
t.string "new_value"
t.string "old_value"
t.boolean "disabled", default: false
t.bigint "employer_card_comparison_id"
t.bigint "member_card_comparison_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["employer_card_comparison_id"], name: "index_report_comparison_errors_on_employer_card_comparison_id"
t.index ["member_card_comparison_id"], name: "index_report_comparison_errors_on_member_card_comparison_id"
end
create_table "report_employer_card_comparisons", force: :cascade do |t|
t.string "employer_name"
t.string "pl_plan_key"
t.integer "new_cards_count"
t.integer "old_cards_count"
t.integer "total_errors_count"
t.boolean "passed", default: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "report_member_card_comparisons", force: :cascade do |t|
t.integer "member_number"
t.string "pl_plan_key"
t.boolean "passed", default: false
t.bigint "employer_card_comparison_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["employer_card_comparison_id"], name: "idx_on_employer_card_comparison_id_43d268709e"
end
create_table "report_old_card_duplicates", force: :cascade do |t|
t.string "employer_name"
t.string "full_name"
t.string "group_number"
t.string "medical_eff_date"
t.string "dental_coverage"
t.string "provider_line_1"
t.string "provider_line_2"
t.string "provider_line_3"
t.string "provider_line_4"
t.string "provider_line_5"
t.string "provider_line_6"
t.string "provider_line_7"
t.string "provider_line_8"
t.string "provider_line_9"
t.string "provider_line_10"
t.string "provider_line_11"
t.string "provider_line_12"
t.string "claim_to_1"
t.string "claim_to_2"
t.string "claim_to_3"
t.string "claim_to_4"
t.string "claim_to_5"
t.string "claim_to_6"
t.string "claim_to_7"
t.string "claim_to_8"
t.string "claim_to_9"
t.string "claim_to_10"
t.string "claim_to_11"
t.string "claim_to_12"
t.string "family_id"
t.string "rx_group"
t.string "customer_service"
t.string "web_url"
t.string "benefit_desc_1"
t.string "benefit_1"
t.string "benefit_desc_2"
t.string "benefit_2"
t.string "benefit_desc_3"
t.string "benefit_3"
t.string "benefit_desc_4"
t.string "benefit_4"
t.string "benefit_desc_5"
t.string "benefit_5"
t.string "benefit_desc_6"
t.string "benefit_6"
t.string "benefit_desc_7"
t.string "benefit_7"
t.string "benefit_desc_8"
t.string "benefit_8"
t.string "benefit_desc_9"
t.string "benefit_9"
t.string "benefit_desc_10"
t.string "benefit_10"
t.string "benefit_desc_11"
t.string "benefit_11"
t.string "benefit_desc_12"
t.string "benefit_12"
t.string "benefit_desc_13"
t.string "benefit_13"
t.string "benefit_desc_14"
t.string "benefit_14"
t.string "dependent_1"
t.string "dependent_2"
t.string "dependent_3"
t.string "dependent_4"
t.string "dependent_5"
t.string "dependent_6"
t.string "dependent_7"
t.string "dependent_8"
t.string "pl_plan_key"
t.string "primary_mb_member_key"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "solid_queue_blocked_executions", force: :cascade do |t|
t.bigint "job_id", null: false
t.string "queue_name", null: false
@@ -403,6 +519,9 @@ ActiveRecord::Schema[7.2].define(version: 2026_03_20_152726) do
add_foreign_key "id_card_setups", "id_card_rx_sections", column: "rx_section_id"
add_foreign_key "members", "employers"
add_foreign_key "members", "id_card_plans"
add_foreign_key "report_comparison_errors", "report_employer_card_comparisons", column: "employer_card_comparison_id"
add_foreign_key "report_comparison_errors", "report_member_card_comparisons", column: "member_card_comparison_id"
add_foreign_key "report_member_card_comparisons", "report_employer_card_comparisons", column: "employer_card_comparison_id"
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
+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