era_835_parser 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee6d77b1fca8cdd052544e74a5932c84a01ead1ef7bca1c1270a7c9ba397b804
4
- data.tar.gz: c0cb958f109b14f7cee14e1f80799e58ccdddbff95c5e7478747c21c07527fc7
3
+ metadata.gz: ab71e41a87a2f73200361b1bedeb9740c6edc2451cee146057682484a3d3caf7
4
+ data.tar.gz: 9ed593d781b601484ac0c99019de108f6b4d15374059c1ef46d5a707d5dbec72
5
5
  SHA512:
6
- metadata.gz: c0ecd8a5bf21446057624dce13d87b26c7c6a8b370dbbdf4871280b35b056da3d05fe71c9813610f6f14af3f905924d89d3119a947bf696bdeb8ee34bf649e03
7
- data.tar.gz: d5b0d016634ef6d2f177462f8cf8f9285e5b7ad820efa094f815e90fe2ec284a93680a5c1f1782ac0a61e872a2b5d879120af19849227c4c8e588a4eb4e7ae60
6
+ metadata.gz: 260a869a1d17269a37c9e06177357b4e8a3c3ac3be88bc9605b9d58459c7bb2bb19be8752109d0640c81b7c7ece04307c9a652f4450d3c94bf198b91213d593c
7
+ data.tar.gz: fd110d86ad73c4a50f2578f0b65fb5f90c174408bde64f97b03b4682eb8615f44dee6e9790f0a6ff26886c39d603f5d6891a7c6aa3f54dc395a9943e4012989e
data/README.md CHANGED
@@ -28,6 +28,9 @@ puts era[:addressed_to] # The person/name the ERA is addressed to
28
28
  if !era[:checks].nil?
29
29
  era[:checks].each do |check_number, check|
30
30
  puts check[:check_number] # Check number
31
+ puts check[:transaction_handling_code] # Transaction handling code
32
+ puts check[:credit_debit_flag] # Credit/debit flag
33
+ puts check[:payment_method_code] # Payment method code
31
34
  puts check[:amount] # Check amount
32
35
  puts check[:number_of_claims] # Number of claims this check covers (integer)
33
36
  puts check[:npi_tax_id] # NPI or Tax ID of payee
@@ -62,6 +62,9 @@ module Era835Parser
62
62
  service_payment_information_loop = false
63
63
  bpr_amount = ''
64
64
  bpr_date = ''
65
+ transaction_handling_code = ''
66
+ credit_debit_flag = ''
67
+ payment_method_code = ''
65
68
  receive_date = false
66
69
  claim_date_start = false
67
70
  claim_date_end = false
@@ -361,6 +364,7 @@ module Era835Parser
361
364
  when 1
362
365
  # Transaction Handling Code
363
366
  # puts "Transaction Handling Code: #{element}"
367
+ transaction_handling_code = element.strip
364
368
  when 2
365
369
  # Monetary Amount
366
370
  # puts "Monetary Amount: #{element}"
@@ -368,9 +372,11 @@ module Era835Parser
368
372
  when 3
369
373
  # Credit/Debit Flag
370
374
  # puts "Credit/Debit Flag: #{element}"
375
+ credit_debit_flag = element.strip
371
376
  when 4
372
377
  # PAYMENT METHOD CODE
373
378
  # puts "PAYMENT METHOD CODE: #{element}"
379
+ payment_method_code = element.strip
374
380
  when 5
375
381
  # PAYMENT FORMAT CODE
376
382
  # puts "PAYMENT FORMAT CODE: #{element}"
@@ -444,13 +450,20 @@ module Era835Parser
444
450
  when 2
445
451
  # REFERENCE IDENTIFICATION
446
452
  # puts "REFERENCE IDENTIFICATION: #{element}"
447
- check = Hash.new
448
- check[:check_number] = element.strip
449
- check[:amount] = (bpr_amount.to_f * 100).round().to_i
453
+ check = {
454
+ check_number: element.strip,
455
+ amount: (bpr_amount.to_f * 100).round().to_i,
456
+ date: bpr_date,
457
+ transaction_handling_code: transaction_handling_code,
458
+ credit_debit_flag: credit_debit_flag,
459
+ payment_method_code: payment_method_code,
460
+ }
461
+ checks[check[:check_number]] = check
450
462
  bpr_amount = ''
451
- check[:date] = bpr_date
452
463
  bpr_date = ''
453
- checks[check[:check_number]] = check
464
+ transaction_handling_code = ''
465
+ credit_debit_flag = ''
466
+ payment_method_code = ''
454
467
  when 3
455
468
  # ORIGINATING COMPANY IDENTIFIER
456
469
  # puts "ORIGINATING COMPANY IDENTIFIER: #{element}"
@@ -1034,7 +1047,7 @@ module Era835Parser
1034
1047
  eras[era_counter] = individual_era
1035
1048
  era[:checks][check_number][:eras] = era[:checks][check_number][:eras].merge(eras)
1036
1049
  end
1037
- return era
1050
+ era
1038
1051
  else
1039
1052
  if individual_line_item != {}
1040
1053
  if line_items.nil?
@@ -1100,7 +1113,7 @@ module Era835Parser
1100
1113
  end
1101
1114
  end
1102
1115
  end
1103
- return era
1116
+ era
1104
1117
  end
1105
1118
  end
1106
1119
 
@@ -1108,15 +1121,15 @@ module Era835Parser
1108
1121
 
1109
1122
  def get_length(string)
1110
1123
  if string.nil?
1111
- return 0
1124
+ 0
1112
1125
  else
1113
- return string.length
1126
+ string.length
1114
1127
  end
1115
1128
  end
1116
1129
 
1117
1130
  def truncate(string, truncate_at)
1118
1131
  if !string.nil?
1119
- return string.to_s[0...truncate_at]
1132
+ string.to_s[0...truncate_at]
1120
1133
  end
1121
1134
  end
1122
1135
 
@@ -1,3 +1,3 @@
1
1
  module Era835Parser
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -35,6 +35,15 @@ RSpec.describe Era835Parser::Parser do
35
35
  it 'returns the check number' do
36
36
  expect(@era[:checks]['70408535'][:check_number]).to eq('70408535')
37
37
  end
38
+ it 'returns the transaction handling code' do
39
+ expect(@era[:checks]['70408535'][:transaction_handling_code]).to eq('I')
40
+ end
41
+ it 'returns the credit debit flag' do
42
+ expect(@era[:checks]['70408535'][:credit_debit_flag]).to eq('C')
43
+ end
44
+ it 'returns the payment method code' do
45
+ expect(@era[:checks]['70408535'][:payment_method_code]).to eq('CHK')
46
+ end
38
47
  it 'returns the amount' do
39
48
  expect(@era[:checks]['70408535'][:amount]).to eq(1509646)
40
49
  end
@@ -192,6 +201,15 @@ RSpec.describe Era835Parser::Parser do
192
201
  it 'returns the check number' do
193
202
  expect(@era[:checks]['02790758'][:check_number]).to eq('02790758')
194
203
  end
204
+ it 'returns the transaction handling code' do
205
+ expect(@era[:checks]['02790758'][:transaction_handling_code]).to eq('I')
206
+ end
207
+ it 'returns the credit debit flag' do
208
+ expect(@era[:checks]['02790758'][:credit_debit_flag]).to eq('C')
209
+ end
210
+ it 'returns the payment method code' do
211
+ expect(@era[:checks]['02790758'][:payment_method_code]).to eq('CHK')
212
+ end
195
213
  it 'returns the amount' do
196
214
  expect(@era[:checks]['02790758'][:amount]).to eq(192286)
197
215
  end
@@ -435,6 +453,15 @@ RSpec.describe Era835Parser::Parser do
435
453
  it 'returns the check number' do
436
454
  expect(@era[:checks]['02790758'][:check_number]).to eq('02790758')
437
455
  end
456
+ it 'returns the transaction handling code' do
457
+ expect(@era[:checks]['02790758'][:transaction_handling_code]).to eq('I')
458
+ end
459
+ it 'returns the credit debit flag' do
460
+ expect(@era[:checks]['02790758'][:credit_debit_flag]).to eq('C')
461
+ end
462
+ it 'returns the payment method code' do
463
+ expect(@era[:checks]['02790758'][:payment_method_code]).to eq('CHK')
464
+ end
438
465
  it 'returns the amount' do
439
466
  expect(@era[:checks]['02790758'][:amount]).to eq(192286)
440
467
  end
@@ -678,6 +705,15 @@ RSpec.describe Era835Parser::Parser do
678
705
  it 'returns the check number' do
679
706
  expect(@era[:checks]['0123456789012345678901234567890123456789'][:check_number]).to eq('0123456789012345678901234567890123456789')
680
707
  end
708
+ it 'returns the transaction handling code' do
709
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:transaction_handling_code]).to eq('I')
710
+ end
711
+ it 'returns the credit debit flag' do
712
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:credit_debit_flag]).to eq('C')
713
+ end
714
+ it 'returns the payment method code' do
715
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:payment_method_code]).to eq('CHK')
716
+ end
681
717
  it 'returns the amount' do
682
718
  expect(@era[:checks]['0123456789012345678901234567890123456789'][:amount]).to eq(192286)
683
719
  end
@@ -921,6 +957,15 @@ RSpec.describe Era835Parser::Parser do
921
957
  it 'returns the check number' do
922
958
  expect(@era[:checks]['0123456789012345678901234567890123456789'][:check_number]).to eq('0123456789012345678901234567890123456789')
923
959
  end
960
+ it 'returns the transaction handling code' do
961
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:transaction_handling_code]).to eq('I')
962
+ end
963
+ it 'returns the credit debit flag' do
964
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:credit_debit_flag]).to eq('C')
965
+ end
966
+ it 'returns the payment method code' do
967
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:payment_method_code]).to eq('CHK')
968
+ end
924
969
  it 'returns the amount' do
925
970
  expect(@era[:checks]['0123456789012345678901234567890123456789'][:amount]).to eq(192286)
926
971
  end
@@ -1154,6 +1199,537 @@ RSpec.describe Era835Parser::Parser do
1154
1199
  end
1155
1200
  end
1156
1201
  end
1202
+ context 'example_6.835' do
1203
+ before :all do
1204
+ @era = Era835Parser::Parser.new(file_path: "../era_835_parser/spec/example_6.835").parse
1205
+ @check_5003 = @era[:checks]['5003']
1206
+ @check_5010 = @era[:checks]['5010']
1207
+ end
1208
+
1209
+ context 'Aggregate totals' do
1210
+ it 'returns the addressed to' do
1211
+ expect(@era[:addressed_to]).to eq(nil)
1212
+ end
1213
+ it 'returns the correct number of checks' do
1214
+ expect(@era[:checks].count).to eq(2)
1215
+ end
1216
+ it 'returns the correct number of adjustments' do
1217
+ expect(@era[:adjustments]).to eq(nil)
1218
+ end
1219
+ it 'returns the correct number of eras' do
1220
+ total = @check_5003[:eras].count + @check_5010[:eras].count
1221
+ expect(total).to eq(2)
1222
+ end
1223
+ it 'returns the correct number of line items' do
1224
+ total = @check_5003[:eras][0][:line_items].count + @check_5010[:eras][0][:line_items].count
1225
+ expect(total).to eq(6)
1226
+ end
1227
+ it 'returns the correct number of adjustment groups' do
1228
+ total = @check_5003[:eras][0][:line_items][0][:adjustment_groups].count + @check_5010[:eras][0][:line_items][0][:adjustment_groups].count
1229
+ expect(total).to eq(4)
1230
+ end
1231
+ it 'returns the correct number of adjustment groups' do
1232
+ total = @check_5003[:eras][0][:line_items][1][:adjustment_groups].count + @check_5010[:eras][0][:line_items][1][:adjustment_groups].count
1233
+ expect(total).to eq(2)
1234
+ end
1235
+ it 'returns the correct number of adjustment groups' do
1236
+ total = @check_5003[:eras][0][:line_items][2][:adjustment_groups].count + @check_5010[:eras][0][:line_items][2][:adjustment_groups].count
1237
+ expect(total).to eq(2)
1238
+ end
1239
+ end
1240
+
1241
+ context 'Check #5003' do
1242
+ it 'returns the check number' do
1243
+ expect(@check_5003[:check_number]).to eq('5003')
1244
+ end
1245
+ it 'returns the transaction handling code' do
1246
+ expect(@check_5003[:transaction_handling_code]).to eq('H')
1247
+ end
1248
+ it 'returns the credit debit flag' do
1249
+ expect(@check_5003[:credit_debit_flag]).to eq('C')
1250
+ end
1251
+ it 'returns the payment method code' do
1252
+ expect(@check_5003[:payment_method_code]).to eq('NON')
1253
+ end
1254
+ it 'returns the amount' do
1255
+ expect(@check_5003[:amount]).to eq(0)
1256
+ end
1257
+ it 'returns the number of claims' do
1258
+ expect(@check_5003[:number_of_claims]).to eq(1)
1259
+ end
1260
+ it 'returns the NPI or Tax ID of payee' do
1261
+ expect(@check_5003[:npi_tax_id]).to eq('0987654321')
1262
+ end
1263
+ it 'returns the Check payee' do
1264
+ expect(@check_5003[:payee]).to eq('XYZ HEALTHCARE CORPORATION')
1265
+ end
1266
+ it 'returns the Payer name' do
1267
+ expect(@check_5003[:payer_name]).to eq('BLUE CROSS AND BLUE SHIELD OF NORTH CAROLINA')
1268
+ end
1269
+ it 'returns the Payer address' do
1270
+ expect(@check_5003[:payer_address]).to eq('P O BOX 2291')
1271
+ end
1272
+ it 'returns the Payer city' do
1273
+ expect(@check_5003[:payer_city]).to eq('DURHAM')
1274
+ end
1275
+ it 'returns the Payer state' do
1276
+ expect(@check_5003[:payer_state]).to eq('NC')
1277
+ end
1278
+ it 'returns the Payer zip code' do
1279
+ expect(@check_5003[:payer_zip_code]).to eq('27702')
1280
+ end
1281
+ it 'returns the Payer tax id' do
1282
+ expect(@check_5003[:payer_tax_id]).to eq('60-894904')
1283
+ end
1284
+ it 'returns the Payer EDI id' do
1285
+ expect(@check_5003[:payer_edi_id]).to eq(nil)
1286
+ end
1287
+ it 'returns the Check date (string mm/dd/yyyy)' do
1288
+ expect(@check_5003[:date]).to eq('01/08/2026')
1289
+ end
1290
+ context 'ERA #0' do
1291
+ it 'returns the Patient ID' do
1292
+ expect(@check_5003[:eras][0][:patient_id]).to eq(nil)
1293
+ end
1294
+ it 'returns the Patient name' do
1295
+ expect(@check_5003[:eras][0][:patient_name]).to eq('DOUGH,MARY')
1296
+ end
1297
+ it 'returns the Patient last name (titleized)' do
1298
+ expect(@check_5003[:eras][0][:patient_last_name]).to eq('Dough')
1299
+ end
1300
+ it 'returns the Patient first name (titleized)' do
1301
+ expect(@check_5003[:eras][0][:patient_first_name]).to eq('Mary')
1302
+ end
1303
+ it 'returns the Subscriber last name (titleized)' do
1304
+ expect(@check_5003[:eras][0][:subscriber_first_name]).to eq('Marty')
1305
+ end
1306
+ it 'returns the Subscriber last name (titleized)' do
1307
+ expect(@check_5003[:eras][0][:subscriber_last_name]).to eq('Dough')
1308
+ end
1309
+ it 'returns the Subscriber name (titleized)' do
1310
+ expect(@check_5003[:eras][0][:subscriber_name]).to eq('DOUGH,MARTY')
1311
+ end
1312
+ it 'returns the Subscriber middle initial' do
1313
+ expect(@check_5003[:eras][0][:subscriber_middle_initial]).to eq('L')
1314
+ end
1315
+ it 'returns the Subscriber suffix' do
1316
+ expect(@check_5003[:eras][0][:subscriber_suffix]).to eq('Sr.')
1317
+ end
1318
+ it 'returns the Subscriber ID' do
1319
+ expect(@check_5003[:eras][0][:subscriber_id]).to eq('YPB123456789009')
1320
+ end
1321
+ it 'returns the rendering provider last_name (titleized)' do
1322
+ expect(@check_5003[:eras][0][:rendering_provider_last_name]).to eq('Jones')
1323
+ end
1324
+ it 'returns the rendering provider first name (titleized)' do
1325
+ expect(@check_5003[:eras][0][:rendering_provider_first_name]).to eq('Alice')
1326
+ end
1327
+ it 'returns the rendering provider NPI' do
1328
+ expect(@check_5003[:eras][0][:rendering_provider_npi]).to eq('1116359906')
1329
+ end
1330
+ it 'returns the Total charge amount (integer)' do
1331
+ expect(@check_5003[:eras][0][:charge_amount]).to eq(30000)
1332
+ end
1333
+ it 'returns the Total payment amount (integer)' do
1334
+ expect(@check_5003[:eras][0][:payment_amount]).to eq(15000)
1335
+ end
1336
+ it 'returns the Account number' do
1337
+ expect(@check_5003[:eras][0][:account_number]).to eq('200200964A52')
1338
+ end
1339
+ it 'returns the Claim status code' do
1340
+ expect(@check_5003[:eras][0][:claim_status_code]).to eq('1')
1341
+ end
1342
+ it 'returns the Claim status code description' do
1343
+ expect(@check_5003[:eras][0][:status]).to eq("PROCESSED AS PRIMARY")
1344
+ end
1345
+ it 'returns the Payer claim control number' do
1346
+ expect(@check_5003[:eras][0][:payer_claim_control_number]).to eq('94151100100')
1347
+ end
1348
+ it 'returns the Claim statement period start' do
1349
+ expect(@check_5003[:eras][0][:claim_statement_period_start]).to eq(nil)
1350
+ end
1351
+ it 'returns the Claim statement period end' do
1352
+ expect(@check_5003[:eras][0][:claim_statement_period_end]).to eq(nil)
1353
+ end
1354
+
1355
+ context 'Line item #0' do
1356
+ it 'returns the Date of service (string mm/dd/yyyy)' do
1357
+ expect(@check_5003[:eras][0][:line_items][0][:service_date]).to eq("12/31/2010")
1358
+ end
1359
+ it 'returns the CPT code' do
1360
+ expect(@check_5003[:eras][0][:line_items][0][:cpt_code]).to eq("59430")
1361
+ end
1362
+ it 'returns the Charge amount (integer)' do
1363
+ expect(@check_5003[:eras][0][:line_items][0][:charge_amount]).to eq(10100)
1364
+ end
1365
+ it 'returns the Payment amount (integer)' do
1366
+ expect(@check_5003[:eras][0][:line_items][0][:payment_amount]).to eq(5050)
1367
+ end
1368
+ it 'returns the Total adjustment amount (integer)' do
1369
+ expect(@check_5003[:eras][0][:line_items][0][:total_adjustment_amount]).to eq(5050)
1370
+ end
1371
+ it 'returns the Remark code' do
1372
+ expect(@check_5003[:eras][0][:line_items][0][:remark_code]).to eq(nil)
1373
+ end
1374
+ it 'returns the Remarks' do
1375
+ expect(@check_5003[:eras][0][:line_items][0][:remarks]).to eq(nil)
1376
+ end
1377
+ it 'returns the Reference number' do
1378
+ expect(@check_5003[:eras][0][:line_items][0][:reference_number]).to eq('0001')
1379
+ end
1380
+ context 'Adjustment group #0' do
1381
+ it 'returns the Adjustment group' do
1382
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group]).to eq("Contractual Obligation")
1383
+ end
1384
+ it 'returns the Adjustment group code' do
1385
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group_code]).to eq("CO")
1386
+ end
1387
+ it 'returns the Adjustment amount (integer)' do
1388
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_amount]).to eq(2550)
1389
+ end
1390
+ it 'returns the Reason code' do
1391
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][0][:reason_code]).to eq('42')
1392
+ end
1393
+ it 'returns the Translated reason code' do
1394
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][0][:translated_reason_code]).to eq("Charges exceed our fee schedule or maximum allowable amount. (Use CARC 45)")
1395
+ end
1396
+ end
1397
+ context 'Adjustment group #1' do
1398
+ it 'returns the Adjustment group' do
1399
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_group]).to eq("Patient Responsibility")
1400
+ end
1401
+ it 'returns the Adjustment group code' do
1402
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_group_code]).to eq("PR")
1403
+ end
1404
+ it 'returns the Adjustment amount (integer)' do
1405
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_amount]).to eq(2500)
1406
+ end
1407
+ it 'returns the Reason code' do
1408
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][1][:reason_code]).to eq('2')
1409
+ end
1410
+ it 'returns the Translated reason code' do
1411
+ expect(@check_5003[:eras][0][:line_items][0][:adjustment_groups][1][:translated_reason_code]).to eq("Coinsurance Amount")
1412
+ end
1413
+ end
1414
+ end
1415
+ context 'Line item #1' do
1416
+ it 'returns the Date of service (string mm/dd/yyyy)' do
1417
+ expect(@check_5003[:eras][0][:line_items][1][:service_date]).to eq("12/31/2010")
1418
+ end
1419
+ it 'returns the CPT code' do
1420
+ expect(@check_5003[:eras][0][:line_items][1][:cpt_code]).to eq("59440")
1421
+ end
1422
+ it 'returns the Charge amount (integer)' do
1423
+ expect(@check_5003[:eras][0][:line_items][1][:charge_amount]).to eq(10000)
1424
+ end
1425
+ it 'returns the Payment amount (integer)' do
1426
+ expect(@check_5003[:eras][0][:line_items][1][:payment_amount]).to eq(5000)
1427
+ end
1428
+ it 'returns the Total adjustment amount (integer)' do
1429
+ expect(@check_5003[:eras][0][:line_items][1][:total_adjustment_amount]).to eq(5000)
1430
+ end
1431
+ it 'returns the Remark code' do
1432
+ expect(@check_5003[:eras][0][:line_items][1][:remark_code]).to eq(nil)
1433
+ end
1434
+ it 'returns the Remarks' do
1435
+ expect(@check_5003[:eras][0][:line_items][1][:remarks]).to eq(nil)
1436
+ end
1437
+ it 'returns the Reference number' do
1438
+ expect(@check_5003[:eras][0][:line_items][1][:reference_number]).to eq('0002')
1439
+ end
1440
+ context 'Adjustment group #0' do
1441
+ it 'returns the Adjustment group' do
1442
+ expect(@check_5003[:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_group]).to eq("Patient Responsibility")
1443
+ end
1444
+ it 'returns the Adjustment group code' do
1445
+ expect(@check_5003[:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_group_code]).to eq("PR")
1446
+ end
1447
+ it 'returns the Adjustment amount (integer)' do
1448
+ expect(@check_5003[:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_amount]).to eq(5000)
1449
+ end
1450
+ it 'returns the Reason code' do
1451
+ expect(@check_5003[:eras][0][:line_items][1][:adjustment_groups][0][:reason_code]).to eq('3')
1452
+ end
1453
+ it 'returns the Translated reason code' do
1454
+ expect(@check_5003[:eras][0][:line_items][1][:adjustment_groups][0][:translated_reason_code]).to eq("Co-payment Amount")
1455
+ end
1456
+ end
1457
+ end
1458
+ context 'Line item #2' do
1459
+ it 'returns the Date of service (string mm/dd/yyyy)' do
1460
+ expect(@check_5003[:eras][0][:line_items][2][:service_date]).to eq("12/31/2010")
1461
+ end
1462
+ it 'returns the CPT code' do
1463
+ expect(@check_5003[:eras][0][:line_items][2][:cpt_code]).to eq("59426")
1464
+ end
1465
+ it 'returns the Charge amount (integer)' do
1466
+ expect(@check_5003[:eras][0][:line_items][2][:charge_amount]).to eq(9900)
1467
+ end
1468
+ it 'returns the Payment amount (integer)' do
1469
+ expect(@check_5003[:eras][0][:line_items][2][:payment_amount]).to eq(4950)
1470
+ end
1471
+ it 'returns the Total adjustment amount (integer)' do
1472
+ expect(@check_5003[:eras][0][:line_items][2][:total_adjustment_amount]).to eq(4950)
1473
+ end
1474
+ it 'returns the Remark code' do
1475
+ expect(@check_5003[:eras][0][:line_items][2][:remark_code]).to eq(nil)
1476
+ end
1477
+ it 'returns the Remarks' do
1478
+ expect(@check_5003[:eras][0][:line_items][2][:remarks]).to eq(nil)
1479
+ end
1480
+ it 'returns the Reference number' do
1481
+ expect(@check_5003[:eras][0][:line_items][2][:reference_number]).to eq('0003')
1482
+ end
1483
+ end
1484
+ end
1485
+ end
1486
+
1487
+ context 'Check #5010' do
1488
+ it 'returns the check number' do
1489
+ expect(@check_5010[:check_number]).to eq('5010')
1490
+ end
1491
+ it 'returns the transaction handling code' do
1492
+ expect(@check_5010[:transaction_handling_code]).to eq('I')
1493
+ end
1494
+ it 'returns the credit debit flag' do
1495
+ expect(@check_5010[:credit_debit_flag]).to eq('C')
1496
+ end
1497
+ it 'returns the payment method code' do
1498
+ expect(@check_5010[:payment_method_code]).to eq('ACH')
1499
+ end
1500
+ it 'returns the amount' do
1501
+ expect(@check_5010[:amount]).to eq(30000)
1502
+ end
1503
+ it 'returns the number of claims' do
1504
+ expect(@check_5010[:number_of_claims]).to eq(1)
1505
+ end
1506
+ it 'returns the NPI or Tax ID of payee' do
1507
+ expect(@check_5010[:npi_tax_id]).to eq('0987654321')
1508
+ end
1509
+ it 'returns the Check payee' do
1510
+ expect(@check_5010[:payee]).to eq('XYZ HEALTHCARE CORPORATION')
1511
+ end
1512
+ it 'returns the Payer name' do
1513
+ expect(@check_5010[:payer_name]).to eq('BLUE CROSS AND BLUE SHIELD OF NORTH CAROLINA')
1514
+ end
1515
+ it 'returns the Payer address' do
1516
+ expect(@check_5010[:payer_address]).to eq('P O BOX 2291')
1517
+ end
1518
+ it 'returns the Payer city' do
1519
+ expect(@check_5010[:payer_city]).to eq('DURHAM')
1520
+ end
1521
+ it 'returns the Payer state' do
1522
+ expect(@check_5010[:payer_state]).to eq('NC')
1523
+ end
1524
+ it 'returns the Payer zip code' do
1525
+ expect(@check_5010[:payer_zip_code]).to eq('27702')
1526
+ end
1527
+ it 'returns the Payer tax id' do
1528
+ expect(@check_5010[:payer_tax_id]).to eq('60-894904')
1529
+ end
1530
+ it 'returns the Payer EDI id' do
1531
+ expect(@check_5010[:payer_edi_id]).to eq(nil)
1532
+ end
1533
+ it 'returns the Check date (string mm/dd/yyyy)' do
1534
+ expect(@check_5010[:date]).to eq('01/09/2026')
1535
+ end
1536
+ context 'ERA #0' do
1537
+ it 'returns the Patient ID' do
1538
+ expect(@check_5010[:eras][0][:patient_id]).to eq(nil)
1539
+ end
1540
+ it 'returns the Patient name' do
1541
+ expect(@check_5010[:eras][0][:patient_name]).to eq('DOUGH,MARY')
1542
+ end
1543
+ it 'returns the Patient last name (titleized)' do
1544
+ expect(@check_5010[:eras][0][:patient_last_name]).to eq('Dough')
1545
+ end
1546
+ it 'returns the Patient first name (titleized)' do
1547
+ expect(@check_5010[:eras][0][:patient_first_name]).to eq('Mary')
1548
+ end
1549
+ it 'returns the Subscriber last name (titleized)' do
1550
+ expect(@check_5010[:eras][0][:subscriber_first_name]).to eq('Marty')
1551
+ end
1552
+ it 'returns the Subscriber last name (titleized)' do
1553
+ expect(@check_5010[:eras][0][:subscriber_last_name]).to eq('Dough')
1554
+ end
1555
+ it 'returns the Subscriber name (titleized)' do
1556
+ expect(@check_5010[:eras][0][:subscriber_name]).to eq('DOUGH,MARTY')
1557
+ end
1558
+ it 'returns the Subscriber middle initial' do
1559
+ expect(@check_5010[:eras][0][:subscriber_middle_initial]).to eq('L')
1560
+ end
1561
+ it 'returns the Subscriber suffix' do
1562
+ expect(@check_5010[:eras][0][:subscriber_suffix]).to eq('Sr.')
1563
+ end
1564
+ it 'returns the Subscriber ID' do
1565
+ expect(@check_5010[:eras][0][:subscriber_id]).to eq('YPB123456789009')
1566
+ end
1567
+ it 'returns the rendering provider last_name (titleized)' do
1568
+ expect(@check_5010[:eras][0][:rendering_provider_last_name]).to eq('Jones')
1569
+ end
1570
+ it 'returns the rendering provider first name (titleized)' do
1571
+ expect(@check_5010[:eras][0][:rendering_provider_first_name]).to eq('Alice')
1572
+ end
1573
+ it 'returns the rendering provider NPI' do
1574
+ expect(@check_5010[:eras][0][:rendering_provider_npi]).to eq('1116359906')
1575
+ end
1576
+ it 'returns the Total charge amount (integer)' do
1577
+ expect(@check_5010[:eras][0][:charge_amount]).to eq(30000)
1578
+ end
1579
+ it 'returns the Total payment amount (integer)' do
1580
+ expect(@check_5010[:eras][0][:payment_amount]).to eq(15000)
1581
+ end
1582
+ it 'returns the Account number' do
1583
+ expect(@check_5010[:eras][0][:account_number]).to eq('200200964A52')
1584
+ end
1585
+ it 'returns the Claim status code' do
1586
+ expect(@check_5010[:eras][0][:claim_status_code]).to eq('1')
1587
+ end
1588
+ it 'returns the Claim status code description' do
1589
+ expect(@check_5010[:eras][0][:status]).to eq("PROCESSED AS PRIMARY")
1590
+ end
1591
+ it 'returns the Payer claim control number' do
1592
+ expect(@check_5010[:eras][0][:payer_claim_control_number]).to eq('94151100100')
1593
+ end
1594
+ it 'returns the Claim statement period start' do
1595
+ expect(@check_5010[:eras][0][:claim_statement_period_start]).to eq(nil)
1596
+ end
1597
+ it 'returns the Claim statement period end' do
1598
+ expect(@check_5010[:eras][0][:claim_statement_period_end]).to eq(nil)
1599
+ end
1600
+
1601
+ context 'Line item #0' do
1602
+ it 'returns the Date of service (string mm/dd/yyyy)' do
1603
+ expect(@check_5010[:eras][0][:line_items][0][:service_date]).to eq("12/31/2010")
1604
+ end
1605
+ it 'returns the CPT code' do
1606
+ expect(@check_5010[:eras][0][:line_items][0][:cpt_code]).to eq("59430")
1607
+ end
1608
+ it 'returns the Charge amount (integer)' do
1609
+ expect(@check_5010[:eras][0][:line_items][0][:charge_amount]).to eq(10100)
1610
+ end
1611
+ it 'returns the Payment amount (integer)' do
1612
+ expect(@check_5010[:eras][0][:line_items][0][:payment_amount]).to eq(5050)
1613
+ end
1614
+ it 'returns the Total adjustment amount (integer)' do
1615
+ expect(@check_5010[:eras][0][:line_items][0][:total_adjustment_amount]).to eq(5050)
1616
+ end
1617
+ it 'returns the Remark code' do
1618
+ expect(@check_5010[:eras][0][:line_items][0][:remark_code]).to eq(nil)
1619
+ end
1620
+ it 'returns the Remarks' do
1621
+ expect(@check_5010[:eras][0][:line_items][0][:remarks]).to eq(nil)
1622
+ end
1623
+ it 'returns the Reference number' do
1624
+ expect(@check_5010[:eras][0][:line_items][0][:reference_number]).to eq('0001')
1625
+ end
1626
+ context 'Adjustment group #0' do
1627
+ it 'returns the Adjustment group' do
1628
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group]).to eq("Contractual Obligation")
1629
+ end
1630
+ it 'returns the Adjustment group code' do
1631
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group_code]).to eq("CO")
1632
+ end
1633
+ it 'returns the Adjustment amount (integer)' do
1634
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_amount]).to eq(2550)
1635
+ end
1636
+ it 'returns the Reason code' do
1637
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][0][:reason_code]).to eq('42')
1638
+ end
1639
+ it 'returns the Translated reason code' do
1640
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][0][:translated_reason_code]).to eq("Charges exceed our fee schedule or maximum allowable amount. (Use CARC 45)")
1641
+ end
1642
+ end
1643
+ context 'Adjustment group #1' do
1644
+ it 'returns the Adjustment group' do
1645
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_group]).to eq("Patient Responsibility")
1646
+ end
1647
+ it 'returns the Adjustment group code' do
1648
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_group_code]).to eq("PR")
1649
+ end
1650
+ it 'returns the Adjustment amount (integer)' do
1651
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_amount]).to eq(2500)
1652
+ end
1653
+ it 'returns the Reason code' do
1654
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][1][:reason_code]).to eq('2')
1655
+ end
1656
+ it 'returns the Translated reason code' do
1657
+ expect(@check_5010[:eras][0][:line_items][0][:adjustment_groups][1][:translated_reason_code]).to eq("Coinsurance Amount")
1658
+ end
1659
+ end
1660
+ end
1661
+ context 'Line item #1' do
1662
+ it 'returns the Date of service (string mm/dd/yyyy)' do
1663
+ expect(@check_5010[:eras][0][:line_items][1][:service_date]).to eq("12/31/2010")
1664
+ end
1665
+ it 'returns the CPT code' do
1666
+ expect(@check_5010[:eras][0][:line_items][1][:cpt_code]).to eq("59440")
1667
+ end
1668
+ it 'returns the Charge amount (integer)' do
1669
+ expect(@check_5010[:eras][0][:line_items][1][:charge_amount]).to eq(10000)
1670
+ end
1671
+ it 'returns the Payment amount (integer)' do
1672
+ expect(@check_5010[:eras][0][:line_items][1][:payment_amount]).to eq(5000)
1673
+ end
1674
+ it 'returns the Total adjustment amount (integer)' do
1675
+ expect(@check_5010[:eras][0][:line_items][1][:total_adjustment_amount]).to eq(5000)
1676
+ end
1677
+ it 'returns the Remark code' do
1678
+ expect(@check_5010[:eras][0][:line_items][1][:remark_code]).to eq(nil)
1679
+ end
1680
+ it 'returns the Remarks' do
1681
+ expect(@check_5010[:eras][0][:line_items][1][:remarks]).to eq(nil)
1682
+ end
1683
+ it 'returns the Reference number' do
1684
+ expect(@check_5010[:eras][0][:line_items][1][:reference_number]).to eq('0002')
1685
+ end
1686
+ context 'Adjustment group #0' do
1687
+ it 'returns the Adjustment group' do
1688
+ expect(@check_5010[:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_group]).to eq("Patient Responsibility")
1689
+ end
1690
+ it 'returns the Adjustment group code' do
1691
+ expect(@check_5010[:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_group_code]).to eq("PR")
1692
+ end
1693
+ it 'returns the Adjustment amount (integer)' do
1694
+ expect(@check_5010[:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_amount]).to eq(5000)
1695
+ end
1696
+ it 'returns the Reason code' do
1697
+ expect(@check_5010[:eras][0][:line_items][1][:adjustment_groups][0][:reason_code]).to eq('3')
1698
+ end
1699
+ it 'returns the Translated reason code' do
1700
+ expect(@check_5010[:eras][0][:line_items][1][:adjustment_groups][0][:translated_reason_code]).to eq("Co-payment Amount")
1701
+ end
1702
+ end
1703
+ end
1704
+ context 'Line item #2' do
1705
+ it 'returns the Date of service (string mm/dd/yyyy)' do
1706
+ expect(@check_5010[:eras][0][:line_items][2][:service_date]).to eq("12/31/2010")
1707
+ end
1708
+ it 'returns the CPT code' do
1709
+ expect(@check_5010[:eras][0][:line_items][2][:cpt_code]).to eq("59426")
1710
+ end
1711
+ it 'returns the Charge amount (integer)' do
1712
+ expect(@check_5010[:eras][0][:line_items][2][:charge_amount]).to eq(9900)
1713
+ end
1714
+ it 'returns the Payment amount (integer)' do
1715
+ expect(@check_5010[:eras][0][:line_items][2][:payment_amount]).to eq(4950)
1716
+ end
1717
+ it 'returns the Total adjustment amount (integer)' do
1718
+ expect(@check_5010[:eras][0][:line_items][2][:total_adjustment_amount]).to eq(4950)
1719
+ end
1720
+ it 'returns the Remark code' do
1721
+ expect(@check_5010[:eras][0][:line_items][2][:remark_code]).to eq(nil)
1722
+ end
1723
+ it 'returns the Remarks' do
1724
+ expect(@check_5010[:eras][0][:line_items][2][:remarks]).to eq(nil)
1725
+ end
1726
+ it 'returns the Reference number' do
1727
+ expect(@check_5010[:eras][0][:line_items][2][:reference_number]).to eq('0003')
1728
+ end
1729
+ end
1730
+ end
1731
+ end
1732
+ end
1157
1733
  end
1158
1734
 
1159
1735
  context 'Human readable' do
@@ -0,0 +1,66 @@
1
+ ST*835*1234~
2
+ BPR*H*0*C*NON************20260108~
3
+ TRN*1*5003*560894904~
4
+ REF*F2*LCLA438D~
5
+ DTM*405*20110104~
6
+ N1*PR*BLUE CROSS AND BLUE SHIELD OF NORTH CAROLINA~
7
+ N3*P O BOX 2291~
8
+ N4*DURHAM*NC*27702~
9
+ PER*CX*TE*8005554844~
10
+ N1*PE*XYZ HEALTHCARE CORPORATION*XX*0987654321~
11
+ N3*P O BOX XYZ~
12
+ N4*CHARLOTTE*NC*28234~
13
+ REF*TJ*123456789~
14
+ LX*1~
15
+ CLP*200200964A52*1*300*150*142.54*15*94151100100~
16
+ NM1*QC*1*Dough*Mary~
17
+ NM1*IL*1*Dough*Marty*L**Sr.*MI* YPB123456789009~
18
+ NM1*82*1*Jones*Alice****XX*1116359906~
19
+ DTM*050*20110103~
20
+ SVC*HC:59430*101*50.5**1*HC:59410~
21
+ DTM*472*20101231~
22
+ CAS*CO*42*25.5~
23
+ CAS*PR*2*25~
24
+ REF*6R*0001~
25
+ SVC*HC:59440*100*50**1*HC:59410~
26
+ DTM*472*20101231~
27
+ CAS*PR*3*50~
28
+ REF*6R*0002~
29
+ SVC*HC:59426*99*49.5**1~
30
+ DTM*472*20101231~
31
+ CAS*CO*42*49.5~
32
+ REF*6R*0003~
33
+ SE*33*1234~
34
+ ST*835*1234~
35
+ BPR*I*300*C*ACH************20260109~
36
+ TRN*1*5010*560894904~
37
+ REF*F2*LCLA438D~
38
+ DTM*405*20110104~
39
+ N1*PR*BLUE CROSS AND BLUE SHIELD OF NORTH CAROLINA~
40
+ N3*P O BOX 2291~
41
+ N4*DURHAM*NC*27702~
42
+ PER*CX*TE*8005554844~
43
+ N1*PE*XYZ HEALTHCARE CORPORATION*XX*0987654321~
44
+ N3*P O BOX XYZ~
45
+ N4*CHARLOTTE*NC*28234~
46
+ REF*TJ*123456789~
47
+ LX*1~
48
+ CLP*200200964A52*1*300*150*142.54*15*94151100100~
49
+ NM1*QC*1*Dough*Mary~
50
+ NM1*IL*1*Dough*Marty*L**Sr.*MI* YPB123456789009~
51
+ NM1*82*1*Jones*Alice****XX*1116359906~
52
+ DTM*050*20110103~
53
+ SVC*HC:59430*101*50.5**1*HC:59410~
54
+ DTM*472*20101231~
55
+ CAS*CO*42*25.5~
56
+ CAS*PR*2*25~
57
+ REF*6R*0001~
58
+ SVC*HC:59440*100*50**1*HC:59410~
59
+ DTM*472*20101231~
60
+ CAS*PR*3*50~
61
+ REF*6R*0002~
62
+ SVC*HC:59426*99*49.5**1~
63
+ DTM*472*20101231~
64
+ CAS*CO*42*49.5~
65
+ REF*6R*0003~
66
+ SE*33*1234~
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: era_835_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin S. Dias
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-04 00:00:00.000000000 Z
11
+ date: 2026-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,7 @@ files:
80
80
  - spec/example_3.835
81
81
  - spec/example_4.835
82
82
  - spec/example_5.835
83
+ - spec/example_6.835
83
84
  - spec/spec_helper.rb
84
85
  - spec/test_era.txt
85
86
  homepage: https://github.com/diasks2/era_835_parser
@@ -112,5 +113,6 @@ test_files:
112
113
  - spec/example_3.835
113
114
  - spec/example_4.835
114
115
  - spec/example_5.835
116
+ - spec/example_6.835
115
117
  - spec/spec_helper.rb
116
118
  - spec/test_era.txt