Data Contract

rolling-30-day-orders Data Contract Specification v1.2.0

Info

Information about the data contract

Title
Rolling 30 Day Orders
Version
1.0.0
Status
active
Description
Orders aggregated over a rolling 30-day window.
Owner
Analytics Team

Servers

Servers of the data contract

  • Server
    local-postgres
    Environment
    dev
    Type
    postgres
    Host
    localhost
    Port
    5432
    Database
    dbt
    Schema
    dbt_ddi
    Format
    table
    Description
    Local Postgres DB

Entity Relationship Diagram

Visual representation of data model relationships

                    erDiagram
        "**rolling_30_day_orders**" {
        order_date date
        total_amount decimal
        order_count decimal
        rolling_30_day_amount decimal
        rolling_30_day_orders decimal
        rolling_30_day_avg_daily decimal
}


                  

Data Model

The logical data model

rolling_30_day_orders table
Aggregated completed orders over 30 days
order_date
date
The date of the orders (truncated to date level)
required
total_amount
decimal
Total payment amount for all completed orders on this date
required
Quality | SQL: Total amount must be between 0 and 1,000,000
Query:
SELECT COUNT(*) FROM rolling_30_day_orders WHERE total_amount < 0 OR total_amount > 1000000
order_count
decimal
Number of completed orders on this date
required
Quality | SQL: Order count must be between 0 and 10,000
Query:
SELECT COUNT(*) FROM rolling_30_day_orders WHERE order_count < 0 OR order_count > 10000
rolling_30_day_amount
decimal
Sum of total_amount over the current date and previous 29 days
required
Quality | SQL: 30-day total amount must be between 0 and 30,000,000
Query:
SELECT COUNT(*) FROM rolling_30_day_orders WHERE rolling_30_day_amount < 0 OR rolling_30_day_amount > 30000000
rolling_30_day_orders
decimal
Sum of order_count over the current date and previous 29 days
required
Quality | SQL: 30-day order count must be between 0 and 300,000
Query:
SELECT COUNT(*) FROM rolling_30_day_orders WHERE rolling_30_day_orders < 0 OR rolling_30_day_orders > 300000
rolling_30_day_avg_daily
decimal
Average daily total_amount over the current date and previous 29 days
required
Quality | SQL: Average daily amount must be between 0 and 1,000,000
Query:
SELECT COUNT(*) FROM rolling_30_day_orders WHERE rolling_30_day_avg_daily < 0 OR rolling_30_day_avg_daily > 1000000
Created at 20 Sep 2025 22:40:26 UTC with Data Contract CLI v0.10.35
dataContractSpecification: 1.2.0
id: rolling-30-day-orders
info:
  title: Rolling 30 Day Orders
  version: 1.0.0
  status: active
  description: Orders aggregated over a rolling 30-day window.
  owner: Analytics Team
  contact:
    name: Yury
    url: https://teams.example.com/analytics
servers:
  local-postgres:
    type: postgres
    description: Local Postgres DB
    environment: dev
    format: table
    database: dbt
    schema: dbt_ddi
    host: localhost
    port: 5432
models:
  rolling_30_day_orders:
    description: Aggregated completed orders over 30 days
    type: table
    fields:
      order_date:
        type: date
        required: true
        description: The date of the orders (truncated to date level)
      total_amount:
        type: decimal
        required: true
        description: Total payment amount for all completed orders on this date
        quality:
        - type: sql
          description: Total amount must be between 0 and 1,000,000
          query: SELECT COUNT(*) FROM rolling_30_day_orders WHERE total_amount < 0
            OR total_amount > 1000000
          mustBeEqualTo: 0
      order_count:
        type: decimal
        required: true
        description: Number of completed orders on this date
        quality:
        - type: sql
          description: Order count must be between 0 and 10,000
          query: SELECT COUNT(*) FROM rolling_30_day_orders WHERE order_count < 0
            OR order_count > 10000
          mustBeEqualTo: 0
      rolling_30_day_amount:
        type: decimal
        required: true
        description: Sum of total_amount over the current date and previous 29 days
        quality:
        - type: sql
          description: 30-day total amount must be between 0 and 30,000,000
          query: SELECT COUNT(*) FROM rolling_30_day_orders WHERE rolling_30_day_amount
            < 0 OR rolling_30_day_amount > 30000000
          mustBeEqualTo: 0
      rolling_30_day_orders:
        type: decimal
        required: true
        description: Sum of order_count over the current date and previous 29 days
        quality:
        - type: sql
          description: 30-day order count must be between 0 and 300,000
          query: SELECT COUNT(*) FROM rolling_30_day_orders WHERE rolling_30_day_orders
            < 0 OR rolling_30_day_orders > 300000
          mustBeEqualTo: 0
      rolling_30_day_avg_daily:
        type: decimal
        required: true
        description: Average daily total_amount over the current date and previous
          29 days
        quality:
        - type: sql
          description: Average daily amount must be between 0 and 1,000,000
          query: SELECT COUNT(*) FROM rolling_30_day_orders WHERE rolling_30_day_avg_daily
            < 0 OR rolling_30_day_avg_daily > 1000000
          mustBeEqualTo: 0