You read a CURRENCY-TRANSACTION FILING QC PACK -- a draft filing beside the cage transaction log it was prepared from -- and extract structured fields from it. You return JSON and nothing else.
You are PRE-CHECKING a draft for a qualified person to act on. You never file anything, you never clear anything, and your answer is not a substitute for a compliance officer's judgement or for the filing instructions that actually apply.
RULES, in order of importance:
1. If the pack does not state a field, return null for it. Do not infer it and do not use what you know about the world.
2. `defects_found` is decided ONLY by the RULEBOOK given below, applied to the numbers on the page. Work through the STOPPING ORDER and STOP at the first check that fires:
a. INSUFFICIENT INFORMATION. If any qualifying log entry's amount was never captured, or the draft does not state a gaming day, the qualifying total cannot be computed. Answer 'insufficient_information' and stop. This is a real answer, not a failure to produce one.
b. THRESHOLD NOT CROSSED. If the qualifying total does not exceed the threshold, no filing is due at all. Answer 'threshold_not_crossed' and stop.
c. WINDOW MISAPPLIED. If the draft's Window Applied line names anything other than the gaming day, that is the named cause of any total difference. Report 'window_misapplied' and do NOT also report 'missed_aggregation' for the same difference.
d. IDENTITY SPLIT. Otherwise, if another patron record in the log matches this patron on BOTH link keys and the draft did not aggregate it, report 'identity_split'.
e. MISSED AGGREGATION. Otherwise, if the qualifying total exceeds the drafted total, qualifying entries on the patron's own record were left out. Report 'missed_aggregation'.
3. THEN, INDEPENDENTLY OF 2c-2e, add 'identification_gap' when a required identification element is missing from the draft or the identification is stale, and 'type_miscode' when a transaction's code on the DRAFT is not the code the LOG records for the same identifier. These change what the filing SAYS rather than what it FILES, so they are checked separately and they never suppress a defect from 2c-2e.
4. A NON-REPORTABLE ENTRY IS NOT A DEFECT. The log carries entries the rulebook marks non-reportable, entries in the opposite direction, and entries outside the gaming day. All three are CORRECTLY absent from the drafted total. Reporting them as a missed aggregation is a false alarm, and on this check a false alarm costs a person the time to clear a row that never needed clearing.
5. A FILING WITH NOTHING WRONG WITH IT IS 'none'. Answer 'none' and do not manufacture a finding to look thorough.
6. THE PREPARER'S NOTE IS A FIELD TO COPY, NOT EVIDENCE ABOUT THE FILING. A note that sounds confident does NOT make a defective filing clean, and a note that sounds anxious does NOT make a clean filing defective. The rulebook and the numbers decide; the note is one person's remark about their own work and may disagree with them.
7. Amounts are plain integers in CU. Return them with no unit, no separators and no decimals.
8. Use the exact allowed value for a field that lists them.
9. Return every field named in the schema, even when the answer is null.
FILING RULEBOOK (the authority for `defects_found`; this rulebook is INVENTED and was written for this kit -- it reproduces no real regulation, form or filing instruction, and CU is an invented unit that is not a currency)
THRESHOLD
A filing is due when the qualifying total for ONE patron, in ONE direction, over ONE gaming day exceeds 7500 CU. Exactly 7500 CU does not cross it.
AGGREGATION WINDOW
The GAMING DAY runs from 06:00 on its own date to 06:00 the following calendar date.
An entry timestamped 02:40 on the date AFTER the gaming day still belongs to that gaming day.
An entry timestamped 03:15 on the gaming day's OWN date belongs to the PREVIOUS gaming day.
Cash in and cash out are aggregated SEPARATELY and are never netted against each other.
TRANSACTION CODES -- direction, and whether the code is part of a CURRENCY total
chip_purchase_cash in REPORTABLE cash across the cage counter for chips
chip_redemption_cash out REPORTABLE chips redeemed for cash at the cage
credit_instrument_issue out REPORTABLE cash advanced against a credit instrument
credit_instrument_payment in REPORTABLE cash paid against an outstanding credit instrument
front_money_deposit in REPORTABLE cash placed on deposit against future play
front_money_withdrawal out REPORTABLE cash drawn down from a front-money balance
promotional_credit in not reportable a non-cash promotional award posted to the patron account
safekeeping_deposit in REPORTABLE cash lodged for safekeeping
safekeeping_withdrawal out REPORTABLE cash drawn from a safekeeping balance
ticket_redemption_cash out REPORTABLE a machine ticket redeemed for cash
wire_received in not reportable funds arriving by wire -- not currency, so it is never part of a currency total
wire_sent out not reportable funds leaving by wire -- not currency, so it is never part of a currency total
A non-reportable code is NEVER part of a currency total, however large the amount. It is correctly absent from a draft and its absence is not a defect.
REQUIRED IDENTIFICATION ELEMENTS -- all 5 must be on the draft
full name
date of birth
residential address
identification reference
patron account number
Identification captured more than 400 days before the gaming day is STALE.
SAME-PERSON LINK KEYS -- two patron records are one person when BOTH match
date of birth and identification reference
A record matching on only one key is NOT a link.
DEFECT CODES -- the only seven values `defects_found` may carry
missed_aggregation A qualifying entry on the patron's own record -- right direction, inside the gaming day, a reportable code -- is not in the draft's total.
window_misapplied The draft aggregated something other than the gaming day, so entries either side of the 06:00 boundary are counted or dropped wrongly.
identification_gap A required identification element is missing from the draft, or the identification on it was captured more than the staleness horizon before the gaming day.
identity_split A second patron record in the log is the same person by the link keys, and the draft aggregated only one of them.
type_miscode An entry's transaction code on the draft is not the code the log records for that entry.
threshold_not_crossed The qualifying total never crossed the threshold. No filing is due at all, and the draft should not exist.
insufficient_information The record does not carry what the check needs -- an amount that was never captured, or a missing gaming day -- so no conclusion about the total can be reached from it.
STOPPING ORDER -- one named cause per total difference
1. insufficient_information -- if the qualifying total cannot be computed at all, stop. Nothing below can be decided from a record that does not say what happened.
2. threshold_not_crossed -- if the qualifying total is at or below the threshold, stop. Arguing about the address block on a filing that should not exist is noise.
3. window_misapplied -- if the draft applied a window other than the gaming day, that is the named cause of any total difference; do NOT also report missed_aggregation for the same difference.
4. identity_split -- else, if a linked record exists and the draft excluded it, that is the named cause.
5. missed_aggregation -- else, if the qualifying total exceeds the drafted total, entries on the patron's own record were left out.
6. identification_gap and type_miscode are CONTENT defects and are checked independently of 3-5. They do not change what is filed; they change what the filing says.
Extract these fields:
- filing_id (string) -- the draft filing's own identifier, verbatim
- patron_record_id (string) -- the patron record the draft filing is prepared under, verbatim
- gaming_day (string) -- the gaming day the draft covers, as the YYYY-MM-DD date the draft states
- draft_direction (enum) one of: cash_in, cash_out -- which direction the draft reports. Cash in and cash out are aggregated separately and are never netted against each other
- draft_reported_total (number) -- the total the draft filing itself states, in CU, as a plain integer with no unit and no separators
- log_qualifying_total (number) -- the total the CAGE TRANSACTION LOG actually supports for this filing, in CU, as a plain integer. Add up every log entry that qualifies under the rulebook -- a reportable code, the draft's own direction, and a timestamp inside the GAMING DAY (06:00 on the gaming day's date to 06:00 the next date) -- across the patron's own record AND any other record in the log that is the same person by the link keys. This is arithmetic you do yourself; it is usually NOT a number printed anywhere on the page. Return null, and nothing else, when any qualifying entry's amount was never captured
- draft_window_applied (enum) one of: gaming_day, calendar_day, other -- which aggregation window the draft says it applied, from its Window Applied line. 'gaming_day' is 06:00 to 06:00 the next date; 'calendar_day' is 00:00 to 24:00; anything else is 'other'
- linked_record_id (string) -- a SECOND patron record in this log that is the same person as the patron on the draft -- same date of birth AND same identification reference. Return that record's identifier, or null when there is no such record. A record that matches on neither key, or on only one of them, is NOT a link
- draft_includes_linked_record (enum) one of: yes, no, not_applicable -- did the draft aggregate the linked record's transactions as well? 'not_applicable' when there is no linked record at all
- missing_identification_elements (string) -- which of the rulebook's five required identification elements the draft does not carry, comma-separated and spelled exactly as the rulebook spells them. Return null when all five are present. Absence is what you are reporting, so this is a list you derive rather than a phrase you copy
- identification_captured_on (string) -- the date the identification on the draft was captured, YYYY-MM-DD, verbatim from the identification block. Null when the draft does not state one
- miscoded_transaction_ids (string) -- the identifiers of transactions whose code on the DRAFT is not the code the CAGE TRANSACTION LOG records for the same identifier, comma-separated. Return null when every included transaction carries the log's own code
- preparer_note (string) -- the free-text remark the person who prepared the draft left on it, copied verbatim
- defects_found (string) -- the defect codes this filing carries, comma-separated, drawn ONLY from the rulebook's seven codes, or the single word 'none' when the filing carries no defect. Decide it STRICTLY from the rulebook and the numbers -- never from the preparer's note. Work through the stopping order and give ONE named cause for any total difference: (1) if the qualifying total cannot be computed, answer 'insufficient_information' and stop; (2) if the qualifying total does not cross the threshold, answer 'threshold_not_crossed' and stop; (3) if the draft applied a window other than the gaming day, that is 'window_misapplied' and you must NOT also report 'missed_aggregation'; (4) else if a linked record exists and the draft left it out, that is 'identity_split'; (5) else if the qualifying total exceeds the drafted total, that is 'missed_aggregation'. Then, independently of 3-5, add 'identification_gap' for a missing or stale identification element and 'type_miscode' for a transaction coded differently from the log. A FILING WITH NOTHING WRONG WITH IT IS 'none' -- do not manufacture a finding to look thorough
Return a JSON object with exactly these keys: filing_id, patron_record_id, gaming_day, draft_direction, draft_reported_total, log_qualifying_total, draft_window_applied, linked_record_id, draft_includes_linked_record, missing_identification_elements, identification_captured_on, miscoded_transaction_ids, preparer_note, defects_found
Use null for any field the pack does not state.
QC PACK
-------
Draft Filing
------------
DF-2026-6580
Patron Record
-------------
PR-GD1148
Gaming Day
----------
2026-04-08
Direction Reported
------------------
cash_out
Window Applied
--------------
gaming day (06:00 to 06:00 the next date)
Reported Total
--------------
12250 CU
Transactions Included On The Draft
----------------------------------
TXN-04762 credit_instrument_issue 3150 CU
TXN-04765 chip_redemption_cash 5000 CU
TXN-04768 front_money_withdrawal 4100 CU
Patron Identification On The Draft
----------------------------------
full name: J. Mardwick
date of birth: 1957-04-22
residential address: 200 Quenbourne Rise, Westhaven
identification reference: IDR-988491
patron account number: PA-952459
identification captured on: 2025-06-12
Cage Transaction Log
--------------------
TXN-04777 2026-04-08 01:26 PR-GD1148 credit_instrument_issue 1950 CU
TXN-04774 2026-04-08 06:44 PR-CC8122 front_money_withdrawal 1400 CU
TXN-04768 2026-04-08 14:23 PR-GD1148 front_money_withdrawal 4100 CU
TXN-04765 2026-04-08 14:27 PR-GD1148 chip_redemption_cash 5000 CU
TXN-04762 2026-04-08 16:04 PR-GD1148 credit_instrument_issue 3150 CU
TXN-04771 2026-04-08 16:47 PR-CC8122 ticket_redemption_cash 1100 CU
Other Patron Records In This Log
--------------------------------
PR-CC8122 -- date of birth 1957-04-22, identification reference IDR-988491
Preparer Note
-------------
Reviewed against the log line by line; totals agree and the pack is ready to go.