stand_socotra_policy_transformer 3.0.11 → 3.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/stand_underwriter.js +1 -1
  2. package/package.json +8 -2
  3. package/__tests__/__utils__/load_payload.js +0 -16
  4. package/__tests__/__utils__/payloads/ai_additional_insured_new.json +0 -90
  5. package/__tests__/__utils__/payloads/ai_no_change_new_payload.json +0 -103
  6. package/__tests__/__utils__/payloads/ai_no_change_old_payload.json +0 -764
  7. package/__tests__/__utils__/payloads/ai_old_payload.json +0 -707
  8. package/__tests__/__utils__/payloads/claims_new_policy.json +0 -117
  9. package/__tests__/__utils__/payloads/claims_remove_new_payload.json +0 -68
  10. package/__tests__/__utils__/payloads/claims_remove_socotra_policy.json +0 -785
  11. package/__tests__/__utils__/payloads/claims_socotra_payload.json +0 -764
  12. package/__tests__/__utils__/payloads/minimal_change_base.json +0 -574
  13. package/__tests__/__utils__/payloads/minimal_change_base2.json +0 -574
  14. package/__tests__/__utils__/payloads/minimal_change_resulting_socotra.json +0 -17
  15. package/__tests__/__utils__/payloads/minimal_change_resulting_socotra2.json +0 -27
  16. package/__tests__/__utils__/payloads/minimal_change_retool.json +0 -37
  17. package/__tests__/__utils__/payloads/minimal_change_retool2.json +0 -27
  18. package/__tests__/__utils__/payloads/sample_minimal_retool.json +0 -33
  19. package/__tests__/__utils__/payloads/sample_minimal_socotra_payload.json +0 -116
  20. package/__tests__/__utils__/payloads/sample_new_policy_holder.json +0 -17
  21. package/__tests__/__utils__/payloads/sample_new_quote.json +0 -216
  22. package/__tests__/__utils__/payloads/sample_new_quote_retool.json +0 -93
  23. package/__tests__/__utils__/payloads/sample_retool.json +0 -157
  24. package/__tests__/__utils__/payloads/sample_retool_converted_quote.json +0 -54
  25. package/__tests__/__utils__/payloads/sample_retool_socotra_subset.json +0 -163
  26. package/__tests__/__utils__/payloads/sample_socotra_quote.json +0 -782
  27. package/__tests__/__utils__/payloads/sample_socotra_with_additional_insured.json +0 -764
  28. package/__tests__/__utils__/payloads/sample_update_quote.json +0 -18
  29. package/__tests__/__utils__/payloads/versions/v1/sample_new_quote.json +0 -211
  30. package/__tests__/__utils__/payloads/versions/v1/sample_retool.json +0 -160
  31. package/__tests__/__utils__/payloads/versions/v1/sample_retool_socotra_subset.json +0 -128
  32. package/__tests__/__utils__/payloads/versions/v1/sample_socotra_quote.json +0 -776
  33. package/__tests__/__utils__/payloads/versions/v1/sample_update_quote.json +0 -18
  34. package/__tests__/__utils__/payloads/versions/v2/sample_new_quote.json +0 -215
  35. package/__tests__/__utils__/payloads/versions/v2/sample_retool.json +0 -165
  36. package/__tests__/__utils__/payloads/versions/v2/sample_retool_socotra_subset.json +0 -159
  37. package/__tests__/__utils__/payloads/versions/v2/sample_socotra_quote.json +0 -779
  38. package/__tests__/__utils__/payloads/versions/v2/sample_update_quote.json +0 -18
  39. package/__tests__/basic_knockout.test.js +0 -113
  40. package/__tests__/claims_history_knockout.test.js +0 -56
  41. package/__tests__/exterior_knockout.test.js +0 -192
  42. package/__tests__/helpers/index.js +0 -10
  43. package/__tests__/home_owner_knockouts.js +0 -260
  44. package/__tests__/interior_knockout.test.js +0 -321
  45. package/__tests__/package_version.test.js +0 -7
  46. package/__tests__/rate_call_knockouts.test.js +0 -347
  47. package/__tests__/retool_utils/socotra_group_update.test.js +0 -563
  48. package/__tests__/retool_utils/socotra_payload.test.js +0 -270
  49. package/__tests__/retool_utils/socotra_structure_helper.test.js +0 -242
  50. package/__tests__/retool_utils/versions/entries_v1.test.js +0 -51
  51. package/__tests__/retool_utils/versions/entries_v2.test.js +0 -51
  52. package/__tests__/underwriter.test.js +0 -169
  53. package/__tests__/wf_knockout.test.js +0 -124
  54. package/src/index.js +0 -14
  55. package/src/knockouts/basic_knockouts.js +0 -66
  56. package/src/knockouts/claims_history_knockout.js +0 -24
  57. package/src/knockouts/exterior_knockouts.js +0 -97
  58. package/src/knockouts/home_owner_knockouts.js +0 -118
  59. package/src/knockouts/index.js +0 -83
  60. package/src/knockouts/interior_knockouts.js +0 -149
  61. package/src/knockouts/rate_call_knockouts.js +0 -155
  62. package/src/knockouts/wf_knockouts.js +0 -66
  63. package/src/retool_to_socotra.js +0 -18
  64. package/src/retool_utils/socotra_entries_helper_fuctions.js +0 -0
  65. package/src/retool_utils/socotra_payloads.js +0 -161
  66. package/src/retool_utils/socotra_structure_helper.js +0 -687
  67. package/src/retool_utils/versions/stand_v1_entries.js +0 -167
  68. package/src/retool_utils/versions/stand_v2_entries.js +0 -211
  69. package/src/retool_utils/versions/stand_v3_entries.js +0 -274
  70. package/src/underwriter.js +0 -86
  71. package/webpack.config.js +0 -14
@@ -1,274 +0,0 @@
1
- const {SocotraEntry, SocotraGroupEntry} = require("../socotra_structure_helper");
2
-
3
- function solar_panel_functions() {
4
- let to_socotra_map = {0: "No", "1+": "Yes"}
5
- let to_retool_map = {"No": 0, "Yes": "1+"}
6
- return [(x) => to_retool_map[x], (x) => to_socotra_map[x]]
7
- }
8
-
9
- entries_v3 = [
10
- new SocotraEntry("quote_name", "quote_name", "quote.name"),
11
- new SocotraEntry("socotra_config_version", "config_version", "quote.version"),
12
- new SocotraEntry("fire_deductible", "wf_deductible", "exposure.dwelling.fields", parseFloat),
13
- new SocotraEntry("other_deductible", "aop_deductible", "exposure.dwelling.fields", parseInt),
14
- new SocotraEntry("water_deductible", "water_deductible", "exposure.dwelling.fields", parseInt),
15
- new SocotraEntry("num_stories", "number_of_stories", "exposure.dwelling.fields"),
16
- new SocotraEntry("num_bath", "number_of_bathrooms", "exposure.dwelling.fields"),
17
- new SocotraEntry("square_feet", "square_feet", "exposure.dwelling.fields", undefined, parseInt),
18
- new SocotraEntry("stand_protect_discount", "stand_protect_discount", "exposure.dwelling.fields"),
19
- new SocotraEntry("multi_policy_discount", "multi_policy_discount", "exposure.dwelling.fields"),
20
- new SocotraEntry(undefined, "has_any_claim_history", "exposure.dwelling.fields", (x) => undefined, x => x && x.claims_data && x.claims_data.claims && x.claims_data.claims.length > 0 ? "Yes" : "No"),
21
- new SocotraEntry("roof_rating", "roof_rating", "exposure.dwelling.fields"),
22
- new SocotraEntry("slab_plumbing", "slab_plumbing", "exposure.dwelling.fields"),
23
- new SocotraEntry("foundation_type", "foundation_type", "exposure.dwelling.fields"),
24
- new SocotraEntry("siding_material", "siding_material", "exposure.dwelling.fields"),
25
- new SocotraEntry("distance_to_fire_department", "dist_to_fire_department", "exposure.dwelling.fields"),
26
- new SocotraEntry("protection_class", "protection_class", "exposure.dwelling.fields"),
27
- new SocotraEntry("purchase_year", "property_purchase_year", "exposure.dwelling.fields", undefined, parseInt),
28
- new SocotraEntry("roof_material", "roof_material", "exposure.dwelling.fields"),
29
- new SocotraEntry("presence_of_fence", "fence", "exposure.dwelling.fields"),
30
- new SocotraEntry("year_built", "year_built", "exposure.dwelling.fields"),
31
- new SocotraEntry("construction_type", "construction_type", "exposure.dwelling.fields"),
32
- // new SocotraEntry("No", "has_any_claim_history", "exposure.dwelling.fields"),
33
- new SocotraEntry("water_damage_limit", "water_damage_limit", "exposure.dwelling.fields"),
34
- new SocotraEntry("extended_dwelling_coverage", "extended_dwelling_coverage", "exposure.dwelling.fields"),
35
- new SocotraEntry("sprinkler", "sprinkler", "exposure.dwelling.fields"),
36
- new SocotraEntry("smoke", "smoke", "exposure.dwelling.fields"),
37
- new SocotraEntry("fire_alarm", "fire_alarm_type", "exposure.dwelling.fields"),
38
- new SocotraEntry("fire_ext", "fire_ext", "exposure.dwelling.fields"),
39
- new SocotraEntry("deadbolt", "dead_bolt", "exposure.dwelling.fields"),
40
- new SocotraEntry(undefined, "24_hour_security_guard", "exposure.dwelling.fields", (x) => undefined, (x) => "No"),
41
- new SocotraEntry("theft_alarm", "theft_alarm_type", "exposure.dwelling.fields"),
42
- new SocotraEntry("distance_to_neighboring_home", "distance_to_nearest_home_ft", "exposure.dwelling.fields"),
43
- new SocotraEntry("chimney_spark_arrestors", "chimney_mesh_cover", "exposure.dwelling.fields"),
44
- new SocotraEntry("ember_resistant_vents", "ember_vents", "exposure.dwelling.fields"),
45
- new SocotraEntry("enclosed_eaves", "enclosed_eaves", "exposure.dwelling.fields"),
46
- new SocotraEntry("fuel_tank_distance", "propane_tank_proximity", "exposure.dwelling.fields"),
47
- new SocotraEntry("ground_clearance", "exterior_clearance", "exposure.dwelling.fields"),
48
- new SocotraEntry("windows_frame_type", "window_frame_type", "exposure.dwelling.fields"),
49
- new SocotraEntry("windows_type", "window_glass_type", "exposure.dwelling.fields"),
50
-
51
- new SocotraEntry("replacement_cost", "full_replacement_value", "policy.fields", parseInt),
52
- new SocotraEntry("street_address", "address", "policy.fields"),
53
- new SocotraEntry("state", "state", "policy.fields"),
54
- new SocotraEntry("is_rental", "is_rental", "policy.fields"),
55
- new SocotraEntry("pool_type", "swimming_pool_type", "policy.fields"),
56
- new SocotraEntry("has_home_business", "home_business", "policy.fields"),
57
- new SocotraEntry("occupation", "occupation", "policy.fields"),
58
- new SocotraEntry("water_shutoff", "water_shutoff_system", "policy.fields"),
59
- new SocotraEntry("waterflow_alarm", "waterflow_alarm", "policy.fields"),
60
- new SocotraEntry("city", "city", "policy.fields"),
61
- new SocotraEntry("electrical_updated_year", "electrical_last_updated", "policy.fields"),
62
- new SocotraEntry("coverage_b", "coverage_b", "policy.fields", parseInt),
63
- new SocotraEntry("coverage_c", "coverage_c", "policy.fields", parseInt),
64
- new SocotraEntry("coverage_a", "coverage_a", "policy.fields", parseInt),
65
- new SocotraEntry("retrofitted", "retrofit_1997", "policy.fields"),
66
- new SocotraEntry("roof_replacement_year", "roof_replaced_year", "policy.fields"),
67
- new SocotraEntry("seismic_shutoff", "seismic_shutoff", "policy.fields"),
68
- new SocotraEntry("coverage_f", "coverage_f", "policy.fields"),
69
- new SocotraEntry("bellweather_wf_score", "bellweather_wf_score", "policy.fields"),
70
- new SocotraEntry("first_street_score", "first_street_wf_score", "policy.fields", parseInt),
71
- new SocotraEntry("degree_of_slope", "degrees_of_slope", "policy.fields"),
72
- new SocotraEntry("number_of_bankrupcies", "bankruptcies_judgements_liens", "policy.fields"),
73
- new SocotraEntry("coverage_d", "coverage_d", "policy.fields", parseInt),
74
- new SocotraEntry("coverage_e", "coverage_e", "policy.fields"),
75
- new SocotraEntry("gre_wf_score", "gre_wf_score", "policy.fields", parseFloat),
76
- // new SocotraEntry("2024-07-04", "prevPolicyExpiration", "policy.fields"),
77
- new SocotraEntry("state", "state", "policy.fields"),
78
- // new SocotraEntry("has_steel_braided_hoses", "steel_braided_hoses", "policy.fields"),
79
- // new SocotraEntry("No", "hasFraudConviction", "policy.fields"),
80
- new SocotraEntry("core_logic_wf_score", "core_logic_score", "policy.fields", parseInt),
81
- new SocotraEntry(undefined, "channel", "policy.fields", (x) => undefined, (x) => "Broker"),
82
- new SocotraEntry(undefined, "coverageForm", "policy.fields", (x) => undefined, (x) => "HO-5 Comprehensive"),
83
- new SocotraEntry("zip", "zip", "policy.fields"),
84
- new SocotraEntry("has_underground_fuel_tank", "underground_fuel_tank", "policy.fields"),
85
- new SocotraEntry("residence_type", "dwelling_use_type", "policy.fields"),
86
- new SocotraEntry("attractive_nuisance", "has_attractive_nuisance", "policy.fields"),
87
- // new SocotraEntry("No", "circuit_breaker", "policy.fields"),
88
- new SocotraEntry("zesty_l2", "zesty_l2", "policy.fields", parseInt),
89
- new SocotraEntry("zesty_l1", "zesty_l1", "policy.fields", parseInt),
90
- // new SocotraEntry("Yes", "hasContinuousCoverage", "policy.fields"),
91
- // new SocotraEntry("Safeco", "pastCarrier", "policy.fields"),
92
- new SocotraEntry("water_heater_update_year", "water_heaters_last_updated", "policy.fields"),
93
- new SocotraEntry("plumbing_updated_year", "plumbing_last_updated", "policy.fields"),
94
- new SocotraEntry("home_heating_update_year", "home_heater_last_updated", "policy.fields", undefined, (x) => x === "" ? null : x),
95
- new SocotraEntry("insured_dob", "date_of_birth", "policy.fields"),
96
- new SocotraEntry("gre_arf", "arf", "policy.fields", parseFloat),
97
- new SocotraEntry("insured_dob", "date_of_birth", "policy.fields"),
98
- new SocotraEntry("flood_score", "first_street_flood_score", "policy.fields"),
99
- new SocotraEntry("fema_flood_zone", "fema_flood_zone", "policy.fields"),
100
- // new SocotraEntry("Yes", "beenPreviouslyInsured", "policy.fields"),
101
- new SocotraEntry("home_heating_source", "heating_source", "policy.fields"),
102
- new SocotraEntry("horses", "has_horses", "policy.fields"),
103
- new SocotraEntry("is_under_renovation", "renovation", "policy.fields"),
104
- new SocotraEntry("pool_type", "swimming_pool_type", "policy.fields"),
105
- new SocotraEntry("residence_type", "dwelling_use_type", "policy.fields"),
106
- new SocotraEntry("previous_insurance_company", "pastCarrier", "policy.fields"),
107
- new SocotraEntry("previous_policy_expiration_date", "prevPolicyExpiration", "policy.fields"),
108
- new SocotraEntry("previous_premium", "prevPolicyPremium", "policy.fields", undefined, parseInt),
109
- new SocotraEntry("fireshed_ID", "fireshed_id", "policy.fields"),
110
- new SocotraEntry("fireshed_code", "fireshed_code", "policy.fields"),
111
- new SocotraEntry("fireshed_capacity", "fireshed_capacity", "policy.fields", parseFloat),
112
- new SocotraEntry("county", "county", "policy.fields"),
113
- new SocotraEntry("ensemble_mean", "wf_score_mean", "policy.fields", parseFloat),
114
- new SocotraEntry("ensemble_variance", "wf_score_variance", "policy.fields", parseFloat),
115
- new SocotraEntry("wildfire_category", "wf_score_category", "policy.fields"),
116
- new SocotraEntry("has_additional_insured", "has_co_applicant", "policy.fields"),
117
- new SocotraEntry("months_unoccupied", "months_unoccupied", "policy.fields", (x) => x == null ? "0" : x),
118
- new SocotraEntry("multifamily_unit_count", "multi_family_unit_count", "policy.fields", undefined, parseInt),
119
- new SocotraEntry("spouse_first_name", "has_co_applicant", "policy.fields", (x) => null, (x) => x ? "Yes" : "No"),
120
- new SocotraEntry("spouse_first_name", "co_applicant_first_name", "policy.fields"),
121
- new SocotraEntry("spouse_last_name", "co_applicant_last_name", "policy.fields"),
122
- new SocotraEntry("spouse_email", "co_applicant_email", "policy.fields"),
123
- new SocotraEntry("co_applicant_address", "co_applicant_address", "policy.fields"),
124
- new SocotraEntry("spouse_phone_number", "co_applicant_phone_number", "policy.fields"),
125
- new SocotraEntry("number_of_mortgages", "num_mortgages", "policy.fields"),
126
- new SocotraEntry("past_liens", "bankruptcies_judgements_liens", "policy.fields"),
127
- new SocotraEntry("property_id", "retool_property_id", "policy.fields"),
128
- new SocotraEntry("primary_dwelling_insured", "primary_insured_by_stand", "policy.fields"),
129
- new SocotraEntry("lat", "latitude", "policy.fields", parseFloat),
130
- new SocotraEntry("lng", "longitude", "policy.fields", parseFloat),
131
- new SocotraEntry("count_of_solar_panels", "has_solar_panels", "exposure.dwelling.fields", ...solar_panel_functions()),
132
-
133
- new SocotraEntry("producer_license_number", "producer_license_number", "policy.fields"),
134
- new SocotraEntry("producer_id", "producerId", "policy.fields"),
135
- new SocotraEntry("producer_email", "producerEmail", "policy.fields"),
136
- new SocotraEntry("producer_name", "producerName", "policy.fields"),
137
- new SocotraEntry("producer_ascend_id", "producer_ascend_id", "policy.fields"),
138
- new SocotraEntry("producer_license_number", "producer_license_number", "policy.fields"),
139
- new SocotraEntry("producer_phone_number", "producer_phone_number", "policy.fields"),
140
- new SocotraEntry("producer_state", "producer_state", "policy.fields"),
141
- new SocotraEntry("producer_commission", "commissionRate", "policy.fields"),
142
- new SocotraEntry("producer_zip", "producer_zip", "policy.fields"),
143
- new SocotraEntry("producer_city", "producer_city", "policy.fields"),
144
- new SocotraEntry("producer_street_address", "producer_street_address", "policy.fields"),
145
- new SocotraEntry("producer_street_address2", "producer_street_address_2", "policy.fields"),
146
-
147
- new SocotraEntry("broker_license_number", "distributor_license_number", "policy.fields"),
148
- new SocotraEntry("broker_name", "distributor_name", "policy.fields"),
149
-
150
-
151
- new SocotraEntry("premium_calculated", "indicated_policy_cost", "policy.fields"),
152
- new SocotraEntry("withdrawal_reasons", "withdrawal_reason", "policy.fields.array"),
153
- new SocotraEntry("rejection_reasons", "declination_reason", "policy.fields.array"),
154
- new SocotraEntry("competing_carrier", "competing_carrier", "policy.fields"),
155
- new SocotraEntry("competing_pricing", "competing_pricing", "policy.fields"),
156
-
157
- new SocotraEntry("client_application_reason", "client_application_reason", "policy.fields"),
158
- new SocotraEntry("client_application_reason_detail", "client_application_reason_detail", "policy.fields"),
159
-
160
- new SocotraEntry("stand_second_approval", "stand_second_approval", "policy.fields"),
161
- new SocotraEntry("fronting_carrier_approval", "fronting_carrier_approval", "policy.fields"),
162
- new SocotraEntry("reinsurance_carrier_approved", "reinsurance_carrier_approved", "policy.fields"),
163
- new SocotraEntry("reinsurance_rate", "reinsurance_rate", "policy.fields"),
164
-
165
- new SocotraEntry("is_agreed_value", "is_agreed_value", "policy.fields"),
166
- new SocotraEntry("is_difference_in_condition", "is_difference_in_condition", "policy.fields"),
167
- new SocotraEntry("lead_source", "lead_source", "policy.fields", (x) => null),
168
-
169
- new SocotraEntry("start_date", "startTimestamp", "effective_date"),
170
- new SocotraEntry("payment_schedule", "paymentScheduleName", "payment_schedule"),
171
-
172
- //For sure
173
- new SocotraEntry("billing_email", "billing_email", "policy.fields"),
174
- new SocotraEntry("account_manager_name", "billing_contact_name", "policy.fields"),
175
- new SocotraEntry("co_applicant_occupation", "co_applicant_occupation", "policy.fields"),
176
- new SocotraEntry("is_firewise_community", "is_firewise_community", "exposure.dwelling.fields"), //YES NO
177
- new SocotraEntry("count_domestic_employees", "count_domestic_employees", "policy.fields" ),
178
- new SocotraEntry("domestic_employees_duties", "domestic_employees_duties", "policy.fields" ),
179
- new SocotraEntry("high_risk_tree_type", "high_risk_tree_type", "exposure.dwelling.fields" ),
180
- new SocotraEntry("exterior_door_material", "exterior_door_material", "exposure.dwelling.fields" ),
181
- new SocotraEntry("trellis_pergola_material", "trellis_pergola_material", "exposure.dwelling.fields" ),
182
- new SocotraEntry("mulch_type", "mulch_type", "exposure.dwelling.fields" ),
183
- new SocotraEntry("farming_activity", "farming_type", "policy.fields" ),
184
- new SocotraEntry("deck_type", "deck_type", "exposure.dwelling.fields" ),
185
- new SocotraEntry("has_fence_attached", "has_fence_attached", "exposure.dwelling.fields" ), // YES NO
186
- new SocotraEntry("gutter_material", "gutter_material", "exposure.dwelling.fields" ),
187
- new SocotraEntry("has_gutter_guards_installed", "has_gutter_guards_installed", "exposure.dwelling.fields" ), // YES NO
188
- new SocotraEntry("gutter_guards_type", "gutter_guards_type", "exposure.dwelling.fields" ),
189
- new SocotraEntry("construction_renovations_details", "construction_renovations_details", "exposure.dwelling.fields" ),
190
- new SocotraEntry("year_retrofitted", "year_retrofitted", "policy.fields" ),
191
- new SocotraEntry("alarm_company", "alarm_company", "exposure.dwelling.fields" ),
192
- new SocotraEntry("eaves_material", "eaves_material", "exposure.dwelling.fields" ),
193
- new SocotraEntry("exterior_sprinkler_type", "exterior_sprinkler_type", "exposure.dwelling.fields" ),
194
- // Defensible space request - in feet
195
- new SocotraEntry("defensible_space", "defensible_space", "exposure.dwelling.fields"),
196
-
197
- //Delete steel braided hoses And toilet
198
- new SocotraEntry("water_supply_hoses_type", "water_supply_hoses_type", "policy.fields"),
199
- new SocotraEntry("water_supply_fittings_type", "water_supply_fittings_type", "policy.fields"),
200
- new SocotraEntry("prior_status_reason", "prev_policy_status", "policy.fields"),
201
- new SocotraEntry("prior_policy_status", "prev_policy_status", "policy.fields"),
202
-
203
- //Maybe
204
- // bite history
205
- // new SocotraEntry("occupation_additional_context", "occupation_additional_context", "policy.fields")
206
-
207
- ]
208
-
209
- // Define schemas for Groups
210
- const additional_insured_socotra_schema = {
211
- type: ":type",
212
- name: ":name",
213
- street_address: ":street_address",
214
- street_address2: ":street_address2",
215
- city: ":city",
216
- state: ":state",
217
- zip: ":zip",
218
- description: ":description",
219
- loan_number: ":loan_number"
220
- };
221
-
222
- const additional_insured_retool_schema = {
223
- zip: ":zip",
224
- street_address: ":street_address",
225
- loan_number: ":loan_number",
226
- city: ":city",
227
- street_address2: ":street_address2",
228
- state: ":state",
229
- type: ":type",
230
- name: ":name",
231
- description: ":description"
232
- };
233
-
234
- // Add additional insured to entries_v3
235
- entries_v3.push(
236
- new SocotraGroupEntry(
237
- "additional_insured_data.additionalInterest",
238
- "additional_insured",
239
- "policy.fields.group",
240
- additional_insured_socotra_schema,
241
- additional_insured_retool_schema
242
- )
243
- );
244
-
245
- // Define schemas for Groups
246
- const claims_retool_schema = {
247
- date: ":date",
248
- amount: ":amount",
249
- type: ":type",
250
- };
251
-
252
- const claims_socotra_schema = {
253
- prior_claim_type: ":type",
254
- accident_date: ":date",
255
- claim_amount: ":amount",
256
- };
257
-
258
- // Create the claims SocotraGroupEntry
259
- const claims_entry = new SocotraGroupEntry(
260
- "claims_data.claims",
261
- "claims_history",
262
- "exposure.dwelling.fields.group",
263
- claims_socotra_schema,
264
- claims_retool_schema
265
- );
266
-
267
- // Add claims entry to entries_v3
268
- entries_v3.push(claims_entry);
269
-
270
-
271
-
272
-
273
-
274
- module.exports = {entries_v3}
@@ -1,86 +0,0 @@
1
- const {
2
- knockout, knockout_names, same_address, stand_wf_knockout, has_circuit_breaker, has_class_a_roof,
3
- check_claims_history
4
- } = require('./knockouts')
5
- function underwrite(payload, full_check = true){
6
- // claims
7
-
8
- let decisions = {}
9
- let notes = []
10
- let notes_dict = {}
11
-
12
- for (let underwriting_function of knockout_names()){
13
- if (full_check || Object.keys(payload).includes(underwriting_function)) {
14
- let decision = knockout(underwriting_function, payload[underwriting_function])
15
- add_decision(decision, underwriting_function, notes, decisions, notes_dict)
16
- }
17
- }
18
-
19
- if (full_check || (('address' in payload)) && ('co_applicant_address' in payload)) {
20
- let address_result = same_address(payload['address'], payload['co_applicant_address'])
21
- add_decision(address_result, "co_applicant_address", notes, decisions, notes_dict)
22
- }
23
-
24
- let wf_result
25
- if (full_check || (('wf_score_mean' in payload)) && ('arf' in payload)) {
26
- wf_result = stand_wf_knockout(payload['wf_score_mean'], payload['arf'])
27
- add_decision(wf_result.underwriter_result, "wf_score_mean", notes, decisions, notes_dict)
28
- }
29
-
30
- if (full_check || (('circuit_breaker' in payload)) && ('year_built' in payload)) {
31
- let circuit_breaker_result =
32
- has_circuit_breaker(payload['circuit_breaker'], payload['year_built'])
33
- add_decision(circuit_breaker_result, 'circuit_breaker', notes, decisions, notes_dict)
34
- }
35
-
36
- if (full_check || ('class_a_roof' in payload)) {
37
- let roof_result =
38
- has_class_a_roof(payload['class_a_roof'], wf_result.category)
39
- add_decision(roof_result, 'roof_rating', notes, decisions, notes_dict)
40
- }
41
-
42
- if (full_check || ('claims' in payload)) {
43
- let claims_result = check_claims_history(payload['claims'])
44
- add_decision(claims_result, 'claims', notes, decisions, notes_dict)
45
- }
46
-
47
- return {
48
- decision: determine_final_result(decisions), notes: notes, refers: collect_refers(decisions),
49
- all_decisions: decisions, notes_dict: notes_dict
50
- }
51
- }
52
-
53
- function collect_refers(all_decisions){
54
- let refer_checks = []
55
- for(let key in all_decisions ){
56
- if(all_decisions[key] === "refer"){
57
- refer_checks.push(key)
58
- }
59
- }
60
- return refer_checks
61
- }
62
- function determine_final_result(all_decisions){
63
- for(let key in all_decisions ){
64
- if(all_decisions[key] === "reject"){
65
- return "reject"
66
- }
67
- }
68
-
69
- for(let key in all_decisions ){
70
- if(all_decisions[key] === "refer"){
71
- return "refer"
72
- }
73
- }
74
-
75
- return "accept"
76
- }
77
-
78
- function add_decision(decision, key, notes, all_decisions, notes_dict = {}){
79
- all_decisions[key] = decision.decision
80
- notes_dict[key] = decision.note
81
- if (decision.note){
82
- notes.push(decision.note)
83
- }
84
- }
85
-
86
- module.exports = {underwrite, knockout_names}
package/webpack.config.js DELETED
@@ -1,14 +0,0 @@
1
- const path = require('path');
2
-
3
- module.exports = [{
4
- mode: 'production',
5
- entry: './src/index.js',
6
- output: {
7
- path: path.resolve(__dirname, 'dist'),
8
- filename: 'stand_underwriter.js',
9
- library: 'stand_underwriter',
10
- libraryTarget: 'umd',
11
- globalObject: 'this',
12
- },
13
- }
14
- ];