Customer Transactions

Customer Transactions

Data Contract Template

Data Contract Template

Ensure data from recent customer transactions is fresh, complete, and reliable before it is used for banking analytics, financial monitoring, account activity tracking, and downstream reporting.

Data contract description

This data contract is designed for Capital One, where recent customer transaction data serves as a governed operational dataset for downstream reporting, monitoring, and data quality control. By scoping the data to the last month of activity and setting expectations around transaction_date, amount, currency, and the uniqueness of transaction_id with transaction_date, the contract makes sure this transaction stream can be used with confidence for tracking recent account activity, validating whether incoming records fall within expected policy bounds, and supporting shift-left quality checks before issues spread into downstream systems.

customer_transactions_data_contract.yaml

dataset: datasource/database/schema/customer_transactions

filter: "transaction_date >= CURRENT_DATE - INTERVAL '1 month'"

variables:
  MAX_TRANSACTION_AMOUNT:
    default: 10000
checks:
  - schema:
      allow_extra_columns: false
      allow_other_column_order: false
  - row_count:
      threshold:
        must_be_greater_than: 0
  - failed_rows:
      expression: amount <= ${var.MAX_TRANSACTION_AMOUNT}
      name: Transactions exceeding maximum allowed
  - duplicate:
      columns: ['transaction_id', 'transaction_date']     
  - freshness:
      column: transaction_date
      threshold:
        unit: day
        must_be_less_than: 30
columns:
  - name: transaction_id
    data_type: varchar
    checks:
      - missing:
      - duplicate:
  - name: customer_id
    data_type: varchar
    checks:
      - missing:
  - name: transaction_date
    data_type: timestamp
    checks:
      - missing:
  - name: amount
    data_type: decimal
    checks:
      - missing:
      - invalid:
          valid_min: 0
          valid_max: ${var.MAX_TRANSACTION_AMOUNT}
  - name: currency
    data_type: varchar
    checks:
      - invalid:
          valid_values: ['USD', 'EUR', 'GBP', 'JPY'

Data contract description

This data contract is designed for Capital One, where recent customer transaction data serves as a governed operational dataset for downstream reporting, monitoring, and data quality control. By scoping the data to the last month of activity and setting expectations around transaction_date, amount, currency, and the uniqueness of transaction_id with transaction_date, the contract makes sure this transaction stream can be used with confidence for tracking recent account activity, validating whether incoming records fall within expected policy bounds, and supporting shift-left quality checks before issues spread into downstream systems.

customer_transactions_data_contract.yaml

dataset: datasource/database/schema/customer_transactions

filter: "transaction_date >= CURRENT_DATE - INTERVAL '1 month'"

variables:
  MAX_TRANSACTION_AMOUNT:
    default: 10000
checks:
  - schema:
      allow_extra_columns: false
      allow_other_column_order: false
  - row_count:
      threshold:
        must_be_greater_than: 0
  - failed_rows:
      expression: amount <= ${var.MAX_TRANSACTION_AMOUNT}
      name: Transactions exceeding maximum allowed
  - duplicate:
      columns: ['transaction_id', 'transaction_date']     
  - freshness:
      column: transaction_date
      threshold:
        unit: day
        must_be_less_than: 30
columns:
  - name: transaction_id
    data_type: varchar
    checks:
      - missing:
      - duplicate:
  - name: customer_id
    data_type: varchar
    checks:
      - missing:
  - name: transaction_date
    data_type: timestamp
    checks:
      - missing:
  - name: amount
    data_type: decimal
    checks:
      - missing:
      - invalid:
          valid_min: 0
          valid_max: ${var.MAX_TRANSACTION_AMOUNT}
  - name: currency
    data_type: varchar
    checks:
      - invalid:
          valid_values: ['USD', 'EUR', 'GBP', 'JPY'

Data contract description

This data contract is designed for Capital One, where recent customer transaction data serves as a governed operational dataset for downstream reporting, monitoring, and data quality control. By scoping the data to the last month of activity and setting expectations around transaction_date, amount, currency, and the uniqueness of transaction_id with transaction_date, the contract makes sure this transaction stream can be used with confidence for tracking recent account activity, validating whether incoming records fall within expected policy bounds, and supporting shift-left quality checks before issues spread into downstream systems.

customer_transactions_data_contract.yaml

dataset: datasource/database/schema/customer_transactions

filter: "transaction_date >= CURRENT_DATE - INTERVAL '1 month'"

variables:
  MAX_TRANSACTION_AMOUNT:
    default: 10000
checks:
  - schema:
      allow_extra_columns: false
      allow_other_column_order: false
  - row_count:
      threshold:
        must_be_greater_than: 0
  - failed_rows:
      expression: amount <= ${var.MAX_TRANSACTION_AMOUNT}
      name: Transactions exceeding maximum allowed
  - duplicate:
      columns: ['transaction_id', 'transaction_date']     
  - freshness:
      column: transaction_date
      threshold:
        unit: day
        must_be_less_than: 30
columns:
  - name: transaction_id
    data_type: varchar
    checks:
      - missing:
      - duplicate:
  - name: customer_id
    data_type: varchar
    checks:
      - missing:
  - name: transaction_date
    data_type: timestamp
    checks:
      - missing:
  - name: amount
    data_type: decimal
    checks:
      - missing:
      - invalid:
          valid_min: 0
          valid_max: ${var.MAX_TRANSACTION_AMOUNT}
  - name: currency
    data_type: varchar
    checks:
      - invalid:
          valid_values: ['USD', 'EUR', 'GBP', 'JPY'

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-postgres

pip install soda-postgres

# 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.

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