Skip to content

About

Code supporting the paper "From Filings to Foresight: Transforming Public Rate Filings into Actuarial Competitive Intelligence" currently submitted

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

From Filings to Foresight

Code and data for From Filings to Foresight: Transforming Public Rate Filings into Actuarial Competitive Intelligence, by Pramod Misra (Georgia Institute of Technology, Atlanta, Georgia). The paper was written for the CAS 2026 Ratemaking Call Paper Program and has been submitted to the CAS Forum (October 2026). A link to the published paper will be added here when it is available.

Abstract

Public rate filings contain competitive intelligence that pricing actuaries rarely use, because assembling a comparable view across carriers is laborious. This paper builds and measures a document-extraction workflow that reads the actuarial justification in a rate filing and returns it as structured data, organized around three uses: monitoring market rate activity, supporting trend selection, and comparing deductible relativities. The joined record from 94 scored California filings reproduces the 2020 through 2024 California automobile cycle: approved rate change correlates +0.35 with the current loss ratio and −0.23 with the following year's change. The evidence supports a controlled pilot with actuarial review of source values, not an autonomous pricing or forecasting system. Public filings can be turned into cross-carrier competitive intelligence at minimum cost. Code, prompts, and frozen data are released under an open-source license.

Keywords: rate filings; competitive intelligence; document extraction; large language models; private passenger automobile; loss trend.

What the code does

  1. Acquire California rate filings from the California Department of Insurance (CDI) public weekly notice lists and its Closed-and-Approved lists (src/serff_pipeline/connectors/california*.py), plus NAIC Market Share tables, the NAIC Auto Insurance Database, SEC EDGAR quarterly loss ratios, FRED drivers and the CAS Loss Reserve Database (Schedule P).
  2. Extract a structured rate-indication record from each filing PDF with a staged LLM pipeline (src/serff_pipeline/extraction/, target schema in schema.py), on a hosted model or a local open-weights model, with page-level provenance.
  3. Evaluate extraction against the regulator's published approved values (evaluation.py) and against hand-coded worksheets (gold_standard/).
  4. Analyse cross-carrier rate actions against realized loss ratios at group × state × line × year grain (dispersion.py, models.py, peer_group.py, variables.py, loss_trend.py), producing the exhibits in paper/exhibits/ that the manuscript's numbers are pinned to.
  5. Publish two public Gradio dashboards on Hugging Face Spaces: RateCompare (hf_space/, https://huggingface.co/spaces/pramodmisra/cas-serff-extractor) and OpenRate (space_ci/, https://huggingface.co/spaces/pramodmisra/open-rate-intel).

Quick start (Python 3.11, no API keys, no network)

git clone https://github.com/casact/rate-filing-competitive-intelligence.git
cd rate-filing-competitive-intelligence
python3.11 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt -r requirements-docs.txt   # Windows: .venv\Scripts\python.exe
.venv/bin/python -m pytest tests -q

The tests are offline. Connectors run on synthetic fixtures and no test reads an API key. The package is not pip-installed; each test inserts src/ on sys.path, so run pytest from the repository root. Tests that need the manuscript .docx or the raw Schedule P CSVs skip when those files are absent. To run the Schedule P tests, copy submission_v10_20260906/reproduction/data/raw/schedule_p/ to data/raw/schedule_p/.

Only the acquisition and extraction scripts under scripts/ need credentials; .env.example lists the variable names. Live acquisition also requires RESEARCH_CONTACT_EMAIL, which the connectors send in an identified User-Agent as SEC EDGAR and the CDI portals expect. Source filing PDFs are not part of this repository.

Reproducing the paper's numbers

There are two routes.

  • Frozen package. submission_v10_20260906/ rebuilds 21 exhibit CSVs plus the model metrics from the saved study records and compares them with expected_outputs/ at absolute tolerance 1.1e-4. Start at submission_v10_20260906/README_REPRODUCE_v10.md. The package pins its own Python 3.12 environment. Its README uses the pre-Forum sequential exhibit numbers (Table 2, Figure 1); the published paper uses section-based numbers in the same order.
  • Live code. scripts/build_exhibits.py, scripts/build_claim2_exhibits.py, scripts/accuracy_report.py and the scripts/build_e*.py builders regenerate paper/exhibits/ from the committed data. The weekly job (scripts/daily_pipeline.py) reads PAPER_FREEZE, which defaults to a full freeze so the published exhibits stay untouched; data/corpus_frozen_195.txt fixes the 195-record corpus the paper analyses, while data/corpus/CA/ holds the current 222 records.

Repository map

src/serff_pipeline/            the importable package (all analysis code)
  schema.py                    RateFilingRecord, the extraction target, with per-field plausibility bands
  evaluation.py                Claim 1 scoring: published-rate check, gold-standard P/R/F
  dispersion.py                Claim 2 spine: filings panel joined to subsequent realized loss ratios
  models.py                    Claim 2 fits: out-of-time LightGBM and GLM baseline, SHAP
  peer_group.py                carrier vs chosen peers vs whole market (three lenses)
  variables.py                 cross-carrier rating-variable comparison (deductible rebasing)
  loss_trend.py                Werner and Modlin loss-trend engine (frequency, severity, pure premium)
  extraction/                  pipeline.py (classify, segment, extract, validate), prompts.py,
                               llm_client.py, llama_extract.py, local_extract.py, pdf_text.py
                               (segmentation is diagnostic; extraction reads the first 200k
                               characters and logs a warning past that)
  connectors/                  california.py, california_approvals.py, california_apex.py,
                               naic_auto_db.py, naic_panel.py, naic_market_share.py,
                               sec_edgar.py, drivers.py, base.py
scripts/                       acquisition, extraction, exhibit and figure builders, Space deploy
tests/                         offline pytest suite
data/                          committed study records (see "Data")
gold_standard/                 hand-coded reference records and verification worksheets
paper/exhibits/                exhibit CSVs and SUMMARY.md (generated; do not hand-edit)
paper/figures/                 figures (PNG)
paper/deck/                    findings deck builder (run build_deck.py to produce the .pptx); exhibit_numbers.py loads figure inputs from exhibits
hf_space/  space_ci/           the two deployed Spaces (each vendors a copy of serff_pipeline)
submission_v10_20260906/       frozen reproduction package (see above)
docs/                          retrieval runbook, cross-state pull plan

Data

File Rows Source
data/ca_approved_panel.csv 27,534 CDI Closed-and-Approved lists (requested and approved values)
data/ca_filings_panel.csv 4,866 CDI weekly public-notice lists (applications received)
data/naic_msr_2019..2024.csv 9,992 total NAIC Market Share, group × state × line × year loss ratios
data/naic_panel.csv 7,707 NAIC Auto Insurance Database, multi-edition panel with restatement log
data/corpus/CA/*.json 222 records extracted rate records with page provenance (195 frozen for the paper)
hf_space/loss_trend_corpus/*.json 143 filings extracted carrier trend selections
gold_standard/ 1 record and 21 worksheets hand-coded reference

data/ACCESS_NOTES.md and data/DOWNLOAD_MANIFEST.md record source URLs, retrieval dates and the NAIC SERFF terms-of-use constraint that limits acquisition to California's own portal. Source filing PDFs are not redistributed. Public accessibility of the inputs does not by itself establish redistribution rights for every source document; users of the data are responsible for the terms of the original sources.

Known differences from the paper

The published exhibits in paper/exhibits/ match the submitted manuscript. Code-review fixes made after submission (see CHANGELOG.md) leave every cited value unchanged, with two disclosures:

  1. Notice-date deduplication. panel_rows() now keeps the newest public-notice date when a filing appears on several weekly lists. Applied to the frozen corpus, four of the 195 records move notice year. If the rate-need gap exhibit (E7) were rebuilt on the new dates, the 2022 private passenger automobile cell would hold three filing records rather than the four the paper reports; its +23.5 / +6.9 / 14.1 figures do not change. The committed E7 and data/ca_filings_panel.csv keep the dates the paper used.
  2. NAIC Market Share parser. The frozen Market Share CSVs carry 100 conflicting duplicate keys, all workers' compensation in NC, VA, WI and RI, where a missing state header attributes small groups to the preceding state. California automobile, the population the paper analyses, is unaffected. A fix requires re-parsing the source PDFs and is not yet made.

In addition, e9_schedule_p_developed_lr.csv keeps the all-year carrier counts the paper cites (135 personal and 144 commercial automobile groups); the updated builder writes per-year n_carriers alongside n_carriers_all_years.

Citation

See CITATION.cff. Until the CAS Forum publication is available, cite as:

Misra, Pramod. 2026. "From Filings to Foresight: Transforming Public Rate Filings into Actuarial Competitive Intelligence." Submitted to the CAS Forum. Code and data: https://github.com/casact/rate-filing-competitive-intelligence.

Licence

Mozilla Public License 2.0 (LICENSE).

About

Code supporting the paper "From Filings to Foresight: Transforming Public Rate Filings into Actuarial Competitive Intelligence" currently submitted

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages