Skip to main content
Install Relativities and download the synthetic examples before running this page. rslc is the command-line tool for RSL raters. This page shows each command on the dwelling fire rater from Write your first rater, with the output it prints. Each command exits with status 0 when it succeeds and 1 when it fails, so a script or CI job can stop on a failure.

Check a rater

rslc check reads the rater and its tables, and proves every promise in What rslc checks and guarantees:
The second line is the cost line. It counts the steps of work for each outcome. A failed check prints one line for each problem. The line gives the message code, the file, the line and column, and the fix:
  • because gives the reason for the rule.
  • help shows a rewrite. Replace the example citation with the real one.
  • applicability: manual means the author applies the fix by hand.
Check messages lists each code with its fix. For tools and scripts, put --json before the command name. The output is one JSON object with the keys ok, diagnostics, cost and summary, among others:

Format a rater

rslc fmt rewrites the source in the standard layout. --check reports the change and leaves the file as it is:
To fix the layout, run the command alone:

Package a rater

rslc export packages the rater as a bundle: one ZIP file that holds the source, the tables and a manifest.
  • Run rslc check first, and package a rater only after it passes. rslc export stops on a calculation that can fail, and leaves the citation and outcome checks to rslc check.
  • The command writes a new ZIP file, and stops when the file already exists.
  • It also writes rater-manifest.json and rater.py beside the source. --format python writes only rater.py.

Rate from Python

rslc.PreparedRater loads an unpacked bundle folder. rate takes one request as JSON text and returns a JSON result. The sample download includes this bundle in relativities-examples/rsl/dwelling-fire:
  • A rated request returns "ok": true and the outcomes under outputs.
  • A refused request returns "ok": false and a refusal. Refusals describes it.
  • detailed=True adds every calculation to outputs.
rate_describe returns JSON Schemas for the request, the output and the detailed output. An integration can build its forms and checks from them:
The schema describes the shape of a request. The rater’s own check of each request decides a refusal. To rate a table of many policies with pandas, load the bundle ZIP with Rater.load. See Rate submissions with a rater.

Generate requests from the rules

rslc inputs sample builds requests that pass every rule. --representation rate prints them in the request form that rate takes:
  • --n sets the number of requests, and --seed fixes the random choices.
  • --json-lines also writes each request to a file, one JSON row per line, under the key input.
  • --invalid builds requests that break one rule each, and records the expected refusal.
Test a rater rates these files.

Check one request

rslc inputs validate checks one request against the rules. It reads the evaluator form, the default form of rslc inputs sample:
Save that object as candidate.json. Save a copy with protection_class set to 11 as bad-candidate.json:
To check a request in the rate form, rate it with PreparedRater.