MOD-057 — Statistical Returns & Survey Engine
Purpose
Compile and submit RBNZ + APRA statistical / survey returns (Bank
Balance Sheet survey, Interest Rate survey, APRA EFS, AS1) from the
governed SD06 data pipeline. Same REP-005 GATE approval shape as
MOD-036 — shared evaluator from
@bank-risk-platform/shared/regulatory-gate. bank-wiki #35 Action C.
Architecture
Hybrid module:
- DCM — STATISTICAL_OBLIGATION_REGISTER table + two alerts. Co-
exists in MOD-056's REGULATORY schema (DCM v2 ownership constraint).
- dbt — four cell-level return DTs (BBS / Interest / EFS / AS1) +
validation + preview views. Same _source_lineage JSON-per-row
shape as MOD-036; reads MOD-032 LCR/NSFR + MOD-086 NIM via
dbt source().
- Lambda — submission orchestrator with the shared four-check
REP-005 GATE; routes NZ → RBNZ data portal stub, AU → APRA RAAP stub
(v1 stubs; v2 wires real endpoints).
- No Streamlit of its own — MOD-170 portal embeds
V_STAT_RETURN_PREVIEW alongside MOD-036's per-return drill-down.
- No new approval table — reuses REGULATORY.RETURN_APPROVALS
(MOD-036-owned). Same orchestrator ingest_role writes RETURN_RUNS +
RETURN_SUBMISSIONS rows alongside MOD-036's prudential rows;
return_code distinguishes the two surfaces.
Snowflake objects owned by MOD-057
| Object |
Type |
Schema |
Notes |
STATISTICAL_OBLIGATION_REGISTER |
TABLE (DCM) |
REGULATORY |
Schedule + due dates. Control table; INSERT/UPDATE allowed. |
ALERT_STAT_RETURN_VALIDATION_FAILED |
ALERT (DCM, post-dbt) |
REGULATORY |
FR-250 |
ALERT_STAT_DUE_DATE_APPROACHING |
ALERT (DCM, post-dbt) |
REGULATORY |
FR-249 |
DT_RBNZ_BBS |
DT (dbt) |
REGULATORY |
1h target_lag, FULL refresh, cell-level |
DT_RBNZ_INTEREST |
DT (dbt) |
REGULATORY |
1h target_lag, FULL refresh |
DT_APRA_EFS |
DT (dbt) |
REGULATORY |
1h target_lag, FULL refresh |
DT_RBNZ_STAT_AS1 |
DT (dbt) |
REGULATORY |
1h target_lag, FULL refresh |
V_STAT_RETURN_VALIDATION |
VIEW (dbt) |
REGULATORY |
PASSED/FAILED per (run_id, return_code) — read by shared gate |
V_STAT_RETURN_PREVIEW |
VIEW (dbt) |
REGULATORY |
Cell viewer — consumed by MOD-170 |
SSM outputs
| Path |
Value |
/bank/{env}/risk-platform/statistical-returns/submission-orchestrator-arn |
Lambda ARN |
/bank/{env}/risk-platform/statistical-returns/obligation-register-table |
REGULATORY.STATISTICAL_OBLIGATION_REGISTER |
/bank/{env}/risk-platform/statistical-returns/return-preview-view |
REGULATORY.V_STAT_RETURN_PREVIEW |
/bank/{env}/risk-platform/statistical-returns/event-source-name |
bank.risk-platform |
| Source |
Path |
Purpose |
| MOD-036 |
/bank/{env}/risk-platform/prudential-return-builder/return-approvals-table |
Shared approval-record table (REGULATORY.RETURN_APPROVALS) — orchestrator gate reads here |
Dependencies
| Module |
Why hard |
| MOD-036 |
Owns RETURN_RUNS / RETURN_SUBMISSIONS / RETURN_APPROVALS (shared audit surface). MOD-057's gate reads RETURN_APPROVALS; orchestrator INSERTs to RUNS + SUBMISSIONS. |
| MOD-056 |
Owns the REGULATORY schema (declared by MOD-056's DCM project). |
| MOD-032 |
V_LCR_CURRENT + V_NSFR_CURRENT feed Bank Balance Sheet survey. |
| MOD-086 |
V_NIM_ATTRIBUTION_DAILY feeds Interest Rate survey. |
| MOD-042 |
CDC pipeline supplies the upstream raw data MOD-032/086 transform. |
| MOD-102/104 |
Account + AWS bootstrap. |
| MOD-170 |
Approval workflow surface — without it, every submission stays APPROVAL_REQUIRED. |
Policies satisfied
| Policy |
Mode |
How |
| REP-008 |
AUTO |
tests/policy/REP-008-auto.test.ts — obligation register lists 4 v1 returns; 4 DTs use 1h target_lag + FULL refresh; orchestrator has daily cron trigger. |
| REP-005 |
GATE |
tests/policy/REP-005-gate.test.ts — 5 negative + 1 positive against the shared evaluateGate(moduleId="MOD-057", …). |
| NFR-024 |
LOG |
tests/policy/NFR-024-log.test.ts — MOD-057 doesn't grant UPDATE/DELETE/TRUNCATE on RETURN_RUNS / RETURN_SUBMISSIONS / RETURN_APPROVALS anywhere in its DCM project. |
docs/handoffs/SD06-streamlit-dashboard-layer.handoff.md — bank-wiki #35 Action C parent.
- MOD-036 design doc — RETURN_APPROVALS / RETURN_RUNS / RETURN_SUBMISSIONS shared-surface contract.
packages/shared/src/regulatory-gate/gate.ts — canonical REP-005 evaluator.