BCBS 239

BCBS 239

Data Contract Template

Data Contract Template

Ensure accounting data is complete, consistent, and reconcilable to support BCBS 239-compliant risk reporting.

Data contract description

This data contract enforces key BCBS 239–aligned controls on the exposures dataset by reconciling total exposure amounts with accounting balances within a defined tolerance, validating the format of Legal Entity Identifiers (LEIs), and ensuring referential integrity with the official counterparty master. It proactively flags missing or inconsistent counterparties and material reconciliation differences between risk and finance data, helping ensure exposure reporting is complete, accurate, and consistent across systems used for regulatory, risk, and financial reporting.

bcbs239_data_contract.yml

dataset
checks:
  - failed_rows:
      name: counterparties_missing_in_exposures
      query: |
        (SELECT m.counterparty_id
        FROM datasource.db.schema.counterparty_master m
        LEFT JOIN datasource.db.schema.exposures e
          ON e.counterparty_id = m.counterparty_id) IS NULL
      threshold:
        must_be: 0
      attributes:
        bcbs239:
          - P4
        description: "Completeness: any counterparties missing from exposures?"
columns:
  - name: lei_code
    data_type: string
    checks:
      - invalid:
          name: lei_code_format
          valid_format:
            name: LEI must be 20 alphanumeric
            regex: '^[A-Z0-9]{20}$'
          attributes:
            bcbs239:
              - P3
            description: LEI format is 20 uppercase alphanumerics
  - name: counterparty_id
    checks:
      - invalid:
          name: counterparty_id_in_master
          valid_reference_data:
            dataset: datasource/db/schema/counterparty_master
            column: counterparty_id
          attributes:
            bcbs239:
              - P3
            description: "Integrity: all counterparties in exposures exist in the master"

reconciliation:
  source:
    dataset: datasource/db/schema/accounting_balances
  checks:
    - metric_diff:
        name: total_exposures_vs_total_balance
        source_expression: SUM(balance_amount)
        target_expression: SUM(exposure_amount)
        threshold:
          must_be_less_than: 1000
        attributes:
          bcbs239:
            - P3
            - P7
          description: "Reconciliation vs accounting: Overall tolerance across the books (sum vs sum)"

Data contract description

This data contract enforces key BCBS 239–aligned controls on the exposures dataset by reconciling total exposure amounts with accounting balances within a defined tolerance, validating the format of Legal Entity Identifiers (LEIs), and ensuring referential integrity with the official counterparty master. It proactively flags missing or inconsistent counterparties and material reconciliation differences between risk and finance data, helping ensure exposure reporting is complete, accurate, and consistent across systems used for regulatory, risk, and financial reporting.

bcbs239_data_contract.yml

dataset
checks:
  - failed_rows:
      name: counterparties_missing_in_exposures
      query: |
        (SELECT m.counterparty_id
        FROM datasource.db.schema.counterparty_master m
        LEFT JOIN datasource.db.schema.exposures e
          ON e.counterparty_id = m.counterparty_id) IS NULL
      threshold:
        must_be: 0
      attributes:
        bcbs239:
          - P4
        description: "Completeness: any counterparties missing from exposures?"
columns:
  - name: lei_code
    data_type: string
    checks:
      - invalid:
          name: lei_code_format
          valid_format:
            name: LEI must be 20 alphanumeric
            regex: '^[A-Z0-9]{20}$'
          attributes:
            bcbs239:
              - P3
            description: LEI format is 20 uppercase alphanumerics
  - name: counterparty_id
    checks:
      - invalid:
          name: counterparty_id_in_master
          valid_reference_data:
            dataset: datasource/db/schema/counterparty_master
            column: counterparty_id
          attributes:
            bcbs239:
              - P3
            description: "Integrity: all counterparties in exposures exist in the master"

reconciliation:
  source:
    dataset: datasource/db/schema/accounting_balances
  checks:
    - metric_diff:
        name: total_exposures_vs_total_balance
        source_expression: SUM(balance_amount)
        target_expression: SUM(exposure_amount)
        threshold:
          must_be_less_than: 1000
        attributes:
          bcbs239:
            - P3
            - P7
          description: "Reconciliation vs accounting: Overall tolerance across the books (sum vs sum)"

Data contract description

This data contract enforces key BCBS 239–aligned controls on the exposures dataset by reconciling total exposure amounts with accounting balances within a defined tolerance, validating the format of Legal Entity Identifiers (LEIs), and ensuring referential integrity with the official counterparty master. It proactively flags missing or inconsistent counterparties and material reconciliation differences between risk and finance data, helping ensure exposure reporting is complete, accurate, and consistent across systems used for regulatory, risk, and financial reporting.

bcbs239_data_contract.yml

dataset
checks:
  - failed_rows:
      name: counterparties_missing_in_exposures
      query: |
        (SELECT m.counterparty_id
        FROM datasource.db.schema.counterparty_master m
        LEFT JOIN datasource.db.schema.exposures e
          ON e.counterparty_id = m.counterparty_id) IS NULL
      threshold:
        must_be: 0
      attributes:
        bcbs239:
          - P4
        description: "Completeness: any counterparties missing from exposures?"
columns:
  - name: lei_code
    data_type: string
    checks:
      - invalid:
          name: lei_code_format
          valid_format:
            name: LEI must be 20 alphanumeric
            regex: '^[A-Z0-9]{20}$'
          attributes:
            bcbs239:
              - P3
            description: LEI format is 20 uppercase alphanumerics
  - name: counterparty_id
    checks:
      - invalid:
          name: counterparty_id_in_master
          valid_reference_data:
            dataset: datasource/db/schema/counterparty_master
            column: counterparty_id
          attributes:
            bcbs239:
              - P3
            description: "Integrity: all counterparties in exposures exist in the master"

reconciliation:
  source:
    dataset: datasource/db/schema/accounting_balances
  checks:
    - metric_diff:
        name: total_exposures_vs_total_balance
        source_expression: SUM(balance_amount)
        target_expression: SUM(exposure_amount)
        threshold:
          must_be_less_than: 1000
        attributes:
          bcbs239:
            - P3
            - P7
          description: "Reconciliation vs accounting: Overall tolerance across the books (sum vs sum)"

How to Enforce Data Contracts with Soda

Embed data quality through data contracts at any point in your pipeline.

Embed data quality through data contracts at any point in your pipeline.

# pip install soda-{data source} for other data sources

# pip install soda-{data source} for other data sources

pip install soda-postgress

pip install soda-postgress

# verify the contract locally against a data source

# verify the contract locally against a data source

soda contract verify -c contract.yml -ds ds_config.yml

soda contract verify -c contract.yml -ds ds_config.yml

# publish and schedule the contract with Soda Cloud

# publish and schedule the contract with Soda Cloud

soda contract publish -c contract.yml -sc sc_config.yml

soda contract publish -c contract.yml -sc sc_config.yml

Check out the CLI documentation to learn more.

Check out the CLI documentation to learn more.

How to Automatically Create Data Contracts.
In one Click.

Automatically write and publish data contracts using Soda's AI-powered data contract copilot.

Make data contracts work in production

Business knows what good data looks like. Engineering knows how to deliver it at scale. Soda unites both, turning governance expectations into executable contracts.

Make data contracts work in production

Business knows what good data looks like. Engineering knows how to deliver it at scale. Soda unites both, turning governance expectations into executable contracts.

Make data contracts work in production

Business knows what good data looks like. Engineering knows how to deliver it at scale. Soda unites both, turning governance expectations into executable contracts.

4.4 of 5

Start trusting your data. Today.

Find, understand, and fix any data quality issue in seconds.
From table to record-level.

Trusted by

4.4 of 5

Start trusting your data. Today.

Find, understand, and fix any data quality issue in seconds.
From table to record-level.

Trusted by

4.4 of 5

Start trusting your data. Today.

Find, understand, and fix any data quality issue in seconds.
From table to record-level.

Trusted by