# Domain metrics for the financial schema. The planner reads this so it can # resolve a business term ("default rate", "loan volume") to a canonical SQL # expression instead of guessing. schema: financial metrics: loan_default_rate: description: Fraction of finished loans that ended in default (status 'B'). Excludes still-running loans. sql: "AVG(CASE WHEN status = 'B' THEN 1.0 WHEN status = 'A' THEN 0.0 END)" from_table: loan filter: "status IN ('A','B')" unit: ratio at_risk_loan_share: description: Of currently running loans, the share that are in debt (status 'D'). sql: "AVG(CASE WHEN status = 'D' THEN 1.0 WHEN status = 'C' THEN 0.0 END)" from_table: loan filter: "status IN ('C','D')" unit: ratio loan_volume: description: Total CZK lent. sql: "SUM(amount)" from_table: loan unit: CZK average_loan_amount: description: Mean loan size in CZK. sql: "AVG(amount)" from_table: loan unit: CZK transaction_volume: description: Total CZK moved through transactions (credits + debits, absolute). sql: "SUM(amount)" from_table: trans unit: CZK active_accounts: description: Distinct accounts with at least one transaction in the period. sql: "COUNT(DISTINCT account_id)" from_table: trans unit: count unemployment_rate_96: description: District unemployment rate in 1996 (already a percentage). sql: "A13" from_table: district unit: percent