/**
* Stage one: the CSV is opened by Axyra's own CSV reader, which types each
* field as it goes, and the validation rules are written beside it as an
* ordinary sheet a business user can edit.
*/
private Workbook loadSource() {
Workbook wb = Workbook.openBytes(SOURCE_CSV.getBytes(StandardCharsets.UTF_8), "csv");
Sheet input = wb.sheet(0);
wb.renameSheet(input.index(), INPUT);
// A title line above the CSV header moves the first record to row 3.
input.insertRows(0, 1);
title(input, 0, "Source CSV · edit any cell, then run validation");
styleInput(input);
Sheet rules = wb.createSheet(RULES);
for (int r = 0; r < RULE_ROWS.length; r++) {
row(rules, r, (Object[]) RULE_ROWS[r]);
}
styleRules(rules);
wb.setActiveSheet(input.index());
return wb;
}This demo follows a data validation and cleansing process of the kind that precedes financial and regulatory reporting.
The source CSV is opened by Axyra's CSV reader and placed beside an ETL Rules sheet. The rules are ordinary cells: a field, an operator and a value, with the issue text and the required action to report when a row fails. Validation reads them on every run, so changing a rule changes what is checked without any change to the code.
Each failing cell is coloured and annotated with a comment, and the Validation sheet lists every issue with a link back to its cell. Values can be corrected directly in the spreadsheet, or with the suggested fixes, and validation run again: every stage reads the book on screen back into Axyra, edits included.
Only an input that passes is transformed. The Reporting Output sheet splits each policy into its IFRS 9 principal and IFRS 15 service fee in base currency, using formulas over the input, and is offered as a CSV for the downstream reporting system.