Skip to main content
A rater returns one result for each request. rate takes complete requests, and evaluate takes one request that leaves inputs out. The examples use the shared renters example, a rater from the synthetic carrier Example Mutual:

Entry points

A request is a JSON object with one key for each root record, such as {"Policy": {"contents": 30000}}. Input contract describes the request of a rater. Result columns and statuses describes the tables that relativities returns. rslc.PreparedRater(folder) loads the rater in the folder that holds rater.rsl:

Results of rate

rate returns the tuple (results, fingerprints, inputs). For a batch of JSON text, fingerprints and inputs are None. threads sets the count of worker threads, and the default of 0 uses every core. The results keep the order of the requests. Each result is a dict that holds ok and one more key:

Rated

outputs follows the shape of the request:
  • Each outcome sits under its record, at the name of its calculation.
  • A child record is an object, and a list of records is a list in request order.
  • A calculation with one value for each member of an enum is an object keyed by member.
  • With detailed=True, each record holds every calculation, in the order of the rater.
order lists each path as a list, such as ["Policy", "items", 0, "charge"]. Each calculation follows the calculations that it reads:

Numbers

Each number is exact: A $rational holds a fraction in lowest terms. In a rater that passes rslc check, each outcome passes through a round. So the fraction form appears only among the calculations of detailed=True. Exact numbers explains why values stay exact.

Refusal

This request says has_dog is true and leaves out the follow-up input dog_has_bitten:
Refusals lists each field of a refusal, each code, and the size limits.

Fault

A rater that passes rslc check returns outcomes or a refusal for each request. A fault reports a rater that skipped the check, or a defect in the engine. The other requests of the batch keep their results. This fault comes from a draft rater that lacks its RatingOutcomes block:

Results of evaluate

evaluate returns compact JSON text: an object with one key. This page adds line breaks to each example. A missing input is a key that the request leaves out. Missing answers explains what each result promises.

Settled with outcomes

The outcomes equal the result of rate for each complete request that holds the given answers. This request leaves out construction and the choice deductible.

Settled with a refusal

Each violation of a settled refusal is a business rule, so each entry of coded is true. The refusal is final for each answer to the missing inputs.

Invalid

The fields are those of a settled refusal. At least one entry of coded is false: that violation is a value to correct. error is BusinessRejection whenever one violation has its own code, so read coded to tell the two kinds apart. A null for a required input is a given value, and it returns invalid with the code INPUT-TYPE.

Open

Each gap is an object: The gaps follow these rules:
  • The gaps come in the order in which the rater needs them.
  • A follow-up input is a gap only where its condition holds. While the condition is unknown, the inputs that the condition reads are the gaps.
  • A choice with a default stays out of the gaps. The request takes the default.
  • A missing list of records is one gap, at the path of the list. Each item of a given list names its own missing inputs.
  • A lookup lists choices from the rows that fit the given answers, 128 rows at most.
  • choices holds enum members in declaration order, and numbers and dates in ascending order.
  • For a gap with a list, rater.table_keys(name) returns the keys of the table as text, in file order.
A suggestion comes from an input that the rater declares with from. The suggested value is for a person to accept or replace. A premium uses given answers only. known holds an outcome when the request has exactly one value for it and that value is final. An outcome with one value for each of several list items stays out of known. This request leaves one gap, and the premium is already final:
A known outcome keeps its value for each answer that the business rules accept.

Errors and limits

The limits on one request and on one refusal are on the Refusals page.

Results in Relativities

relativities turns each result into a row with a status: Result columns and statuses lists each column.