Skip to main content
This guide reads the synthetic dwelling-fire table from Write your first rater. To follow along, save a copy of that rater and enter its folder:
With a dwelling/ folder from the tutorial, run cd dwelling alone. The first excerpts quote rater.rsl in that folder.

Declare the table

Define the protection-class bands and perils in Types:
Declare BaseRate in Tables:
  • dims defines the lookup key.
  • rate: Rate[Peril] returns one rate per peril.
  • columns maps those rates to CSV columns.
  • cite identifies the source location.

Save the CSV rows

The rows of BaseRate live in tables/BaseRate.csv:
Each protection value starts a band: 1–3, 4–6, 7–9, or 10 and above. Each key identifies one row. Keep numeric values as digits with a decimal point where needed.

Look up a rate

Pass the table name and key to lookup!, then select the returned value:
For protection class 5, the lookup selects the row beginning at 4. Its fire rate is 2.60. The lookup has a name, base_rate, and the premium reads that name:
A lookup inside arithmetic gets its own name. Arithmetic over named values can nest, so the premium is one calculation. For Coverage A of 250,000, the fire premium is 250 × 2.60 = 650.
A table can use several key columns. The fn-tables example on the examples page keys its base rate by territory and construction:
Its CSV contains one row per key combination:
Pass keys in declaration order:
Map RSL names to the CSV headers with columns. This small rater reads a ZIP table whose CSV has its own headers:
zip/rater.rsl
zip/tables/ZipRate.csv
The columns block maps the key zip and the output rate to the two headers:

Read the rate an input selects

The subscript on a map column is a map binder, such as p, or one member, such as @Peril.fire. This small rater takes the peril as an input:
one-peril/rater.rsl
one-peril/tables/BaseRate.csv
To read the rate for the peril that the request names, read the column into a map and index that map with the input:
For protection class 5 and the peril wind, self.base_rate[self.peril] is 0.80. An input as the column’s own subscript, .rate[self.peril], gets E-MAP-DOMAIN.

Handle missing keys

Every lookup must find a value for each key it can receive. Choose the behavior supported by the filing: An uncovered lookup fails rslc check with E-LOOKUP-GAP.

Use a filed fallback

Add otherwise when the filing provides an all-other value, as the fn-tables example does:
A ZIP absent from the CSV receives the factor 1. The fallback needs a citation to the filing’s all-other rule.
For a table with one supported key column, Key(T) accepts values naming its filed rows.The zip rater under “CSV headers with different names” declares a five-digit ZIP type and a table:
Its input uses the table’s name in the input type:
A missing key receives INPUT-KEY-UNFILED before rating. A wholly unfiled row also counts as missing.
Use unfiled when the filing leaves an output blank. The zip rater’s CSV marks one row:
A row whose outputs are all unfiled is treated as absent.Restrict accepted keys, or use a filing-supported otherwise value. A lookup that can reach an uncovered missing row produces E-LOOKUP-GAP.For a table with several output cells, a partly unfiled row produces E-TABLE-COL. Split outputs into separate tables when their filed rows differ.

Locate a point in a filed grid

Some plans key a table by a grid cell that the filing assigns from the risk’s latitude and longitude. Add each cell’s filed representative point to the table, and declare the grid as a geography.
grid/rater.rsl
grid/tables/Grid.csv
locate returns the key of the filed cell that holds the point, as an option:
A point on a line between cells takes the lesser code. Write the None arm as the filing directs: refuse the risk, remove the factor, or assign a filed code. A rater that uses locate rates on the native engine. When the filed cells are squares of latitude and longitude, declare a degree_grid. Its cell and origin are decimal degrees, as in the fn-geography example:
locate(WildfireGrid, …) works as it does for a projected grid.

Check the rater

The check verifies lookup coverage for the inputs the rater accepts. Compare the extracted rates with the filing and test independent examples to verify their accuracy.

Next steps