There should be two sections. A Parser and an Assembler. Each section will be explained below.
The main goal of the engine is to take in some sort of structured input
(json, csv, fixed-wdith, etc...) and convert it into the standard format needed by the upload
service. The engine does NOT need to support every output type. It just needs to fit the
standard format.
The parser is responsible for parsing the incoming data into an array of objects. These objects represent a record in the data. The parser does not need to know about how the data is merged/transformed, as this happens in the assembler. There can be parsers for different filetypes. For example, the csv parser uses papaparse to get an array of records. Each parser is responsible for pulling out fields that should be available for further processing in the assembler. The values in the fields array of the parser, can be thought of as names of properties on the parsed record. The parsed record should have every property with blanks, as the empty string "".
The assember is responsible for merging and mapping data to the standard format. It does this with a set of rules that transforms how the data is manipulated. The rules should be somewhat user-friendly, as they should be able to be built into a ui.
-
Take This rule allows you to
takethe sequence from the grouped records andsetits value in the member record output via themergeInto.outputfield. -
When This rule allows you to
pushorsetvalues in the member record output via themergeInto.outputfield when a conditions is met. The condition is in thewhensection of the rule. If themergeInto.operationis set, then thelastvalue from the grouped records is set.
{
"ssn": "XXX-XX-XXXX",
"effectiveDate": "MM/DD/YYYY",
"demographics": {
"addr1": "XXXXXXXXXX",
"addr2": "XXXXXXXXXX",
"city": "XXXXXXX",
"state": "XXXX",
"zip": 00000,
"country": "XX"
},
"deductions": [
{ "type": "401K", "amount": 0, "percent": 0 }
{ "type": "ROTH", "amount": 0, "percent": 0 }
{ "type": "LOAN", "amount": 0, "percent": 0 }
]
}