-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdb.dbml
288 lines (248 loc) · 7.87 KB
/
db.dbml
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
//// -- Project
Project "Actuarial-Database" {
/// database_type: 'PostgreSQL'
Note: "This is the database used by the actuarial R package and
serves as a demonstation of a production-like actuarial claims
data warehousing environment"
}
//// -- Custom ENUM Types
// CLAIM_STATUS:
ENUM CLAIM_STATUS {
O [note: 'Open']
C [note: 'Closed']
R [note: 'ReOpened']
}
// COVERAGE_CODE:
ENUM COVERAGE_CODE {
WC [note: 'Workers Compensation']
AL [note: 'Automobile Liability']
PROP [note: 'Property (Damage) Insurance']
GL [note: 'General Liability']
MPL [note: 'Medical Professional Liability (Malpractice)']
OTHER [note: 'Any other coverage types']
}
//// -- TABLE GROUPS
TableGroup claims_layer {
claim
occurrence
claimant
claim_evaluations
}
TableGroup exposure_layer {
vehicles
policies
}
TableGroup business_layer {
companies
segments
coverage
evaluation
tpas
}
//// -- TABLES
// CLAIM:
Table claim [headercolor: #c0392b] {
claim_id uuid [
pk,
not null,
note: "Unique indentifier for the individual claim. Primary Key of this table."
]
claim_number int [
increment,
note: "Another form of claim identification but using an auto-incrememnting
integer based off creation date."
]
claimant_id uuid [
ref: < claimant.claimant_id,
note: "Identifier for the claim's claimant.
References the claimants table > claimant_id field."
]
occurrence_id uuid [
ref: < occurrence.occurrence_id,
note: "Identifier for the claim's occurrence, if applicable.
Occurrences group claims by accident or occurrence and depending
on the policy, occurrence or claims based reserving
should be used."
]
policy_id uuid [
ref: < policies.policy_id, note: "Identifer for the claims policy."
]
coverage_id uuid [
ref: < coverage.coverage_id,
note: "Identifier for the claim's coverage (i.e. WC, AL, GL, MPL, PROP, etc.)"
]
tpa_id uuid [
ref: < tpas.tpa_id,
note: "Identifier for the claim's TPA (third party administer)
that provieded claim details."
]
company_id uuid [
ref: < companies.company_id,
note: "Identifier for the claim's company or division, if applicable."
]
segment_id uuid [
ref: < segments.segment_id,
note: "Identifier for the claim's segment, if applicable."
]
loss_date date [
not null,
note: "The claim's loss date, i.e. the date which the accident or
insured event took place."
]
report_date date [
not null,
note: "The claim's report date, i.e. the date which the claimant
reported the claim to the insurer/TPA."
]
close_date date [
default: NULL,
note: "The claim's closure date, i.e. the date the claim's
Status changes to Closed and case reserves are zeroed out."
]
reopen_date date [
default: NULL,
note: "The claim's re-open date, i.e. the date a previosly
closed claim is re-opened."
]
reclose_date date [
default: NULL,
note: "The claim's last closure date given it has been re-opened at least once."
]
/// Table Note ///
Note: "Primary claims fact table listing idividual claim's measures
such as amounts paid, reported, and reserved as well as the
dimensional relationships to various claim attributes."
}
// EVALUATION
Table evaluation {
evaluation_id UUID [
pk
]
evaluation_date DATE [
not null,
unique
]
// Table Note: //
Note: "The evaluation table represents all possible evaluation dates to analyze
the claims as of in the form of static loss runs."
}
// CLAIM EVALUATIONS
Table claim_evaluations [headercolor: #3498db] {
claim_id UUID [
ref: > claim.claim_id,
note: "Claim Identifier"
]
evaluation_id UUID [
ref: > evaluation.evaluation_id,
note: "Evaluation date identifier foreign key."
]
evaluation_date DATE [
not null,
ref: > evaluation.evaluation_date,
note: "Evaluation date the loss values are evaluated as of."
]
status CLAIM_STATUS [
not null,
note: "Claim status uses a custom ENUM user-defined data-type allowing only
the values of O, C, or R for Open, Closed, or Re-Opened. Status can change
between evaluation dates determining prior-to-current status levels. This is
known as a 'slowly changing dimention in data engineering (i.e. O->C is a
closure, C->R is a re-opening, etc.)"
]
total_paid NUMERIC [
not null,
default: 0,
note: "Total cumulative paid as of the specified evaluation date. Should be
less than reported and flagged if closed and $0 paid."
]
total_case NUMERIC [
not null,
default: 0,
note: "Total cumulative case reserves as of the evaluation date.
Case plus paid determines reported amounts."
]
// Table Note: //
Note: "This table combines individual claims and their corresponding
evaluation dates values. containing all combinations of claims and evaluation
dates. This table represents a merged table containing all evaluation date
lossuns for a given client or project."
}
Table claimant [headercolor: #16a085] {
claimant_id UUID [
pk,
note: "Claimant unique identier and primary key for this table."
]
claimant_first_name VARCHAR(100) [
note: "Claimant first name."
]
claimant_last_name VARCHAR(100) [
note: "Claimant last, or family, name."
]
claimant_full_name VARCHAR(100) [
note: "Claimant's full name."
]
claimant_age INTEGER [
note: "Claimant's age in years represented as an integer (i.e. 78 is 78
years old.)"
]
claimant_details VARCHAR(100) [
note: "Details about the claimant."
]
// Table Note: //
Note: "The Claimants table represents all claimants that have appeared
in the system over its lifetime. Claimants represent individuals that have
filed claims in accordance with their policies and coverages."
}
Table occurrence [headercolor: #c0392b] {
occurrence_id uuid [pk, not null]
occurrence_number int [not null, increment]
number_of_claims int
default_claim_used uuid
Note: 'Occurrences represent groups of individual claims and group together all parties involved with a single occurrence or accident. Depending on the policy type, treatment of losses will either depend on occurrence based or claims based losses.'
}
Table coverage [headercolor: #f39c12] {
coverage_id uuid [pk, not null]
coverage varchar [not null, unique]
coverage_abbr varchar [not null, unique]
coverage_exposure_base varchar [not null, unique]
Note: 'The coverages table lists all potential coverages and their abbrevations/codes in the given actuarial projects environment'
}
Table policies {
policy_id uuid [pk, not null]
policy_type varchar
coverage varchar [ref: > coverage.coverage_abbr]
start_date date [not null]
end_date date [not null]
policy_year int
start_end_text varchar
premium numeric [not null]
alae_treatment varchar
occ_claims_based varchar
Note: 'Policy details'
}
Table tpas {
tpa_id uuid [pk, not null]
tpa varchar [not null, unique]
coverage varchar [ref: > coverage.coverage_abbr]
}
Table companies {
company_id uuid [pk, not null]
company_name varchar
company_abbr varchar
}
Table segments {
segment_id uuid [pk, not null]
segment_name varchar
segment_abbr varchar
}
Table vehicles {
vehicle_id uuid [pk, not null, note: "The vehicle's unique identifer and primary key."]
vehicle_vin_number varchar [note: "VIN number for the vehicle."]
driver_id uuid [ref: > claimant.claimant_id, note: "Foreign key identity to the claimant whom acted as the driver (owner) of the vehicle."]
vehicle_make varchar [note: "The make of the vehicle."]
vehicle_model varchar [note: "The vehicle's model."]
vehicle_year int [note: "Year the vehicle was made/purchased."]
vehicle_color varchar [note: "Color of the vehicle."]
vehicle_exposure_level int [note: "Exposure level (1,2, or 3) or the vehicle (i.e. passenger vehicles = 1, motor bikes = 2, and trucks = 3)."]
vehicle_value float [note: "The value in USD ($) of the vehicle."]
}