OSFI P&C Insurance Return checks
Insurance Canada
Checks the P&C Insurance Return a Canadian property and casualty insurer files with OSFI, the quarterly PC1 and PC2 and the annual PC3, against OSFI’s own 5,093 validation rules: every total on a page, every tie between pages and every tie between the three returns. It also checks that each value is on a page, line and column of the return, that the reporting end date is a quarter end and that no cell is given twice.
From OSFI’s P&C Insurance Return for 2027: the PC1, PC2 and PC3 return workbooks, and OSFI’s validation rules for PC1 (version 15), PC2 (version 14) and PC3 (version 13)
- 11validation rules
- 19pipeline stages
- 5,093OSFI rules
- 5 minto build and check
See it in Quantemplate
The pipeline

The test run’s checks

A rule across returns

What it checks
11 rules 11 Fail
- CellsThe return is PC1, PC2 or PC3, and the page, line and column are on it 3 Fail 3
- FormatThe reporting end date is a quarter end and PC3’s is 31 December, values OSFI’s rules add up are numbers, the insurer is given and no cell is given twice 5 Fail 5
- OSFI’s rulesOSFI’s validation rules hold within a page, across pages and between PC1, PC2 and PC3, to within 1 where OSFI allows for rounding 3 Fail 3
A rule set to Fail marks its rows as failed, and any failure blocks Auto Export if you set it up. Validation never removes a row. Every rule and its formula is listed in VALIDATIONS.md in the download.
How the pipeline works
- Stages 1–2 Prepare Clean each returns file, add the numbers and keys the checks use, and stack the files
- Stages 3–7 Reference data The cells, rules and rule terms tables, each page’s cell count, and the rows given for each cell
- Stages 8–11 Check rows Bring each cell’s data point code, description and counts onto every row, and run the 8 row checks. Output: every row of every return
- Stages 12–14 Add up rules Match each value to the OSFI rules that read it, add up each rule for each insurer and reporting end date, and count the returns given
- Stages 15–17 Check rules Bring each rule’s type, threshold and formula onto it, and run the 3 rule checks. Output: each OSFI rule for each insurer and reporting end date
- Stages 18–19 Outputs Return rows checked and OSFI rules checked
OSFI’s validation rules
OSFI publishes a file of validation rules for each return, the checks its filing system runs. The pipeline keeps them as data, in two reference datasets: OSFI PC Rules lists each rule, and OSFI PC Rule Terms lists the cells each rule adds or takes away. Every rule is a sum, such as total assets less each asset line, that should come to zero, or to within 1 where OSFI allows for rounding.
Return |
Within a page |
Across pages |
Across returns |
|---|---|---|---|
PC1, quarterly, rules version 15 |
823 |
29 |
42 |
PC2, quarterly, rules version 14 |
3,425 |
15 |
39 |
PC3, annual, rules version 13 |
706 |
1 |
13 |
The rules across returns tie PC1, PC2 and PC3 together, so each is checked when an insurer gives every return it reads for the same reporting end date: PC1 and PC2 each quarter, and all three at the year end. OSFI’s files also have 90 rules that check a cell is filled in, nearly all on PC3’s summary of selected financial data, and 5 that check ratios on the same page. They aren’t sums, so they’re left out.
What’s in the download
- The 11 checks as JSON, and a table of every check with its formula, notes and source
- Three reference tables: every line of PC1, PC2 and PC3 with the columns of its table and OSFI’s data point codes, OSFI’s 5,093 validation rules, and the cells each rule adds or takes away
- Two fictional insurers’ returns, one with PC1, PC2 and PC3 at the year end and one with PC1 and PC2 for a quarter, every OSFI rule holding, and a test file with a case for each check
- The rows each check should flag on the test file
- A template file the Quantemplate build skill reads to build the pipeline and check the results
- A snapshot of the finished pipeline, and the Python scripts that read OSFI’s workbooks and generate everything in the download
OSFI’s workbooks aren’t included. Download the PC1, PC2 and PC3 returns and their validation rules from OSFI’s Property and casualty (P&C) insurance return (2027) page. All six are Excel workbooks.
Build it
- Install the Quantemplate skills, version 1.0.0 or later, if you haven’t already. Then unzip the download.
- With Claude in Chrome signed in to Quantemplate, ask Claude Code:
Build the OSFI P&C Insurance Return pipeline from the osfi-pc-return folder. Test it with the test returns and the clean returns and compare the results with the expected ones.
- Claude creates the three reference datasets, uploads the test returns, builds the 19 stages and checks the test returns and the clean ones. This takes around 5 minutes.
The agent builds through the Quantemplate app’s own API in your browser. That API isn’t published, so if a release changes it, the build stops and tells you what went wrong. Review what the agent builds before you rely on it.
Using your own returns
- Give your returns the same columns as the test file, one row per cell: Insurer, Reporting end date, Return, Page, Line, Column and Value. Several insurers and reporting end dates can share a file, or have one each.
- Use OSFI’s page, line and column codes as printed on the return, such as page 20.10, line 01 and column 01. They’re matched as numbers, so leading zeros can be left out, and the page can be given as 2010. Where a page has several tables, use the column codes of the table the line is in.
- Give amounts in thousands of dollars, as on the return, without commas or currency signs. Cells that don’t apply can be left out: they count as zero in OSFI’s rules. Cells no rule reads, such as a counterparty’s name or a Y or N answer, can hold text.
- Give the reporting end date as yyyy-mm-dd, such as 2027-03-31. Give PC1 and PC2 together each quarter, and all three returns at the year end, so the rules across returns are checked.
- Upload each file and add it to stage 1’s inputs. Stage 2 stacks stage 1’s outputs with Linked Stages on, so nothing after it needs changing.
- In the OSFI rules checked output, Out by shows how far each rule is from balancing, and Check gives OSFI’s formula with its data point codes, such as PC1_P20100101.
Contact the Quantemplate support team, or use your AI agent, to build custom logic for your use case.
Limits
- It covers PC1, PC2 and PC3, and OSFI’s rules for 2027. The MCT capital return isn’t covered. When OSFI publishes new returns or rules, the download’s scripts read them again into new reference datasets.
- Pages without line codes aren’t covered: PC1’s statement of cash flows, notes and certification, and PC3’s annual return information, organisation chart, out of Canada operations and affidavits.
- The cells dataset gives each line every column of its table, so it may hold a few cells the form doesn’t use. A value given for one of those isn’t flagged.
- A few pages are only for Canadian insurers or only for foreign insurers’ Canadian branches. The template doesn’t tell the two apart.
- Some rules across returns are in both returns’ files, so a difference between two returns can be flagged twice.
- It doesn’t check the filing deadline, or whether the figures match your records.
- The two insurers in the test data are made up. Neither turned up as an insurer when we searched in December 2026.
- The build doesn’t set up Auto Run, Auto Export or feeds.
- The agent works through the app in your browser, so changes someone makes in the app whilst it’s working can trip it up.