X12 generation patch

tkaufmann wrote on Thursday, August 04, 2005:

When doing testing with ProxyMed last fall I found many changes were required to standard.pl to get the generated claims to pass. 

It was a real learning experience.  Early on during this learning/questioning/testing I posted one diff (http://sourceforge.net/forum/message.php?msg_id=3172935) but after getting claims to pass, I never posted my other changes.  Subsequently 1000+ claims were successfully processed through ProxyMed.

When I upgraded to the latest version of OpenEMR/FreeB, I found that claims wouldn’t pass the ‘ProxyMed HIPAA 3rd Party Testing Service’, so I went back and re-implemented my changes.

A diff follows.  I urge those who send X12 to other sources to test this first.

Some of my changes may break things for you, though I couldn’t pass the ‘837 Q1 Health Care Claim Professional’ tests at hipaadesk.com without these.

Note:  I commented out the code that put in “REF*1G” – I have never seen this code in any of my claims; I think it was someone’s specific provider they hardcoded, this appears more general. 

Please test, and if it works for you as well, someone (Rod?) can check it in.  Thanks.

Index: standard.pl

RCS file: /cvsroot/openemr/freeb/formatbin/standard.pl,v
retrieving revision 1.9
diff -r1.9 standard.pl
603a604,609
> # ID 1069, pos 02 NSF ref: DA0-17.0
>   my $relationship = FreeB::FBPatient::X12InsuredRelationship($PatientKey,$InsuredKey);
>   if ( $relationship != 18 ) {
>     $PatientHL = 1;
>   }
>
633c639,647
< $data=FreeB::FBPatient::X12InsuredRelationship($PatientKey,$InsuredKey);

>
> ##** if code is not ‘18’, then blank this.
> ##** HL04 above is then 1, not 0.
>
> #$data=FreeB::FBPatient::X12InsuredRelationship($PatientKey,$InsuredKey);
> $data = $relationship;
>     if ( $relationship != 18 ) {
>       $data = ‘’;
>     }
1264c1278
<

> ############################################ ********* NEW
1310,1326c1324,1342
< $x12item="";
< $data="*";
< $x12delim=$data;
< $x12begin=“REF”;
< $x12item=$x12begin;
< $edicount++;
< $data=“1G”;
< $data = FreeB::Global::X12Beauty($data);
< $x12item=$x12item.$x12delim.uc($data);
< $data=FreeB::FBProvider::IPN($ReferringProviderKey);
< $data = FreeB::Global::X12Beauty($data);
< $x12item=$x12item.$x12delim.uc($data);
< $data="~";
< $x12item = FreeB::Global::X12TrailingDelimiters($x12item);
< $x12item=$x12item.$data;
< print “$x12item
< “;

> if (0) {
>     $x12item=””;
>     $data="*";
>     $x12delim=$data;
>     $x12begin=“REF”;
>     $x12item=$x12begin;
>     $edicount++;
>     $data=“1G”;
>     $data = FreeB::Global::X12Beauty($data);
>     $x12item=$x12item.$x12delim.uc($data);
>     $data=FreeB::FBProvider::IPN($ReferringProviderKey);
>     $data = FreeB::Global::X12Beauty($data);
>     $x12item=$x12item.$x12delim.uc($data);
>     $data="~";
>     $x12item = FreeB::Global::X12TrailingDelimiters($x12item);
>     $x12item=$x12item.$data;
>     print “$x12item
>     “;
>  }
1407a1424,1450
> # ********************************************
> ##** Tk - added 2004.11.29 - per proxymed testing - add REF field to PRV
> # however, they identified the missing REF as part of loop 2420
> # and here is 2310…
> #
> # Question:  should it only be here for 1B (blue shield) and 1D (medicaid)
>                
> $x12item=””;
> $data="*";
> $x12delim=$data;
> $x12begin=“REF”;
> $x12item=$x12begin;
> $edicount++;
> $data=FreeB::FBPractice::ProviderNumX12Type($PracticeKey,$PayerKey,$ProviderKey);
> $data = FreeB::Global::X12Beauty($data);
> $x12item=$x12item.$x12delim.uc($data);
> $data=FreeB::FBPractice::PracticeID($PracticeKey,$PayerKey,$ProviderKey);
> $data = FreeB::Global::X12Beauty($data);
> $x12item=$x12item.$x12delim.uc($data);
> $data="~";
> $x12item = FreeB::Global::X12TrailingDelimiters($x12item);
> $x12item=$x12item.$data;
> print “$x12item
> “;
>
> # ********************************************
>
1570,1571c1613,1615
< #$data=“N”;
< $data=””; # 004010X098A1 (addendum) says this must be Y or blank

> #$data=""; # 004010X098A1 (addendum) says this must be Y or blank
> # proxymed doesn’t like it though…
> $data=“N”;

sunsetsystems wrote on Friday, August 05, 2005:

Thanks for the patch.  I don’t have any clients in billing test mode right now, but one of the other developers might be in a position to test and commit this.

– Rod <rod at sunsetsystems dot com>

andres_paglayan wrote on Monday, August 22, 2005:

Hi Tod,
I did test the patch and is actually much better that the original standard as it gets far less errors from hipaadesk but still some,
Did you manage to get zero errors?
I get:
H10614: missing mandatry CLM0501
and date generation problems too,
Andres

ajperezcrespo wrote on Monday, August 22, 2005:

If a proxymed script exists why dont we keep proxymed specifics in it?
The same should hold true to the cms.pl.
Shouldn’t standard.pl be just a plain X12 script?
This way we can have a generic script and specific scripts for  clearing houses that need them.

sunsetsystems wrote on Monday, August 22, 2005:

In my experience most of what goes into the x12 scripts is for the payers, not the clearinghouse.  As a result all these different scripts are (or should be) very similar, resulting in extra work every time a fix is installed.  I think this idea of a different script for each clearinghouse was misguided.

Note also the “formatsrc” directory.  It appears that at one time there was a concept of running a preprocessor to create the .pl files from .xml files, which at some time in the past was abandoned.  Perhaps that addressed the concern above.  It’s hard to know since the process does not seem to be documented.

– Rod (http://www.sunsetsystems.com/)

andres_paglayan wrote on Monday, August 22, 2005:

I am not very sure about how this whole billing thing works yet,
but for the clearing house I am dealing with now, they just want a valid x12 file, I am still not fully passing hippadesk yet, I read tkaufmann had, but even with his patch I am still not getting 100% cleared.
I think the standard.pl should be whatever fully passes a hipaa x12 test (as you said)

ajperezcrespo wrote on Monday, August 22, 2005:

Here’s what Ive found wrong with standard.pl so far…
NM1 subscriber Item #4 is hardcode to 2 (Facility) some docs are Individual (1).
CLM*1-1-2*50.00***0::1*Y*A*Y*Y*B~ The 0 between the *and the :: should be the POS code (Usually 11).
PRV*PE*ZZ*207Q00000X PE should be BI or PT and the Taxonomy code is hardcoded.  Heres the link to the Taxonomy codes http://www.wpc-edi.com/content/view/515/375/.

sunsetsystems wrote on Tuesday, August 23, 2005:

> NM1 subscriber Item #4 is hardcode to 2 (Facility) some docs are Individual (1).

I guess this should be added to the facility setup form.

> CLM*1-1-2*50.00***0::1*Y*A*Y*Y*B~ The 0 between the *and the :: should be the POS code (Usually 11).

standard.pl already has support for this.  Are you sure you have the code defined for your facility?

– Rod (http://www.sunsetsystems.com/)

ajperezcrespo wrote on Tuesday, August 23, 2005:

If you mean select 11  from the POS pulldown on the facility screen? Yes.  In fact if I peek into the Facility Table its there too.
As far as the Taxonomy codes are conserned: wouldnt a pull down go nice on the facility setup form for those?
Thanks
Alfonso

okhra wrote on Tuesday, August 23, 2005:

Right now the code seems to pick up the ‘place of service’(POS) from the facility setup. That may not be right. Typically, in our office, POS is 11 most of the time. But, when the provider admits patients to the hospital, daily service at the hospital, hospital discharge, attend new born, the POS is 21. I had to add code to check the procedure codes to arrive at the POS code.

Not only that, our facility being an RHC, Vermont Medicaid wants an extra service line with procedure code, T1015 with a fee of $ 0.00. So, X12 may be a standard, but different payers have different quirks ( a lot of them introduced as situational fileds).

<braman at world dot std dot com>

okhra wrote on Tuesday, August 23, 2005:

Taxonomy codes depend on the providers, not on the facilty.
<braman at world dot std dot com>

sunsetsystems wrote on Tuesday, August 23, 2005:

In the New Encounter Form there is a place to select the facility.  The POS code should be picked up from the selected facility and it should not be necessary to get it from the procedure codes.

– Rod (http://www.sunsetsystems.com/)

okhra wrote on Tuesday, August 23, 2005:

Thanks Rod. I’ll look at the new encounter form. Is there a corresponding change in hcfa.pl and its siblings, to pick up the right POS code ?
<braman at world dot std dot com>

sunsetsystems wrote on Tuesday, August 23, 2005:

I don’t know of any fixes that are not checked in.  If it’s not working then some troubleshooting/debugging is in order.

– Rod (http://www.sunsetsystems.com/)

andres_paglayan wrote on Tuesday, August 23, 2005:

Oops,
The problem was that I had to change the facility name few days after the practice began, because the initial one was too long,
the changes were not reflecting in the form_encounter because in that table instead of a facility_id there is a facility name field,
I updated form_encounter and also the default facility for the providers and that solved the issue since the /lib/freeb/*.classes where fine.

tekknogenius wrote on Tuesday, August 23, 2005:

For proxymed I’m using the proxymed.pl script. We’re billing now and I’ve made several changes to the initial script so that it would be compliant with Proxymed. Perhaps you should try using that one since that works (at least for us) and we’re billing medicare. medicaid, blue cross/blue shield, CIGNA, AETNA and some other Maryland area insurances.

ajperezcrespo wrote on Wednesday, August 24, 2005:

  Yup thats where it was, on the form.  After updating that all seems well.

Thanks a mil

okhra wrote on Wednesday, August 24, 2005:

Rod,
Now I understand how the facility pull down works in the Patient Encounter form. I added a few facilities, like - Copley-Outpatient,Copley-Inpatient,Copley-Birthing center,Copley-ER with their corresponding POS codes. Like you said, I don’t have to muck around with procedures codes in hcfa.pl.
Thanks for straightening me out.

braman at world dot std dot com