Objective
Fairness testing is usually an offline project run once a quarter. Because your decisions already live in the database, it can be a query you run any day. This recipe computes approval rates by group and surfaces a disparate-impact signal against the classic four-fifths (80%) rule.
Step 1: Your decisions
(In production this is the decision record; here, a small sample with a group attribute used only for fairness monitoring.)
DROP TABLE IF EXISTS uw_dec;
CREATE TABLE uw_dec (app_id INT, grp TEXT, decision TEXT);
INSERT INTO uw_dec VALUES
(1,'A','approve'),(2,'A','approve'),(3,'A','decline'),(4,'A','approve'),
(5,'B','decline'),(6,'B','decline'),(7,'B','approve'),(8,'B','decline');
Step 2: Approval rate by group
SELECT grp,
COUNT(*) AS n,
SUM(CASE WHEN decision = 'approve' THEN 1 ELSE 0 END) AS approvals,
ROUND(AVG(CASE WHEN decision = 'approve' THEN 1.0 ELSE 0.0 END), 3) AS approval_rate
FROM uw_dec
GROUP BY grp
ORDER BY grp;
Result:
| grp | n | approvals | approval_rate |
|---|---|---|---|
| A | 4 | 3 | 0.750 |
| B | 4 | 1 | 0.250 |
Step 3: Read the four-fifths ratio
Group B's rate (0.25) divided by the highest rate (0.75) is 0.33 — well under the 0.80 threshold, a disparate-impact flag that warrants review. In production you would compute the ratio directly and alert when it drops below 0.8.
Why it matters
Fairness becomes a continuous query over decisions you already made, with the evidence sitting next to the decisions themselves — exactly what NAIC, Colorado, and DOI examinations ask you to demonstrate. Keep the underlying decisions in a tamper-evident record so the fairness evidence is itself defensible.