What a bank model file is and what it holds
Each bank gets one JSON file named for it. A file in the set of bank model files has six blocks.
- The identity block holds the bank name, a short slug, a version and the validated flag.
- The discriminants block holds identifying text, balance labels, section names, a date format and a multi-account flag.
- The structure block describes the summary section, the account format, the transaction sections and the daily balance table.
- The extraction hints block records separators, the way negatives are printed and rows to skip.
- The validation rules block holds the balance tolerance of 0.01.
- The test documents list names the statements that proved the model.
Identifying text lists words that a statement from that bank usually shows, such as a name or a section title. Second, balance labels give the exact wording that the bank uses for opening and closing balances. In addition, some files carry a layout signature, which names the overall page pattern.
How the reader finds and loads a model for each bank
The second phase detects the bank name. Next, it looks for one of the bank model files with the matching slug. If the file exists, the run loads it.
A validated model is logged as validated, and the reader turns it into hints for the next phases. Likewise, an unvalidated model is also loaded, with a warning, and its hints are used too. Therefore, the validated flag tells a reviewer how far the hints were tested.
If no file exists, the same phases still run. The log simply notes that the structure will be learned. Thus, bank model files are an aid and not a requirement.
Specifically, the hints become plain text in the prompts that read the tables. That text names the known structure of the bank, so the model call does not start from zero. However, a model call can still be wrong, which is why the balance check follows later.
How a new model is created and then marked as validated
First, the third phase builds a draft model. When the bank name is known, the run builds an initial model from the document structure it saw. That draft holds the summary title, balance labels, sub-account notes and transaction sections. Notably, it starts with the validated flag set to false.
The draft becomes a validated model only after the balance check passes. At that point the run sets the flag and writes the validation date. Finally, it adds the document name to the test documents and saves the file under the bank slug.
This order matters, because a validated model is trusted only after arithmetic proved the reading consistent. A run that fails the balance check never promotes its draft. Likewise, an unvalidated model keeps its warning until a later run balances.
In addition, a switch can turn model saving off for all bank model files. By default, each run that balances can add a file. Teams with strict rules about stored data can use that switch to keep the folder empty.
What the hints tell the reader before it reads tables
The hints describe the known structure of the bank. First, they name the summary section and its balance labels. Also, they say whether each account has its own transaction sections or whether lines are mixed.
When sub-accounts exist, the hints give the separator in the account number. For example, for transaction sections, they can say that all amounts are debits or all are credits. They also name the daily balance section and say whether it has several columns. Identifying text from the model also helps the first phases confirm the bank.
How the hints help to spot a date or a sum
Format hints are small but they save effort. They give the date format, such as month and day. They also give the decimal and thousands separators. A negative is printed in parentheses or with a minus sign.
Meanwhile, continuation pages get a rule as well. If a page starts with data rows and no header, the hints call it a continuation. Thus, it assigns those rows to the same account as the previous page. As a result, a table without a visible account number stays tied to its account.
What the 47 extracted files are and what they are not
The repository holds 47 extracted model files. Together they cover 29 bank names. Each one stores identifying text, balance labels, section names, a date format and a multi-account flag. Moreover, most also carry observations from the source statements.
The runtime folder for bank model files is different. Instead, it holds the models that validated runs saved, so its content depends on the runs of each deployment. Both folders are kept out of Git, which means that a fresh clone contains none.
Therefore, say 47 files and not 47 banks. In fact, several files can cover one bank, and 29 names are the real count. Bank model files also do not form a closed list, because a bank outside them still runs without a model.
The bank statement extraction page describes the product route in which these files are used.
How to manage model files as part of your deployment
Treat the folder of bank model files as configuration. Thus, back it up, and copy it when you move a deployment, because a fresh checkout will not carry it. Also, record which bank model files were present when you ran a pack, so that results can be repeated.
Next, check the validated flag and the validation date before you trust a validated model. A model is saved per bank name, so a redesigned statement layout may need a new validated run. Meanwhile, the run falls back on its normal phases when a model does not fit.
The National Institute of Standards and Technology (opens in new tab) publishes guidance on configuration management. The format itself is described at JSON.org (opens in new tab). That helps staff who read a model by hand.
What a model never replaces in the rest of the checks
Bank model files help the reader begin well. They do not prove that the reading was right. However, the balance check still tests each account, as the article on the running balance check explains.
Bank model files also do not settle which account owns a line. The article on multi-account statements shows how that review works. Similarly, the article on bank statement table detection shows where the tables themselves can fail.