"Rabobank receives monthly deliveries of customer statement records. This information is delivered in two formats, CSV and XML. These records need to be validated."
# install dependencies
npm i
# run tests
npm run test
# build
npm run build
# install the CLI globally
npm install -g .
# run the CLI
rabo -h
Simply run the CLI in a folder containing the input files (XML or CSV). The CLI
will scan the folder and generate a JSON report of the failed transactions in
the same folder. For more options, see the help menu (rabo -h
).
You can also run the CLI with npx
:
npx rabo
The challenge is to implement an I/O API that can process the customer statement records and generate a report on any invalid records.
The customer statement records can be delivered in two file formats: CSV
or
XML
. Records within these files need to be parsed and validated.
- all records should have a unique transaction reference.
- all records should show a balance that matches the sum of all the mutations to the initial balance.
Any record that does not meet these requirements should be written to a report.
My approach consists of three steps:
- Read the input file and parse the records.
- Validate the records.
- Generate a report.
As this is a challenge, there are some requirements missing. Additional to the requirements I received initially, I was also told:
"A requirement we would put to you is that the report should be easy to use for further processing. Think about what is necessary for a user/another application to best navigate this report, what information should be in it and how can it best be presented and used."
- My goal with this is to create a simple API that could easily be implemented in other applications.
- I will not implement a UI as the challenge is to create a processor that generates a report that can be used elsewhere. 1
- I will use a command line interface to demonstrate the functionality and write the reports.
- Based on the additional requirement, I will use a
JSON
format for the report as a default.
1: I imagine, and am working under the assumption, that a statement processor would more likely exist in an automated environment, e.g. as part of a pipeline, rather than be implemented in a UI. Of course, it would still be easy to support a manual file upload too.
- Code quality
- Testing and coverage
- Type safety (TS) and documentation (JSDoc)