Skip to main content
A rater is a module that rates one product. Its entry function takes the facts of one policy and returns money: an amount on a grid, such as whole cents or whole dollars. A rater is a function: values in, one value out. It reads the request and its own tables only, so the same request always gets the same premium.

Rater parts

Each part of a filed rating plan has one place in a rater:

Rater shape

The rater of Write your first rater rates a dwelling-fire policy. Its premium step reads a rate table and rounds each peril premium to cents. It adds the fees and rounds the total to whole dollars:
A check on an input refuses a request outside the risks that the manual rates. This one carries a code, a message and the page it comes from:
The rater names the value a caller reads:

Guarantees

  • Arithmetic is exact. A value changes only at a round that the rater writes.
  • The rater reads each number of a request from its text, so 1000.005 stays 1000.005. A number off its input’s precision gets a refusal.
  • A rater that passes rslc check gives a value for each request it accepts. Each lookup finds a row.
  • A refused request gets the check’s code, the path of the input and the message. Refusals lists the fields.
  • Each table, constant and rounding cites the page of its source document.
What the check proves states each guarantee. The check proves the rater is sound, and tests against the filing prove it is right.

Requests and books

Keep the bundle_id beside each premium you keep. It names the exact rater that gave the premium.

Filing tests

A filing often prints rating examples. Rate each one and compare the premiums. A reviewer still checks the extracted rates and the interpreted rules against the filing. After a new release, rate the examples again and compare each premium and bundle_id.

Next steps