X12 generation problem

Good afternoon OpenEMR Users and Developers,

I have noticed a problem with OpenEMR 5.0.3

The problem is when I generate a x12 claim file to be uploaded to office ally.

The claim sometimes is missing the service location info, even though in a lot of other claims this information is correct. Only happens with bluecross/blueshield payer types.

Hope someone helps me out with diagnosing this problem

Here is the link for my error.log file

https://drive.google.com/open?id=0B_Qc48Wwm2_2RUt4VXlYQTdPZms

Regards,

hi @crlsgzmn, is the error in the billing log within OpenEMR (viewed by clicking on view log in the billing manager)? thanks

Hi Stephen,

No, the error is not shown in the error log. Just when I compare X12 files and I submit them to office ally.

The service location (Box32) is blank on that payer type.

If I select another patient/encounter it’s OK.

I already checked the demographics, the encounter summary, and I ran out of ideas of how to troubleshoot it with what I have available right now…

Thanks in advance for the help!

hi @crlsgzmn, do you happen to have a provider # entered in Admin->Practice->Insurance #s ?

Mr. Stephen,

I only have the group number for two insurance companies including BlueCross/BlueShield.

But this also started happening with Careplus. So as this is a new issue that wasn’t present last month, So I can relate maybe if there was any change made to the X12 generation part to be at fault…

Regards,

Adding the insurance numbers doesn’t change the outcome of the X12.

I can’t upload a x12 file since it has sensitive information, but is clearly missing what appears normally in the cms1500 form corresponding to box 32.

Regards,

Doing some troubleshooting figured that if the service location and the billing location have the same NPI the system will omit the service location info.

If I remove the NPI it will show up in the X12, but insurance companies make you put the npi of the billing facility and service location so this is a error I think.

hi @crlsgzmn, thanks for the troubleshooting, before i dig into the 5010 specs is the file rejected at the clearinghouse or is this just something you noticed? thank you

Hi Stephen,

The claim is getting rejected in OfficeAlly and we could confirm in different insurance companies that they were rejecting the claim because the place of service was not being populated. Assuming we have a billing facility that is not a service location, but our npi is there, when we add the npi to service locations the service location won’t appear with it’s NPI on the X12.

I think that the problematic code is here:
*adding 3 backticks to make a code block - stephen

// 4010: REF*1C is required here for the Medicare provider number if NPI was
  // specified in NM109.  Not sure if other payers require anything here.
  // --- apparently ECLAIMS, INC wants the data in 2010 but NOT in 2310B - tony@mi-squared.com
  //
  // 5010 spec says nothing here if NPI was specified.
  //
  if (($CMS_5010 && !$claim->providerNPI() && in_array($claim->providerNumberType(), array('0B','1G','G2','LU')))
      || (!$CMS_5010 && trim($claim->x12gsreceiverid()) != '470819582')) // if NOT ECLAIMS EDI
  {
    if ($claim->providerNumber()) {
      ++$edicount;
      $out .= "REF" .
        "*" . $claim->providerNumberType() .
        "*" . $claim->providerNumber() .
        "~\n";
    }
  }

  // Loop 2310D is omitted in the case of home visits (POS=12).
  if ($claim->facilityPOS() != 12 &&
      (!$CMS_5010 || $claim->facilityNPI() != $claim->billingFacilityNPI()))
    {
    ++$edicount;
    $out .= "NM1" .       // Loop 2310D Service Location
      "*77" .
      "*2";
    //Field length is limited to 35. See nucc dataset page 77 www.nucc.org
    $facilityName = substr($claim->facilityName(), 0, $CMS_5010 ? 60 : 35);
    if ($claim->facilityName() || $claim->facilityNPI() || $claim->facilityETIN()) { $out .=
      "*" . $facilityName;
    }
    if ($claim->facilityNPI() || $claim->facilityETIN()) { $out .=
      "*" .
      "*" .
      "*" .
      "*";
      if ($CMS_5010 || $claim->facilityNPI()) { $out .=
        "*XX*" . $claim->facilityNPI();
      } else { $out .=
        "*24*" . $claim->facilityETIN();
      }
      if (!$claim->facilityNPI()) {
        $log .= "*** Service location has no NPI.\n";
      }
    }
    $out .= "~\n";
    if ($claim->facilityStreet()) {
      ++$edicount;
      $out .= "N3" .
        "*" . $claim->facilityStreet() .
        "~\n";
    }
    if ($claim->facilityState()) {
      ++$edicount;
      $out .= "N4" .
        "*" . $claim->facilityCity() .
        "*" . $claim->facilityState() .
        "*" . stripZipCode($claim->facilityZip()) .
        "~\n";
    }
  }

Regards,

thanks @crlsgzmn, and the facility details look fine under admin->facilities?

ok @crlsgzmn, you’re on the right track, here’s the offending code

you could probably remove the last part of the OR condition for your instance while we formulate a better conditional because the clearinghouse probably doesn’t reject redundant info

if i understand, the only difference is the address so we would need something to test for in the claim class, like this and that

please try it out

I tested the code on my testing enviroment, and the X12 keeps being generated without the service location.

I did change this line, as I think that a lot of practices will have different service locations but the same NPI for all of them…:

     ($claim->facilityStreet() != $claim->billingFacilityStreet())))
    {
    ++$edicount;

It worked perfectly.

Thanks Mr. Waite!

glad you’ve found a solution, i’ve got a pull request so that the community can benefit from your experience.