era_835_parser 0.1.9 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/era_835_parser/parser.rb +38 -33
- data/lib/era_835_parser/version.rb +2 -2
- data/lib/era_835_parser.rb +1 -1
- data/spec/era_835_parser_spec.rb +262 -1
- data/spec/example_4.835 +32 -0
- data/spec/spec_helper.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdc09dc9f3656f4155cf027e2ddc655167840ad8d4e06b0e09cc3658c4eb1309
|
4
|
+
data.tar.gz: 3b37bb69fc93fc5bde9125ad62b48d720402a848da1837535fcf928f0edf2bb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4e30df5a5cb6b819bc399d1fc6072f66ec6c950bc9abb33cd5c98d038aff1025dfd14c860719bfa9db4c1f7adbdee81131dd03ffaa7ad729661906af89f6a35
|
7
|
+
data.tar.gz: 158d3d082f2eb8b13af67845fd65dcacef8a12f342770e9ce2f2a1aeb8203092892f9f2341238f6d295c85f6dd534d12adf9d0758651f74dd67a90c774fd864b
|
data/README.md
CHANGED
@@ -66,6 +66,7 @@ if !era[:checks].nil?
|
|
66
66
|
puts line_item[:total_adjustment_amount] # Total adjustment amount (integer)
|
67
67
|
puts line_item[:remark_code] # Remark code
|
68
68
|
puts line_item[:remarks] # Remarks
|
69
|
+
puts line_item[:reference_number] # Reference number
|
69
70
|
if !line_item[:adjustment_groups].nil?
|
70
71
|
line_item[:adjustment_groups].each do |adjustment_group_counter, adjustment_group|
|
71
72
|
puts adjustment_group[:adjustment_group] # Adjustment group
|
@@ -66,6 +66,7 @@ module Era835Parser
|
|
66
66
|
claim_date_end = false
|
67
67
|
service_date = false
|
68
68
|
floating_adjustment_group_code = nil
|
69
|
+
returned_reference_number = false
|
69
70
|
|
70
71
|
file_or_file_path = !file.nil? ? file : file_path
|
71
72
|
opened_file = file_or_file_path.respond_to?(:write) ? file_or_file_path : open(file_or_file_path)
|
@@ -294,7 +295,6 @@ module Era835Parser
|
|
294
295
|
# puts element_type
|
295
296
|
# puts subline
|
296
297
|
# https://www.healthpartnersplans.com/media/100017241/254_Electronic-Remittance-Advice.pdf
|
297
|
-
|
298
298
|
subline.split("*").each_with_index do |element, index|
|
299
299
|
case element_type
|
300
300
|
when "ST"
|
@@ -457,15 +457,6 @@ module Era835Parser
|
|
457
457
|
# Originating Company Supplemental Code
|
458
458
|
# puts "Originating Company Supplemental Code: #{element}"
|
459
459
|
end
|
460
|
-
when "REF"
|
461
|
-
case index
|
462
|
-
when 1
|
463
|
-
# Receiver Identification Number
|
464
|
-
# puts "Receiver Identification Number: #{element}"
|
465
|
-
when 2
|
466
|
-
# Receiver REFERENCE IDENTIFICATION
|
467
|
-
# puts "Receiver REFERENCE IDENTIFICATION: #{element}"
|
468
|
-
end
|
469
460
|
when "N1"
|
470
461
|
if !payer_identification_loop && !payee_identification_loop
|
471
462
|
payer_identification_loop = true
|
@@ -562,21 +553,6 @@ module Era835Parser
|
|
562
553
|
payee_identification_loop = true
|
563
554
|
end
|
564
555
|
end
|
565
|
-
when "REF"
|
566
|
-
case index
|
567
|
-
when 1
|
568
|
-
# Additional Payee Identification Qualifier
|
569
|
-
# puts "Additional Payee Identification Qualifier: #{element}"
|
570
|
-
when 2
|
571
|
-
# Reference Identification Code
|
572
|
-
# puts "Reference Identification Code: #{element}"
|
573
|
-
when 3
|
574
|
-
# Additional Payee Identification Qualifier
|
575
|
-
# puts "Additional Payee Identification Qualifier: #{element}"
|
576
|
-
when 4
|
577
|
-
# Reference Identification Code
|
578
|
-
# puts "Reference Identification Code: #{element}"
|
579
|
-
end
|
580
556
|
when "PER"
|
581
557
|
case index
|
582
558
|
when 1
|
@@ -980,6 +956,26 @@ module Era835Parser
|
|
980
956
|
# Original Units of Service Count
|
981
957
|
# puts "Original Units of Service Count: #{element}"
|
982
958
|
end
|
959
|
+
when "REF"
|
960
|
+
case index
|
961
|
+
when 1
|
962
|
+
# Additional Payee Identification Qualifier
|
963
|
+
# puts "Additional Payee Identification Qualifier: #{element}"
|
964
|
+
returned_reference_number = true if element == '6R'
|
965
|
+
when 2
|
966
|
+
# Reference Identification Code
|
967
|
+
# puts "Reference Identification Code: #{element}"
|
968
|
+
if individual_line_item != {} && svc_counter >= 1 && returned_reference_number && !element.nil?
|
969
|
+
individual_line_item[:reference_number] = element
|
970
|
+
returned_reference_number = false
|
971
|
+
end
|
972
|
+
when 3
|
973
|
+
# Additional Payee Identification Qualifier
|
974
|
+
# puts "Additional Payee Identification Qualifier: #{element}"
|
975
|
+
when 4
|
976
|
+
# Reference Identification Code
|
977
|
+
# puts "Reference Identification Code: #{element}"
|
978
|
+
end
|
983
979
|
end
|
984
980
|
era[:checks] = checks
|
985
981
|
end
|
@@ -1035,13 +1031,13 @@ module Era835Parser
|
|
1035
1031
|
else
|
1036
1032
|
remark = truncate(line_item[:remarks], 82)
|
1037
1033
|
end
|
1038
|
-
line_items += "#{" " *
|
1034
|
+
line_items += "#{" " * 22}#{line_item[:service_date]} #{line_item[:cpt_code]}#{safe_spacing(7, get_length(line_item[:cpt_code]))}#{'%.2f' % (line_item[:charge_amount].to_f / 100)}#{safe_spacing(13, get_length('%.2f' % (line_item[:charge_amount].to_f / 100)))}#{'%.2f' % (line_item[:payment_amount].to_f / 100)}#{safe_spacing(13, get_length('%.2f' % (line_item[:payment_amount].to_f / 100)))}#{'%.2f' % (line_item[:total_adjustment_amount].to_f / 100)}#{safe_spacing(15, get_length('%.2f' % (line_item[:total_adjustment_amount].to_f / 100)))}#{remark}\n\n"
|
1039
1035
|
|
1040
1036
|
if !line_item[:adjustment_groups].nil?
|
1041
1037
|
line_item[:adjustment_groups].each do |adjustment_group_counter, adjustment_group|
|
1042
1038
|
line_items += " Adjustment Group Adj Amt Translated Reason Code\n" if adjustment_group_counter == 0
|
1043
1039
|
reason_code = adjustment_group[:translated_reason_code].nil? ? '' : adjustment_group[:translated_reason_code].upcase
|
1044
|
-
line_items += " #{adjustment_group[:adjustment_group].upcase}#{
|
1040
|
+
line_items += " #{adjustment_group[:adjustment_group].upcase}#{safe_spacing(28, get_length(adjustment_group[:adjustment_group]))}#{'%.2f' % (adjustment_group[:adjustment_amount].to_f / 100)}#{safe_spacing(8, get_length('%.2f' % (adjustment_group[:adjustment_amount].to_f / 100)))}#{truncate(reason_code, 84)}\n"
|
1045
1041
|
line_items += "\n" if line_item[:adjustment_groups].length == (adjustment_group_counter + 1)
|
1046
1042
|
end
|
1047
1043
|
end
|
@@ -1049,19 +1045,19 @@ module Era835Parser
|
|
1049
1045
|
end
|
1050
1046
|
era_text = "--------------------------------------------------------------------------------------------------------------------------------------------------------\n"
|
1051
1047
|
era_text += "Check# Patient ID Last,First Charge Amt Payment Amt Accnt##{" " * [8, get_length(individual_era[:account_number]) - 5].max}Status Payer\n"
|
1052
|
-
era_text += "#{check[:check_number]}#{
|
1048
|
+
era_text += "#{check[:check_number]}#{safe_spacing(31, get_length(check[:check_number]))}#{individual_era[:patient_id]}#{safe_spacing(19, get_length(individual_era[:patient_id]))}#{truncate(individual_era[:patient_name], 18)}#{safe_spacing(20, get_length(truncate(individual_era[:patient_name], 18)))}#{'%.2f' % (individual_era[:charge_amount].to_f / 100)}#{safe_spacing(12, get_length('%.2f' % (individual_era[:charge_amount].to_f / 100)))}#{'%.2f' % (individual_era[:payment_amount].to_f / 100)}#{safe_spacing(13, get_length('%.2f' % (individual_era[:payment_amount].to_f / 100)))}#{individual_era[:account_number]}#{safe_spacing([14, get_length(individual_era[:account_number]) + 1].max, get_length(individual_era[:account_number]))}#{individual_era[:status]}#{safe_spacing(31, get_length(individual_era[:status]))}#{check[:payer_name]}\n"
|
1053
1049
|
era_text += "#{" " * (126 + [14, get_length(individual_era[:account_number]) + 1].max)}#{check[:payer_address]}\n"
|
1054
1050
|
era_text += "#{" " * (126 + [14, get_length(individual_era[:account_number]) + 1].max)}#{check[:payer_city]},#{check[:payer_state]} #{check[:payer_zip_code]}\n"
|
1055
1051
|
era_text += "#{" " * (126 + [14, get_length(individual_era[:account_number]) + 1].max)}Tax ID: #{check[:payer_tax_id]}\n"
|
1056
1052
|
|
1057
1053
|
if !individual_era[:claim_statement_period_end].nil? && !individual_era[:claim_statement_period_start].nil?
|
1058
|
-
era_text += "#{" " *
|
1059
|
-
era_text += "#{" " *
|
1054
|
+
era_text += "#{" " * 96}Payer Claim Control Number: #{individual_era[:payer_claim_control_number]}\n"
|
1055
|
+
era_text += "#{" " * 96}Claim Statement Period: #{individual_era[:claim_statement_period_start]} - #{individual_era[:claim_statement_period_end]}\n\n"
|
1060
1056
|
else
|
1061
|
-
era_text += "#{" " *
|
1057
|
+
era_text += "#{" " * 96}Payer Claim Control Number: #{individual_era[:payer_claim_control_number]}\n\n"
|
1062
1058
|
end
|
1063
1059
|
if line_items.length > 0
|
1064
|
-
era_text += "#{" " *
|
1060
|
+
era_text += "#{" " * 10}Line Item: Svc Date CPT Charge Amt Payment Amt Total Adj Amt Remarks\n"
|
1065
1061
|
era_text += line_items
|
1066
1062
|
end
|
1067
1063
|
era[:checks][check[:check_number]][:eras][era_counter][:era_text] = era_text
|
@@ -1087,5 +1083,14 @@ module Era835Parser
|
|
1087
1083
|
return string.to_s[0...truncate_at]
|
1088
1084
|
end
|
1089
1085
|
end
|
1086
|
+
|
1087
|
+
def safe_spacing(max, length)
|
1088
|
+
value = max - length
|
1089
|
+
if value >= 0
|
1090
|
+
" " * value
|
1091
|
+
else
|
1092
|
+
""
|
1093
|
+
end
|
1094
|
+
end
|
1090
1095
|
end
|
1091
|
-
end
|
1096
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module Era835Parser
|
2
|
-
VERSION = "0.1.
|
3
|
-
end
|
2
|
+
VERSION = "0.1.11"
|
3
|
+
end
|
data/lib/era_835_parser.rb
CHANGED
data/spec/era_835_parser_spec.rb
CHANGED
@@ -128,6 +128,9 @@ RSpec.describe Era835Parser::Parser do
|
|
128
128
|
it 'returns the Remarks' do
|
129
129
|
expect(@era[:checks]['70408535'][:eras][0][:line_items][0][:remarks]).to eq(nil)
|
130
130
|
end
|
131
|
+
it 'returns the Reference number' do
|
132
|
+
expect(@era[:checks]['70408535'][:eras][0][:line_items][0][:reference_number]).to eq(nil)
|
133
|
+
end
|
131
134
|
context 'Adjustment group #0' do
|
132
135
|
it 'returns the Adjustment group' do
|
133
136
|
expect(@era[:checks]['70408535'][:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group]).to eq("Contractual Obligation")
|
@@ -279,6 +282,9 @@ RSpec.describe Era835Parser::Parser do
|
|
279
282
|
it 'returns the Remarks' do
|
280
283
|
expect(@era[:checks]['02790758'][:eras][0][:line_items][0][:remarks]).to eq(nil)
|
281
284
|
end
|
285
|
+
it 'returns the Reference number' do
|
286
|
+
expect(@era[:checks]['02790758'][:eras][0][:line_items][0][:reference_number]).to eq('0001')
|
287
|
+
end
|
282
288
|
context 'Adjustment group #0' do
|
283
289
|
it 'returns the Adjustment group' do
|
284
290
|
expect(@era[:checks]['02790758'][:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group]).to eq("Contractual Obligation")
|
@@ -336,6 +342,9 @@ RSpec.describe Era835Parser::Parser do
|
|
336
342
|
it 'returns the Remarks' do
|
337
343
|
expect(@era[:checks]['02790758'][:eras][0][:line_items][1][:remarks]).to eq(nil)
|
338
344
|
end
|
345
|
+
it 'returns the Reference number' do
|
346
|
+
expect(@era[:checks]['02790758'][:eras][0][:line_items][1][:reference_number]).to eq('0002')
|
347
|
+
end
|
339
348
|
context 'Adjustment group #0' do
|
340
349
|
it 'returns the Adjustment group' do
|
341
350
|
expect(@era[:checks]['02790758'][:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_group]).to eq("Patient Responsibility")
|
@@ -376,6 +385,9 @@ RSpec.describe Era835Parser::Parser do
|
|
376
385
|
it 'returns the Remarks' do
|
377
386
|
expect(@era[:checks]['02790758'][:eras][0][:line_items][2][:remarks]).to eq(nil)
|
378
387
|
end
|
388
|
+
it 'returns the Reference number' do
|
389
|
+
expect(@era[:checks]['02790758'][:eras][0][:line_items][2][:reference_number]).to eq('0003')
|
390
|
+
end
|
379
391
|
end
|
380
392
|
end
|
381
393
|
end
|
@@ -510,6 +522,9 @@ RSpec.describe Era835Parser::Parser do
|
|
510
522
|
it 'returns the Remarks' do
|
511
523
|
expect(@era[:checks]['02790758'][:eras][0][:line_items][0][:remarks]).to eq(nil)
|
512
524
|
end
|
525
|
+
it 'returns the Reference number' do
|
526
|
+
expect(@era[:checks]['02790758'][:eras][0][:line_items][0][:reference_number]).to eq('0001')
|
527
|
+
end
|
513
528
|
context 'Adjustment group #0' do
|
514
529
|
it 'returns the Adjustment group' do
|
515
530
|
expect(@era[:checks]['02790758'][:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group]).to eq("Contractual Obligation")
|
@@ -567,6 +582,9 @@ RSpec.describe Era835Parser::Parser do
|
|
567
582
|
it 'returns the Remarks' do
|
568
583
|
expect(@era[:checks]['02790758'][:eras][0][:line_items][1][:remarks]).to eq(nil)
|
569
584
|
end
|
585
|
+
it 'returns the Reference number' do
|
586
|
+
expect(@era[:checks]['02790758'][:eras][0][:line_items][1][:reference_number]).to eq('0002')
|
587
|
+
end
|
570
588
|
context 'Adjustment group #0' do
|
571
589
|
it 'returns the Adjustment group' do
|
572
590
|
expect(@era[:checks]['02790758'][:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_group]).to eq("Patient Responsibility")
|
@@ -607,6 +625,249 @@ RSpec.describe Era835Parser::Parser do
|
|
607
625
|
it 'returns the Remarks' do
|
608
626
|
expect(@era[:checks]['02790758'][:eras][0][:line_items][2][:remarks]).to eq(nil)
|
609
627
|
end
|
628
|
+
it 'returns the Reference number' do
|
629
|
+
expect(@era[:checks]['02790758'][:eras][0][:line_items][2][:reference_number]).to eq('0003')
|
630
|
+
end
|
631
|
+
end
|
632
|
+
end
|
633
|
+
end
|
634
|
+
end
|
635
|
+
|
636
|
+
context 'example_4.835' do
|
637
|
+
before :all do
|
638
|
+
@era = Era835Parser::Parser.new(file_path: "../era_835_parser/spec/example_4.835").parse
|
639
|
+
end
|
640
|
+
|
641
|
+
context 'Aggregate totals' do
|
642
|
+
it 'returns the addressed to' do
|
643
|
+
expect(@era[:addressed_to]).to eq(nil)
|
644
|
+
end
|
645
|
+
it 'returns the correct number of checks' do
|
646
|
+
expect(@era[:checks].count).to eq(1)
|
647
|
+
end
|
648
|
+
it 'returns the correct number of adjustments' do
|
649
|
+
expect(@era[:adjustments]).to eq(nil)
|
650
|
+
end
|
651
|
+
it 'returns the correct number of eras' do
|
652
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras].count).to eq(1)
|
653
|
+
end
|
654
|
+
it 'returns the correct number of line items' do
|
655
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items].count).to eq(3)
|
656
|
+
end
|
657
|
+
it 'returns the correct number of adjustment groups' do
|
658
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups].count).to eq(2)
|
659
|
+
end
|
660
|
+
it 'returns the correct number of adjustment groups' do
|
661
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:adjustment_groups].count).to eq(1)
|
662
|
+
end
|
663
|
+
it 'returns the correct number of adjustment groups' do
|
664
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:adjustment_groups]).to eq(nil)
|
665
|
+
end
|
666
|
+
end
|
667
|
+
|
668
|
+
context 'Check #70408535' do
|
669
|
+
it 'returns the check number' do
|
670
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:check_number]).to eq('0123456789012345678901234567890123456789')
|
671
|
+
end
|
672
|
+
it 'returns the amount' do
|
673
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:amount]).to eq(192286)
|
674
|
+
end
|
675
|
+
it 'returns the number of claims' do
|
676
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:number_of_claims]).to eq(1)
|
677
|
+
end
|
678
|
+
it 'returns the NPI or Tax ID of payee' do
|
679
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:npi_tax_id]).to eq('0987654321')
|
680
|
+
end
|
681
|
+
it 'returns the Check payee' do
|
682
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:payee]).to eq('XYZ HEALTHCARE CORPORATION')
|
683
|
+
end
|
684
|
+
it 'returns the Payer name' do
|
685
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:payer_name]).to eq('BLUE CROSS AND BLUE SHIELD OF NORTH CAROLINA')
|
686
|
+
end
|
687
|
+
it 'returns the Payer address' do
|
688
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:payer_address]).to eq('P O BOX 2291')
|
689
|
+
end
|
690
|
+
it 'returns the Payer city' do
|
691
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:payer_city]).to eq('DURHAM')
|
692
|
+
end
|
693
|
+
it 'returns the Payer state' do
|
694
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:payer_state]).to eq('NC')
|
695
|
+
end
|
696
|
+
it 'returns the Payer zip code' do
|
697
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:payer_zip_code]).to eq('27702')
|
698
|
+
end
|
699
|
+
it 'returns the Payer tax id' do
|
700
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:payer_tax_id]).to eq('60-894904')
|
701
|
+
end
|
702
|
+
it 'returns the Check date (string mm/dd/yyyy)' do
|
703
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:date]).to eq('01/08/2011')
|
704
|
+
end
|
705
|
+
context 'ERA #0' do
|
706
|
+
it 'returns the Patient ID' do
|
707
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:patient_id]).to eq('YPB123456789001')
|
708
|
+
end
|
709
|
+
it 'returns the Patient name' do
|
710
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:patient_name]).to eq('DOUGH,MARY')
|
711
|
+
end
|
712
|
+
it 'returns the Patient last name (titlized)' do
|
713
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:patient_last_name]).to eq('Dough')
|
714
|
+
end
|
715
|
+
it 'returns the Patient first name (titlized)' do
|
716
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:patient_first_name]).to eq('Mary')
|
717
|
+
end
|
718
|
+
it 'returns the Total charge amount (integer)' do
|
719
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:charge_amount]).to eq(210000)
|
720
|
+
end
|
721
|
+
it 'returns the Total payment amount (integer)' do
|
722
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:payment_amount]).to eq(192286)
|
723
|
+
end
|
724
|
+
it 'returns the Account number' do
|
725
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:account_number]).to eq('200200964A52')
|
726
|
+
end
|
727
|
+
it 'returns the Cliam status code' do
|
728
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:claim_status_code]).to eq('1')
|
729
|
+
end
|
730
|
+
it 'returns the Claim status code description' do
|
731
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:status]).to eq("PROCESSED AS PRIMARY")
|
732
|
+
end
|
733
|
+
it 'returns the Payer claim control number' do
|
734
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:payer_claim_control_number]).to eq('94151100100')
|
735
|
+
end
|
736
|
+
it 'returns the Claim statement period start' do
|
737
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:claim_statement_period_start]).to eq(nil)
|
738
|
+
end
|
739
|
+
it 'returns the Claim statement period end' do
|
740
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:claim_statement_period_end]).to eq(nil)
|
741
|
+
end
|
742
|
+
|
743
|
+
context 'Line item #0' do
|
744
|
+
it 'returns the Date of service (string mm/dd/yyyy)' do
|
745
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:service_date]).to eq("12/31/2010")
|
746
|
+
end
|
747
|
+
it 'returns the CPT code' do
|
748
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:cpt_code]).to eq("59430")
|
749
|
+
end
|
750
|
+
it 'returns the Charge amount (integer)' do
|
751
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:charge_amount]).to eq(121000)
|
752
|
+
end
|
753
|
+
it 'returns the Payment amount (integer)' do
|
754
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:payment_amount]).to eq(105786)
|
755
|
+
end
|
756
|
+
it 'returns the Total adjustment amount (integer)' do
|
757
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:total_adjustment_amount]).to eq(15214)
|
758
|
+
end
|
759
|
+
it 'returns the Remark code' do
|
760
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:remark_code]).to eq(nil)
|
761
|
+
end
|
762
|
+
it 'returns the Remarks' do
|
763
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:remarks]).to eq(nil)
|
764
|
+
end
|
765
|
+
it 'returns the Reference number' do
|
766
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:reference_number]).to eq('0001')
|
767
|
+
end
|
768
|
+
context 'Adjustment group #0' do
|
769
|
+
it 'returns the Adjustment group' do
|
770
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group]).to eq("Contractual Obligation")
|
771
|
+
end
|
772
|
+
it 'returns the Adjustment group code' do
|
773
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group_code]).to eq("CO")
|
774
|
+
end
|
775
|
+
it 'returns the Adjustment amount (integer)' do
|
776
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_amount]).to eq(3460)
|
777
|
+
end
|
778
|
+
it 'returns the Reason code' do
|
779
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][0][:reason_code]).to eq('42')
|
780
|
+
end
|
781
|
+
it 'returns the Translated reason code' do
|
782
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][: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)")
|
783
|
+
end
|
784
|
+
end
|
785
|
+
context 'Adjustment group #1' do
|
786
|
+
it 'returns the Adjustment group' do
|
787
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_group]).to eq("Patient Responsibility")
|
788
|
+
end
|
789
|
+
it 'returns the Adjustment group code' do
|
790
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_group_code]).to eq("PR")
|
791
|
+
end
|
792
|
+
it 'returns the Adjustment amount (integer)' do
|
793
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_amount]).to eq(11754)
|
794
|
+
end
|
795
|
+
it 'returns the Reason code' do
|
796
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][1][:reason_code]).to eq('2')
|
797
|
+
end
|
798
|
+
it 'returns the Translated reason code' do
|
799
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][1][:translated_reason_code]).to eq("Coinsurance Amount")
|
800
|
+
end
|
801
|
+
end
|
802
|
+
end
|
803
|
+
context 'Line item #1' do
|
804
|
+
it 'returns the Date of service (string mm/dd/yyyy)' do
|
805
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:service_date]).to eq("12/31/2010")
|
806
|
+
end
|
807
|
+
it 'returns the CPT code' do
|
808
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:cpt_code]).to eq("59440")
|
809
|
+
end
|
810
|
+
it 'returns the Charge amount (integer)' do
|
811
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:charge_amount]).to eq(89000)
|
812
|
+
end
|
813
|
+
it 'returns the Payment amount (integer)' do
|
814
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:payment_amount]).to eq(86500)
|
815
|
+
end
|
816
|
+
it 'returns the Total adjustment amount (integer)' do
|
817
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:total_adjustment_amount]).to eq(2500)
|
818
|
+
end
|
819
|
+
it 'returns the Remark code' do
|
820
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:remark_code]).to eq(nil)
|
821
|
+
end
|
822
|
+
it 'returns the Remarks' do
|
823
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:remarks]).to eq(nil)
|
824
|
+
end
|
825
|
+
it 'returns the Reference number' do
|
826
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:reference_number]).to eq('0002')
|
827
|
+
end
|
828
|
+
context 'Adjustment group #0' do
|
829
|
+
it 'returns the Adjustment group' do
|
830
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_group]).to eq("Patient Responsibility")
|
831
|
+
end
|
832
|
+
it 'returns the Adjustment group code' do
|
833
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_group_code]).to eq("PR")
|
834
|
+
end
|
835
|
+
it 'returns the Adjustment amount (integer)' do
|
836
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_amount]).to eq(2500)
|
837
|
+
end
|
838
|
+
it 'returns the Reason code' do
|
839
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:adjustment_groups][0][:reason_code]).to eq('3')
|
840
|
+
end
|
841
|
+
it 'returns the Translated reason code' do
|
842
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:adjustment_groups][0][:translated_reason_code]).to eq("Co-payment Amount")
|
843
|
+
end
|
844
|
+
end
|
845
|
+
end
|
846
|
+
context 'Line item #2' do
|
847
|
+
it 'returns the Date of service (string mm/dd/yyyy)' do
|
848
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:service_date]).to eq("12/31/2010")
|
849
|
+
end
|
850
|
+
it 'returns the CPT code' do
|
851
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:cpt_code]).to eq("59426")
|
852
|
+
end
|
853
|
+
it 'returns the Charge amount (integer)' do
|
854
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:charge_amount]).to eq(74200)
|
855
|
+
end
|
856
|
+
it 'returns the Payment amount (integer)' do
|
857
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:payment_amount]).to eq(74200)
|
858
|
+
end
|
859
|
+
it 'returns the Total adjustment amount (integer)' do
|
860
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:total_adjustment_amount]).to eq(nil)
|
861
|
+
end
|
862
|
+
it 'returns the Remark code' do
|
863
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:remark_code]).to eq(nil)
|
864
|
+
end
|
865
|
+
it 'returns the Remarks' do
|
866
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:remarks]).to eq(nil)
|
867
|
+
end
|
868
|
+
it 'returns the Reference number' do
|
869
|
+
expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:reference_number]).to eq('0003')
|
870
|
+
end
|
610
871
|
end
|
611
872
|
end
|
612
873
|
end
|
@@ -1477,4 +1738,4 @@ Check# Patient ID Last,First Charge Amt
|
|
1477
1738
|
end
|
1478
1739
|
end
|
1479
1740
|
end
|
1480
|
-
end
|
1741
|
+
end
|
data/spec/example_4.835
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
ST*835*1234~
|
2
|
+
BPR*I*1922.86*C*CHK************20110108~
|
3
|
+
TRN*1*0123456789012345678901234567890123456789*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*2100*1922.86*142.54*15*94151100100~
|
16
|
+
NM1*QC*1*Dough*Mary****MI* YPB123456789001~
|
17
|
+
DTM*050*20110103~
|
18
|
+
SVC*HC:59430*1210*1057.86**1*HC:59410~
|
19
|
+
DTM*472*20101231~
|
20
|
+
CAS*CO*42*34.6~
|
21
|
+
CAS*PR*2*117.54~
|
22
|
+
REF*6R*0001~
|
23
|
+
AMT*B6*1175.4~
|
24
|
+
SVC*HC:59440*890*865**1*HC:59410~
|
25
|
+
DTM*472*20101231~
|
26
|
+
CAS*PR*3*25~
|
27
|
+
REF*6R*0002~
|
28
|
+
SVC*HC:59426*742*742**1~
|
29
|
+
DTM*472*20101231~
|
30
|
+
REF*6R*0003~
|
31
|
+
AMT*B6*742~
|
32
|
+
SE*33*1234~
|
data/spec/spec_helper.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin S. Dias
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -78,13 +78,14 @@ files:
|
|
78
78
|
- spec/example_1.835
|
79
79
|
- spec/example_2.835
|
80
80
|
- spec/example_3.835
|
81
|
+
- spec/example_4.835
|
81
82
|
- spec/spec_helper.rb
|
82
83
|
- spec/test_era.txt
|
83
84
|
homepage: https://github.com/diasks2/era_835_parser
|
84
85
|
licenses:
|
85
86
|
- MIT
|
86
87
|
metadata: {}
|
87
|
-
post_install_message:
|
88
|
+
post_install_message:
|
88
89
|
rdoc_options: []
|
89
90
|
require_paths:
|
90
91
|
- lib
|
@@ -99,9 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
100
|
- !ruby/object:Gem::Version
|
100
101
|
version: '0'
|
101
102
|
requirements: []
|
102
|
-
|
103
|
-
|
104
|
-
signing_key:
|
103
|
+
rubygems_version: 3.3.26
|
104
|
+
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: Electronic Remittance Advice (ERA) 835 parser
|
107
107
|
test_files:
|
@@ -109,5 +109,6 @@ test_files:
|
|
109
109
|
- spec/example_1.835
|
110
110
|
- spec/example_2.835
|
111
111
|
- spec/example_3.835
|
112
|
+
- spec/example_4.835
|
112
113
|
- spec/spec_helper.rb
|
113
114
|
- spec/test_era.txt
|