Skip to main content
Install Relativities and download the synthetic examples before running this page. In this tutorial, you turn one page of an invented rating manual into a working rater. You check it, package it, and price a policy in Python. Each step shows the output you get. The manual prices a dwelling fire policy. It reads a rate per peril from a table, by the dwelling’s protection class, and applies it per 1,000 of Coverage A. It adds 1.5% of each scheduled item’s value and a 35 policy fee. The total rounds to whole dollars. You need the rslc command on your path, and Python with the rslc package.

1. Make a folder

A rater is a folder. It holds the source file rater.rsl and one CSV file per table:

2. Name the filing

Open rater.rsl and write the two header blocks:
  • spec names the carrier, state, product and effective date of the filing.
  • rsl: "0.4" is the language version line. Copy it as it is.
  • Sources names the filed documents. Here manual is the rating manual, a PDF. A citation such as manual:p3 points to its page 3.

3. Add the filed numbers

Add the names the manual uses, its one fixed number and its rate table:
  • Peril lists the three perils the manual rates.
  • ProtectionClass groups protection classes into bands: 1 to 3, 4 to 6, 7 to 9, and 10 and up.
  • Money is an amount in whole cents.
  • expense_fee is the 35 policy fee from page 9.
  • BaseRate is the table on page 3: one rate per peril for each band.

4. Write the rate table

Write the table’s rows in tables/BaseRate.csv:
Each protection cell names a band by its first class. Check the rater so far:
A rater must say which value is its premium. The next step adds it.

5. Describe the policy and the math

Add the records, which describe the policy, and the outcome, which names the premium:
  • A policy has one dwelling and up to ten scheduled items. These are the inputs: the facts a request sends.
  • Each where line is a rule on an input. A rule with a code is a rule from the manual.
  • peril_premium[p: Peril] holds one premium per peril.
  • lookup! reads the rate table.
  • round(x, 0, half_up) rounds to whole dollars, half up.
  • RatingOutcomes publishes Policy.premium as the rater’s premium.
RSL at a glance explains each of these forms.

6. Check

Check the rater:
PASS means each request that passes the rules gets a premium. The cost line counts the steps of work for one premium: 12, plus 2 per item. Check the layout too:

7. Package

Export the rater as a bundle, a zip file that holds everything needed to rate. Unpack it:

8. Price a policy

Price a 250,000 dwelling in protection class 5 with two scheduled items. Load the bundle folder you unpacked in the preceding step, from the same dwelling working directory:
The premium is 1,028. To see each value behind it, rate with detailed=True:
Now send a protection class of 11:
The rater refuses the request before it calculates anything. The refusal names the rule, its message and its manual page.

Next steps