Skip to main content
Install Relativities before running the synthetic examples. rslc.PreparedRater.evaluate rates one request that leaves inputs out. It returns the outcomes when the given answers settle them, and a refusal when a given answer breaks a rule. Otherwise it returns each missing input that still matters, as a gap.

Evaluate a partial request

Save the shared renters example, a rater from the synthetic carrier Example Mutual:
Load the folder and evaluate a request that holds two answers:
  • rater.evaluate takes one request as JSON text and returns JSON text.
  • evaluate is a helper in ordinary Python. It wraps the answers in the root record Policy and parses the result.
  • The result is open: the premium still depends on insured_now and has_dog.
The rater declares seven inputs. The two gaps are the inputs that still change its result:
Example raters shows the whole rater and its tables.

Read the open questions

Evaluate an empty request:
  • path names the input in the request. The gaps arrive in the order the rater needs them.
  • choices lists the values that the rate tables file for the input.
  • more is true when the table also has an all-other row, so a value outside choices is valid too.
Two inputs stay off the list:
  • deductible is a choice with a default. A request that leaves it out buys the $500 deductible.
  • dog_has_bitten is a follow-up input. It becomes a gap only when has_dog is true.

See an answer narrow the next question

The building table files a factor for each territory and construction, and 1.20 for all other pairs:
Answer territory and read the gap for construction:
  • metro has a row for each construction, so choices is the whole list.
  • suburban has two rows. A fire-resistive building takes the all-other factor, so more is true.
  • rural has one factor for every construction, so construction stops being a gap.

Read a settled result

Give the four answers that a rural policy needs:
The annual premium is $216. The request still leaves construction out. Each value of construction gives the same premium, so the result is final. An open result also reports each outcome that is already settled, under known:
The follow-up input dog_has_bitten now applies, and a business rule reads it. The premium is $241 for each answer that the rule accepts.

Read a refusal

A given answer that breaks a business rule settles the request as a refusal:
The refusal is final. An answer to an input that the request leaves out keeps it the same. Refusals lists each field of a violation.

Correct an invalid answer

A given value outside its type or range returns invalid:
Correct the value and evaluate again. To mark an input as unanswered, leave its key out of the request. A null for a required input counts as a given value, and the result is invalid:

Evaluate a book of submissions

To evaluate each submission of a book, pass allow_missing=True to Program.rate. Rate a book with a program shows the open status and the gaps column.