Skip to main content
An RSL file describes the facts a rater accepts, the rules it applies, and the calculations it returns. Most excerpts quote the synthetic dwelling-fire rater from Write your first rater. The tutorial contains the complete runnable source. Every rater starts with a spec block. It names the RSL version, the carrier, the state, the product, and the effective date:
rslc reads RSL 0.4 and 0.4.1. A file that declares another version gets one E-RSL-VERSION message. Versions explains the two.

File structure

A rater is a sequence of sections. Most raters use these, in this order: The order is a convention: the compiler reads the sections in any order. Lines beginning with # are comments. Other sections serve other files, such as import for a split rater and use, Roles and Acts for a guideline. Sections, types and annotations lists every section. Files and versions in the language reference states the rules of a file.

Types and inputs

The Types block defines names used throughout the rater:
  • Peril lists named choices.
  • ProtectionClass defines bands starting at 1, 4, 7, and 10.
  • Money represents amounts in whole cents.
An inputs block declares the facts supplied to a record:
Here, a policy contains one dwelling and a list of up to ten scheduled items.
An optional input’s meaning comes from the rating algorithm. It can represent an absent coverage or a value handled by an explicit default.Sections, types and annotations lists every type.
Types and Inputs in the language reference state each form.

Input rules

A where clause restricts an input:
self refers to the input value. [1, 10] includes both endpoints. The rule carries a code, message, and source citation. A request that breaks this rule receives a refusal with those details.
Numeric inputs require a declared precision and range. A set such as {6, 12} further restricts that range.
Rules in the language reference covers rules on lists and records, codes and citations.

Follow-up inputs

A follow-up input is a fact the rater needs only for some risks. The follow-up, question and label excerpts quote this second small rater.
vacancy/rater.rsl
when states the condition that makes the input part of a request:
A request for a vacant dwelling supplies vacant_months. A request for an occupied dwelling leaves it out. A calculation reads a follow-up input where its condition holds:
Inside if self.vacant then, the compiler knows the answer is present. Ask questions builds a rater with follow-up inputs, and Follow-up inputs in the language reference states the rules.

Questions

An ask annotation gives an input the question a person answers:
The question travels with the rater in its input contract, so an application builds its screens from the rater. The rate stays the same. Other annotations add help text, an answer format and the wording for each choice. Sections, types and annotations lists them, and The input contract shows what an application receives. Questions and choices in the language reference states each annotation’s rule.

Constants and calculations

A constant gives a fixed value a name:
A step block holds calculations. Each calculation declares its name, type, and formula:
This calculation charges 1.5% of an item’s value, rounded to cents. self.value reads an input from the same record. RSL keeps arithmetic exact between explicit rounding steps. A calculation is arithmetic over named values, constants, and inputs. The arithmetic can nest, so one step of the filed rating algorithm is one calculation:
In an RSL 0.4.1 rater, a lookup, if, match, round, or pow inside arithmetic gets its own name. The tutorial names its rate lookup base_rate, and peril_premium multiplies by self.base_rate[p]. A label is optional on a working value.
The compiler determines calculation order from dependencies.
A calculation can end with rule clauses, in this order. A rater that uses them declares rsl: "0.4.1".An exception applies before the formula. with … otherwise decides only whether the formula applies.select(low..high, position) gives a value between a filed low and a filed high. It also needs rsl: "0.4.1".
Constants, Steps and calculations and Expressions in the language reference state each form.

Rating tables

The Tables block declares a table’s keys and returned values:
The rows live in tables/BaseRate.csv. The column mapping connects each peril’s rate to its CSV column. Read a rate with lookup!:
This selects the protection-class band and reads the rate for peril p. Use a filed rate table covers table keys, CSV layouts, and fallback values. Tables and lookups in the language reference states the rules of a table and of lookup!.

Rounding

Each rounding operation states its decimal places and rounding mode:
Here, 2 means two decimal places. half_up rounds halfway values up. Round a premium describes the available rounding modes, and Rounding in the language reference states the rules.

Sources and citations

The Sources block identifies supporting documents:
artifact(...) refers to a document in Effective by its artifact ID. This example uses a placeholder for a synthetic manual. A citation connects a rule or value to a source location:
manual:p9 means page 9 of the document named manual. Citations explains source locations and citation requirements. Sources and citations in the language reference lists the region form of each source kind.

Labels and concepts

Labels, notes, concepts, and stages describe a rater on its rating manual page. They are optional, and the rate stays the same when a rater adds them. The vacancy rater above declares two stages and labels each filed value:
  • A label marks a value that the filing names, such as a rating step, a filed factor, a premium, a discount, or a fee. Its note is one sentence.
  • An unlabelled value is a working value, such as a lookup, a range end, a key, or a partial sum. It takes its role and its citation from the value that it serves. The rating manual shows it inside the value that reads it.
  • A concept, such as BasePremium(Premium), states what a labelled value is. A concept on a table column, such as BaseRate(Rate[Peril]), applies to each lookup of that column.
  • Stages names the parts of the filed algorithm, and step base in base puts a step in one part. A step takes its note from its stage or states its own.
An RSL 0.4.1 rater reads the rating@2 vocabulary. Each concept has a role, such as these:
  • A Credit is a discount ratio, such as 0.05, that applies as 1 - credit. A filed multiplier, such as 0.80, is a Relativity.
  • A fact that the request supplies is a Classification or another fact.
  • For a value that lacks a concept, the compiler infers the role from the values that read it.
On the rater page, each labelled premium, factor, or base value is one row of the calculation. A labelled bound shows inside the value that it bounds. Each step lists its checks. Variables lists the inputs, lookups, and outcomes, and Tables lists the rate tables. The rating manual messages explain the checks on labels, concepts, and calculation forms. Stages, labels, notes and concepts in the language reference lists each form and concept.

Rating outcomes

RatingOutcomes selects the values returned by the rater:
This publishes the policy’s calculated premium under the outcome name premium. Outcomes in the language reference lists the types an outcome may have.

Guidelines

A guideline is a second RSL file that holds underwriting rules. It uses a rater and adds roles, question owners and referrals. These excerpts quote the staffing example on the examples page. use links the rater under a name, and Roles orders the people who answer and sign off:
An input names the role that answers it with by, and a calculation reads the rater’s premium:
A refer clause sends a submission to a role for sign-off:
A referral holds the quote until a manager signs it off. A where rule on the record still refuses a submission outright. Write your first guideline builds this example, and Raters and guidelines explains the split. Guidelines in the language reference states each form.

Next steps