Billing with version 2.9.0

xiaoanri wrote on Sunday, September 21, 2008:

I installed the new 2.9.0 version and tried to send x12 files to OfficeAlly–the clearing house I use.  I got the following errors: 

Warning: Element Error occurs at Line Number = 30; Segment Name = HI; Element Position = 4; Invalid data = (HI); Element Number = HI; Error Number = 6: Invalid character in data element.;
Warning: Element Error occurs at Line Number = 33; Segment Name = PRV; Element Position = 2; Invalid data = (207LP2900X); Element Number = 128; Error Number = 5: Data element too long.;
Warning: Element Error occurs at Line Number = 33; Segment Name = PRV; Element Position = 2; Invalid data = (207LP2900X); Element Number = 128; Error Number = 7: Invalid code value.;
Warning: Element Error occurs at Line Number = 35; Segment Name = PRV; Element Position = 2; Invalid data = (207LP2900X); Element Number = 128; Error Number = 5: Data element too long.;
Warning: Element Error occurs at Line Number = 35; Segment Name = PRV; Element Position = 2; Invalid data = (207LP2900X); Element Number = 128; Error Number = 7: Invalid code value.;

It seems there are data errors regarding the taxonomy code area and an area with data "HI".  May I ask for some directions on how to fix that, which file should I go into and what should I change? 

By the way, I only have the Open EMR and do not have any other softwares (php-gacl, etc.)installed, if that is of importance. 

Thank you very much in advance. 

Hui

gutiersa wrote on Tuesday, September 23, 2008:

The file you want is openemr/library/gen_x12_837.inc.php. I was just doing some troubleshooting there myself. It’s hard to help without looking at your actual 837 file (the one you uploaded to officeally (I use them too, and I know they give specific info on the error.)

Looks like you are giving them the string “HI” when they are expecting  another string or nothing. This makes sense since the name of the segment (that is HI) should appear at the begining and nowhere else within the segment. Openemr must be putting in the wrong data at that position. Again, this depends on your actual claim. I don’t think I have ever needed a HI segment, in my claims. It depends on what came just before this segment in your particular claim.

The HI segment is used for the following:

       HI      Principal, Admitting, E-Code, Patient Reason for Visit      Loop 2300
     HI     Diagnosis Related Group (DRG) Information                     Loop 2300
     HI     Other Diagnosis Information                                              Loop 2300
     HI     Principal Procedure Information                                     Loop 2300
     HI     Other Procedure Information                                             Loop 2300
     HI     Occurrence Span Information                                           Loop 2300
     HI     Occurrence Information                                                       Loop 2300
     HI     Value Information                                                            Loop 2300
    HI     Condition Information                                                          Loop 2300

This is some of the stuff that can go before and after your HI segment:
                                DTP      Admission Date/Hour
                CL1     Institutional Claim Code
                REF     Medical Record Number
                NTE     Claim Note
    -->                 HI     Principal, Admitting, E-Code, Patient Reason for Visit
    -->            HI     Other Diagnosis Information
    -->            HI     Principal Procedure Information
    -->            HI     Other Procedure Information
    -->            HI     Value Information

                LOOP ID     2310A ATTENDING PHYSICIAN NAME     (1)
                NM1     Attending Physician Name
                REF     Attending Physician Secondary ID

Here are some samples of what it can look like:

Example:  HI*BK:63491*PR:63491~
Example reporting HI01 thru HI06:   HI*BF:99591::::::::*BF:5789::::::::*BF:2851::::::::*BF:5849::::::::*BF:40391::::::::*BF:4538::::::::~
Example:  HI*BR:3614:D8:20060413~
Example:  HI*BQ:3963:D8:20060413*BQ:3964:D8:20060413~
Example:  HI*BH:01:D8:20061124~
Example:  HI*BE:83:::6.00~
Example:  HI*BG:17~

Again which is applicable depends on your particular claim.

I hope this helps you narrow down the first error. I wish I could help more. I hope this info is accurate.

good luck

xiaoanri wrote on Tuesday, September 23, 2008:

Hi, Dr. G:

Thank you very much for the response, that directed me to further look at the details of the x12 file.  Here is what I found possibly the problem. 

I processed the same claim with the old functional claim software and compared the 2 X12 files and found the differences: 

1. The "HI" section was immediately after the CLIA Number (we do some basic lab work in clinic) of the clinic, and followed by "NM1" section, the difference is that in the correct file, there is a "*BK:" with primary diagnosis right after that. In the incorrect file, the "*BK:" and primary diagnosis part is missing.

2. In the incorrect file, the taxonomy code appears twice:  they both show up right after my NPI number, but the first time the segament "~PRV*RF*207LP2900X" replaced the segament "~REF*1G*" in the correct file, and the second time it showed up in the same place where the correct file has the Taxonomy code, but is missing "ZZ*" right after "~PRV*PE*".  

Here is the script: 

from correct, processable file:

"…~REF*G1*1516001~REF*X4*10D1084291~HI*BK:V5883~NM1*DN*1*ZHU*HUI****XX*1043283617~REF*1G*~NM1*82*1*ZHU*HUI****XX*1043283617~PRV*PE*ZZ*207Q00000X~NM1*77*2*…"

from incorrect, unprocessable file: 

"…~REF*G1*1516001~REF*X4*10D1084291~HI~NM1*DN*1*ZHU*HUI****XX*1043283617~PRV*RF*207LP2900X~NM1*82*1*ZHU*HUI****XX*1043283617~PRV*PE*207LP2900X~NM1*77*2*…"

Any suggestions/instructions on how to correct that would be greatly appreciated!

Thank you.

Hui

gutiersa wrote on Tuesday, September 23, 2008:

is V5883 your first or second diagnosis code?

gutiersa wrote on Tuesday, September 23, 2008:

Now that I remember, the new gen_x12_837.inc.php that comes with openemr2.9.0 did not work for me. I went back to using the one from openemr2.8.3.

gutiersa wrote on Tuesday, September 23, 2008:

the following section  starting at line 473 in the gen_x12_837.inc.php from  the 2.9.0 version has been commented out:

  /*******************************************************************
  ++$edicount;
  $out .= "PRV" .       // Rendering Provider Information
    "*PE" .
    "*ZZ" .
    "*207Q00000X" .
    "~\n";
  *******************************************************************/
  if ($claim->providerTaxonomy()) {
    ++$edicount;
    $out .= "PRV" .
      "*PE" . // PErforming provider
      "*" . $claim->providerTaxonomy() .
      "~\n";
  }

I think the commented out section would give you a result closer to the corrected claim.

xiaoanri wrote on Tuesday, September 23, 2008:

That is the first diagnosis code.  we use that to bill urine tox screening.

xiaoanri wrote on Wednesday, September 24, 2008:

I was able to fix the two errors on the taxonomy code–at least it generates the file that looks more like the correct file.  Here is what I did: 

After Line 440, I added ""*ZZ"  . " as shown below:

    if ($claim->referrerTaxonomy()) {
      ++$edicount;
      $out .= "PRV" .
        "*RF" . // ReFerring provider
        "*ZZ" .                               <==== this is the line I added. 
        "*" . $claim->referrerTaxonomy() .
        "~\n";
    }

The commented part you specified in the prior email, starting form line 473, I erased the first part,  and inserted the ""*ZZ"  ." again.  Here is how it looks like:  

  if ($claim->providerTaxonomy()) {
    ++$edicount;
    $out .= "PRV" .     // PErforming provider
      "*PE" .
      "*ZZ" .
      "*" . $claim->providerTaxonomy() .
      "~\n";
  }

I will try to figure out the error in the "HI" section, and will report later. 

Also, there is a "$diag" in that section, anybody knows where it was defined?

Thank you. 

Hui

gutiersa wrote on Thursday, September 25, 2008:

Comments

1. consider using the old version of gen_x12_837.inc.php (that is the one from openemr version 2.8.3) rather than modifying the new one. Especially if you find that you are just restoring lines that were commented out of the code, in going from the old to the new.

2. make a back up copy of the file before you modify it. (you are probably doing so already.) I have made my complete openemer unusable just by accidental file modifications. Then I ended up having to re-install the whole thing.
Usually what I do, is I make a copy of the file named filenameOrig.fileextension, and leave it in that same folder. When I need to know which files I have modified, I just do a search for *Orig* in all of openemr. Orig stands for original. That means the original file that came with that version of openemr. So in /openemr/library I have 2 files:
gen_x12_837.incOrig.php
and
gen_x12_837.inc.php

2. Finally, is the information for officeally configured  correctly? Go to Admin, Practice, x12 partners, OfficeAlly (or whatever you named your clearinghouse) and double check that under processing format you have selected standard. I think this can affect the resulting x12 file.

Keep reporting!

xiaoanri wrote on Saturday, September 27, 2008:

I have tried the old version of gen_x12_837.inc.php and did not see any difference in the "HI" segment. Also checked and OfficeAlly configuration, it was standard.  I compared the section in gen_x12_837.php file (from 2.9.0 vs 2.8.3) and found they are exactly the same: 

  $da = $claim->diagArray();
  ++$edicount;
  $out .= “HI”;         // Health Diagnosis Codes
  $diag_type_code = ‘BK’;
  foreach ($da as $diag) {
    $out .= “*$diag_type_code:” . $diag;
    $diag_type_code = ‘BF’;
  }
  $out .= “~\n”;

Then I looked at the Claim.class.php file in library folder, and found the relative section was changed:

In version 2.8.3, from line 748:

  // Returns an array of unique primary diagnoses.  Periods are stripped.
  function diagArray() {
    $da = array();
    foreach ($this->procs as $row) {
      $tmp = explode(’:’, $row[‘justify’]);
      if (count($tmp)) {
        $diag = str_replace(’.’, ‘’, $tmp[0]);
        $da[$diag] = $diag;
      }
    }
    return $da;
  }

  // Compute the 1-relative index in diagArray for the given procedure.
  function diagIndex($prockey) {
    $da = $this->diagArray();
    $tmp = explode(’:’, $this->procs[$prockey][‘justify’]);
    if (empty($tmp)) return ‘’;
    $diag = str_replace(’.’, ‘’, $tmp[0]);
    $i = 0;
    foreach ($da as $value) {
      ++$i;
      if (strcmp($value,$diag) == 0) return $i;
    }
    return ‘’;
  }

In version 2.9.0, from line 880:

  // Returns an array of unique diagnoses.  Periods are stripped.
  function diagArray() {
    $da = array();
    foreach ($this->procs as $row) {
      $atmp = explode(’:’, $row[‘justify’]);
      foreach ($atmp as $tmp) {
        if (!empty($tmp)) {
          $diag = str_replace(’.’, ‘’, $tmp);
          $da[$diag] = $diag;
        }
      }
    }
    return $da;
  }

  // Compute one 1-relative index in diagArray for the given procedure.
  // This function is obsolete, use diagIndexArray() instead.
  function diagIndex($prockey) {
    $da = $this->diagArray();
    $tmp = explode(’:’, $this->procs[$prockey][‘justify’]);
    if (empty($tmp)) return ‘’;
    $diag = str_replace(’.’, ‘’, $tmp[0]);
    $i = 0;
    foreach ($da as $value) {
      ++$i;
      if (strcmp($value,$diag) == 0) return $i;
    }
    return ‘’;
  }

  // Compute array of 1-relative diagArray indices for the given procedure.
  function diagIndexArray($prockey) {
    $dia = array();
    $da = $this->diagArray();
    $atmp = explode(’:’, $this->procs[$prockey][‘justify’]);
    foreach ($atmp as $tmp) {
      if (!empty($tmp)) {
        $diag = str_replace(’.’, ‘’, $tmp);
        $i = 0;
        foreach ($da as $value) {
          ++$i;
          if (strcmp($value,$diag) == 0) $dia[] = $i;
        }
      }
    }
    return $dia;
  }

Then I tried to replace line 886 in new version:

" if (!empty($tmp)) {"

with line 753 in old version:

" if (count($tmp)) {"

That change added the "BK:" after the "HI", instead of "~HI~NM1…", now I got "~HI*BK:~NM1…".  There is still no diagnosis code after "BK:".  Also of interest is I assume the secondary diagnosis code should show after "BF:" after looking at the code, but found none of  the prior X12 files I sent out before with OEMR 2.8.3 had secondary diagonosis or BF code.  I do not know if this is my own problem or a common problem? 

Do not know what to do next.  Any comments appreciated! 

Hui

sunsetsystems wrote on Saturday, September 27, 2008:

I checked in a fix (to gen_x12_837.inc.php) for the missing *ZZ.

As far as the empty HI segment, it sounds  a lot like your procedure codes have not been "justified" (linked to a diagnosis), and so there are no eligible diagnoses.

Rod
www.sunsetsystems.com

xiaoanri wrote on Saturday, September 27, 2008:

We have always paid attention to justify the diagnosis, I also double checked that just now.  with the 2.83 version, I will have the "BK:" plus the first diagnosis code in the HI section. with the new 2.9.0 version, I can only get an empty "HI" with nothing following.  I checked some of the old X12 files, as well as the record from the clearing house, which are HCFA images, there has been only one diagnosis, none of  the secondary diagnosis are posted, there were no "BF" in the x12 file either.
Thank you,
Hui

xiaoanri wrote on Saturday, September 27, 2008:

I rechecked the data, and apologize I did foget to justify the procedure with diagnosis for the patient I am testing with 2.9.0.  After I "justify", the segment looks like this:  "~HI*BK:7*BF:v*BF:~NM1…".  The original 4 diagnosis codes are:  "722.4, 723.4, 729.1,v58.69".  It seems the program now allows 3 diagnosis, but only allows one digit for the first 2 codes and no diget for the third.  What should I do now? 

sunsetsystems wrote on Saturday, September 27, 2008:

Seems like the values in the “justify” column of your billing table are messed up.  Why don’t you go to the Database area and see what’s in there.  Something’s not right.

Rod
www.sunsetsystems.com

xiaoanri wrote on Saturday, September 27, 2008:

Here is what I got in the justify part of billing table:

Field: justify
Type: VARCHAR
Length/Values: 255
Null: null
Default: NULL

All other values are empty. 
Thanks, Hui

xiaoanri wrote on Sunday, September 28, 2008:

It worked finally. All I did was getting  to the database area as Rod suggested, and looked at the values in Justify section and resaved it without changing any values.  I do not understand but the x12 files has the diagnosis codes now. 

Thank you all for your help!

Hui

voipbound wrote on Thursday, October 30, 2008:

I have been following this thread and made some changes.  I have not done the modifications as Hui did and I have not replaced my 2.9 x12 version with the 2.83.  I have gone in and resave the justification table as Hui did.  Here is my x12 submission and the error I received from OfficeAlly.  I have x’ed out sensitive data.

ISA*00*          *00*          *ZZ*               *ZZ*               *081023*1555*U*00401*020413196*0*P*:~GS*HC***20081023*1555*1*X*004010X098A1~ST*837*0001~BHT*0019*00*0123*20081023*1023*CH~REF*87*004010X098A1~NM1*41*2*FIRSTMEDICAL*****46*xxxxxxxxx~PER*IC**TE*xxxxxxxxxx~NM1*40*2*OFFICE ALLY*****46*~HL*1**20*1~NM1*85*2*FIRSTMEDICAL*****XX*xxxxxxxxxx~N3*1000 SILVER RD, STE 100~N4*REMOTE*CA*12345-6789~REF*EI*xxxxxxxxx~REF*1C*xxxxxxxxxx~NM1*87*2*FIRSTMEDICAL*****XX*xxxxxxxxxx~N3*1000 SILVER RD, STE 100~N4*REMOTE*CA*12345-6789~REF*EI*xxxxxxxxx~HL*2*1*22*0~SBR*P*18*******MB~NM1*IL*1*ZEBRA*ESTHER*R***MI*012-34-5678D~N3*3605 SAN DIEGO ZOO~N4*SAN DIEGO*CA*12345~DMG*D8*98765432*F~NM1*PR*2*HIGHMARK MEDICARE SERVICES*****PI*123456ZALK~N3*PO BOX  654321~N4*CAMP HILL*CA*76543-0123~CLM*4-77*57.42***11::1*Y*A*Y*Y*C~DTP*431*D8*20081023~HI*BK:7241~NM1*DN*1*WELLERBY*MARCUS****XX*1234567890~PRV*RF*506R00000X~REF*1G*H23456~NM1*82*1*WELLERBY*MARCUS****XX*123457890~PRV*PE*506R00000X~REF*1C*1234567890~NM1*77*2*FIRSTMED*****XX*1234567890~N3*1000 SILVER RD, STE 100~N4*REMOTE*CA*12345-6789~SBR*S*18***C1****OF~DMG*D8*1234567*F~OI***Y*B**Y~NM1*IL*1*ZEBRA*FRANK*A***MI*098-76-5432~N3*3605 SAN DIEGO ZOO~N4*SAN DIEGO*CA*12345~NM1*PR*2*TRICARE*****PI*~N3*NOT KNOWN~N4*NOT KNOWN*CA*22222~LX*1~SV1*HC:99213*57.42*UN*1***1~DTP*472*D8*20081023~SE*50*0001~GE*1*1~IEA*1*020413196~

Warning: Element Error occurs at Line Number = 32; Segment Name = PRV; Element Position = 2; Invalid data = (207R00000X); Element Number = 128; Error Number = 5: Data element too long.;
Warning: Element Error occurs at Line Number = 32; Segment Name = PRV; Element Position = 2; Invalid data = (207R00000X); Element Number = 128; Error Number = 7: Invalid code value.;
Warning: Element Error occurs at Line Number = 35; Segment Name = PRV; Element Position = 2; Invalid data = (207R00000X); Element Number = 128; Error Number = 5: Data element too long.;
Warning: Element Error occurs at Line Number = 35; Segment Name = PRV; Element Position = 2; Invalid data = (207R00000X); Element Number = 128; Error Number = 7: Invalid code value.;

Can anyone make sense of this and what is wrong?

voipbound wrote on Thursday, October 30, 2008:

Oops the invalid data 207R00000X is 506R00000X but that is the insurance ID number.

voipbound wrote on Thursday, October 30, 2008:

I am sorry that is actually the Taxonomy number 207R00000X.  But is that is wrong, what is it suppose to be in that field?

xiaoanri wrote on Thursday, October 30, 2008:

The toxonomy number is specific for your spcecialty.  You can find the info on line, maybe at the site where you get the NPI number.  After you find it, just log in as admin, and modify the entry at the practice info area.  Hope that helps. Hui