Big RxR Blues

I’ve updated the GitHub repository for RxR with some bits of SQL that are hopefully useful. This is a very quick stab at establishing a basic schema definition for (re)insurance data. This first cut simply creates a table to store accounts, written premium and a query to get earned premium.

The account table has an index field called “SegmentID” which could be used to map to marketing/demographic characteristics. Apart from that, there’s nothing here to describe the exposure other than a field which defines the insurance coverage being offered. That puts quite a burden on the SegmentID field, but it’s fairly straightforward to build some basics like territory, agency, program, etc.

The MonthMap table is the easiest solution I came up with to quickly move from aggregating across year, quarter or semi-annual periods. It feels a bit kludgy at first, but with the date udfs, I can now get appropriate totals without having to think too hard. And I hate having to think hard.

SQL is obviously only one option for data storage. If anyone knows more about XML, JSON or other formats, feel free to chime in. For my work, I use either R or Excel to interact with the data. I manage that with an ODBC DSN. Typically, I’m using a query, so everything is in a nice, tabular format and all of the joins have already been sorted out. In other words, once the data comes to me from the warehouse, I need to do nothing further to it other than draw meaningful conclusions.

Future updates would include:

  • A table or field to identify a specific policy.
  • Addition of exposure elements and rating values to construct the written premium information.
  • Once a policy field has been established, creation of a claim table and associated information.
  • Lots of other things.

Grab a fork and have a look at the repository:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s