stable, before a refactor

This commit is contained in:
Jason Jordan
2026-03-03 22:53:21 -05:00
parent 4fac3b1036
commit 942d60c3e0
66 changed files with 1321 additions and 194 deletions
@@ -0,0 +1,11 @@
class CreateCardExceptions < ActiveRecord::Migration[7.2]
def change
create_table :card_exceptions do |t|
t.string :type
t.string :value
t.belongs_to :employer, null: false, foreign_key: true
t.timestamps
end
end
end
@@ -0,0 +1,13 @@
class CreateCardExceptionItems < ActiveRecord::Migration[7.2]
def change
create_table :card_exception_items do |t|
t.string :field_name
t.string :field_value
t.belongs_to :card_exception, null: false, foreign_key: true
t.belongs_to :card_logo_file, null: true, foreign_key: true
t.belongs_to :card_provider, null: true, foreign_key: true
t.timestamps
end
end
end
@@ -0,0 +1,5 @@
class AddAspectRatioToCardLogoFiles < ActiveRecord::Migration[7.2]
def change
add_column :card_logo_files, :aspect_ratio, :float
end
end
@@ -0,0 +1,5 @@
class AddLastNameToSampleIdCard < ActiveRecord::Migration[7.2]
def change
add_column :sample_id_cards, :name, :string
end
end
@@ -0,0 +1,5 @@
class RenameCardFieldExceptionsToCardExceptionItems < ActiveRecord::Migration[7.2]
def change
rename_table :card_field_exceptions, :card_exception_items
end
end
@@ -0,0 +1,5 @@
class AddTitleToCardProviders < ActiveRecord::Migration[7.2]
def change
add_column :card_providers, :title, :string
end
end
@@ -0,0 +1,5 @@
class AllowNullEsPonCardLogoFiles < ActiveRecord::Migration[7.2]
def change
change_column_null :card_logo_files, :employer_setup_process_id, true
end
end
@@ -0,0 +1,5 @@
class ChangeMbMemberKeyToString < ActiveRecord::Migration[7.2]
def change
change_column :sample_id_cards, :primary_mb_member_key, :string
end
end
@@ -0,0 +1,5 @@
class RenameEmployerSetupProcessToEmployer < ActiveRecord::Migration[7.2]
def change
rename_table :employer_setup_processes, :employers
end
end
@@ -0,0 +1,14 @@
class UpdateFieldsOnEmployer < ActiveRecord::Migration[7.2]
def change
remove_column :employers, :form_method, :string
remove_column :employers, :status, :string
remove_column :employers, :current_step, :string
remove_column :employers, :applied_to_prod, :boolean
remove_column :employers, :applied_to_dev, :boolean
rename_column :employers, :employer_name, :name
rename_column :employers, :card_template, :single_card_template
add_column :employers, :multiple_card_template, :string
add_column :employers, :plan_id, :integer
add_column :employers, :active, :boolean, default: false
end
end
@@ -0,0 +1,7 @@
class UpdateBelongsToKeyForEmployer < ActiveRecord::Migration[7.2]
def change
rename_column :alternate_network_logos, :employer_setup_process_id, :employer_id
rename_column :card_logo_files, :employer_setup_process_id, :employer_id
rename_column :plans, :employer_setup_process_id, :employer_id
end
end
@@ -0,0 +1,5 @@
class AddPbEntityKeyToEmployer < ActiveRecord::Migration[7.2]
def change
add_column :employers, :company_pb_entity_key, :integer
end
end
@@ -0,0 +1,5 @@
class AddImageTypeToEmployerImages < ActiveRecord::Migration[7.2]
def change
add_column :employer_images, :image_type, :string
end
end
@@ -0,0 +1,5 @@
class AddCardProviderToEmployers < ActiveRecord::Migration[7.2]
def change
add_reference :employers, :card_provider, null: true, foreign_key: true
end
end
@@ -0,0 +1,6 @@
class AddProvderLineAndClaimTo12ToSampleIdCards < ActiveRecord::Migration[7.2]
def change
add_column :sample_id_cards, :provider_line_12, :string
add_column :sample_id_cards, :claim_to_12, :string
end
end
@@ -0,0 +1,5 @@
class AddIdCardFieldsToEmployer < ActiveRecord::Migration[7.2]
def change
add_column :employers, :id_card_display_name, :string
end
end
@@ -0,0 +1,5 @@
class AddPlanIdToMember < ActiveRecord::Migration[7.2]
def change
add_reference :members, :plans, null: true, foreign_key: true
end
end
+27 -1
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_01_14_183848) do
ActiveRecord::Schema[7.2].define(version: 2026_02_27_213305) do
create_table "action_text_rich_texts", force: :cascade do |t|
t.string "name", null: false
t.text "body"
@@ -59,6 +59,26 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_14_183848) do
t.index ["employer_id"], name: "index_alternate_network_logos_on_employer_id"
end
create_table "card_exception_items", force: :cascade do |t|
t.string "field_name"
t.string "field_value"
t.bigint "card_logo_file_id"
t.bigint "card_provider_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["card_logo_file_id"], name: "index_card_exception_items_on_card_logo_file_id"
t.index ["card_provider_id"], name: "index_card_exception_items_on_card_provider_id"
end
create_table "card_exceptions", force: :cascade do |t|
t.string "type"
t.string "value"
t.bigint "employer_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["employer_id"], name: "index_card_exceptions_on_employer_id"
end
create_table "card_logo_files", force: :cascade do |t|
t.string "filename"
t.binary "image_data"
@@ -67,6 +87,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_14_183848) do
t.boolean "active", default: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.float "aspect_ratio"
end
create_table "card_providers", force: :cascade do |t|
@@ -113,6 +134,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_14_183848) do
t.string "precert_6"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "title"
end
create_table "card_rxes", force: :cascade do |t|
@@ -281,11 +303,15 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_14_183848) do
t.string "benefit_14"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "name"
end
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "alternate_network_logos", "employers"
add_foreign_key "card_exception_items", "card_logo_files"
add_foreign_key "card_exception_items", "card_providers"
add_foreign_key "card_exceptions", "employers"
add_foreign_key "employer_card_logos", "card_logo_files"
add_foreign_key "employer_card_logos", "employers"
add_foreign_key "employers", "card_providers"
+67 -67
View File
@@ -83,30 +83,30 @@ def determine_network_logos(pl_plan_key)
end
end
benefit_descriptions = ["Primary Visit",
"Specialist Visit",
"Urgent Care",
"INNInd Ded",
"INNFamily Ded",
"OONInd Ded",
"OONFamily Ded",
"Co-Insurance",
"INNInd OOP",
"INNFamily OOP",
"OONInd OOP",
"OONFamily OOP",
"Emergency Room",
"Preventive Care"]
# benefit_descriptions = ["Primary Visit",
# "Specialist Visit",
# "Urgent Care",
# "INNInd Ded",
# "INNFamily Ded",
# "OONInd Ded",
# "OONFamily Ded",
# "Co-Insurance",
# "INNInd OOP",
# "INNFamily OOP",
# "OONInd OOP",
# "OONFamily OOP",
# "Emergency Room",
# "Preventive Care"]
default = IdCardBenefitsTemplate.create(title: "BLANK")
benefit_descriptions.each_with_index do |bene, i|
IdCardBenefit.create(sequence: i + 1, benefit_desc: bene, id_card_benefits_template: default)
end
# default = IdCardBenefitsTemplate.create(title: "BLANK")
# benefit_descriptions.each_with_index do |bene, i|
# IdCardBenefit.create(sequence: i + 1, benefit_desc: bene, id_card_benefits_template: default)
# end
temp_2 = IdCardBenefitsTemplate.create(title: "Jason's Template")
(1..14).each do |seq|
IdCardBenefit.create(sequence: seq, benefit: "#{seq} hit wonder", id_card_benefits_template: temp_2)
end
# temp_2 = IdCardBenefitsTemplate.create(title: "Jason's Template")
# (1..14).each do |seq|
# IdCardBenefit.create(sequence: seq, benefit: "#{seq} hit wonder", id_card_benefits_template: temp_2)
# end
# temp_1 = IdCardBenefitsTemplate.create(title: "Rebekah's Template")
# (1..14).each do |seq|
@@ -130,7 +130,7 @@ end
# Imports employers and members from VHCS
sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader WHERE ActiveInactive = 'Active' AND PLPlanKey = 61"
sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader WHERE ActiveInactive = 'Active' AND PLPlanKey = 65"
plan_headers = VhcsRecord.connection.select_all(sql_query)
plan_headers.each do |ph|
@@ -202,57 +202,57 @@ plan_headers.each do |ph|
end
end
Vhcs::HlidCardProvider.all.each do |vhcs|
CardProvider.find_or_create_by(provider_code: vhcs.provider_code) do |cp|
cp.provider_line_1 = vhcs.provider_line_1
cp.provider_line_2 = vhcs.provider_line_2
cp.provider_line_3 = vhcs.provider_line_3
cp.provider_line_4 = vhcs.provider_line_4
cp.provider_line_5 = vhcs.provider_line_5
cp.provider_line_6 = vhcs.provider_line_6
cp.provider_line_7 = vhcs.provider_line_7
cp.provider_line_8 = vhcs.provider_line_8
cp.provider_line_9 = vhcs.provider_line_9
cp.provider_line_10 = vhcs.provider_line_10
cp.provider_line_11 = vhcs.provider_line_11
cp.provider_line_12 = vhcs.provider_line_12
# Vhcs::HlidCardProvider.all.each do |vhcs|
# CardProvider.find_or_create_by(provider_code: vhcs.provider_code) do |cp|
# cp.provider_line_1 = vhcs.provider_line_1
# cp.provider_line_2 = vhcs.provider_line_2
# cp.provider_line_3 = vhcs.provider_line_3
# cp.provider_line_4 = vhcs.provider_line_4
# cp.provider_line_5 = vhcs.provider_line_5
# cp.provider_line_6 = vhcs.provider_line_6
# cp.provider_line_7 = vhcs.provider_line_7
# cp.provider_line_8 = vhcs.provider_line_8
# cp.provider_line_9 = vhcs.provider_line_9
# cp.provider_line_10 = vhcs.provider_line_10
# cp.provider_line_11 = vhcs.provider_line_11
# cp.provider_line_12 = vhcs.provider_line_12
cp.claim_to_1 = vhcs.claim_to_1
cp.claim_to_2 = vhcs.claim_to_2
cp.claim_to_3 = vhcs.claim_to_3
cp.claim_to_4 = vhcs.claim_to_4
cp.claim_to_5 = vhcs.claim_to_5
cp.claim_to_6 = vhcs.claim_to_6
cp.claim_to_7 = vhcs.claim_to_7
cp.claim_to_8 = vhcs.claim_to_8
cp.claim_to_9 = vhcs.claim_to_9
cp.claim_to_10 = vhcs.claim_to_10
cp.claim_to_11 = vhcs.claim_to_11
cp.claim_to_12 = vhcs.claim_to_12
# cp.claim_to_1 = vhcs.claim_to_1
# cp.claim_to_2 = vhcs.claim_to_2
# cp.claim_to_3 = vhcs.claim_to_3
# cp.claim_to_4 = vhcs.claim_to_4
# cp.claim_to_5 = vhcs.claim_to_5
# cp.claim_to_6 = vhcs.claim_to_6
# cp.claim_to_7 = vhcs.claim_to_7
# cp.claim_to_8 = vhcs.claim_to_8
# cp.claim_to_9 = vhcs.claim_to_9
# cp.claim_to_10 = vhcs.claim_to_10
# cp.claim_to_11 = vhcs.claim_to_11
# cp.claim_to_12 = vhcs.claim_to_12
cp.mail_to = vhcs.mail_to
cp.mail_to_2 = vhcs.mail_to_2
# cp.mail_to = vhcs.mail_to
# cp.mail_to_2 = vhcs.mail_to_2
cp.contact_line_1 = vhcs.contact_line_1
cp.contact_line_2 = vhcs.contact_line_2
cp.contact_line_3 = vhcs.contact_line_3
# cp.contact_line_1 = vhcs.contact_line_1
# cp.contact_line_2 = vhcs.contact_line_2
# cp.contact_line_3 = vhcs.contact_line_3
cp.group_number = vhcs.group_number
cp.rx_group_id = vhcs.rx_group_id
cp.rx_contact = vhcs.rx_contact
# cp.group_number = vhcs.group_number
# cp.rx_group_id = vhcs.rx_group_id
# cp.rx_contact = vhcs.rx_contact
cp.provider_lookup_1 = vhcs.provider_lookup_1
cp.provider_lookup_2 = vhcs.provider_lookup_2
# cp.provider_lookup_1 = vhcs.provider_lookup_1
# cp.provider_lookup_2 = vhcs.provider_lookup_2
cp.precert_1 = vhcs.precert_1
cp.precert_2 = vhcs.precert_2
cp.precert_3 = vhcs.precert_3
cp.precert_4 = vhcs.precert_4
cp.precert_5 = vhcs.precert_5
cp.precert_6 = vhcs.precert_6
# cp.precert_1 = vhcs.precert_1
# cp.precert_2 = vhcs.precert_2
# cp.precert_3 = vhcs.precert_3
# cp.precert_4 = vhcs.precert_4
# cp.precert_5 = vhcs.precert_5
# cp.precert_6 = vhcs.precert_6
end
end
# end
# end
Vhcs::HlrxCrosRef.all.each do |vhcs|
rx = CardRx.find_or_create_by(help_desk: vhcs.help_desk, customer_service: vhcs.customer_service, web_url: vhcs.web_url)