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:rater.evaluatetakes one request as JSON text and returns JSON text.evaluateis a helper in ordinary Python. It wraps the answers in the root recordPolicyand parses the result.- The result is
open: the premium still depends oninsured_nowandhas_dog.
Read the open questions
Evaluate an empty request:pathnames the input in the request. The gaps arrive in the order the rater needs them.choiceslists the values that the rate tables file for the input.moreistruewhen the table also has an all-other row, so a value outsidechoicesis valid too.
deductibleis a choice with a default. A request that leaves it out buys the $500 deductible.dog_has_bittenis a follow-up input. It becomes a gap only whenhas_dogistrue.
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:territory and read the gap for construction:
metrohas a row for each construction, sochoicesis the whole list.suburbanhas two rows. A fire-resistive building takes the all-other factor, somoreistrue.ruralhas one factor for every construction, soconstructionstops being a gap.
Read a settled result
Give the four answers that a rural policy needs: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:
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:Correct an invalid answer
A given value outside its type or range returnsinvalid:
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, passallow_missing=True to Program.rate.
Rate a book with a program shows the open status and the gaps column.
Related
- Missing answers explains why a rater answers a partial request.
- Results lists each field of the three results.
- Plan the next question turns the gaps of several raters into question cards.
- Ask the questions a rater needs writes the
askandwhenforms.