Sidebar

Can you perform NodePath filtering on FixedLength records?

0 votes
334 views
asked Sep 30, 2021 by scott-b-8720 (560 points)

I've got a source file that is fixed length and uses specific beginning characters to start each row.  It looks roughly like this:

01PatientInfo
02GuarantorInfo
03Insurance1Info
04Insurance2Info
05Insurance3Info
11ChargeInfo

The catch is that if there is no secondary or tertiary info I don't get a 04 (or a 05) line.  Rather, it looks like this:

01PatientInfo
02GuarantorInfo
03Insurance1Info
11ChargeInfo

I can access the secondary info using typical index-based nodepath syntax such as "3,10[4]", which references the fourth line of data from the 3rd character for a length of 10, but if there isn't a secondary insurance present that ends up giving me data from the "11" row.  Is there a way to do something like "3,10[@0,2=04]" (similar to how nodepath filtering works for HL7 data) to specifically get the characters from the row where the value at 0,2 is "04"?  I've tried using the nodepath like what is listed here, but that doesn't seem to work

1 Answer

0 votes

Unfortunately we do not have a [@start,length=value] filter for the fixed width at this time.  But I will put an enhancement request in for it.

Here is some sample code that I am able to extract out and process each row based on your example data:

var rowCount = message.getCount('/');
qie.debug("rowCount = " + rowCount);
for (var i = 0; i < rowCount; i++) {
   var rowKey = message.getNode("1,2[" + i + "]");
   var rowValue = message.getNode("3,10[" + i + "]");
   qie.debug("rowKey = " + rowKey);
   if (StringUtils.equalsIgnoreCase("01", rowKey)) {
      // process Patient Info
      qie.debug("patient = " + rowValue);
   } else if (StringUtils.equalsIgnoreCase("02", rowKey)) {
      // process Guarantor Info
      qie.debug("guarantor = " + rowValue);
   } else if (StringUtils.equalsIgnoreCase("03", rowKey)) {
      // process Insurance1 Info
      qie.debug("insurance1 = " + rowValue);
   } else if (StringUtils.equalsIgnoreCase("04", rowKey)) {
      // process Insurance2 Info
      qie.debug("insurance2 = " + rowValue);
   } else if (StringUtils.equalsIgnoreCase("05", rowKey)) {
      // process Insurance3 Info
      qie.debug("insurance3 = " + rowValue);
   } else if (StringUtils.equalsIgnoreCase("11", rowKey)) {
      // process Charge Info
      qie.debug("charge = " + rowValue);
   } else {
      qie.debug("Unknown... " + rowKey + rowValue);
   }
}

answered Sep 30, 2021 by mike-r-7535 (13,830 points)
...