kputnam / stupidedi

Ruby API for parsing and generating ASC X12 EDI transactions
BSD 3-Clause "New" or "Revised" License
262 stars 137 forks source link

Extend max length of "Name Last or Organization Name" #248

Closed jrohrbaugh closed 2 years ago

jrohrbaugh commented 2 years ago

The billing platform we work with has instructed us to use payor names that are longer than 60 characters. When we generate x12 for those, we receive the error: "value is too long in element NM103 Receiver Name".

I've found a few resources that indicate the max length field should be 80 characters, not 60: https://www.stedi.com/edi/x12-008010/segment/NM1?account=4a37fdae-d1b4-4707-b7cd-8d96e695ddf3 https://ushik.ahrq.gov/ViewItemDetails?&system=apcd&itemKey=196701000

kputnam commented 2 years ago

Hi Josh, the first link you sent was for X12 008010, a newer version that hasn't been mandated by HHS. Looking at the 005010 version you can see the correct length is 60. Therefore I can't accept these changes, it could allow other users to generate and send invalid files without realizing until a while later.

However, you can create a copy of the transaction set (837?) and override this MaxLength attribute (example: https://github.com/kputnam/stupidedi/blob/master/lib/stupidedi/transaction_sets/005010/implementations/X223A3-HC837.rb#L29). I don't think there are constraints imposed on what lengths you can change it to using b::MaxLength, so you should be able to make it longer than what the element is defined to be for cases like this.

Since this will be a new TransactionSetDef, you will need to update the Config given to Stupidedi::Parser::BuilderDsl or Stupidedi::Parser.build. You can overwrite an existing config entry, so you can start with Config.hipaa if that's what you have been using and wire in your custom TransactionSetDef shown here.

Since you may have other trading partners that won't accept values longer than 60 characters in that element, you can choose the grammar based on where the file is going.

jrohrbaugh commented 2 years ago

Good to know, thanks! I'm just starting to dip my toes into the world of x12, so I really appreciate the detailed response.