Skip to main content
Rate submissions with one carrier’s rater, and read each premium and status. Install Relativities and set your API key before running this page.
Copy this Python and pandas setup to create the example submissions.
Rater.load("effective://example-ca-ppa") loads the rater of the running example program, with its tables and its rules. Q-1 buys liability only, and Q-2 adds comprehensive and collision. The program refuses rideshare use, so Q-3 stays unrated.

Load a rater

  • To load the rater of a library program, pass its reference, such as "effective://example-ca-ppa".
  • To load a local bundle, pass its path to Rater.load, such as "raters/my-rater.zip".
  • To load a catalog rater, pass its ID, such as "my-rater", with EFFECTIVE_API_KEY set.
The first catalog load downloads the bundle, verifies it and caches it by its bundle_id. Bundles and exact rating describes the checks.

Pin a revision

To load a numbered release, pass revision= a whole number. To rerun a rating exactly, pass revision= the bundle_id.
A cached bundle_id loads offline with local_files_only=True.

Download a rater to a folder

To keep a rater next to your work, call Rater.download with a path. Then load it from that path.
  • A path that ends in .zip gets the bundle archive. Any other path gets a folder with the rater’s RSL source, its tables and, for a program, its program/ folder.
  • The bundle is verified first. Then it goes to a new path or an empty folder, and the call raises FileExistsError for any other path.
  • revision= pins the download, as it does for Rater.load.

List the fields a rater accepts

rater.inputs lists each field a submission can give, one row per field. rater.outputs lists the outcomes that rate returns. Both use the type names of a book’s Schema.
path names the field as explain does, with [] for each list. values gives the allowed values or range, and the default when the rater has one. input_schema is the same contract as JSON Schema.

Rate one submission or a list

  • To rate one submission, pass a dict.
  • To rate several submissions, pass a list. Each row ID is the list position.
The dict holds the fields of the rater’s root record, Policy. Five years with the carrier earn its loyalty discount.

Rate a table of submissions

To keep your own IDs on the results, rate a DataFrame and name its ID column as key, as the first example does.
  • The key column stays on every result row. The rater receives the other columns.
  • A NaN, None or NaT cell leaves its field out of the rater’s input.
  • A date becomes ISO 8601 text.

Read the results in pandas

Call to_pandas() for one row per submission, with exact Decimal outcomes.
Q-3 has the status refused with the rule’s code and message. Its premium is NaN, so the mean skips it. drivers and vehicles hold each item’s nested outcomes, such as each vehicle’s coverage premiums. Results lists every column and status. Report the two successes and one refusal with that mean. The mean describes the rated submissions only.

Read exact values

To read one submission’s row, index the results by its ID.
results.rows holds every row, in input order. Each row’s outputs holds the rater’s nested outcomes as exact values. To list the calculations behind one premium, see Rate a book with a program.

Next step

Validate a program to establish the rating source and comparison scope. To write a rater of your own, start with About RSL.