Example
If the EDI file output is not required to have format, the format
property should be in false.
The value of input
will be:
{
"header": [
"01",
"0000000000",
"01",
"0000000000",
"ZZ",
"ABCDEFGHIJKLMNO",
"ZZ",
"123456789012345",
"101127",
"1719",
"U",
"00400",
"3438",
"0",
"P",
">"
],
"options": {
"elementDelimiter": "/",
"endOfLine": "\n"
},
"functionalGroups": [
{
"header": [
"PO",
"4405197800",
"999999999",
"20101127",
"1719",
"1421",
"X",
"004010VICS"
],
"transactions": [
{
"header": [
"277",
"0003",
"005010X364"
],
"segments": [
{
"tag": "BHT",
"elements": [
"0085",
"08",
"0000221",
"20190221",
"1025"
]
},
{
"tag": "HL",
"elements": [
"1",
"",
"20",
"1"
]
},
{
"tag": "NM1",
"elements": [
"ACV",
"2",
"ALL PAYER CLAIMS DATABASE",
"",
"",
"",
"",
"46",
"APCD01"
]
},
{
"tag": "TRN",
"elements": [
"1",
"ABC12345"
]
},
{
"tag": "DTP",
"elements": [
"050",
"D8",
"20190220"
]
},
{
"tag": "DTP",
"elements": [
"009",
"D8",
"20190221"
]
},
{
"tag": "HL",
"elements": [
"2",
"1",
"21",
"1"
]
},
{
"tag": "NM1",
"elements": [
"40",
"2",
"YOUR INSURANCE COMPANY",
"",
"",
"",
"",
"46",
"S00003"
]
},
{
"tag": "TRN",
"elements": [
"2",
"206438976580901"
]
},
{
"tag": "STC",
"elements": [
"DR02:20",
"20190221",
"WQ",
"365.5"
]
},
{
"tag": "QTY",
"elements": [
"90",
"3"
]
},
{
"tag": "QTY",
"elements": [
"AA",
"2"
]
},
{
"tag": "AMT",
"elements": [
"YU",
"200.5"
]
},
{
"tag": "AMT",
"elements": [
"YY",
"165"
]
},
{
"tag": "HL",
"elements": [
"3",
"2",
"19",
"1"
]
},
{
"tag": "NM1",
"elements": [
"85",
"1",
"JONES",
"HARRY",
"B",
"",
"MD",
"XX",
"1546326897"
]
},
{
"tag": "HL",
"elements": [
"4",
"3",
"PT"
]
},
{
"tag": "NM1",
"elements": [
"QC",
"1",
"PATIENT",
"FEMALE",
"",
"",
"",
"MI",
"2222222222"
]
},
{
"tag": "TRN",
"elements": [
"2",
"PATIENT22222"
]
},
{
"tag": "STC",
"elements": [
"DR02:20:PR",
"20190221",
"WQ",
"100"
]
},
{
"tag": "REF",
"elements": [
"F8",
"IC847502"
]
},
{
"tag": "REF",
"elements": [
"1K",
"220216359803X"
]
},
{
"tag": "DTP",
"elements": [
"472",
"D8",
"20190214"
]
},
{
"tag": "HL",
"elements": [
"5",
"3",
"PT"
]
},
{
"tag": "NM1",
"elements": [
"QC",
"1",
"PATIENT",
"MALE",
"",
"",
"",
"MI",
"3333333333"
]
},
{
"tag": "TRN",
"elements": [
"2",
"PATIENT33333"
]
},
{
"tag": "STC",
"elements": [
"DR06:21",
"20190221",
"U",
"65",
"",
"",
"",
"",
"",
"DR06:255"
]
},
{
"tag": "REF",
"elements": [
"F8",
"IC429783"
]
},
{
"tag": "REF",
"elements": [
"1K",
"220216359954X"
]
},
{
"tag": "DTP",
"elements": [
"472",
"D8",
"20190121"
]
},
{
"tag": "HL",
"elements": [
"6",
"3",
"PT"
]
},
{
"tag": "NM1",
"elements": [
"QC",
"1",
"JONES",
"LARRY",
"",
"",
"",
"MI",
"4444444444"
]
},
{
"tag": "TRN",
"elements": [
"2",
"JONES44444"
]
},
{
"tag": "STC",
"elements": [
"DR03:26:77",
"20190221",
"U",
"100"
]
},
{
"tag": "REF",
"elements": [
"F8",
"IC429805"
]
},
{
"tag": "REF",
"elements": [
"1K",
"220216359964X"
]
},
{
"tag": "DTP",
"elements": [
"472",
"D8",
"20190211"
]
},
{
"tag": "HL",
"elements": [
"7",
"2",
"19",
"1"
]
},
{
"tag": "NM1",
"elements": [
"85",
"1",
"SMITH",
"JOHN",
"C",
"",
"MD",
"XX",
"1546326780"
]
},
{
"tag": "TRN",
"elements": [
"1",
"0"
]
},
{
"tag": "REF",
"elements": [
"LU",
"AB142"
]
},
{
"tag": "QTY",
"elements": [
"QA",
"2"
]
},
{
"tag": "AMT",
"elements": [
"YU",
"100.5"
]
},
{
"tag": "HL",
"elements": [
"8",
"7",
"PT"
]
},
{
"tag": "NM1",
"elements": [
"QC",
"1",
"JOHNSON",
"MARY",
"",
"",
"",
"MI",
"5555555555"
]
},
{
"tag": "TRN",
"elements": [
"2",
"JOHNSON55555"
]
},
{
"tag": "STC",
"elements": [
"DR08:20:PR",
"20190221",
"EZ",
"50.5"
]
},
{
"tag": "REF",
"elements": [
"F8",
"IC429888"
]
},
{
"tag": "REF",
"elements": [
"1K",
"220216359806X"
]
},
{
"tag": "DTP",
"elements": [
"472",
"D8",
"20190210"
]
},
{
"tag": "SVC",
"elements": [
"HC:G9938",
"50.5",
"",
"",
"",
"",
"1"
]
},
{
"tag": "STC",
"elements": [
"DR08:475",
"",
"EZ"
]
},
{
"tag": "REF",
"elements": [
"6R",
"1"
]
},
{
"tag": "DTP",
"elements": [
"472",
"D8",
"20190210"
]
},
{
"tag": "HL",
"elements": [
"9",
"7",
"PT"
]
},
{
"tag": "NM1",
"elements": [
"QC",
"1",
"MILLS",
"HARRIETT",
"",
"",
"",
"MI",
"6666666666"
]
},
{
"tag": "TRN",
"elements": [
"2",
"MILLS66666"
]
},
{
"tag": "STC",
"elements": [
"DR02:20:PR",
"20190221",
"WQ",
"50"
]
},
{
"tag": "REF",
"elements": [
"F8",
"IC429956"
]
},
{
"tag": "REF",
"elements": [
"1K",
"220216359807X"
]
},
{
"tag": "DTP",
"elements": [
"472",
"D8",
"20190205"
]
}
]
}
]
}
]
}
This example uses the object objectJsonToEdi
let properties = {
...objectJsonToEdi
};
properties.header = data.header;
properties.functionalGroups = data.functionalGroups;
const _data = await processJSToEDI({
data: properties
}, data);
console.log(_data);
In this second example the information is configured without the object described above, the properties used are:
let properties = {
options:{
elementDelimiter: '/',
endOfLine: '\n'
};
properties.headers = data.headers;
properties.functionalGroups = data.functionalGroups;
};
const _data = await processEdiToJSON({
data: properties
}, {}, true);
console.log(_data)
Result:
ISA/01/0000000000/01/0000000000/ZZ/ABCDEFGHIJKLMNO/ZZ/123456789012345/101127/1719/U/00400/000003438/0/P/>~
GS/PO/4405197800/999999999/20101127/1719/1421/X/004010VICS~
ST/277/0003/005010X364~
BHT/0085/08/0000221/20190221/1025~
HL/1//20/1~
NM1/ACV/2/ALL PAYER CLAIMS DATABASE/////46/APCD01~
TRN/1/ABC12345~
DTP/050/D8/20190220~
DTP/009/D8/20190221~
HL/2/1/21/1~
NM1/40/2/YOUR INSURANCE COMPANY/////46/S00003~
TRN/2/206438976580901~
STC/DR02:20/20190221/WQ/365.5~
QTY/90/3~
QTY/AA/2~
AMT/YU/200.5~
AMT/YY/165~
HL/3/2/19/1~
NM1/85/1/JONES/HARRY/B//MD/XX/1546326897~
HL/4/3/PT~
NM1/QC/1/PATIENT/FEMALE////MI/2222222222~
TRN/2/PATIENT22222~
STC/DR02:20:PR/20190221/WQ/100~
REF/F8/IC847502~
REF/1K/220216359803X~
DTP/472/D8/20190214~
HL/5/3/PT~
NM1/QC/1/PATIENT/MALE////MI/3333333333~
TRN/2/PATIENT33333~
STC/DR06:21/20190221/U/65//////DR06:255~
REF/F8/IC429783~
REF/1K/220216359954X~
DTP/472/D8/20190121~
HL/6/3/PT~
NM1/QC/1/JONES/LARRY////MI/4444444444~
TRN/2/JONES44444~
STC/DR03:26:77/20190221/U/100~
REF/F8/IC429805~
REF/1K/220216359964X~
DTP/472/D8/20190211~
HL/7/2/19/1~
NM1/85/1/SMITH/JOHN/C//MD/XX/1546326780~
TRN/1/0~
REF/LU/AB142~
QTY/QA/2~
AMT/YU/100.5~
HL/8/7/PT~
NM1/QC/1/JOHNSON/MARY////MI/5555555555~
TRN/2/JOHNSON55555~
STC/DR08:20:PR/20190221/EZ/50.5~
REF/F8/IC429888~
REF/1K/220216359806X~
DTP/472/D8/20190210~
SVC/HC:G9938/50.5/////1~
STC/DR08:475//EZ~
REF/6R/1~
DTP/472/D8/20190210~
HL/9/7/PT~
NM1/QC/1/MILLS/HARRIETT////MI/6666666666~
TRN/2/MILLS66666~
STC/DR02:20:PR/20190221/WQ/50~
REF/F8/IC429956~
REF/1K/220216359807X~
DTP/472/D8/20190205~
SE/63/0003~
GE/1/1421~
IEA/1/000003438~
Note: In this example /
is used to indicate the separator of each element, however this symbol is replacing the default delimiter character *
.