Component: src/Billing/X125010837P.php
Affected Versions: Unknown — likely affects all current versions
Severity: High — causes claim rejections at clearinghouse level for all dependent (non-self) subscriber claims
Description:
In X125010837P.php, the SBR segment (Loop 2000B, Subscriber Information) generates an empty SBR02 element for any claim where the patient is not the subscriber (spouse, child, other dependent). This causes clearinghouse rejections with errors such as:
- “Entity’s Group Name — This code requires use of an Entity Code”
- “Information submitted inconsistent with billing guidelines”
- “Unrecognized data was found in Loop 2010BB”
Root Cause:
Line ~402 in X125010837P.php:
php
"*" . ($claim->isSelfOfInsured() ? '18' : '') .
This ternary returns '18' for self subscribers but an empty string for all other relationships (spouse, child, other). The X12 005010X222A1 standard requires a valid relationship code in SBR02 for all claims.
The Fix:
The Claim class already contains a correct insuredRelationship() method in Claim.php that properly maps all relationship types:
php
public function insuredRelationship($ins = 0)
{
$tmp = strtolower(($this->payers[$ins]['data']['subscriber_relationship'] ?? ''));
if (strcmp($tmp, 'self') == 0) return '18';
if (strcmp($tmp, 'spouse') == 0) return '01';
if (strcmp($tmp, 'child') == 0) return '19';
if (strcmp($tmp, 'other') == 0) return 'G8';
return $tmp;
}
Replace the ternary with a call to this existing method:
Before:
php
"*" . ($claim->isSelfOfInsured() ? '18' : '') .
After:
php
"*" . $claim->insuredRelationship() .
Impact:
- All claims where the patient is a spouse, child, or other dependent of the subscriber generate an empty SBR02
- Many payers (UMR, Aetna, UnitedHealthcare) reject these claims at the clearinghouse level
- Some payers (BCBS Texas in our experience) may accept the blank code, masking the issue
- The bug affects every practice using OpenEMR to bill dependent claims
Steps to Reproduce:
- Create a patient who is a dependent (spouse or child) on another person’s insurance
- Set subscriber relationship to “Spouse” or “Child” in the insurance record
- Generate an 837P batch file
- Inspect the SBR segment — SBR02 will be empty (
SBR*P**groupnumber...)
Expected: SBR*P*01*groupnumber... (spouse) or SBR*P*19*groupnumber... (child)
Actual: SBR*P**groupnumber... (empty relationship code)
Tested Fix: Confirmed working in production. Replacing the ternary with $claim->insuredRelationship() correctly generates 01 for spouse and 19 for child relationships without any other side effects.
Reported by Jeff Guillory, NP Health Clinic PLLC, Lumberton TX