Back to Docs
Documentation

Metric Schema Reference

Complete field reference for the MetricRegistry definition format.

Field Reference

FieldTypeRequiredDescription
idstringFully qualified metric ID (e.g. uk.banking.capital.cet1_ratio)
versionsemverSemantic version of this metric definition
schema_versionintegerSchema format version (currently 1)
titlestringHuman-readable metric name
descriptionstringOne-line summary of what this metric measures
certificationenumLifecycle status: draft, pending_review, certified, deprecated
formula.dialectstringSQL dialect (ansi, postgres, bigquery, etc.)
formula.sqlstringThe canonical SQL formula with template variables
inputs[]arrayList of input datasets with columns required
inputs[].datasetstringTemplate variable name for the source table
inputs[].columns[]arrayTemplate variable names for required columns
output.columnstringName of the output column produced
output.typestringData type of output (numeric, integer, text, etc.)
output.unitstringUnit of measure (ratio, percentage, gbp, tonnes_co2e, etc.)
frequencystring--How often this metric is typically reported
thresholds[]array--Regulatory or internal thresholds (type, value, source)
regulatory_sourceobject--Source framework, URL, excerpt, section reference, caveats
provenance.source_excerptstring--Verbatim text from the source document
provenance.calculation_notesstring--Notes on implementation details or edge cases
provenance.caveatsstring--Known limitations or jurisdictional variations

Certification Lifecycle

draft

Initial definition, may be incomplete

pending_review

Submitted for expert validation

certified

Validated by domain expert, production-ready

deprecated

Superseded or no longer applicable

Template Variable Syntax

All formulas use ${variable_name} placeholders instead of hardcoded table or column names. This ensures metric definitions are schema-agnostic and portable across different data warehouses.

Each variable in the formula maps to an entry in the inputs array. When implementing the metric, substitute each variable with your actual table and column names.

Zero Fabrication Policy

Every metric in the registry must trace to a verifiable primary source. No metric definition may contain fabricated regulatory references, invented thresholds, or unverifiable source excerpts. If a value cannot be verified, it must be marked as null with a caveat explaining why.

Complete Example

uk.banking.capital.cet1_ratio.yaml
id: uk.banking.capital.cet1_ratio
version: 0.1.0
schema_version: 1
title: CET1 Ratio
description: >
  Common Equity Tier 1 capital as percentage
  of risk-weighted assets
certification: draft

formula:
  dialect: ansi
  sql: >
    SELECT ${cet1_capital} / nullif(${rwa}, 0)
    AS cet1_ratio
    FROM ${capital}

inputs:
  - dataset: capital
    columns:
      - cet1_capital
      - rwa

output:
  column: cet1_ratio
  type: numeric
  unit: ratio

frequency: quarterly

thresholds:
  - type: regulatory_minimum
    value: 0.045
    source: CRR Article 92(1)(a)
  - type: buffer_requirement
    value: 0.025
    source: CRR Article 129

regulatory_source:
  framework: CRR Article 92(2)(a)
  url: https://legislation.gov.uk/eur/2013/575
  excerpt: >
    The CET1 capital ratio shall be the CET1
    capital expressed as a percentage of the
    total risk exposure amount.
  caveats: >
    Transitional provisions may apply.
    Check PRA PS1/26 for UK-specific rules.

provenance:
  source_excerpt: >
    "The CET1 capital ratio shall be the CET1
    capital expressed as a percentage of the
    total risk exposure amount."
  calculation_notes: >
    Uses nullif to guard against division by
    zero when RWA is reported as zero.
  caveats: >
    Different jurisdictions may have different
    minimum requirements.