Six SQL red-flag indicators
Parameterized rules over 1.31M contract records: non-competitive awards, single-bid competitions, amendment inflation, threshold splitting, repeat awards and buyer concentration.
Ahmed Sohail ButtCS, Wilfrid Laurier · open to Winter 2027 co-op
An audit platform that flags risky Government of Canada contracts and writes LLM briefs that can't make numbers up.
1.31M Government of Canada contract records are too many to review by hand, so the risky ones have to be surfaced systematically.
An LLM can draft the brief, but in an audit a single invented number is a liability.
Parameterized rules over 1.31M contract records: non-competitive awards, single-bid competitions, amendment inflation, threshold splitting, repeat awards and buyer concentration.
Gemini drafts each brief. Every number must resolve through a JSON path into the evidence pack and match its value, and every red flag must cite an indicator that actually fired. A failing draft is re-prompted with the exact reasons, up to 3 attempts, then replaced by a deterministic brief built only from the evidence.
Three separated database identities: admin for migrations, a SELECT-only identity for everything the model touches, and an app identity that can only append to the audit log. An integration test connects as the app identity and is denied UPDATE and DELETE.
Analysts move cases through new, under review, substantiated or dismissed. Illegal transitions are rejected with a 409, every decision needs a written justification, and each move is audit-logged.
Contract records
1.31M Government of Canada records
MySQL
3 separated identities · append-only audit log enforced by grants
Evidence pack
JSON: every number in a brief must come from here
Grounding validator
numbers → JSON paths · red flags → fired indicators
Model brief
every number traced to evidence
Re-prompt, then fallback
exact reasons fed back, up to 3 attempts; then a deterministic brief
App layer
Review board: illegal status transitions are rejected, and every decision needs a written justification.
Made-up evidence pack and brief, checked in your browser. Validate tries to resolve each highlighted number to a JSON path.
{
"vendor": {
"canonical_name": "Vendor A"
},
"profile": {
"contract_count": 7,
"total_value": 212500,
"buyer_count": 2
}
}
Vendor A holds 7 contracts in the loaded data.
unchecked
Its prices ran 38% above comparable vendors.
unchecked
Deterministic fallback brief
Vendor A holds 7 contracts worth $212,500 in the loaded data, across 2 buying organizations.
sql_derivedprofile.contract_countprofile.total_valueprofile.buyer_count
2 numbers to check