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

# Load a program

> Load a program from Effective's library, your catalog or a file, and read its schema, its rater's inputs and its rating tables.

Load a program from Effective's library by its `effective://` name:

```python theme={null}
from relativities import Program

program = Program.load("effective://example-ca-ppa")
program.schema.version  # 'ppa/1.0'
```

A program is a rater, the schema of the book it accepts, and the `prepare` function that turns
that book into the rater's inputs. `example-ca-ppa` is a synthetic California personal auto program.

```mermaid theme={null}
flowchart LR
  book["Book"] --> schema["program.schema: checks the book"]
  schema --> prepare["prepare: builds each input"]
  prepare --> rater["program.rater: rates each input"]
  rater --> rows["One row per submission"]
```

## Choose where to load from

| Source | Loads |
| - | - |
| `"effective://example-ca-ppa"` | A program from Effective's library |
| `"my-program"` | A program from your organization's catalog |
| `"example-ca-ppa"` | A program you downloaded, from its folder or ZIP |

* Pass `revision=` to pin a version, as [Download a program](/relativities/how-to/download-a-program) describes.
* Pass `local_files_only=True` to read the local cache only.

<Warning>
  Loading a program runs its Python `prepare`. Load programs from Effective's library, your own
  catalog or files you trust.
</Warning>

## Read the book it accepts

`program.schema` lists each table and column that `prepare` reads:

```python theme={null}
schema = program.schema.to_pandas()
schema.query("table == 'vehicles'")[["column", "type", "unit", "values"]].tail(4)
#                     column    type   unit                           values
# 28          annual_mileage     int  miles
# 29          mileage_source    enum         estimated, odometer, telematics
# 30              anti_theft    enum         none, passive, active, recovery
# 31  custom_equipment_value  number    USD
```

## Read the rater's inputs and outcomes

`program.rater.inputs` lists each field the rater takes, with its allowed values.
`program.rater.outputs` lists each outcome that `rate` returns:

```python theme={null}
program.rater.inputs.query("path.str.startswith('vehicles[].')")[["path", "values"]].head(4)
#                                path                                    values
# 15        vehicles[].annual_mileage                               0 to 150000
# 16            vehicles[].anti_theft           none, passive, active, recovery
# 17   vehicles[].bodily_injury_limit  30/60, 50/100, 100/300, 250/500, 500/500
# 18  vehicles[].collision_deductible                 100, 250, 500, 1000, 2000
program.rater.outputs["path"].head(3).tolist()
# ['premium', 'vehicles[].coverage_premium.bodily_injury', 'vehicles[].coverage_premium.collision']
```

`premium` is the policy's annual premium. Each vehicle carries a premium for each coverage.

## Read the rating tables

`program.rater.tables` holds each rating table, with exact `Decimal` values.
[Create a market](/relativities/how-to/create-a-market) rates a book with an edited table.

```python theme={null}
program.rater.tables["BaseRate"]
#                            coverage  rate
# 0                     bodily_injury   550
# 1                   property_damage   358
# 2                  medical_payments    78
# 3  uninsured_motorist_bodily_injury   183
# 4                     comprehensive   477
# 5                         collision  1519
```

## Read the example book

A library program carries an example book. `program.check()` rates it and compares each result with
the expected premium:

```python theme={null}
program.example_book  # Book(100000 policies, 100000 submissions, 193158 drivers, 185985 vehicles)
program.check()["matches"].all()  # True
```


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