# namespace :export_fes do # desc "Export field exceptions for seed data" # task to_seeds: :environment do # IdCard::FieldExceptions.all.each do |fe| # # Exclude internal metadata like ID and timestamps # attrs = fe.attributes.except("id", "created_at", "updated_at") # puts "User.find_or_create_by!(#{attrs})" # end # end # end # IdCard::FieldException.includes(:field_exception_items).all.as_json( # except: [:id, :setup_id, :created_at, :updated_at], # include: { # field_exception_items: { except: [:id, :field_exception_id, :created_at, :updated_at] } # } # ) # {"exception_type" => "state", # "exception_values" => "VA", # "field_exception_items" => # [{"field_name" => "medical_eff_date", "field_value" => "12/01/2025", "provider_section_id" => nil}, # {"field_name" => "provider_section", "field_value" => "", "provider_section_id" => 7}, # {"field_name" => "network_logo", "field_value" => "", "network_logo_id" => 10, "provider_section_id" => nil}]} # { # "3" => [{ # "exception_type" => "state", # "exception_values" => ["AZ", "MO", "IL"], # "field_exception_items" => [ # {"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" => [ # {"field_name" => "network_logo", "network_logo_id" => 3} # ] # }], # "16" => [{ # "exception_type" => "state", # "exception_values" => ["VA"], # "field_exception_items" => [ # {"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" => [ # {"field_name" => "network_logo", "network_logo_id" => 3} # ] # }], # "51" => [{ # "exception_type" => "zipcode", # "exception_values" => ["41456", "41149", "41124"], # "field_exception_items" => [ # {"field_name" => "network_logo", "network_logo_id" => 4} # ] # }], # "55" => [{ # "exception_type" => "state", # "exception_values" => ["CA", "GA"], # "field_exception_items" => [ # {"field_name" => "network_logo", "network_logo_id" => 5}, # {"field_name" => "provider_section", "provider_section_id" => 8} # ] # }], # "62" => [ # { # "exception_type" => "zipcode", # "exception_values" => ["49420", "48167"], # "field_exception_items" => [ # {"field_name" => "network_logo", "network_logo_id" => 2} # ] # }, # { # "exception_type" => "zipcode", # "exception_values" => ["55419", "55379"], # "field_exception_items" => [ # {"field_name" => "network_logo", "network_logo_id" => 1} # ] # } # ], # "65" => [ # { # "exception_type" => "zipcode", # "exception_values" => ["48430", "44842", "48649"], # "field_exception_items" => [ # {"field_name" => "network_logo", "network_logo_id" => 2} # ] # }, # { # "exception_type" => "zipcode", # "exception_values" => ["55372", "55021"], # "field_exception_items" => [ # {"field_name" => "network_logo", "network_logo_id" => 1} # ] # }, # { # "exception_type" => "zipcode", # "exception_values" => ["18042", "18080"], # "field_exception_items" => [ # {"field_name" => "network_logo", "network_logo_id" => 10} # ] # } # ], # "66" => [{ # "exception_type" => "state", # "exception_values" => ["GA"], # "field_exception_items" => [ # {"field_name" => "network_logo", "network_logo_id" => 5} # ] # }] # }