Definitions
The claims terms the operator, its detectors and Ask all run on. Each has an owner, a version, SQL and tests. Edits make a new version.Payment waiting above authority
payment_over_authority unit: payments operator detectorA payment requested by an adjuster above their own payment authority, waiting for a team lead's approval for longer than the rule allows. Garages and claimants wait for this money.
financeHead of Claims Finance · finance
v1
A payment requested in the last 90 days, at least hours_waiting ago, for more than the requesting adjuster's authority limit, not approved and not held as of now.
latest change: First version.
- pass count_betweenobserved 0, expected between 0.0 and 120.0
- pass uniqueobserved {'duplicates': 0}, expected payment_id unique
- pass detector_shapeobserved {'missing_columns': [], 'bad_rows': 0, 'rows': 0}, expected columns ['subject_type', 'subject_id', 'started_at', 'evidence'], evidence is an object
SQL, rendered for now
SELECT 'payment' AS subject_type, p.id AS subject_id, p.id AS payment_id, p.claim_id, c.team_id,
p.requested_at + INTERVAL (4) HOUR AS started_at,
CASE WHEN p.amount >= 25000 THEN 'high' ELSE 'medium' END AS severity,
json_object('claim_no', c.claim_no, 'amount', p.amount, 'payee', p.payee_type,
'requested_at', p.requested_at, 'requested_by', a.name, 'authority_limit', a.authority_limit,
'hours_waiting', date_diff('hour', p.requested_at, TIMESTAMP 'Mon 17:00:00'), 'team_lead', t.lead_name,
'claim_flags', (CASE WHEN c.siu_referred_at <= TIMESTAMP 'Mon 17:00:00' THEN 'referred to SIU' ELSE 'none' END))
AS evidence
FROM payments p
JOIN adjusters a ON a.id = p.requested_by
JOIN claims c ON c.id = p.claim_id
LEFT JOIN teams t ON t.id = a.team_id
WHERE p.requested_at <= TIMESTAMP 'Mon 17:00:00' - INTERVAL (4) HOUR AND p.requested_at >= TIMESTAMP 'Mon 17:00:00' - INTERVAL 90 DAY
AND p.amount > a.authority_limit
AND (p.approved_at IS NULL OR p.approved_at > TIMESTAMP 'Mon 17:00:00')
AND (p.held_at IS NULL OR p.held_at > TIMESTAMP 'Mon 17:00:00')
ORDER BY started_at, p.id
Parameters
change one, see what changes today, then save it as a new version with a noteHistory
append-only; nothing is edited in place- definitionHead of Claims Finance finance v1 First version.