Skip to main content
This guide builds on Write your first rating function, which writes the rating function it calls. You write an underwriting guideline for a synthetic staffing liability program of Example Mutual, then work one submission on its log. A guideline is a process. The log of one submission folds into a status: the open questions, who answers each, and the acts that are free to take. The process calls a rating function for the premium. The function reads only its inputs. The process reads the log and who acts.

Underwriting rules

The rating manual has four rules:
  • The premium is $2 for each $1,000 of payroll.
  • A firm with claims pays 1.5 times that premium.
  • The basic limit is $1,000,000. A higher limit, up to $2,000,000, costs 1.1 times that premium.
  • The program rates a payroll of $1,000 or more.
The underwriting guideline adds five:
  • A professional employer organization (PEO) must be in operation for 3 years or more and be financially sound.
  • An underwriter judges the loss experience and the financial soundness.
  • A manager signs off a firm in operation for less than 3 years.
  • A manager signs off a premium of $10,000 or more.
  • An underwriter quotes and binds.
A staffing firm 2 years old, with a $2,500,000 payroll, a clean loss record and the basic limit, pays $5,000 after the manager signs off. The rates, rules and citations are synthetic.

Save the rating function

Make a folder for the program:
Save the rater as rater.rsl:
staffing/rater.rsl
The function takes the payroll, the loss experience and the limit, and returns premium. Its check PAYROLL_BELOW_MINIMUM refuses a payroll below $1,000. per quote on limit makes the limit a term: each offer may set its own limit. Every other input is a fact that all offers share.

Write the guideline

Create guideline.rsl beside rater.rsl. The parts below build it from top to bottom, and the whole file follows them.

Use the rating function

The guideline starts with the same spec header as a rater, with component: guideline. use links the rater under the short name ts, so its record is ts.Policy.

Grant roles and acts

Roles lists the roles from lowest to highest, and a role acts for each role below it. Each act names its kind, the states it moves between, and the lowest role that takes it.

Ask the questions

  • policy: ts.Policy takes the inputs of the rater as one input. The guideline asks each of them under policy.
  • by @Role.uw grants a question to the underwriter. A question that lacks by is open to every role.
  • policy.experience by @Role.uw grants one question of the rater to the underwriter, by its path.
  • when makes financially_sound a follow-up: the log asks it only for a PEO.
An input can also carry the words that a host shows. The questions example words two questions this way:
ask is the question, help the longer text, and group the section. The words change what a host asks, and the premium stays the same. Input contract lists every key, and rslc examples get questions saves the whole file.

Call the rating function

ts(self.policy).premium calls the rater on the policy and reads its premium. A policy that breaks a check of the rater makes the submission ineligible.

Add eligibility and referrals

  • The where rule has a code. A submission that breaks it is ineligible, and the log refuses quote.
  • A refer rule holds the offer act while its condition holds: the underwriter can still record a quote, but it is held, and bind refuses it (NOT_READY) until the named role decides Approved or Declined.
  • A decision stands while the values that its condition reads stay the same. When one changes, the decision lapses.

Check the guideline

The whole file, with its header, source and constants:
staffing/guideline.rsl
One check covers both files: the rater alone, then the guideline and its call. The cost of large_account holds the call, because its condition reads the premium.

Work a submission

rslc log records one submission in a log file. Each command names its writer as --as role:name, and prints the entries it wrote and the status.

Open and answer

Save the answers of the applicant as application.json:
staffing/application.json
Open a log for the guideline, then answer from the file as the assistant:
The status lists what is still open, with the lowest role for each. The firm is 2 years old, so new_venture is open before the premium is known. An assistant who answers policy.experience gets the refusal NOT_AUTHORIZED, and the log stays as it was.

Answer as the underwriter

Every input has an answer, so the premium is known: 2,500 × $2 is $5,000. The referral waits for the manager.

Sign off as manager

A sign-off answers the referral by its name:
The status is ready: the offer act is free to take.

Quote

The offer q1 keeps the $5,000 premium. It stands while the answers stay the same.

Change an answer

The applicant reports a higher payroll:
The offer rests on every answer, so q1 lapses. The sign-off stands, because new_venture reads only years_in_operation. Now change the answer that the referral reads:
The manager approved a firm 2 years old, so the sign-off lapses and the referral opens again.

Sign off and bind

q1 stays in the log under its name, so the new offer takes a new name. bind takes an offer only while it stands, so the bound premium matches the answers in the log. An accepted submission is final.

Read the log

The log file holds one JSON object on each line. These are entries 7, 8 and 13:
  • kind is the shape of the entry, and on is what it is about.
  • decide is the sign-off. stamp.read holds the answer that the manager read.
  • act is an act of the program. stamp.act says what it did: offer, then accept.
  • at is the time of your run. Commands only add lines, and each status follows from the lines.
rslc log history submission.jsonl lists every entry with its number and its writer.

Release it on Effective

To take real submissions, release the guideline on Effective:
  1. Package it with rslc export guideline.rsl --format bundle --out guideline.zip. The bundle carries the rating function it uses.
  2. Upload the bundle, then release it under a version number.
Releasing makes you the holder of each role the guideline declares, so you can work a submission straight away. Programs on Effective shows each call, and how to hand the roles to your team. Then take in submissions.

Next steps