Created
September 19, 2022 12:02
-
-
Save edlvj/7f1956656a340ca0fdb270826e1cf977 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ConsumerDemo | |
module Consumer | |
module Applications | |
class UnderwritingQuestionsController < ApplicationController | |
skip_before_action :authenticate_user! | |
# rubocop:disable Metrics/MethodLength | |
def index | |
application = DataStore.get_application(params.to_unsafe_hash[:application_id]) | |
if application.nil? | |
return render status: :not_found | |
end | |
business_category = application[:document][:industry][:display_name] | |
Rails.logger.info "Business Category: #{business_category}" | |
generic_underwriting_questions = [ | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does the applicant own more than 50% of any business other than the one described?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Any group transportation provided?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Are uninsured subcontractors ever used?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does the insured do any delivery?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does the insured perform any work above 2 stories?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does the applicant sub out more than 20% of total work performed?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does insured's travel radius exceed 200 miles?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Do employees use vehicles to perform job duties?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Any regular out of office exposure by clerical employees?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Are operations 24 hours?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Do any employees live on premise?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
} | |
] | |
wc_underwriting_questions = [] | |
if business_category == "Electrical contractor" | |
wc_underwriting_questions += [ | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Do employees work in trenches greater than three (3) feet deep?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does the applicant sub out more than 20% of total work performed?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Is at least 80% of the applicant's work residential electrical wiring?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does your business do any solar or roof top work?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: " Does your business perform any overhead street lighting or traffic signal work?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does your business use any new building materials or technology that has not been tested or yet to have building code standards?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does the applicant ever work over 3 stories?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
} | |
] | |
elsif business_category == "Business Consulting" | |
wc_underwriting_questions += [ | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does the applicant provide money gram/check cashing services?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Is all of the payroll derived from salespersons and/or include foreign travel?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: " Does your business primarily advise clients on matters relating to general management and strategy?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
} | |
] | |
elsif business_category == "Landscaping services" | |
wc_underwriting_questions += [ | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does the applicant provide snow plowing services other than residential driveways and parking lots?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Do employees use vehicles to perform job duties?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does your business build retaining walls above 5 feet?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does your business hire subcontractors?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does your business use any new building materials or technology that has not been tested or yet to have building code standards?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does your business use day laborers or unskilled workers?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Any security employees or armed security (employee or contracted)?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
} | |
] | |
else | |
wc_underwriting_questions += generic_underwriting_questions | |
end | |
bop_underwriting_questions = [] | |
if business_category == "Electrical contractor" | |
bop_underwriting_questions += [ | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does your business install or repair generators?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Do you or other business owners review MVRs annually for employees who drive regularly?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Any group transportation provided?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does insured's travel radius exceed 200 miles?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
} | |
] | |
elsif business_category == "Business consulting" | |
bop_underwriting_questions += [ | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Is the applicant an employee leasing/staffing firm/employee placement agency?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Applicant is a rental operation", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does the applicant own more than 50% of any business other than the one described?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Is your business a professional employer organization (PEO)?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Applicant is involved in logistics", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
} | |
] | |
elsif business_category == "Landscaping services" | |
bop_underwriting_questions += [ | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does the majority of the applicant's work involve roadside services?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does your business use herbicides and insecticides?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does insured's travel radius exceed 200 miles?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Does the insured install pools or ponds?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
} | |
] | |
elsif business_category == "Restaurant, no waitstaff" | |
bop_underwriting_questions += [ | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Is the applicant open 24 hours?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Any health inspection or food safety violations in the past three years?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Are alcoholic beverages sold?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Are there any playgrounds or playrooms on premises?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
}, | |
{ | |
id: SecureRandom.uuid, | |
type: "boolean", | |
question: "Do they have musicians or entertainers?", | |
values: nil, | |
default_value: false, | |
validation: [ | |
{ | |
params: [], | |
message: "You must select yes or no.", | |
function: "required" | |
} | |
], | |
map_from: [], | |
map_response: [], | |
show: nil, | |
sub_text: "" | |
} | |
] | |
else | |
bop_underwriting_questions += generic_underwriting_questions | |
end | |
Rails.logger.info params.to_unsafe_hash[:line_of_business_abbr] | |
if params.to_unsafe_hash[:line_of_business_abbr] == "WC" | |
render json: wc_underwriting_questions | |
elsif params.to_unsafe_hash[:line_of_business_abbr] == "BOP" | |
Rails.logger.info "enter" | |
render json: bop_underwriting_questions | |
else | |
render json: generic_underwriting_questions | |
end | |
end | |
def update | |
render json: {value: params[:value]} | |
end | |
# rubocop:enable Metrics/MethodLength | |
end | |
end | |
end | |
end | |
# wc | |
# Electrical Contractor | |
# Do employees work in trenches greater than three (3) feet deep? | |
# Does the applicant sub out more than 20% of total work performed? | |
# "Is at least 80% of the applicant's work residential electrical wiring?" | |
# Does your business do any solar or roof top work? | |
# Does your business perform any overhead street lighting or traffic signal work? | |
# Does your business use any new building materials or technology that has not been tested or yet to have building code standards? | |
# Does the applicant ever work over 3 stories? | |
# Business Consulting | |
# Does the applicant provide money gram/check cashing services? | |
# Is all of the payroll derived from salespersons and/or include foreign travel? | |
# Does your business primarily advise clients on matters relating to general management and strategy? | |
# Landscaping services | |
# Does the applicant provide snow plowing services other than residential driveways and parking lots? | |
# Do employees use vehicles to perform job duties? | |
# Does your business build retaining walls above 5 feet? | |
# Does your business hire subcontractors? | |
# Does your business use any new building materials or technology that has not been tested or yet to have building code standards? | |
# Does your business use day laborers or unskilled workers? | |
# Any security employees or armed security (employee or contracted)? | |
# bop | |
# Electrical Contractor | |
# Does your business install or repair generators? | |
# Do you or other business owners review MVRs annually for employees who drive regularly? | |
# Any group transportation provided? | |
# "Does insured's travel radius exceed 200 miles?" | |
# Business consulting | |
# Is the applicant an employee leasing/staffing firm/employee placement agency? | |
# Applicant is a rental operation | |
# Does the applicant own more than 50% of any business other than the one described? | |
# Is your business a professional employer organization (PEO)? | |
# Applicant is involved in logistics | |
# Landscaping services | |
# "Does the majority of the applicant's work involve roadside services?" | |
# Does your business use herbicides and insecticides? | |
# "Does insured's travel radius exceed 200 miles?" | |
# Does the insured install pools or ponds? | |
# Restuarant, no waitstaff | |
# Is the applicant open 24 hours? | |
# Any health inspection or food safety violations in the past three years? | |
# Are alcoholic beverages sold? | |
# Are there any playgrounds or playrooms on premises? | |
# Do they have musicians or entertainers? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment