What you build
You make five changes to the inputs of one rater:- Give two inputs a question, help text and a section.
- Add two follow-up inputs that a host asks only after a
trueanswer. - Name the items of a list.
- Mark the coverage limit as a choice with a default.
- Mark an input that the host fills, and suggest an answer from it.
Start from a plain rater
Create a folder for the starting rater:plain/rater.rsl.
plain/rater.rsl
plain/rater.rsl
plain/rater.rsl
Give an input its question
Inquestions/rater.rsl, replace the year_built and home_business inputs with these lines:
askis the question a person reads.helpis a longer text that the host shows with the question.groupnames the section of the questionnaire.formattells the host how to take the answer. Answer formats lists the names.
Add follow-up inputs
Some questions apply only after an earlier answer. A follow-up input states its condition after its type:home_business:
true answer to home_business. unit names the unit of the amount.
Each follow-up changes the premium. Add two constants to Constants:
premium step:
equipment_premiumreads the amount insideif self.home_business then …, where the amount is present.visitor_premiumreads the answer afterself.home_business and, so an unasked question adds the same $0 as an answer offalse.
false: the rater states which one it counts as. not self.home_business or self.customers_visit counts an unasked question as true.
A read of either follow-up outside its condition gets the check message E-FOLLOW-UP-READ.
Name the items of a list
A person adds valuables one at a time, and each later question names the item it is about. Replace theitems input:
keyed by item_idmakesitem_idthe key of each item.callednames an item in a question.{kind}is the item’skindanswer, and{#}is its place in the list.- The
|separates alternatives, and a host takes the first one that it has every answer for. completeis the question a host asks before it closes the list.
Item:
{this} stands for the name that called gives the item.
A label on an enum member gives the words a person reads for that value. In Types, add one to instrument:
Mark what the person buys
The contents limit is something the person buys. The other inputs are facts about the home. Replace thecontents_limit input:
choicemarks the input as a choice. A host offers it as a coverage option and keeps it out of the questions.askis the text a host shows beside the option.shapenames the kind of choice. Choice shapes lists the names.api_defaultis the value the rater uses when a request leaves the input out. Write it as a JSON literal in quotes.
choice requires an api_default, so a request always has a value for it.
Let the host fill an answer
A host often has a source for an answer, such as a table of ZIP codes and counties. The rater names the source, and each host supplies a function of that name. Add a type for the ZIP code toTypes:
county input with these three inputs:
filled_byhas the formsource(input).field. The host gives thepostal_codeanswer to its sourcezip_lookupand stores thecountyfield of the result.- Leave
askoff an input withfilled_by. The host fills it and skips the question. from self.zip_countysuggests an answer forcounty. The person accepts the suggestion or picks another county.
county alone, so the price rests on an answer the person gave or accepted.
Check and export the rater
Your file now matches the finished rater.questions/rater.rsl
questions/rater.rsl
questions/rater.rsl
program/input-schema.json.
Read the input contract
Rater.input_schema returns the same contract as a dictionary. It is the JSON Schema of one request, and each annotation is a key that starts with x-:
null:
x-round comes from the shape. For a limit that the rater leaves unsold, a host prices the next limit up.
x-group comes from the shape as well: a limit sits in the liability part of a coverage screen.
The list carries its key, its item name and its closing question:
Rate with the follow-ups left out
This request answers the three required questions and leaves out everything else:else value of 0. It takes the default contents limit of $30,000 and rates an empty list. The premium is $275: the $120 base premium plus 30 × 4.50 × 1.15, rounded to whole dollars.
Where the condition is false, the rater ignores a follow-up that the request gives:
Next steps
- Plan the next question asks these questions one at a time, in order.
- Rate with missing answers rates a request while a person is still answering.
- Input contract lists every key of the contract.
- Names lists every annotation and where it applies.
rslc examples get questions saves the finished rater of this tutorial to a folder.