{
  "$version": "0.1.0",
  "learn_more": "http://data-dict.tidyverse.org/",
  "tables": [
    {
      "name": "payments",
      "description": "<p>Synthetic dataset of payment transactions processed by a payment processor. Each row represents one transaction.</p>",
      "source": {
        "parquet": "data/payments.parquet"
      },
      "columns": [
        {
          "name": "psp_reference",
          "description": "<p>Unique payment identifier.</p>",
          "type": "number(id)",
          "constraints": [
            "primary_key",
            "unique",
            "required"
          ],
          "examples": [
            10000636248,
            29933254267,
            49981130818,
            70032289018,
            89998294921
          ]
        },
        {
          "name": "merchant",
          "description": "<p>Merchant name.</p>",
          "type": "enum",
          "constraints": [
            "required"
          ],
          "values": [
            "Belles_cookbook_store",
            "Crossfit_Hanna",
            "Golfclub_Baron_Friso",
            "Martinis_Fine_Steakhouse",
            "Rafa_AI"
          ]
        },
        {
          "name": "card_scheme",
          "description": "<p>Card scheme (network) used for the transaction.</p>",
          "type": "enum",
          "constraints": [
            "required"
          ],
          "values": [
            "GlobalCard",
            "NexPay",
            "SwiftCharge",
            "TransactPlus"
          ]
        },
        {
          "name": "year",
          "description": "<p>Year of payment initiation. Always 2023 in this dataset.</p>",
          "type": "number(ordinal)",
          "constraints": [
            "required"
          ],
          "range": {
            "min": 2023,
            "max": 2023
          }
        },
        {
          "name": "hour_of_day",
          "description": "<p>Hour of the day of payment initiation (0-23).</p>",
          "type": "number(ordinal)",
          "constraints": [
            "required"
          ],
          "range": {
            "min": 0,
            "max": 23
          }
        },
        {
          "name": "minute_of_hour",
          "description": "<p>Minute of the hour of payment initiation (0-59).</p>",
          "type": "number(ordinal)",
          "constraints": [
            "required"
          ],
          "range": {
            "min": 0,
            "max": 59
          }
        },
        {
          "name": "day_of_year",
          "description": "<p>Day of the year of payment initiation (1-365).</p>",
          "type": "number(ordinal)",
          "constraints": [
            "required"
          ],
          "range": {
            "min": 1,
            "max": 365
          }
        },
        {
          "name": "month",
          "description": "<p>Month of payment initiation (1-12).</p>",
          "type": "number(ordinal)",
          "constraints": [
            "required"
          ],
          "range": {
            "min": 1,
            "max": 12
          }
        },
        {
          "name": "is_credit",
          "description": "<p>Whether the card used is a credit card. FALSE indicates a debit card. Credit transactions are typically more expensive.</p>",
          "type": "boolean",
          "constraints": [
            "required"
          ]
        },
        {
          "name": "eur_amount",
          "description": "<p>Payment amount in euros.</p>",
          "type": "number(quantity)",
          "units": "EUR",
          "constraints": [
            "required"
          ],
          "range": {
            "min": 0.5,
            "max": 4811.76
          }
        },
        {
          "name": "ip_country",
          "description": "<p>Country the shopper was in at the time of the transaction, determined by IP address. ISO 3166-1 alpha-2 code.</p>",
          "type": "enum",
          "constraints": [
            "required"
          ],
          "values": [
            "BE",
            "ES",
            "FR",
            "GR",
            "IT",
            "LU",
            "NL",
            "SE"
          ]
        },
        {
          "name": "issuing_country",
          "description": "<p>Country of the card-issuing bank. ISO 3166-1 alpha-2 code. When this matches acquirer_country, the transaction is domestic (intracountry).</p>",
          "type": "enum",
          "constraints": [
            "required"
          ],
          "values": [
            "BE",
            "ES",
            "FR",
            "GR",
            "IT",
            "LU",
            "NL",
            "SE"
          ]
        },
        {
          "name": "device_type",
          "description": "<p>Device type used for the transaction.</p>",
          "type": "enum",
          "constraints": [
            "required"
          ],
          "values": [
            "Android",
            "iOS",
            "Linux",
            "MacOS",
            "Other",
            "Windows"
          ]
        },
        {
          "name": "ip_address",
          "description": "<p>Hashed shopper IP address.</p>",
          "type": "string",
          "constraints": [
            "required"
          ],
          "examples": [
            "__-7u3f9uJKdXS3u_2ukdQ",
            "bYuXXkz9nZuRjS0r9dT-_w",
            "jyxXoQ7r78mNUH0BnlngEw",
            "s-xemKxVf5o0K46vaODxhA",
            "ZzZYJhXWE4MTCE9vcHnCdQ"
          ]
        },
        {
          "name": "email_address",
          "description": "<p>Hashed shopper email address. May be empty.</p>",
          "type": "string",
          "examples": [
            "__-8prajRhB4WeqqIoY5PA",
            "Byq-k5LkiiVbiYjHS95XsQ",
            "jvXaD_MZf_Ljdf7UvAUMpQ",
            "Rz-JZg73tHtXbVEj0wkr_g",
            "ZZzHkjMLX3_pzQtc1HmvBg"
          ]
        },
        {
          "name": "card_number",
          "description": "<p>Hashed card number.</p>",
          "type": "string",
          "constraints": [
            "required"
          ],
          "examples": [
            "__8Fy8ayxoTnl0EX9DtIhw",
            "c8fAIVb46qwMwy1_z2TpxA",
            "k97dMMQVxeLQjnWvk0hy3Q",
            "s24En6cJp3dNBoLHXSWiWg",
            "zzzp-SYj0U6e5r2ioWVniQ"
          ]
        },
        {
          "name": "shopper_interaction",
          "description": "<p>Payment method.</p>",
          "type": "enum",
          "constraints": [
            "required"
          ],
          "values": [
            "Ecommerce",
            "POS"
          ],
          "value_labels": {
            "Ecommerce": "Online transactions",
            "POS": "In-person or in-store transactions"
          }
        },
        {
          "name": "card_bin",
          "description": "<p>Bank Identification Number (first digits of card number).</p>",
          "type": "number(id)",
          "constraints": [
            "required"
          ],
          "examples": [
            4017,
            4526,
            4571,
            4802,
            4920
          ]
        },
        {
          "name": "has_fraudulent_dispute",
          "description": "<p>Whether the issuing bank flagged the transaction as a fraudulent dispute.</p>",
          "type": "boolean",
          "constraints": [
            "required"
          ]
        },
        {
          "name": "is_refused_by_adyen",
          "description": "<p>Whether the transaction was refused by Adyen.</p>",
          "type": "boolean",
          "constraints": [
            "required"
          ]
        },
        {
          "name": "aci",
          "description": "<p>Authorization Characteristics Indicator. Identifies how the transaction was submitted to the acquirer.</p>",
          "type": "enum",
          "constraints": [
            "required"
          ],
          "values": [
            "A",
            "B",
            "C",
            "D",
            "E",
            "F",
            "G"
          ],
          "value_labels": {
            "A": "Card present, non-authenticated",
            "B": "Card present, authenticated",
            "C": "Tokenized with mobile device",
            "D": "Card not present, card on file",
            "E": "Card not present, recurring",
            "F": "Card not present, 3-D Secure",
            "G": "Card not present, non-3-D Secure"
          }
        },
        {
          "name": "acquirer_country",
          "description": "<p>Country of the acquiring bank. ISO 3166-1 alpha-2 code.</p>",
          "type": "enum",
          "constraints": [
            "required"
          ],
          "values": [
            "FR",
            "GB",
            "IT",
            "NL",
            "US"
          ]
        }
      ]
    },
    {
      "name": "acquirer_countries",
      "description": "<p>Lookup table mapping acquirer names to their country codes.</p>",
      "source": {
        "parquet": "data/acquirer_countries.parquet"
      },
      "columns": [
        {
          "name": "acquirer",
          "description": "<p>Name of the acquiring bank.</p>",
          "type": "string",
          "constraints": [
            "primary_key",
            "unique",
            "required"
          ],
          "referenced_by": [
            {
              "table": "merchant_acquirers",
              "column": "acquirer"
            }
          ],
          "examples": [
            "bank_of_springfield",
            "dagoberts_vault",
            "gringotts",
            "medici",
            "the_savings_and_loan_bank"
          ]
        },
        {
          "name": "country_code",
          "description": "<p>Country of the acquirer. ISO 3166-1 alpha-2 code.</p>",
          "type": "enum",
          "constraints": [
            "required"
          ],
          "values": [
            "FR",
            "GB",
            "IT",
            "NL",
            "US"
          ]
        }
      ]
    },
    {
      "name": "merchants",
      "description": "<p>Merchant profiles with business classification and processing configuration. Each row represents one merchant.</p>",
      "source": {
        "parquet": "data/merchants.parquet"
      },
      "columns": [
        {
          "name": "merchant",
          "description": "<p>Merchant name.</p>",
          "type": "string",
          "constraints": [
            "primary_key",
            "unique",
            "required"
          ],
          "referenced_by": [
            {
              "table": "merchant_acquirers",
              "column": "merchant"
            },
            {
              "table": "merchant_months",
              "column": "merchant"
            }
          ],
          "examples": [
            "AI_Pro_Labs",
            "Crafty_Cuisine",
            "Gym_Pro",
            "Read_and_Co",
            "Yoga_Masters"
          ]
        },
        {
          "name": "capture_delay",
          "description": "<p>Capture delay range. Faster capture is generally more expensive.</p>",
          "type": "enum",
          "constraints": [
            "required"
          ],
          "values": [
            "immediate",
            "<3",
            "3-5",
            ">5",
            "manual"
          ],
          "value_labels": {
            "3-5": "3 to 5 days",
            "<3": "Under 3 days",
            ">5": "Over 5 days",
            "immediate": "Immediate capture",
            "manual": "Manual capture"
          }
        },
        {
          "name": "merchant_category_code",
          "description": "<p>Four-digit Merchant Category Code classifying the business type.</p>",
          "type": "number(id)",
          "constraints": [
            "foreign_key",
            "required"
          ],
          "references": {
            "table": "merchant_category_codes",
            "column": "mcc"
          },
          "examples": [
            5812,
            5814,
            7372,
            7997,
            8299
          ]
        },
        {
          "name": "account_type",
          "description": "<p>Business model classification.</p>",
          "type": "enum",
          "constraints": [
            "required"
          ],
          "values": [
            "D",
            "F",
            "H",
            "R",
            "S"
          ],
          "value_labels": {
            "D": "Enterprise - Digital",
            "F": "Platform - Franchise",
            "H": "Enterprise - Hospitality",
            "R": "Enterprise - Retail",
            "S": "Platform - SaaS"
          }
        }
      ]
    },
    {
      "name": "merchant_acquirers",
      "description": "<p>Junction table linking merchants to their acquiring banks. A merchant may route transactions through multiple acquirers (typically in different countries) to enable local acquiring.</p>",
      "source": {
        "parquet": "data/merchant_acquirers.parquet"
      },
      "columns": [
        {
          "name": "merchant",
          "description": "<p>Merchant name.</p>",
          "type": "string",
          "constraints": [
            "foreign_key",
            "required"
          ],
          "references": {
            "table": "merchants",
            "column": "merchant"
          },
          "examples": [
            "AI_Pro_Labs",
            "Crafty_Cuisine",
            "Gym_Pro",
            "Read_and_Co",
            "Yoga_Masters"
          ]
        },
        {
          "name": "acquirer",
          "description": "<p>Name of the acquiring bank.</p>",
          "type": "string",
          "constraints": [
            "foreign_key",
            "required"
          ],
          "references": {
            "table": "acquirer_countries",
            "column": "acquirer"
          },
          "examples": [
            "bank_of_springfield",
            "dagoberts_vault",
            "gringotts",
            "medici",
            "the_savings_and_loan_bank"
          ]
        }
      ]
    },
    {
      "name": "fees",
      "description": "<p>Fee rules for payment processing. Each row is a rule with constraints that determine which transactions it applies to. A rule matches a transaction when all non-null fields match. Null (scalar) or empty (list) means \"matches all values.\" The fee for a matched transaction is: fixed_amount + rate * eur_amount / 10000.</p>",
      "source": {
        "parquet": "data/fees.parquet"
      },
      "columns": [
        {
          "name": "ID",
          "description": "<p>Unique identifier for the fee rule.</p>",
          "type": "number(id)",
          "constraints": [
            "primary_key",
            "unique",
            "required"
          ],
          "examples": [
            1,
            251,
            500,
            750,
            1000
          ]
        },
        {
          "name": "card_scheme",
          "description": "<p>Card scheme this rule applies to. Always set (never null).</p>",
          "type": "enum",
          "constraints": [
            "required"
          ],
          "values": [
            "GlobalCard",
            "NexPay",
            "SwiftCharge",
            "TransactPlus"
          ]
        },
        {
          "name": "capture_delay",
          "description": "<p>Capture delay range this rule applies to. Null means all. Matches the same enum used in the merchants table.</p>",
          "type": "enum",
          "values": [
            "immediate",
            "<3",
            "3-5",
            ">5",
            "manual"
          ],
          "value_labels": {
            "3-5": "3 to 5 days",
            "<3": "Under 3 days",
            ">5": "Over 5 days",
            "immediate": "Immediate capture",
            "manual": "Manual capture"
          }
        },
        {
          "name": "fraud_percent_min",
          "description": "<p>Minimum monthly fraud level (%) this rule applies to (inclusive). <code>-Inf</code> means no lower bound, and is by far the most common value (926 of 1000 rules); the finite values observed run from 7.2 to 8.3.</p>",
          "type": "number(quantity)",
          "units": "%",
          "constraints": [
            "required"
          ],
          "range": {
            "min": null,
            "max": 8.3
          }
        },
        {
          "name": "fraud_percent_max",
          "description": "<p>Maximum monthly fraud level (%) this rule applies to (exclusive). <code>Inf</code> means no upper bound, and is by far the most common value (921 of 1000 rules); the finite values observed run from 7.2 to 8.3.</p>",
          "type": "number(quantity)",
          "units": "%",
          "constraints": [
            "required"
          ],
          "range": {
            "min": 7.2,
            "max": null
          }
        },
        {
          "name": "monthly_volume",
          "description": "<p>Monthly transaction volume range this rule applies to. Null means all.</p>",
          "type": "enum",
          "values": [
            "<100k",
            "100k-1m",
            "1m-5m",
            ">5m"
          ],
          "value_labels": {
            "100k-1m": "100k to 1m euros",
            "1m-5m": "1m to 5m euros",
            "<100k": "Under 100k euros",
            ">5m": "Over 5m euros"
          }
        },
        {
          "name": "is_credit",
          "description": "<p>Whether this rule applies to credit (TRUE) or debit (FALSE) transactions. Null means both.</p>",
          "type": "boolean"
        },
        {
          "name": "fixed_amount",
          "description": "<p>Fixed fee component (also called \"absolute fee\") in euros per transaction.</p>",
          "type": "number(quantity)",
          "units": "EUR",
          "constraints": [
            "required"
          ],
          "range": {
            "min": 0,
            "max": 0.14
          }
        },
        {
          "name": "rate",
          "description": "<p>Variable fee rate (also called \"relative fee\"). Multiply by transaction value and divide by 10000 to get the variable component in euros.</p>",
          "type": "number(quantity)",
          "constraints": [
            "required"
          ],
          "range": {
            "min": 10,
            "max": 99
          }
        },
        {
          "name": "intracountry",
          "description": "<p>Whether this rule applies to domestic (TRUE) or international (FALSE) transactions. A transaction is domestic when issuing_country equals acquirer_country. Null means both.</p>",
          "type": "boolean"
        }
      ]
    },
    {
      "name": "merchant_months",
      "description": "<p>Monthly aggregates per merchant, computed from the payments data. Used for matching payments to fee rules based on monthly fraud level and transaction volume thresholds.</p>",
      "source": {
        "parquet": "data/merchant_months.parquet"
      },
      "columns": [
        {
          "name": "merchant",
          "description": "<p>Merchant name.</p>",
          "type": "string",
          "constraints": [
            "primary_key",
            "foreign_key",
            "unique",
            "required"
          ],
          "references": {
            "table": "merchants",
            "column": "merchant"
          },
          "examples": [
            "Belles_cookbook_store",
            "Crossfit_Hanna",
            "Golfclub_Baron_Friso",
            "Martinis_Fine_Steakhouse",
            "Rafa_AI"
          ]
        },
        {
          "name": "year",
          "description": "<p>Year.</p>",
          "type": "number(ordinal)",
          "constraints": [
            "primary_key",
            "unique",
            "required"
          ],
          "range": {
            "min": 2023,
            "max": 2023
          }
        },
        {
          "name": "month",
          "description": "<p>Month (1-12).</p>",
          "type": "number(ordinal)",
          "constraints": [
            "primary_key",
            "unique",
            "required"
          ],
          "range": {
            "min": 1,
            "max": 12
          }
        },
        {
          "name": "total_volume",
          "description": "<p>Total transaction volume in euros for this merchant-month.</p>",
          "type": "number(quantity)",
          "units": "EUR",
          "constraints": [
            "required"
          ],
          "range": {
            "min": 91877.05,
            "max": 438023.59
          }
        },
        {
          "name": "fraud_volume",
          "description": "<p>Total volume of transactions flagged as fraudulent disputes, in euros.</p>",
          "type": "number(quantity)",
          "units": "EUR",
          "constraints": [
            "required"
          ],
          "range": {
            "min": 5612.78,
            "max": 42617.6
          }
        },
        {
          "name": "fraud_percent",
          "description": "<p>Fraud rate as a percentage: fraud_volume / total_volume * 100.</p>",
          "type": "number(quantity)",
          "units": "%",
          "constraints": [
            "required"
          ],
          "range": {
            "min": 6.09,
            "max": 11.62
          }
        },
        {
          "name": "monthly_volume",
          "description": "<p>Binned total_volume matching the fee rule volume ranges.</p>",
          "type": "enum",
          "constraints": [
            "required"
          ],
          "values": [
            "<100k",
            "100k-1m",
            "1m-5m",
            ">5m"
          ],
          "value_labels": {
            "100k-1m": "100k to 1m euros",
            "1m-5m": "1m to 5m euros",
            "<100k": "Under 100k euros",
            ">5m": "Over 5m euros"
          }
        }
      ]
    },
    {
      "name": "merchant_category_codes",
      "description": "<p>Lookup table of Merchant Category Codes (MCCs). MCCs are four-digit codes assigned by card networks to classify a merchant's business type.</p>",
      "source": {
        "parquet": "data/merchant_category_codes.parquet"
      },
      "columns": [
        {
          "name": "mcc",
          "description": "<p>Four-digit Merchant Category Code.</p>",
          "type": "number(id)",
          "constraints": [
            "primary_key",
            "unique",
            "required"
          ],
          "referenced_by": [
            {
              "table": "merchants",
              "column": "merchant_category_code"
            }
          ],
          "examples": [
            742,
            3286,
            3679,
            5732,
            9950
          ]
        },
        {
          "name": "description",
          "description": "<p>Human-readable description of the merchant category.</p>",
          "type": "string",
          "constraints": [
            "required"
          ],
          "examples": [
            "Concrete Work Contractors",
            "Eating Places Restaurants",
            "Industrial Supplies",
            "Recreation Services",
            "Veterinary Services"
          ]
        }
      ]
    }
  ],
  "relationships": [
    {
      "description": "<p>Each payment belongs to one merchant.</p>",
      "cardinality": "many-to-one",
      "declared_cardinality": "many-to-one",
      "pairs": [
        {
          "left": {
            "table": "payments",
            "column": "merchant"
          },
          "right": {
            "table": "merchants",
            "column": "merchant"
          }
        }
      ],
      "join": "payments.merchant = merchants.merchant"
    },
    {
      "description": "<p>Each merchant has one or more acquirers.</p>",
      "cardinality": "many-to-one",
      "declared_cardinality": "one-to-many",
      "pairs": [
        {
          "left": {
            "table": "merchant_acquirers",
            "column": "merchant"
          },
          "right": {
            "table": "merchants",
            "column": "merchant"
          }
        }
      ],
      "join": "merchants.merchant = merchant_acquirers.merchant"
    },
    {
      "description": "<p>Each merchant-acquirer references one acquirer.</p>",
      "cardinality": "many-to-one",
      "declared_cardinality": "many-to-one",
      "pairs": [
        {
          "left": {
            "table": "merchant_acquirers",
            "column": "acquirer"
          },
          "right": {
            "table": "acquirer_countries",
            "column": "acquirer"
          }
        }
      ],
      "join": "merchant_acquirers.acquirer = acquirer_countries.acquirer"
    },
    {
      "description": "<p>Each merchant has monthly aggregates for each active month.</p>",
      "cardinality": "many-to-one",
      "declared_cardinality": "one-to-many",
      "pairs": [
        {
          "left": {
            "table": "merchant_months",
            "column": "merchant"
          },
          "right": {
            "table": "merchants",
            "column": "merchant"
          }
        }
      ],
      "join": "merchants.merchant = merchant_months.merchant"
    },
    {
      "description": "<p>Each merchant has one merchant category code.</p>",
      "cardinality": "many-to-one",
      "declared_cardinality": "many-to-one",
      "pairs": [
        {
          "left": {
            "table": "merchants",
            "column": "merchant_category_code"
          },
          "right": {
            "table": "merchant_category_codes",
            "column": "mcc"
          }
        }
      ],
      "join": "merchants.merchant_category_code = merchant_category_codes.mcc"
    }
  ],
  "glossary": [
    {
      "term": "acquirer",
      "definition": "<p>The acquiring bank that processes a merchant's card transactions and settles funds. Also called the \"acquiring bank\" or \"merchant bank.\"</p>"
    },
    {
      "term": "card scheme",
      "definition": "<p>The card network (e.g. GlobalCard, NexPay) that sets rules and interchange rates for transactions on its network.</p>"
    },
    {
      "term": "ACI",
      "definition": "<p>Authorization Characteristics Indicator. A code that identifies the transaction flow submitted to the acquirer (e.g. card-present vs card-not-present, authenticated vs non-authenticated).</p>"
    },
    {
      "term": "MCC",
      "definition": "<p>Merchant Category Code. A four-digit code assigned by card networks to classify a merchant's business type, used for risk assessment, fraud detection, and fee determination.</p>"
    },
    {
      "term": "intracountry",
      "definition": "<p>A domestic transaction where the card-issuing country and the acquiring country are the same. Intracountry transactions typically have lower fees than cross-border transactions.</p>"
    },
    {
      "term": "BIN",
      "definition": "<p>Bank Identification Number. The first six to eight digits of a card number that identify the issuing bank.</p>"
    },
    {
      "term": "POS",
      "definition": "<p>Point of Sale. An in-person or in-store transaction, as opposed to an online (ecommerce) transaction.</p>"
    },
    {
      "term": "3-D Secure",
      "definition": "<p>A payment security protocol that adds an extra authentication step for online card-not-present transactions, reducing fraud risk.</p>"
    },
    {
      "term": "chargeback",
      "definition": "<p>A reversal of a transaction initiated by the cardholder's issuing bank, typically due to a dispute or fraud claim.</p>"
    },
    {
      "term": "capture delay",
      "definition": "<p>The number of days between authorization and settlement of a transaction. Faster capture is generally more expensive.</p>"
    }
  ]
}
