load paycom

This commit is contained in:
Paul Trowbridge 2018-05-30 15:10:46 -04:00
parent 0bedaa5657
commit 3abb2fa9ba
5 changed files with 285 additions and 1335 deletions

View File

@ -2,31 +2,57 @@
COPY
(
SELECT
to_char(r."AsOfDate",'mm/dd/yyyy') "AsOfDate"
,r."BankId"
,r."AccountNumber"
,r."AccountName"
,r."BaiControl"
,r."Currency"
,r."Transaction"
,r."Reference"
,r."Amount"
,r."Description"
r."perd_start",
r."perd_end",
r."check_date",
r."loc_code",
r."loc_descr",
r."loc_glseg",
r."loc_over",
r."dep_code",
r."dep_descr",
r."dep_nat",
r."dep_over",
r."di_code",
r."di_descr",
r."di_glseg",
r."di_over",
r."title_code",
r."title_descr",
r."title_glseg",
r."title_over",
r."ee_code",
r."ee_glseg",
r."ee_over",
r."acct_type_code",
r."hours",
r."nat_code",
r."nat_over",
r."gl_ref",
r."gl_group",
r."gl_descr",
r."gl_code",
r."gl_amount",
r."pp_code",
r."pp_descr",
r."pp_gl",
r."pp_over",
r."transaction"
FROM
tps.trans
JOIN LATERAL jsonb_populate_record(NULL::tps.pncc, rec) r ON TRUE
JOIN LATERAL jsonb_populate_record(NULL::tps.PAYCOM, rec) r ON TRUE
WHERE
srce = 'PNCC'
srce = 'PAYCOM'
)
TO 'C:\users\ptrowbridge\downloads\pncc.csv' WITH (format csv, header TRUE)
TO 'C:\users\ptrowbridge\downloads\PAYCOM.csv' WITH (format csv, header TRUE)
--source
SELECT DEFN FROM TPS.SRCE WHERE SRCE = 'PNCC'
SELECT DEFN FROM TPS.SRCE WHERE SRCE = 'PAYCOM'
--mapdef
SELECT jsonb_agg(row_to_json(x)::jsonb) FROM (SELECT srce, target "name", regex, seq "sequence" FROM tps.map_rm WHERE srce = 'PNCC') x
SELECT jsonb_agg(row_to_json(x)::jsonb) FROM (SELECT srce, target "name", regex, seq "sequence" FROM tps.map_rm WHERE srce = 'PAYCOM') x
--map values
SELECT jsonb_agg(row_to_JSON(x)::jsonb) FROM (SELECT srce "source", target "map", retval ret_val, "map" mapped FROM tps.map_rv WHERE srce = 'PNCC') X
SELECT jsonb_agg(row_to_JSON(x)::jsonb) FROM (SELECT srce "source", target "map", retval ret_val, "map" mapped FROM tps.map_rv WHERE srce = 'PAYCOM') X

View File

@ -1,4 +1,4 @@
curl -H "Content-Type: application/json" -X POST -d@./srce.json http://localhost:81/srce_set
curl -H "Content-Type: application/json" -X POST -d@./map.json http://localhost:81/mapdef_set
curl -H "Content-Type: application/json" -X POST -d@./vals.json http://localhost:81/mapval_set
curl -v -F upload=@//mnt/c/Users/ptrowbridge/Downloads/pncc.csv http://localhost:81/import?srce=PNCC
curl -v -F upload=@//mnt/c/Users/ptrowbridge/Downloads/PAYCOM.csv http://localhost:81/import?srce=PAYCOM

View File

@ -1,454 +1,63 @@
[
{
"name": "Check Number",
"srce": "PNCC",
"name": "Extract month and code",
"srce": "PAYCOM",
"regex": {
"defn": [
{
"key": "{Description}",
"key": "{check_date}",
"map": "n",
"field": "checkn",
"regex": "[^0-9]*([0-9]*)\\s|$",
"flag": "",
"field": "check_month",
"regex": "(\\d{4})-(\\d{2})-\\d{2}",
"retain": "y"
}
],
"where": [
{
"Transaction": "Checks Paid"
}
],
"function": "extract"
},
"sequence": 2
},
{
"name": "Strip Amount Commas",
"srce": "PNCC",
"regex": {
"defn": [
{
"key": "{Amount}",
"map": "n",
"flag": "g",
"field": "amount",
"regex": ",",
"retain": "y",
"replace": ""
}
],
"name": "Strip Amount Commas",
"where": [
{}
],
"function": "replace",
"description": "the Amount field come from PNC with commas embeded so it cannot be cast to numeric"
},
"sequence": 1
},
{
"name": "Trans Type",
"srce": "PNCC",
"regex": {
"defn": [
{
"key": "{AccountName}",
"map": "y",
"field": "acctn",
"regex": "(.*)",
"retain": "n"
},
{
"key": "{Transaction}",
"key": "{loc_code}",
"map": "y",
"field": "trans",
"regex": "(.*)",
"flag": "",
"field": "loc_code_rx",
"regex": ".*",
"retain": "n"
},
{
"key": "{Description}",
"map": "y",
"field": "ini",
"regex": "([\\w].*?)(?=$| -|\\s[0-9].*?|\\s[\\w/]+?:)",
"retain": "y"
}
],
"name": "Trans Type",
"name": "Paycom",
"where": [
{}
],
"function": "extract",
"description": "extract intial description in conjunction with account name and transaction type for mapping"
"description": "extract month and code"
},
"sequence": 1
},
{
"name": "Currency",
"srce": "PNCC",
"name": "SUBSEQUENT PAYOUT",
"srce": "PAYCOM",
"regex": {
"defn": [
{
"key": "{Description}",
"key": "{gl_group}",
"map": "y",
"field": "ini",
"regex": "([\\w].*?)(?=$| -|\\s[0-9].*?|\\s[\\w/]+?:)",
"retain": "y"
"flag": "",
"field": "gl_group",
"regex": ".*",
"retain": "n"
},
{
"key": "{Description}",
"key": "{acct_type_code}",
"map": "y",
"field": "curr1",
"regex": ".*(DEBIT|CREDIT).*(USD|CAD).*(?=DEBIT|CREDIT).*(?=USD|CAD).*",
"retain": "y"
},
{
"key": "{Description}",
"map": "y",
"field": "curr2",
"regex": ".*(?=DEBIT|CREDIT).*(?=USD|CAD).*(DEBIT|CREDIT).*(USD|CAD).*",
"retain": "y"
"flag": "",
"field": "acct_type_code",
"regex": ".*",
"retain": "n"
}
],
"name": "Currency",
"name": "Paycom",
"where": [
{
"Transaction": "Miscellaneous Credits"
},
{
"Transaction": "Miscellaneous Debits"
}
{}
],
"function": "extract",
"description": "pull out currency indicators from description of misc items and map"
},
"sequence": 2
},
{
"name": "Parse ACH Credits",
"srce": "PNCC",
"regex": {
"defn": [
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "beneficiary",
"regex": "Comp Name:(.+?)(?=\\d{6} Com|SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "Cust ID",
"regex": "Cust ID:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "Desc",
"regex": "Desc:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "originator",
"regex": "Cust Name:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "Batch Discr",
"regex": "Batch Discr:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "Comp ID",
"regex": "Comp ID:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "Addenda",
"regex": "Addenda:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "SETT",
"regex": "SETT:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "Date",
"regex": "Date:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "Time",
"regex": "Time:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
}
],
"name": "Parse ACH Credits",
"where": [
{
"Transaction": "ACH Credits"
}
],
"function": "extract",
"description": "parse select components of the description for ACH Credits Receieved"
},
"sequence": 2
},
{
"name": "Parse ACH Debits",
"srce": "PNCC",
"regex": {
"defn": [
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "originator",
"regex": "Comp Name:(.+?)(?=\\d{6} Com|SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "Cust ID",
"regex": "Cust ID:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "Desc",
"regex": "Desc:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "beneficiary",
"regex": "Cust Name:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "Batch Discr",
"regex": "Batch Discr:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "Comp ID",
"regex": "Comp ID:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "Addenda",
"regex": "Addenda:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "SETT",
"regex": "SETT:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "Date",
"regex": "Date:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "Time",
"regex": "Time:(.+?)(?=SEC:|Cust ID:|Desc:|Comp Name:|Comp ID:|Batch Discr:|Cust Name:|Addenda:|SETT:|Date:|Time:|$)",
"retain": "y"
}
],
"name": "Parse ACH Debits",
"where": [
{
"Transaction": "ACH Debits"
}
],
"function": "extract",
"description": "parse select components of the description for ACH Credits Receieved"
},
"sequence": 2
},
{
"name": "Parse Wires",
"srce": "PNCC",
"regex": {
"defn": [
{
"key": "{Description}",
"map": "n",
"flag": "g",
"field": "dparse",
"regex": "([A-Z]{3,}?:)(.*)(?=[A-Z]{3,}?:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "beneficiary_components",
"regex": "BENEFICIARY:(.*?)AC/([\\d-]*) (.*)(?=[A-Z]{3,}?:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "originator_components",
"regex": "ORIGINATOR:(.*?)AC/(\\d*) (.*)(?=[A-Z]{3,}?:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "beneficiary",
"regex": "BENEFICIARY:(.*?)AC/[\\d-]* .*(?=[A-Z]{3,}?:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "originator",
"regex": "ORIGINATOR:(.*?)AC/\\d* .*(?=[A-Z]{3,}?:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "OBI",
"regex": "OBI:(.*?)(?=[A-Z]{3,}?:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "RFB",
"regex": "RFB:(.*?)(?=[A-Z]{3,}?:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "ABA",
"regex": "ABA:(.*?)(?=[A-Z]{3,}?:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "BBI",
"regex": "BBI:(.*?)(?=[A-Z]{3,}?:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "BENEBNK",
"regex": "BENEBNK:(.*?)(?=[A-Z]{3,}?:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "IBK",
"regex": "IBK:(.*?)(?=[A-Z]{3,}?:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "RATE",
"regex": "RATE:(.*?)(?=[A-Z]{3,}?:|$)",
"retain": "y"
},
{
"key": "{Description}",
"map": "n",
"flag": "",
"field": "RECVBNK",
"regex": "RECVBNK:(.*?)(?=[A-Z]{3,}?:|$)",
"retain": "y"
}
],
"name": "Parse Wires",
"where": [
{
"Transaction": "Money Transfer DB - Wire"
},
{
"Transaction": "Money Transfer DB - Other"
},
{
"Transaction": "Money Transfer CR-Wire"
},
{
"Transaction": "Money Transfer CR-Other"
},
{
"Transaction": "Intl Money Transfer Debits"
},
{
"Transaction": "Intl Money Transfer Credits"
}
],
"function": "extract",
"description": "pull out whatever follows OBI in the description until atleast 3 capital letters followed by a colon are encountered"
"description": "map payroll code and account group to subsequent payout"
},
"sequence": 2
}

View File

@ -1,66 +1,194 @@
{
"name": "PNCC",
"constraint": [
"{transaction}",
"{loc_code}",
"{perd_start}",
"{perd_end}"
],
"name": "PAYCOM",
"source": "client_file",
"loading_function": "csv",
"constraint": [
"{AsOfDate}"
],
"schemas": {
"default": [
{
"path": "{AsOfDate}",
"path": "{perd_start}",
"type": "date",
"column_name": "AsOfDate"
"column_name": "perd_start"
},
{
"path": "{BankId}",
"type": "text",
"column_name": "BankId"
"path": "{perd_end}",
"type": "date",
"column_name": "perd_end"
},
{
"path": "{AccountNumber}",
"type": "text",
"column_name": "AccountNumber"
"path": "{check_date}",
"type": "date",
"column_name": "check_date"
},
{
"path": "{AccountName}",
"path": "{loc_code}",
"type": "text",
"column_name": "AccountName"
"column_name": "loc_code"
},
{
"path": "{BaiControl}",
"path": "{loc_descr}",
"type": "text",
"column_name": "BaiControl"
"column_name": "loc_descr"
},
{
"path": "{Currency}",
"path": "{loc_glseg}",
"type": "text",
"column_name": "Currency"
"column_name": "loc_glseg"
},
{
"path": "{Transaction}",
"path": "{loc_over}",
"type": "text",
"column_name": "Transaction"
"column_name": "loc_over"
},
{
"path": "{Reference}",
"path": "{dep_code}",
"type": "text",
"column_name": "Reference"
"column_name": "dep_code"
},
{
"path": "{Amount}",
"path": "{dep_descr}",
"type": "text",
"column_name": "Amount"
"column_name": "dep_descr"
},
{
"path":"{Description}",
"path": "{dep_nat}",
"type": "text",
"column_name": "Description"
"column_name": "dep_nat"
},
{
"path": "{AdditionalRemittance}",
"path": "{dep_over}",
"type": "text",
"column_name": "AdditionalRemittance"
"column_name": "dep_over"
},
{
"path": "{di_code}",
"type": "text",
"column_name": "di_code"
},
{
"path": "{di_descr}",
"type": "text",
"column_name": "di_descr"
},
{
"path": "{di_glseg}",
"type": "text",
"column_name": "di_glseg"
},
{
"path": "{di_over}",
"type": "text",
"column_name": "di_over"
},
{
"path": "{title_code}",
"type": "text",
"column_name": "title_code"
},
{
"path": "{title_descr}",
"type": "text",
"column_name": "title_descr"
},
{
"path": "{title_glseg}",
"type": "text",
"column_name": "title_glseg"
},
{
"path": "{title_over}",
"type": "text",
"column_name": "title_over"
},
{
"path": "{ee_code}",
"type": "text",
"column_name": "ee_code"
},
{
"path": "{ee_glseg}",
"type": "text",
"column_name": "ee_glseg"
},
{
"path": "{ee_over}",
"type": "text",
"column_name": "ee_over"
},
{
"path": "{acct_type_code}",
"type": "text",
"column_name": "acct_type_code"
},
{
"path": "{hours}",
"type": "numeric",
"column_name": "hours"
},
{
"path": "{nat_code}",
"type": "text",
"column_name": "nat_code"
},
{
"path": "{nat_over}",
"type": "text",
"column_name": "nat_over"
},
{
"path": "{gl_ref}",
"type": "text",
"column_name": "gl_ref"
},
{
"path": "{gl_group}",
"type": "text",
"column_name": "gl_group"
},
{
"path": "{gl_descr}",
"type": "text",
"column_name": "gl_descr"
},
{
"path": "{gl_code}",
"type": "text",
"column_name": "gl_code"
},
{
"path": "{gl_amount}",
"type": "numeric",
"column_name": "gl_amount"
},
{
"path": "{pp_code}",
"type": "text",
"column_name": "pp_code"
},
{
"path": "{pp_descr}",
"type": "text",
"column_name": "pp_descr"
},
{
"path": "{pp_gl}",
"type": "text",
"column_name": "pp_gl"
},
{
"path": "{pp_over}",
"type": "text",
"column_name": "pp_over"
},
{
"path": "{transaction}",
"type": "text",
"column_name": "transaction"
}
]
}

File diff suppressed because it is too large Load Diff