rslc plan and rslc.journey.Journey run the planner on your machine. Plan the next question gives the steps.
The examples use two raters from the synthetic carrier Example Mutual: the shared renters example and a smaller rater, basic/rater.rsl.
Complete example: basic/rater.rsl
Complete example: basic/rater.rsl
basic/rater.rsl
Commands
Each command names a journey file. A command that changes the journey writes the file back, then prints the next card.
Commands lists each option. Each command takes
--json.
start
start replaces a file at the same path. The journey begins with one empty record for each root record of the first rater.
answer
VALUE is JSON: 30000, true, "metro" or null. answer also takes a skipped path off the cards put off.
dismiss
DOCUMENT is the kind of a document card, such as declarations_page. The planner offers each document once.
next
next prints the current card again and keeps the journey as it is.
skip
(skipped before).
search
Each line holds the JSON value of an answer, then its label. A query that matches zero answers prints
no match.
Card text
A card prints as these lines. A line appears only when the card has the field:- A document card prints
document:and its kind as the path, and an empty question. asked byappears when some open rater leaves the input out of its contract.readylists each settled rater, ornone.- When the plan has zero open cards, the command prints
done: every rater is settledand thereadyline.
JSON output and exit status
With--json, a command prints one compact JSON object with sorted keys: "ok": true and the fields of the plan.
rslc plan search --json prints "ok": true and results, a list of objects with value and label.
A command that fails prints "ok": false and an error object with a message and a type.
The journey file
The journey file is JSON.rslc plan keeps the whole state of a journey in it:
The facts are one request for every rater. Each rater receives only the inputs that its contract declares.
rslc.journey
Journey(raters, *, titles=None, sections=(), decoders=None) holds a set of raters:
The arguments of
plan:
The module has two functions:
decode fills an input that the rater declares with filled_by. It fills the input only when the facts lack an answer and the contract admits the decoded value.
The plan
implied and priced_on appear only when they hold an entry.
A settled rater has outcomes or a final refusal. Journey.evaluations returns which.
A plan with a null card can still hold a failed rater, so read standings before you show a result.
Task
task has a kind and the fields of that kind:
A rater that refuses the value of a choice is a difference too, for a confirmed choice as well. Its
options are the other values that the rater sells, and suggested stays out:
rslc plan passes an empty confirmed. For a rater with a choice, its last task is confirm_choices.
Card
Achoice card that one of two raters asks:
number card, after the person has declined the document:
kind, path, screen and text. Every other field appears only when it applies.
A card takes its wording and its limits from the first rater of the journey that declares the input.
The
min and max of a date card also apply the earliest and latest annotations of the input. A bound of today reads as_of.
The fields of why:
Raters with one title count once in
still_settled. The planner ends each reason with a full stop.
Card kinds
The planner offers a document when the person has it and it prints an open answer:
Screen
A screen holds the cards that a host shows together:Choices
A choice is something the person buys, such as a deductible. It carries a default, so the planner lists it underchoices and leaves it out of the cards:
Each step has
value, label, programs (the titles of the raters that sell it), program_ids and common.
common is true when each rater that declares the choice sells the step.
The compiler sets the group of a choice. Input contract gives the rule.
The choices arrive by section, then by the count of titles that declare them, largest first.
A choice outside a list then comes before a choice of a list item.
A choice that a condition opens comes after the choices that its condition reads.
Readiness
standings holds one standing for each rater, in every plan. The programs of a review_results task is the same list.
State
Each rater is in one state. Every state exceptpriced names the way forward:
A settled rater with a choice that lacks a confirmation is in
needs, with one choice item for each such path.
So a rater moves from priced back to needs only when an earlier answer changes.
pending covers a list of the root record that has a complete annotation and lacks inline. Its path is the more card of the list, or the list card.
A price with a path in pending can still change with the next item of that list.
A reason has a
code and a message. The code is the code of the refusal, or null for a refusal that lacks one.
A failed state has the code NOTHING_TO_ASK: the rater lacks a result, and the planner has zero cards or choices to offer for it.
A refused key of a list item is one such case, and the host corrects the key.
Implied answers
Some answers follow from other answers. The planner plans with them and lists each one underimplied, with its path and value:
- A list item that lacks its key takes the next whole number after the largest key of the list.
- An answered follow-up that has a
none_answersets its unansweredBoolinput totrue.
Journey.plan evaluates each rater on the facts as given. Write each implied answer into the facts with answer, then plan again.
Until then, a rater that waits on an implied Bool input has the state failed.
rslc plan keeps the journey file to the answers of its commands, so run rslc plan answer for an implied Bool input.
Changes
A change reports a rater whose status differs from an earlier status that the host supplies.rslc plan and Journey.plan supply zero earlier statuses, so their changes is an empty list.
Issues
An issue names one answer in the facts that every rater rejects:
An answer that one rater takes raises zero issues. A rater with a narrower rule refuses on its own.
Fills
A fill tells the planner that your program fills inputs from one answer. The planner then asks that question first.
A rater also declares a fill itself, with the
filled_by annotation. Journey.decode then fills the input.
Search results
Journey.search and rslc plan search --json return a list of answers, each with value and label:
- The search ignores case and reads punctuation as spaces.
- Each word of the query matches the start of a word of a label.
- The search also matches the other names of an answer, from the
aliasescolumn of an enum file. - A label equal to the query comes first, then another name equal to the query.
- A label that starts with the query follows, then the other matches of a label, then the other matches of another name.
- The result holds 20 answers at most, or
limit. - For a card with a
list, the search reads the keys of the table from the rater.
How the planner orders cards
- Raters share an input when they declare it at the same path. One card serves each rater that needs it.
- Sections follow the section order of the journey, then the order in which the contracts first name them.
- The planner stays in the section of
afterwhile that section has cards in turn. - A question that fills other inputs comes before those inputs.
- A follow-up question comes after the answer that makes it apply.
- A card put off comes last. A card that only a waiting rater asks moves behind the cards of the other raters.
- The planner offers a document once, on entering a section, when the person has it and it prints an open answer.
- A refused answer returns as the next card, with the refusal message as
errorand its code aserror_code. - The key of a list item stays out of the cards. The planner numbers the items: see implied answers.
- In a list with a
youannotation, the item of the person who answers comes before the other items.
Related
- Missing answers explains how a rater decides which inputs still matter.
- Ask the questions a rater needs writes the annotations that a card shows.