> ## Documentation Index
> Fetch the complete documentation index at: https://docs.effectiveai.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate a program for comparison

> Check filing scope, input mappings, independent premiums, and rating exceptions before using a program in a competitive study.

A reproducible competitive study needs evidence for the rating source, input mapping, and comparison basis.
Use this workflow when adding a program or changing its source, tables, `prepare` function, or assumptions.

[Install Relativities and download the synthetic examples](/relativities/setup) before running this page.

Run the examples packaged with the synthetic program:

```python theme={null}
from pathlib import Path

from relativities import Program, Rater

samples = Path("relativities-examples/ppa")
with Rater.load(samples / "carrier-a.zip") as engine:
    engine_id = engine.bundle_id
    program = Program.pack(
        engine,
        samples / "program_a",
        "validated-program.zip",
        prepare="program:prepare",
        schema="program:SCHEMA",
        examples="examples",
    )
checks = program.check()
checks[["submission_id", "status", "expected_premium", "premium", "matches"]]
#   submission_id          status  expected_premium  premium  matches
# 0            S2       succeeded             825.0    825.0     True
# 1            S3       succeeded             375.0    375.0     True
# 2            S4  invalid_inputs               NaN      NaN     True
```

The examples cover two successful ratings and invalid inputs.
Their expected premiums were calculated independently from the synthetic rules.

## Confirm the source and scope

Record the company, state, product, program version, effective date, and new-business or renewal basis.
Review the applicable manual, tables, amendments, and underwriting rules together.
Identify supported coverages, fees, discounts, and any omitted components before interpreting totals.

| Check | Evidence it supplies |
| - | - |
| Bundle hashes and `bundle_id` | Identity of the downloaded implementation |
| `rslc check` | Structural and calculation properties of that implementation |
| Source review and citations | Evidence for how the filing was interpreted |
| Independent examples or matched quotes | Evidence that specified inputs reproduce expected premiums |
| Book-level status counts | Coverage of the population used in the study |

Each check answers a different question. A verified bundle or successful rating alone establishes only the corresponding property above.

## Inspect the mapping before the premium

Review the book a program accepts, then the carrier inputs for a representative submission:

```python theme={null}
schema = program.schema.to_pandas()
schema.query("table == 'drivers' and type == 'date'")[["column", "type", "required"]]
#                    column  type  required
# 11             birth_date  date     False
# 14    first_licensed_date  date     False
# 15  defensive_course_date  date     False
program.explain(program.examples, "S2").json_in
# {'drivers': [{'age': 45}, {'age': 19}], 'vehicles': [{'annual_mileage': 6000, 'collision_deductible': 500}, {'annual_mileage': 9000, 'collision_deductible': 0}]}
```

`program.schema` lists every table and column that `prepare` can read. A program checks each
book against it before `prepare` runs.

Check dates, vehicle and driver assignments, symbols, territories, coverage selections, units, and supplied model inputs.
Keep reported values separate from derived values, proxies, and carrier-specific estimates. Document each mapping's source and assumptions beside `prepare`.
`explain` shows the prepared inputs and RSL calculations. The Python `prepare` function remains the source for its mapping logic.

## Reconcile independent examples

Use filing examples, independently calculated cases, or quotes with established rating facts and scope.
Reconcile by coverage and vehicle where available, then the policy total, including the applicable fees and rounding.
For a mismatch, inspect inputs first, followed by table keys, factors, calculation order, and rounding.
Retain unresolved differences and the evidence needed to settle them.

Choose cases at rating-band boundaries and with material interactions, such as a young driver in a multi-vehicle household.
Include refusals, missing facts, and unsupported selections so the study reports those outcomes explicitly.

`Program.check` compares packaged expectations within half a cent. It provides regression evidence only for those cases and the quality of their expectations.
`with_rater` recalculates expected outcomes for a replacement rater while checking statuses.
Validate the changed premiums independently before accepting them as new expectations.

## Preserve the run and its exceptions

```python theme={null}
run_identity = {"bundle_id": program.rater.bundle_id, "engine_id": engine_id}
checks.to_csv("program-validation.csv", index=False)
program.close()
```

Retain the IDs with the book snapshot, mapping assumptions, comparison basis, and analysis code.
For sampled facts, retain the sampling procedure and seed too.

Count every program's successes, refusals, invalid inputs, and mapping failures before summarizing premiums.
A calculated premium is a rating result. Underwriting appetite needs its own evidence in a placement-oriented exhibit.
[Compare carriers](/relativities/how-to/compare-carriers) shows how to keep those populations visible.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.