file_splitter
1. Description
This program processes .cf and .txt input files, transforming and organizing their data according to specified rules and metadata. It can split the output by identifiers or merge all data into a single file, depending on configuration settings.
2. Input
2.1 Mandatory Parameters
# | Parameters | Description | Example |
---|---|---|---|
1 | process_config | Path to the process configuration file that needs to be processed | /path/to/process_config.json |
2 | as_on_date | The date for which the program should run | 2024-11-28 |
3 | log_file_path | Path to write general processing logs | test-bed/log.txt |
4 | diagnostics_file_path | Path to write diagnostics logs for performance and error tracking | test-bed/diag_log.txt |
5 | is_split_req | Flag to decide if output needs to be split based on LLG | true |
2.2 Non-Mandatory Parameters
# | Parameters | Description | Default Value | Example |
---|---|---|---|---|
1 | log_level | Level of diagnostics written to the log file | info | error/warn/info/debug/trace/none |
2 | is_perf_diagnostics_enabled | Flag to decide if performance diagnostics will be logged | false | true or false |
3 | is_split_req | Flag to decide if output needs to be split based on LLG | true | true or false |
4 | default_llg_code | Default LLG (Local Legal Group) code used for processing | 08888 | 1000 |
2.3 process-config
{
"id": "M_PC004",
"name": "RULE_BASED_SPLITTER_CONFIG",
"file_type": "ProcessConfig",
"base_input_id": "M_IN011",
"base_input_metadata": "path/to/input_details.json",
"base_output_id": "M_OP011",
"base_output_metadata": "path/to/output_details.json",
"additional_output": [
{
"id": "M_OP012",
"output_metadata_path": "path/to/addnl_details_1.json"
},
{
" id": "M_OP013",
"output_metadata_path": "path/to/addnl_details_2.json"
}
]
}
3. Output
File naming is done based on the name present in metadata file like this: Rule-Based-Splitter-{name}.txt . Also Rule-Based-Splitter-merged.txt is also created.
3.1 is_split_req=true
If is_split_req is true, the input.txt file is read and each line is iterated one by one. Each line is added to different files according to the extracted llg_code from rules given in metadata files.If any llg_code is not present in metadata, then NA.txt is created and that line is added in this file. If it is a .cf file, it extracts the data for each account and its cashflows.Format the data as a string, separated by a delimiter and appending to the files is done in the same way as .txt file
Ex:
AC001|USD|10.467|4000.237|24-10-2023
AC001|USD|14.467|4004.237|26-10-2023
AC001|USD|15.467|4005.237|27-10-2023
AC001|USD|17.467|4007.237|29-10-2023
3.2 is_split_req=false
If is_split_req is false, the input.txt file is read and lines are iterated one by one. At the end of each line the llg_code is added with a "|" separator and the line is added into the merged file. If it is a .cf file, it extracts the data for each account and its cashflows.Format the data as a string, separated by a delimiter and appending to the files is done in the same way as .txt file
Ex:
AC001|USD|10.467|4000.237|24-10-2023|1000
AC001|INR|11.467|4001.237|22-10-2023|2000
AC001|YEN|12.467|4002.237|23-10-2023|3000
AC001|INR|13.467|4003.237|25-10-2023|2000
AC001|USD|14.467|4004.237|26-10-2023|1000
AC001|USD|15.467|4005.237|27-10-2023|1000
AC001|YEN|16.467|4006.237|28-10-2023|3000
AC001|USD|17.467|4007.237|29-10-2023|1000
AC001|INR|18.467|4008.237|30-10-2023|2000
AC001|INR|19.467|4009.237|01-10-2023|2000
AC001|YEN|20.467|4010.237|02-10-2023|3000