OSFI Life Insurance Return checks
Insurance Canada
Checks the Life Insurance Return a Canadian life insurer or fraternal benefit society files with OSFI, the quarterly LF1 and the annual LF3, against OSFI’s own 2,350 validation rules: every total on a page, every tie between pages and every tie between the two 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 Life Insurance Return for 2027: the LF1 and LF3 return workbooks, and OSFI’s validation rules for LF1 (version 15) and LF3 (version 13)
- 11validation rules
- 19pipeline stages
- 2,350OSFI rules
- 4 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 LF1 or LF3, and the page, line and column are on it 3 Fail 3
- FormatThe reporting end date is a quarter end and LF3’s is 31 December, values 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 LF1 and LF3, 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 LF Rules lists each rule, and OSFI LF 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 |
|---|---|---|---|
LF1, quarterly, rules version 15 |
1,443 |
39 |
10 |
LF3, annual, rules version 13 |
848 |
0 |
10 |
The rules across returns tie LF1 to LF3, so they’re checked when an insurer gives both returns for the same reporting end date. OSFI’s files also have 98 LF1 rules that read the LF2 capital return, which isn’t covered, and 9 LF3 rules that read a line no longer on page 45.060. Those are 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 and column of LF1 and LF3 with OSFI’s data point codes, OSFI’s 2,350 validation rules, and the cells each rule adds or takes away
- Two fictional insurers’ returns, one with LF1 and LF3 at the year end and one with LF1 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 LF1 and LF3 returns and their validation rules from OSFI’s Life Insurance Return 2027 page. All four 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 Life Insurance Return pipeline from the osfi-life-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 4 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.002, line 010 and column 01. They’re matched as numbers, so leading zeros can be left out, and the page can be given as 20002.
- 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.
- Give the reporting end date as yyyy-mm-dd, such as 2027-03-31. At the year end, give LF1 and LF3 together, 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 LF1_P2000201001.
Contact the Quantemplate support team, or use your AI agent, to build custom logic for your use case.
Limits
- It covers LF1 and LF3, and OSFI’s rules for 2027. The LF2 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, such as LF1’s certification and LF3’s affidavits and organisation chart, aren’t covered.
- The cells dataset has every line and column of each page, so it may hold a few that the form doesn’t use. A value given for one of those isn’t flagged.
- Some rules across returns are in both returns’ files, so a difference between LF1 and LF3 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.