# Risk Type States and Risk States

BriteLines has concept of states which are used in rating usually called as Risk Type State and Risk State.

# Risk Type State

Risk Type State is JSON representation of a Risk Type for a given Product and Version. It contains information regarding a Risk Type's entities fields, rate_tables, calculations, and items, as well as its Line. The Risk Type State is used by the rating engine to rate a risk, as well as by Quoting to display information about Fields and Items.

{
  "id": "3aa43696-8c18-49d6-8c6d-dc03b5081e98",
  "name": "vehicles",
  "label": "Vehicle",
  "description": "",
  "version": "2a35a6bf-e569-4e23-90bb-0b386173f65c",
  "fields": [
    {
      "name": "vin",
      "risk_type": "3aa43696-8c18-49d6-8c6d-dc03b5081e98",
      "default": null,
      "optional": false,
      "id": "81fa966c-c48b-480f-97de-568bcdb608ec",
      "version": "2a35a6bf-e569-4e23-90bb-0b386173f65c",
      "validators": [],
      "label": "VIN",
      "type": "string",
      "order": 0,
      "supplemental": true
    },
    {
      "name": "towingLimit",
      "risk_type": "3aa43696-8c18-49d6-8c6d-dc03b5081e98",
      "default": null,
      "optional": false,
      "options": [
        {
          "display_label": "None",
          "value": "None",
          "label": ""
        },
        {
          "display_label": "25",
          "value": "25",
          "label": ""
        },
        {
          "display_label": "50",
          "value": "50",
          "label": ""
        },
        {
          "display_label": "75",
          "value": "75",
          "label": ""
        },
        {
          "display_label": "100",
          "value": "100",
          "label": ""
        }
      ],
      "source": null,
      "version": "2a35a6bf-e569-4e23-90bb-0b386173f65c",
      "validators": [],
      "id": "fb4f4313-0c55-4fb1-b6d5-c95cf0ba9a75",
      "label": "Towing Limit",
      "type": "enum",
      "order": 1,
      "supplemental": false
    },
    {
      "name": "chosenDriver",
      "risk_type": "3aa43696-8c18-49d6-8c6d-dc03b5081e98",
      "default": null,
      "optional": false,
      "options": [],
      "source": {
        "source_label_template": "{{ driverName }}",
        "source_type": "risk_types",
        "source_entity": "af96bd68-a414-44b3-9d8b-758bbf134023",
        "source_entity_name": "drivers"
      },
      "version": "2a35a6bf-e569-4e23-90bb-0b386173f65c",
      "validators": [],
      "id": "4ddec7d6-8d4d-4a48-a2d5-79dd8ed2d7f4",
      "label": "Principal Driver",
      "type": "enum",
      "order": 2,
      "supplemental": false
    }
  ],
  "rate_tables": [
    {
      "name": "equipmentCoverageRateTable",
      "risk_type": "3aa43696-8c18-49d6-8c6d-dc03b5081e98",
      "default": null,
      "label": "Equipment Coverage Rate Table",
      "sources": [
        {
          "source_field": "cb20a5b6-e441-4935-81a5-831a029c5863",
          "sub_risk_field": null,
          "source_name": "additionalEquipmentCoverageLimit",
          "validity_state": "valid",
          "source_table": null,
          "source_calculation": null,
          "tier_values": [],
          "column_index": 0,
          "resolution": "map",
          "id": "8fa24c20-f729-45d9-a47b-dbe03e2f672c"
        }
      ],
      "version": "2a35a6bf-e569-4e23-90bb-0b386173f65c",
      "validity_state": "valid",
      "data": [
        ["additionalEquipmentCoverageLimit", "rate"],
        ["None", 0],
        ["0-500", 25],
        ["501-1000", 35],
        ["1000-1500", 50],
        ["1501-2000", 75]
      ],
      "id": "52ac07d3-20cb-4ab0-b7cb-5e354b8a3643"
    }
  ],
  "calculations": [
    {
      "referenced_names": {
        "current": ["equipmentCoverageRateTable"]
      },
      "description": "",
      "compiled_code": "gANjZGlsbC5kaWxsCl9sb2FkX3R5cGUKcQBYCAAAAENvZGVUeXBlcQGFcQJScQMoSwBLAEsASwRLQEMSZQBlAWUCZACDAmQBgwEXAFMAcQRYBwAAAERlY2ltYWxxBVgCAAAAMTBxBoZxB1gaAAAAZXF1aXBtZW50Q292ZXJhZ2VSYXRlVGFibGVxCFgJAAAAX2dldGF0dHJfcQlYBwAAAGRlY2ltYWxxCodxCylYCAAAADxzdHJpbmc+cQxYCAAAADxtb2R1bGU+cQ1LAUMAcQ4pKXRxD1JxEC4=",
      "calculation": "equipmentCoverageRateTable + 10",
      "optional_referenced_names": [],
      "type": "variable",
      "id": "3339e8f8-7359-4682-9139-764d8c2dbb0c",
      "name": "equipmentCalc"
    }
  ],
  "items": [
    {
      "name": "towing",
      "limits": [],
      "presence": "optional",
      "fields": {
        "towingLimit": {
          "optional": false
        }
      },
      "id": "709da9a7-e19f-4227-847b-5634fba5d88d",
      "label": "Towing",
      "order": 0
    },
    {
      "name": "additionalEquipment",
      "limits": [],
      "presence": "default",
      "fields": {
        "additionalEquipmentCoverageLimit": {
          "optional": false
        }
      },
      "id": "b31f9acd-eb79-46aa-a32e-59162703cb89",
      "calculations": [
        {
          "referenced_names": {
            "current": ["equipmentCoverageRateTable"]
          },
          "description": "",
          "compiled_code": "gANjZGlsbC5kaWxsCl9sb2FkX3R5cGUKcQBYCAAAAENvZGVUeXBlcQGFcQJScQMoSwBLAEsASwFLQEMEZQBTAHEEKVgNAAAAZXF1aXBtZW50Q2FsY3EFhXEGKVgIAAAAPHN0cmluZz5xB1gIAAAAPG1vZHVsZT5xCEsBQwBxCSkpdHEKUnELLg==",
          "calculation": "equipmentCalc",
          "order": 0,
          "optional_referenced_names": [],
          "type": "premium",
          "id": "538d66b2-51eb-4dee-b0b9-e496256eaca4",
          "name": "premium"
        }
      ],
      "label": "Additional Equipment Coverage",
      "order": 1
    }
  ],
  "line": {
    "description": "General Auto Description",
    "initial_version": "2a35a6bf-e569-4e23-90bb-0b386173f65c",
    "id": "882aa329-e07e-4aec-a816-533f451a1617",
    "name": "generalAuto",
    "label": "General Auto"
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

# Risk State

A Risk State is a JSON representation of a Risk at a point in time.

{
  "id": "c26fffcd-7897-4384-98c4-95de6b0902e8",
  "name": "Vehicle 1",
  "type": {
    "label": "Vehicle",
    "id": "3aa43696-8c18-49d6-8c6d-dc03b5081e98",
    "name": "vehicles"
  },
  "number": 1,
  "total_premium": 54.0,
  "items": {
    "additionalEquipment": {
      "premium": 45.0,
      "limits": {
        "perRiskLimit": 100.0,
        "policyAggregateLimit": 500.0
      },
      "deductible": 20.0
    }
  },
  "field_answers": {
    "additionalEquipmentCoverageLimit": "501-1000",
    "vin": "5YJSA1E28HF190648",
    "make": "Tesla",
    "model": "Model S",
    "chosenDriver": ""
  },
  "detached_answers": {
    "towingLimit": "75"
  },
  "detached_items": ["towing"],
  "field_overrides": {
    "chosenDriver": {
      "options": [
        {
          "value": "ef763124-8b7f-4016-ac54-7d07e4adfe70",
          "label": "John Doe"
        }
      ]
    }
  },
  "item_overrides": {
    "towing": {
      "visible": false
    }
  },
  "calculations": {
    "driverFactor": 1.0
  },
  "rate_tables": {
    "towingRateTable": 0
  },
  "children": []
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

It contains following keys:

Key Description
id Unique risk ID
name Risk name as calculated via risk_name_template
type Risk type information e.g. Risk Type name, label and ID
number Risk number is calculated based on type. It can be used in calculations to know how many risks of a particular type have been added.
total_premium Sum of all enabled items coverages premium
items Enabled items on risk
field_answers Fields answers for enabled items
detached_answers Field answers for items which are disabled/unchecked by user. Used later to repopulate associated fields of an item when it gets re-enabled.
detached_items Contains name of items having presence Default or Optional which are removed from risk
field_overrides Used to contains extra information for a field e.g. Options for Enum field which uses Risk Type as Source for options
item_overrides Used to set visibility of item
calculations Contains resolved shared calculations
rate_tables Contains resolved rate tables
children Array containing child risks if any