Statutory financial reporting & ERP integration¶
| ID | MOD-080 |
| System | SD06 |
| Repo | bank-risk-platform |
| Build status | Deployed |
| Deployed | Yes |
| Last commit | 54197c02fff0ca78a988e6140d31778e59f05b46 |
The statutory financial reporting and ERP integration module produces the bank's statutory accounts and regulatory financial statements from Snowflake, and pushes a structured GL feed to the bank's ERP on the statutory schedule.
Purpose¶
The bank has two distinct financial reporting obligations: management accounts (internal, continuous) and statutory accounts (external, regulated, filed with the Companies Office and submitted to RBNZ/APRA). This module serves the statutory side — it takes the Snowflake analytical layer as its source, produces audited-format outputs, and delivers them to the ERP for filing and consolidation.
What it does¶
- Trial balance extraction — extracts a complete trial balance from the Snowflake
COREdatabase on the statutory schedule (monthly for management, quarterly for regulatory, annually for statutory filing) - Statement production — produces P&L, balance sheet, and cash flow statement in the statutory format required for NZ Companies Act / AU Corporations Act filings
- ERP GL feed — formats the journal entries as a structured feed (CSV or API push, depending on the ERP) and delivers them to the bank's general ledger system; the ERP is the system of record for filing, not Snowflake
- Reconciliation gate — before each extract, the module confirms that the Snowflake trial balance agrees with Postgres account balances; any variance blocks the extract and raises an operations alert
- RBNZ/APRA prudential feeds — works alongside MOD-036 (Prudential return builder) to produce the financial data component of prudential returns; MOD-036 owns the regulatory submission; this module owns the GL-quality financial data it depends on
What it does not do¶
This module does not produce risk-weighted capital calculations (MOD-033), liquidity ratios (MOD-032), or AML regulatory reports (MOD-037). It does not write to Postgres — it reads from Snowflake and pushes to the ERP.
Build notes — 2026-05-14¶
Two distinct failures:
1. STATUTORY schema privileges — same DCM ownership root cause as MOD-056.
Under HAS_DCM=false, DCM-declared tables (REPORT_RUNS, ERP_PUSH_LOG,
RECONCILIATION_RUNS, EB_PUBLISH_CURSOR) are never created in the STATUTORY
schema. The dbt view v_period_close_metrics joins to REPORT_RUNS and fails
compilation. Resolution: the same BANK_NONPROD_RISK_ROLE grant that unblocks
MOD-056 also unblocks this failure path in MOD-080.
2. Dynamic Table lag inversion (code bug) — reconciliation_status_current
has target_lag='5 minutes' while its dependency trial_balance_period has
target_lag='15 minutes'. Snowflake requires a downstream Dynamic Table's lag
to be ≥ the largest lag of its dependencies.
002715 (22023): Dynamic Table 'BANK_DEV_RISK.STATUTORY.RECONCILIATION_STATUS_CURRENT'
has a lag of 5 minutes, less than the largest lag of its dependencies.
Fix: In dbt/models/MOD-080-statutory-reporting/reconciliation_status_current.sql,
change target_lag='5 minutes' to target_lag='15 minutes' (or '1 hour' to
align with the hourly reconciliation Lambda cadence). One-line change.
Streamlit dashboard¶
MOD-080 ships a Streamlit page STATUTORY.STREAMLIT_FINANCIALS_VIEWER providing:
- Period profit and loss statement (current and prior period side-by-side)
- Balance sheet (assets, liabilities, equity)
- Cash flow statement
- Period navigation (prior 8 quarters accessible)
- Each line item links to the trial balance rows that compose it via model_run_id
Consumed by MOD-172 (Operations & Model Intelligence Dashboard) as the statutory financials viewer section. Cross-schema SELECT on STATUTORY.* published views required for OPERATIONS_ROLE.
Module dependencies¶
Depends on¶
| Module | Title | Required? | Contract | Reason |
|---|---|---|---|---|
| MOD-042 | CDC pipeline — Neon logical replication to S3 Iceberg | Required | — | Statutory reports are generated from the Snowflake analytical layer fed by the CDC pipeline — no direct Neon access. |
| MOD-001 | Double-entry posting engine | Required | — | Financial statements are derived from ledger postings — the posting engine is the ultimate source for all reported figures. |
| MOD-104 | AWS shared infrastructure bootstrap | Required | — | MOD-104 provisions the S3 Iceberg bucket (Snowflake external tables), KMS key, and bank-risk-platform EventBridge bus ARN. Required before this module can be deployed. |
| MOD-102 | Snowflake account configuration & governance | Required | — | Snowflake account and governance provisioned by MOD-102 must exist before this module can read or write Snowflake. |
| MOD-172 | Operations & Model Intelligence Dashboard | Required | — | Operations & Model Intelligence Dashboard uses MOD-080 statutory financial published views as its financials viewer section. |
Required by¶
| Module | Title | As | Contract |
|---|---|---|---|
| MOD-056 | Compliance visibility engine | Optional enhancement | — |
| MOD-140 | Chart of accounts and GL configuration | Hard dependency | — |
| MOD-172 | Operations & Model Intelligence Dashboard | Hard dependency | — |
Policies satisfied¶
| Policy | Title | Mode | How |
|---|---|---|---|
| REP-004 | Financial Statements Policy | AUTO |
Statutory financial statements (P&L, balance sheet, cash flow) produced from the Snowflake analytical layer on the regulatory schedule — no manual extraction. |
| REP-001 | Regulatory Reporting Policy | AUTO |
Regulatory reporting feeds drawn from the same Snowflake data as internal management accounts — single source of truth for all statutory obligations. |
| GOV-006 | Internal Audit Policy | LOG |
All ERP journal entries and statutory extracts are logged with the source data lineage — auditors can trace every figure to its transaction origin. |
Capabilities satisfied¶
| Capability | Title | Mode | How |
|---|---|---|---|
| CAP-126 | Statutory financial reporting (ERP feed) | AUTO |
Generates trial balance, P&L, and balance sheet extracts from Snowflake on the statutory schedule and pushes a structured GL feed to the bank's ERP via a secure API integration. |
Part of SD06 — Snowflake Analytics & Risk Platform
Compiled 2026-05-22 from source/entities/modules/MOD-080.yaml