Library /
Contract Enterprise
Payments quality contract
An ODCS contract for seller payments whose quality rules the Enterprise Data quality module proposes as Nistor checks.
Use it when A finance table already has its checks written in a contract, and you want them running without rewriting them.
apiVersion: v3.1.0
kind: DataContract
id: eeeeabcb-0000-4000-8000-000000000902
name: seller_payments
version: 1.1.0
status: active
domain: seller
schema:
- name: seller_payments
physicalName: seller_payments
physicalType: table
logicalType: object
dataGranularityDescription: One row per payment event.
properties:
- name: payment_id
physicalType: STRING
logicalType: string
description: Unique payment identifier.
required: true
primaryKey: true
classification: internal
tags:
- identifier
quality:
- type: library
rule: duplicateCount
dimension: uniqueness
severity: error
mustBe: 0
- name: seller_id
physicalType: STRING
logicalType: string
description: Seller foreign key.
required: true
classification: restricted
- name: amount
physicalType: NUMERIC
logicalType: number
description: Payment amount in EUR.
required: true
quality:
- type: library
rule: range
dimension: accuracy
mustBeGreaterOrEqualTo: 0
mustBeLessOrEqualTo: 1000000
- name: event_ts
physicalType: TIMESTAMP
logicalType: date
description: Event timestamp.
required: true
quality:
- type: library
rule: freshness
dimension: timeliness
mustBeLessOrEqualTo: 24
unit: hours
- name: notes
physicalType: STRING
logicalType: string
description: Free-form notes.
required: false
quality:
- type: library
rule: rowCount
dimension: completeness
severity: error
mustBeGreaterOrEqualTo: 1000
- type: sql
name: no_negative_totals
dimension: accuracy
query: SELECT COUNT(*) FROM seller_payments WHERE amount < 0
- type: text
name: manual_reconciliation
description: Finance team manually reconciles monthly.
Taken from nistor-enterprise/packages/plugins/data_quality/tests/tool_facets/odcs/data/full-example.odcs.yaml
The schema part of the Data quality module's own test contract, with its header; its team, service levels and custom properties are left out here. Each quality rule is proposed as a Nistor check, graded by how much a person must add:
duplicateCountonpayment_idbecomes a uniqueness check, andrangeonamounta range check: both ready as written.freshnessonevent_tsbecomes a freshness check on that timestamp column, with a 24-hour limit, for review.rowCountgives the floor of 1000 rows, which also becomes the contract'svolumedimension.- The
sqlrule becomes a BigQuery check for review: imported SQL is never run until a person has read it. - The
textrule describes a manual reconciliation. Nistor keeps it in the document; there is nothing to run.
Because the contract has rules Nistor can run, it also gets a quality dimension that asks for 95% of the runs to pass.
Feeds fromODCS contractsGoogle Cloud