Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rdpcrystal-edi-library

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rdpcrystal-edi-library - npm Package Compare versions

Comparing version 1.2.8 to 1.2.9

examples/parsedocument/enummap.js

2

package.json
{
"name": "rdpcrystal-edi-library",
"version": "1.2.8",
"version": "1.2.9",
"description": "ASCII X12 EDI Library, Create, Parse, Load, Validate, View, Edit, Split, Join And Scrub EDI Data",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -19,2 +19,150 @@ # RDPCrystal EDI Library

## Parse an 5010 837I X12 EDI File
```javascript
/// <reference path="../../lib/RDPCrystalEDILibrary.d.ts" />
const edi = require('../../lib/RDPCrystalEDILibrary').RDPCrystalEDILibrary;
const fs = require('fs');
const enumMap = require('./enummap');
let map = new enumMap();
//Create a new validator
let validator = new edi.EDIValidator();
//Load a 5010 270 validation rules
let validationRules = fs.readFileSync('../../validationrules/5010/Rules_5010_837I_005010X223A2.Rules').toString();
validator.EDIRulesFileData = validationRules;
//Set the EDI data to validate and load. This can also be read in from a file
//Set EDI data to validate and load
validator.EDIDataString = "ISA*00* *00* *ZZ*87726 *ZZ*593697504 *120815*0801*^*00501*000000001*0*T*:~" +
"GS*HC*87726*BOAFHC*20120815*080159*1*X*005010X223A2~"+
"ST*837*000000001*005010X223A2~"+
"BHT*0019*00*000000001*20120815*080159*CH~"+
"NM1*41*2*UNITED HEALTH*****46*12345~"+
"PER*IC*TOM JONES*TE*1234567891~"+
"NM1*40*2*UNITED HEALTH*****46*87726~"+
"HL*1**20*1~"+
"NM1*85*2*HOSPITAL INC*****XX*12345~"+
"N3*PO BOX 633571~"+
"N4*CINCINNATI*OH*452633571~"+
"REF*EI*12345~"+
"HL*2*1*22*0~"+
"SBR*P*18*12345*GE*****13~"+
"NM1*IL*1*VAZQUEW*SMITH****MI*123456~"+
"N3*1234 LAKE~"+
"N4*FAIRFIELD*OH*12345~"+
"DMG*D8*19520206*M~"+
"NM1*PR*2*BANK OF AMERICA*****PI*123456~"+
"CLM*10000014893900*2017.85***22:A:1**A*Y*Y~"+
"DTP*434*RD8*20120723-20120723~"+
"CL1*1*7*30~"+
"REF*D9*123456~"+
"HI*BK:7244~"+
"HI*BF:4019*BF:2720*BF:25000*BF:2749*BF:V4582*BF:7244~"+
"NM1*71*1*ORLANDO*SING~"+
"LX*1~"+
"SV2*250*HC:OPS*2017.85*UN*1**0~"+
"DTP*47xx2*RD8*20120723-20120723~"+
"SVD*87726*1378.4*HC:OPS**0*0~"+
"CAS*PR*1*0*0*2*344.6*0*3*0*0~"+
"DTP*573*D8*20120814~"+
"HL*3**20*1~"+
"NM1*85*2*HOSPITAL INC*****XX*123456~"+
"N3*PO BOX 633571~"+
"N4*CINCINNATI*OH*452633571~"+
"REF*EI*123456~"+
"HL*4*3*22*1~"+
"SBR*P*18*304000*GE*****13~"+
"NM1*IL*1*Gates*Bill****MI*12345~"+
"N3*999 EASTWICK~"+
"N4*CINCINNATI*NY*12345~"+
"DMG*D8*19440928*M~"+
"NM1*PR*2*BANK*****PI*12345~"+
"HL*5*4*23*0~"+
"PAT*01~"+
"NM1*QC*1*Gates*Bill~"+
"N3*999 EASTWICK~"+
"N4*CINCINNATI*NY*12345~"+
"DMG*D8*19540531*F~"+
"CLM*10000015567100*1820.32***22:A:1**A*Y*Y~"+
"DTP*434*RD8*20120727-20120727~"+
"CL1*1*7*30~"+
"REF*D9*12345~"+
"HI*BK:V7651~"+
"HI*BF:4550*BF:4019*BF:V1272*BF:V7651~"+
"NM1*71*1*MCDONALD*RONALD~"+
"LX*1~"+
"SV2*250*HC:OPS*1820.32*UN*4**0~"+
"DTP*472*RD8*20120727-20120727~"+
"SVD*87726*1348.62*HC:OPS**0*0~"+
"CAS*PR*1*134.55*0*2*337.15*0*3*0*0~"+
"DTP*573*D8*20120814~"+
"SE*60*000000001~"+
"GE*1*1~"+
"IEA*1*000000001~";
console.log("Validating 5010 837I EDI File");
validator.validate();
//Get the EDI document loaded into memory
let loadedEDIFile = validator.EDILightWeightDocument;
//Get EDI Data
let stTransaction = loadedEDIFile.Loops.getItem(0).getLoop("INTERCHANGE HEADER/FUNCTIONAL GROUP/ST HEADER")
let stSegment = stTransaction.getSegment("ST");
let ediData = "";
ediData += "Transaction Name = " + stSegment.Name + "\n";
ediData += "Transaction Number = " + stSegment.Elements.getItem(1).DataValue + "\n";
ediData += "Transaction Impl = " + stSegment.Elements.getItem(2).DataValue + "\n";
ediData += "\n";
//Get all billing providers
let billingProviderLoops = stTransaction.getLoops("2000A");
for(let i=0;i < billingProviderLoops.Count;i++)
{
//Get billing provider name
let billingProviderLoop = billingProviderLoops.getItem(i).getLoop("2010AA");
let billingProviderNameSegment = billingProviderLoop.getSegment("NM1");
ediData += "Billing Provider = " + billingProviderNameSegment.Elements.getItem(2).DataValue+ "\n";
//Get subscriber name
let subscriberLoop = billingProviderLoops.getItem(i).getLoop("2000B/2010BA");
let subscriberNameSegment = subscriberLoop.getSegment("NM1");
ediData += "Subscriber Name = " + subscriberNameSegment.Elements.getItem(2).DataValue+ "\n";
//Get the claim loop
let claimLoop = billingProviderLoops.getItem(i).getLoop("2000B/2300");
if (claimLoop == null){
claimLoop = billingProviderLoops.getItem(i).getLoop("2000B/2000C/2300");
}
let claimSegment = claimLoop.getSegment("CLM");
ediData += "Claim ID = " + claimSegment.Elements.getItem(0).DataValue + "\n";
ediData += "Claim Price = " + claimSegment.Elements.getItem(1).DataValue + "\n";
let serviceLoops = claimLoop.getLoops("2400");
for(let j=0;j < serviceLoops.Count;j++)
{
let serviceSegment = serviceLoops.getItem(j).getSegment("SV2");
ediData += "Service Price= " + serviceSegment.Elements.getItem(2).DataValue+ "\n";
}
ediData += "\n\n";
}
console.log(ediData);
```
## Validate an X12 EDI File

@@ -21,0 +169,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc