era_835_parser 0.1.10 → 0.1.12

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: 1b394c2e2133a067275fc162829b81b1e2a2a6b7794c3263796f7bc307560b24
4
- data.tar.gz: 050a54cc12e40d5d302fb90d978c2da811271a32c97248e019961ca5795a059d
3
+ metadata.gz: 1a4d95e601bfb1f71b439fe740842c2485accf92bbd7b890e922e5fa53d1b447
4
+ data.tar.gz: 89f39835c344f1a9005245ac6712ec0c56dedbebe1cca0f92f608ad598b93ca8
5
5
  SHA512:
6
- metadata.gz: 74ba8ed4f544b671ffa85bb88e9557b3a36bef85563cf5a4b6644e3167417705ed0bdc4c676614836081754dbb4f6845c75f4af6950d9ce3a6b4d067eaf096b0
7
- data.tar.gz: 1e1f44f0771c48278b527168fe706d60178f17f4ca84e1fd74b81eb01f2aba68b27fcc59da197b1147e09fd795f9a8918ac9c268b11ba333987effc78cc70e9e
6
+ metadata.gz: 489f980ede5fe53b11c9e83806343da7a891e333f3a4d21cdcb1e73918915938473f5cee500b9624874fd1c34e2f06c6d050b616756060dc8e4fd9f1eae21237
7
+ data.tar.gz: 641a2ddd323d683091d047dd04c4b26e43bdbf4bc9151bbe28c0e8aa5bf72d958a329eeadf40cdcfe402c4bff51477d9f17f7f2ab337fc2e85986272ee4f9a3e
@@ -67,6 +67,7 @@ module Era835Parser
67
67
  service_date = false
68
68
  floating_adjustment_group_code = nil
69
69
  returned_reference_number = false
70
+ payer_edi_id = false
70
71
 
71
72
  file_or_file_path = !file.nil? ? file : file_path
72
73
  opened_file = file_or_file_path.respond_to?(:write) ? file_or_file_path : open(file_or_file_path)
@@ -962,6 +963,7 @@ module Era835Parser
962
963
  # Additional Payee Identification Qualifier
963
964
  # puts "Additional Payee Identification Qualifier: #{element}"
964
965
  returned_reference_number = true if element == '6R'
966
+ payer_edi_id = true if element == '2U'
965
967
  when 2
966
968
  # Reference Identification Code
967
969
  # puts "Reference Identification Code: #{element}"
@@ -969,6 +971,11 @@ module Era835Parser
969
971
  individual_line_item[:reference_number] = element
970
972
  returned_reference_number = false
971
973
  end
974
+
975
+ if payer_edi_id
976
+ era[:checks][check[:check_number]][:payer_edi_id] = element
977
+ payer_edi_id = false
978
+ end
972
979
  when 3
973
980
  # Additional Payee Identification Qualifier
974
981
  # puts "Additional Payee Identification Qualifier: #{element}"
@@ -1031,13 +1038,13 @@ module Era835Parser
1031
1038
  else
1032
1039
  remark = truncate(line_item[:remarks], 82)
1033
1040
  end
1034
- line_items += "#{" " * (22)}#{line_item[:service_date]} #{line_item[:cpt_code]}#{" " * (7 - get_length(line_item[:cpt_code]))}#{'%.2f' % (line_item[:charge_amount].to_f / 100)}#{" " * (13 - get_length('%.2f' % (line_item[:charge_amount].to_f / 100)))}#{'%.2f' % (line_item[:payment_amount].to_f / 100)}#{" " * (13 - get_length('%.2f' % (line_item[:payment_amount].to_f / 100)))}#{'%.2f' % (line_item[:total_adjustment_amount].to_f / 100)}#{" " * (15 - get_length('%.2f' % (line_item[:total_adjustment_amount].to_f / 100)))}#{remark}\n\n"
1041
+ 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"
1035
1042
 
1036
1043
  if !line_item[:adjustment_groups].nil?
1037
1044
  line_item[:adjustment_groups].each do |adjustment_group_counter, adjustment_group|
1038
1045
  line_items += " Adjustment Group Adj Amt Translated Reason Code\n" if adjustment_group_counter == 0
1039
1046
  reason_code = adjustment_group[:translated_reason_code].nil? ? '' : adjustment_group[:translated_reason_code].upcase
1040
- line_items += " #{adjustment_group[:adjustment_group].upcase}#{" " * (28 - get_length(adjustment_group[:adjustment_group]))}#{'%.2f' % (adjustment_group[:adjustment_amount].to_f / 100)}#{" " * (8 - get_length('%.2f' % (adjustment_group[:adjustment_amount].to_f / 100)))}#{truncate(reason_code, 84)}\n"
1047
+ 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"
1041
1048
  line_items += "\n" if line_item[:adjustment_groups].length == (adjustment_group_counter + 1)
1042
1049
  end
1043
1050
  end
@@ -1045,19 +1052,19 @@ module Era835Parser
1045
1052
  end
1046
1053
  era_text = "--------------------------------------------------------------------------------------------------------------------------------------------------------\n"
1047
1054
  era_text += "Check# Patient ID Last,First Charge Amt Payment Amt Accnt##{" " * [8, get_length(individual_era[:account_number]) - 5].max}Status Payer\n"
1048
- era_text += "#{check[:check_number]}#{" " * (31 - get_length(check[:check_number]))}#{individual_era[:patient_id]}#{" " * (19 - get_length(individual_era[:patient_id]))}#{truncate(individual_era[:patient_name], 18)}#{" " * (20 - get_length(truncate(individual_era[:patient_name], 18)))}#{'%.2f' % (individual_era[:charge_amount].to_f / 100)}#{" " * (12 - get_length('%.2f' % (individual_era[:charge_amount].to_f / 100)))}#{'%.2f' % (individual_era[:payment_amount].to_f / 100)}#{" " * (13 - get_length('%.2f' % (individual_era[:payment_amount].to_f / 100)))}#{individual_era[:account_number]}#{" " * ([14, get_length(individual_era[:account_number]) + 1].max - get_length(individual_era[:account_number]))}#{individual_era[:status]}#{" " * (31 - get_length(individual_era[:status]))}#{check[:payer_name]}\n"
1055
+ 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"
1049
1056
  era_text += "#{" " * (126 + [14, get_length(individual_era[:account_number]) + 1].max)}#{check[:payer_address]}\n"
1050
1057
  era_text += "#{" " * (126 + [14, get_length(individual_era[:account_number]) + 1].max)}#{check[:payer_city]},#{check[:payer_state]} #{check[:payer_zip_code]}\n"
1051
1058
  era_text += "#{" " * (126 + [14, get_length(individual_era[:account_number]) + 1].max)}Tax ID: #{check[:payer_tax_id]}\n"
1052
1059
 
1053
1060
  if !individual_era[:claim_statement_period_end].nil? && !individual_era[:claim_statement_period_start].nil?
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"
1061
+ era_text += "#{" " * 96}Payer Claim Control Number: #{individual_era[:payer_claim_control_number]}\n"
1062
+ era_text += "#{" " * 96}Claim Statement Period: #{individual_era[:claim_statement_period_start]} - #{individual_era[:claim_statement_period_end]}\n\n"
1056
1063
  else
1057
- era_text += "#{" " * (96)}Payer Claim Control Number: #{individual_era[:payer_claim_control_number]}\n\n"
1064
+ era_text += "#{" " * 96}Payer Claim Control Number: #{individual_era[:payer_claim_control_number]}\n\n"
1058
1065
  end
1059
1066
  if line_items.length > 0
1060
- era_text += "#{" " * (10)}Line Item: Svc Date CPT Charge Amt Payment Amt Total Adj Amt Remarks\n"
1067
+ era_text += "#{" " * 10}Line Item: Svc Date CPT Charge Amt Payment Amt Total Adj Amt Remarks\n"
1061
1068
  era_text += line_items
1062
1069
  end
1063
1070
  era[:checks][check[:check_number]][:eras][era_counter][:era_text] = era_text
@@ -1083,5 +1090,14 @@ module Era835Parser
1083
1090
  return string.to_s[0...truncate_at]
1084
1091
  end
1085
1092
  end
1093
+
1094
+ def safe_spacing(max, length)
1095
+ value = max - length
1096
+ if value >= 0
1097
+ " " * value
1098
+ else
1099
+ ""
1100
+ end
1101
+ end
1086
1102
  end
1087
- end
1103
+ end
@@ -1,3 +1,3 @@
1
1
  module Era835Parser
2
- VERSION = "0.1.10"
3
- end
2
+ VERSION = "0.1.12"
3
+ end
@@ -1,3 +1,3 @@
1
1
  require "set"
2
2
  require "era_835_parser/version"
3
- require "era_835_parser/parser"
3
+ require "era_835_parser/parser"
@@ -65,6 +65,9 @@ RSpec.describe Era835Parser::Parser do
65
65
  it 'returns the Payer tax id' do
66
66
  expect(@era[:checks]['70408535'][:payer_tax_id]).to eq('57-14001')
67
67
  end
68
+ it 'returns the Payer EDI id' do
69
+ expect(@era[:checks]['70408535'][:payer_edi_id]).to eq('11111')
70
+ end
68
71
  it 'returns the Check date (string mm/dd/yyyy)' do
69
72
  expect(@era[:checks]['70408535'][:date]).to eq('09/23/2010')
70
73
  end
@@ -185,7 +188,7 @@ RSpec.describe Era835Parser::Parser do
185
188
  end
186
189
  end
187
190
 
188
- context 'Check #70408535' do
191
+ context 'Check #02790758' do
189
192
  it 'returns the check number' do
190
193
  expect(@era[:checks]['02790758'][:check_number]).to eq('02790758')
191
194
  end
@@ -219,6 +222,9 @@ RSpec.describe Era835Parser::Parser do
219
222
  it 'returns the Payer tax id' do
220
223
  expect(@era[:checks]['02790758'][:payer_tax_id]).to eq('60-894904')
221
224
  end
225
+ it 'returns the Payer EDI id' do
226
+ expect(@era[:checks]['02790758'][:payer_edi_id]).to eq('22222')
227
+ end
222
228
  it 'returns the Check date (string mm/dd/yyyy)' do
223
229
  expect(@era[:checks]['02790758'][:date]).to eq('01/08/2011')
224
230
  end
@@ -425,7 +431,7 @@ RSpec.describe Era835Parser::Parser do
425
431
  end
426
432
  end
427
433
 
428
- context 'Check #70408535' do
434
+ context 'Check #02790758' do
429
435
  it 'returns the check number' do
430
436
  expect(@era[:checks]['02790758'][:check_number]).to eq('02790758')
431
437
  end
@@ -459,6 +465,9 @@ RSpec.describe Era835Parser::Parser do
459
465
  it 'returns the Payer tax id' do
460
466
  expect(@era[:checks]['02790758'][:payer_tax_id]).to eq('60-894904')
461
467
  end
468
+ it 'returns the Payer EDI id' do
469
+ expect(@era[:checks]['02790758'][:payer_edi_id]).to eq('33333')
470
+ end
462
471
  it 'returns the Check date (string mm/dd/yyyy)' do
463
472
  expect(@era[:checks]['02790758'][:date]).to eq('01/08/2011')
464
473
  end
@@ -632,6 +641,249 @@ RSpec.describe Era835Parser::Parser do
632
641
  end
633
642
  end
634
643
  end
644
+
645
+ context 'example_4.835' do
646
+ before :all do
647
+ @era = Era835Parser::Parser.new(file_path: "../era_835_parser/spec/example_4.835").parse
648
+ end
649
+
650
+ context 'Aggregate totals' do
651
+ it 'returns the addressed to' do
652
+ expect(@era[:addressed_to]).to eq(nil)
653
+ end
654
+ it 'returns the correct number of checks' do
655
+ expect(@era[:checks].count).to eq(1)
656
+ end
657
+ it 'returns the correct number of adjustments' do
658
+ expect(@era[:adjustments]).to eq(nil)
659
+ end
660
+ it 'returns the correct number of eras' do
661
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras].count).to eq(1)
662
+ end
663
+ it 'returns the correct number of line items' do
664
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items].count).to eq(3)
665
+ end
666
+ it 'returns the correct number of adjustment groups' do
667
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups].count).to eq(2)
668
+ end
669
+ it 'returns the correct number of adjustment groups' do
670
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:adjustment_groups].count).to eq(1)
671
+ end
672
+ it 'returns the correct number of adjustment groups' do
673
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:adjustment_groups]).to eq(nil)
674
+ end
675
+ end
676
+
677
+ context 'Check #70408535' do
678
+ it 'returns the check number' do
679
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:check_number]).to eq('0123456789012345678901234567890123456789')
680
+ end
681
+ it 'returns the amount' do
682
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:amount]).to eq(192286)
683
+ end
684
+ it 'returns the number of claims' do
685
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:number_of_claims]).to eq(1)
686
+ end
687
+ it 'returns the NPI or Tax ID of payee' do
688
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:npi_tax_id]).to eq('0987654321')
689
+ end
690
+ it 'returns the Check payee' do
691
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:payee]).to eq('XYZ HEALTHCARE CORPORATION')
692
+ end
693
+ it 'returns the Payer name' do
694
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:payer_name]).to eq('BLUE CROSS AND BLUE SHIELD OF NORTH CAROLINA')
695
+ end
696
+ it 'returns the Payer address' do
697
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:payer_address]).to eq('P O BOX 2291')
698
+ end
699
+ it 'returns the Payer city' do
700
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:payer_city]).to eq('DURHAM')
701
+ end
702
+ it 'returns the Payer state' do
703
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:payer_state]).to eq('NC')
704
+ end
705
+ it 'returns the Payer zip code' do
706
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:payer_zip_code]).to eq('27702')
707
+ end
708
+ it 'returns the Payer tax id' do
709
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:payer_tax_id]).to eq('60-894904')
710
+ end
711
+ it 'returns the Payer EDI id' do
712
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:payer_edi_id]).to eq(nil)
713
+ end
714
+ it 'returns the Check date (string mm/dd/yyyy)' do
715
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:date]).to eq('01/08/2011')
716
+ end
717
+ context 'ERA #0' do
718
+ it 'returns the Patient ID' do
719
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:patient_id]).to eq('YPB123456789001')
720
+ end
721
+ it 'returns the Patient name' do
722
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:patient_name]).to eq('DOUGH,MARY')
723
+ end
724
+ it 'returns the Patient last name (titlized)' do
725
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:patient_last_name]).to eq('Dough')
726
+ end
727
+ it 'returns the Patient first name (titlized)' do
728
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:patient_first_name]).to eq('Mary')
729
+ end
730
+ it 'returns the Total charge amount (integer)' do
731
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:charge_amount]).to eq(210000)
732
+ end
733
+ it 'returns the Total payment amount (integer)' do
734
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:payment_amount]).to eq(192286)
735
+ end
736
+ it 'returns the Account number' do
737
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:account_number]).to eq('200200964A52')
738
+ end
739
+ it 'returns the Cliam status code' do
740
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:claim_status_code]).to eq('1')
741
+ end
742
+ it 'returns the Claim status code description' do
743
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:status]).to eq("PROCESSED AS PRIMARY")
744
+ end
745
+ it 'returns the Payer claim control number' do
746
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:payer_claim_control_number]).to eq('94151100100')
747
+ end
748
+ it 'returns the Claim statement period start' do
749
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:claim_statement_period_start]).to eq(nil)
750
+ end
751
+ it 'returns the Claim statement period end' do
752
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:claim_statement_period_end]).to eq(nil)
753
+ end
754
+
755
+ context 'Line item #0' do
756
+ it 'returns the Date of service (string mm/dd/yyyy)' do
757
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:service_date]).to eq("12/31/2010")
758
+ end
759
+ it 'returns the CPT code' do
760
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:cpt_code]).to eq("59430")
761
+ end
762
+ it 'returns the Charge amount (integer)' do
763
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:charge_amount]).to eq(121000)
764
+ end
765
+ it 'returns the Payment amount (integer)' do
766
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:payment_amount]).to eq(105786)
767
+ end
768
+ it 'returns the Total adjustment amount (integer)' do
769
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:total_adjustment_amount]).to eq(15214)
770
+ end
771
+ it 'returns the Remark code' do
772
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:remark_code]).to eq(nil)
773
+ end
774
+ it 'returns the Remarks' do
775
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:remarks]).to eq(nil)
776
+ end
777
+ it 'returns the Reference number' do
778
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:reference_number]).to eq('0001')
779
+ end
780
+ context 'Adjustment group #0' do
781
+ it 'returns the Adjustment group' do
782
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group]).to eq("Contractual Obligation")
783
+ end
784
+ it 'returns the Adjustment group code' do
785
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_group_code]).to eq("CO")
786
+ end
787
+ it 'returns the Adjustment amount (integer)' do
788
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][0][:adjustment_amount]).to eq(3460)
789
+ end
790
+ it 'returns the Reason code' do
791
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][0][:reason_code]).to eq('42')
792
+ end
793
+ it 'returns the Translated reason code' do
794
+ 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)")
795
+ end
796
+ end
797
+ context 'Adjustment group #1' do
798
+ it 'returns the Adjustment group' do
799
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_group]).to eq("Patient Responsibility")
800
+ end
801
+ it 'returns the Adjustment group code' do
802
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_group_code]).to eq("PR")
803
+ end
804
+ it 'returns the Adjustment amount (integer)' do
805
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][1][:adjustment_amount]).to eq(11754)
806
+ end
807
+ it 'returns the Reason code' do
808
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][1][:reason_code]).to eq('2')
809
+ end
810
+ it 'returns the Translated reason code' do
811
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][0][:adjustment_groups][1][:translated_reason_code]).to eq("Coinsurance Amount")
812
+ end
813
+ end
814
+ end
815
+ context 'Line item #1' do
816
+ it 'returns the Date of service (string mm/dd/yyyy)' do
817
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:service_date]).to eq("12/31/2010")
818
+ end
819
+ it 'returns the CPT code' do
820
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:cpt_code]).to eq("59440")
821
+ end
822
+ it 'returns the Charge amount (integer)' do
823
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:charge_amount]).to eq(89000)
824
+ end
825
+ it 'returns the Payment amount (integer)' do
826
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:payment_amount]).to eq(86500)
827
+ end
828
+ it 'returns the Total adjustment amount (integer)' do
829
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:total_adjustment_amount]).to eq(2500)
830
+ end
831
+ it 'returns the Remark code' do
832
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:remark_code]).to eq(nil)
833
+ end
834
+ it 'returns the Remarks' do
835
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:remarks]).to eq(nil)
836
+ end
837
+ it 'returns the Reference number' do
838
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:reference_number]).to eq('0002')
839
+ end
840
+ context 'Adjustment group #0' do
841
+ it 'returns the Adjustment group' do
842
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_group]).to eq("Patient Responsibility")
843
+ end
844
+ it 'returns the Adjustment group code' do
845
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_group_code]).to eq("PR")
846
+ end
847
+ it 'returns the Adjustment amount (integer)' do
848
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:adjustment_groups][0][:adjustment_amount]).to eq(2500)
849
+ end
850
+ it 'returns the Reason code' do
851
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:adjustment_groups][0][:reason_code]).to eq('3')
852
+ end
853
+ it 'returns the Translated reason code' do
854
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][1][:adjustment_groups][0][:translated_reason_code]).to eq("Co-payment Amount")
855
+ end
856
+ end
857
+ end
858
+ context 'Line item #2' do
859
+ it 'returns the Date of service (string mm/dd/yyyy)' do
860
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:service_date]).to eq("12/31/2010")
861
+ end
862
+ it 'returns the CPT code' do
863
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:cpt_code]).to eq("59426")
864
+ end
865
+ it 'returns the Charge amount (integer)' do
866
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:charge_amount]).to eq(74200)
867
+ end
868
+ it 'returns the Payment amount (integer)' do
869
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:payment_amount]).to eq(74200)
870
+ end
871
+ it 'returns the Total adjustment amount (integer)' do
872
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:total_adjustment_amount]).to eq(nil)
873
+ end
874
+ it 'returns the Remark code' do
875
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:remark_code]).to eq(nil)
876
+ end
877
+ it 'returns the Remarks' do
878
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:remarks]).to eq(nil)
879
+ end
880
+ it 'returns the Reference number' do
881
+ expect(@era[:checks]['0123456789012345678901234567890123456789'][:eras][0][:line_items][2][:reference_number]).to eq('0003')
882
+ end
883
+ end
884
+ end
885
+ end
886
+ end
635
887
  end
636
888
 
637
889
  context 'Human readable' do
@@ -1498,4 +1750,4 @@ Check# Patient ID Last,First Charge Amt
1498
1750
  end
1499
1751
  end
1500
1752
  end
1501
- end
1753
+ end
data/spec/example_1.835 CHANGED
@@ -1 +1 @@
1
- ST*835*1234~BPR*I*15096.46*C*CHK************20100923~TRN*1*70408535*15714001~REF*F2*slca435w~DTM*405*20100923~N1*PR*NC TEACHERS & STATE EMPLOYEES HEALTH PLAN & HEALTH CHOICE~N3*P O BOX 30025~N4*DURHAM*NC*27702~PER*CX**TE*8002144844~N1*PE*ACME UNIV HLTH SYS INC*XX*1234567890~N3*P O BOX AAA1~N4*DURHAM*NC*27701~REF*TJ*123456789~CLP*474623UB001CW0321*1*3740.6*5451.04**15*80209000000*11*1**397*0.7309~CAS*CO*94*-1710.44~NM1*QC*1*Rabbit*Roger*B***MI* RUN123456789~MIA*0~REF*EA*CW0321~DTM*232*20100307~DTM*233*20100310~DTM*50*20100918~AMT*AU*5451.04~SE*21*1234~
1
+ ST*835*1234~BPR*I*15096.46*C*CHK************20100923~TRN*1*70408535*15714001~REF*F2*slca435w~DTM*405*20100923~N1*PR*NC TEACHERS & STATE EMPLOYEES HEALTH PLAN & HEALTH CHOICE~N3*P O BOX 30025~N4*DURHAM*NC*27702~REF*2U*11111~PER*CX**TE*8002144844~N1*PE*ACME UNIV HLTH SYS INC*XX*1234567890~N3*P O BOX AAA1~N4*DURHAM*NC*27701~REF*TJ*123456789~CLP*474623UB001CW0321*1*3740.6*5451.04**15*80209000000*11*1**397*0.7309~CAS*CO*94*-1710.44~NM1*QC*1*Rabbit*Roger*B***MI* RUN123456789~MIA*0~REF*EA*CW0321~DTM*232*20100307~DTM*233*20100310~DTM*50*20100918~AMT*AU*5451.04~SE*21*1234~
data/spec/example_2.835 CHANGED
@@ -1 +1 @@
1
- ST*835*1234~BPR*I*1922.86*C*CHK************20110108~TRN*1*02790758*560894904~REF*F2*LCLA438D~DTM*405*20110104~N1*PR*BLUE CROSS AND BLUE SHIELD OF NORTH CAROLINA~N3*P O BOX 2291~N4*DURHAM*NC*27702~PER*CX*TE*8005554844~N1*PE*XYZ HEALTHCARE CORPORATION*XX*0987654321~N3*P O BOX XYZ~N4*CHARLOTTE*NC*28234~REF*TJ*123456789~LX*1~CLP*200200964A52*1*2100*1922.86*142.54*15*94151100100~NM1*QC*1*Dough*Mary****MI* YPB123456789001~DTM*050*20110103~SVC*HC:59430*1210*1057.86**1*HC:59410~DTM*472*20101231~CAS*CO*42*34.6~CAS*PR*2*117.54~REF*6R*0001~AMT*B6*1175.4~SVC*HC:59440*890*865**1*HC:59410~DTM*472*20101231~CAS*PR*3*25~REF*6R*0002~SVC*HC:59426*742*742**1~DTM*472*20101231~REF*6R*0003~AMT*B6*742~SE*33*1234~
1
+ ST*835*1234~BPR*I*1922.86*C*CHK************20110108~TRN*1*02790758*560894904~REF*F2*LCLA438D~DTM*405*20110104~N1*PR*BLUE CROSS AND BLUE SHIELD OF NORTH CAROLINA~N3*P O BOX 2291~N4*DURHAM*NC*27702~REF*2U*22222~PER*CX*TE*8005554844~N1*PE*XYZ HEALTHCARE CORPORATION*XX*0987654321~N3*P O BOX XYZ~N4*CHARLOTTE*NC*28234~REF*TJ*123456789~LX*1~CLP*200200964A52*1*2100*1922.86*142.54*15*94151100100~NM1*QC*1*Dough*Mary****MI* YPB123456789001~DTM*050*20110103~SVC*HC:59430*1210*1057.86**1*HC:59410~DTM*472*20101231~CAS*CO*42*34.6~CAS*PR*2*117.54~REF*6R*0001~AMT*B6*1175.4~SVC*HC:59440*890*865**1*HC:59410~DTM*472*20101231~CAS*PR*3*25~REF*6R*0002~SVC*HC:59426*742*742**1~DTM*472*20101231~REF*6R*0003~AMT*B6*742~SE*33*1234~
data/spec/example_3.835 CHANGED
@@ -6,6 +6,7 @@ DTM*405*20110104~
6
6
  N1*PR*BLUE CROSS AND BLUE SHIELD OF NORTH CAROLINA~
7
7
  N3*P O BOX 2291~
8
8
  N4*DURHAM*NC*27702~
9
+ REF*2U*33333~
9
10
  PER*CX*TE*8005554844~
10
11
  N1*PE*XYZ HEALTHCARE CORPORATION*XX*0987654321~
11
12
  N3*P O BOX XYZ~
@@ -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
@@ -1,3 +1,3 @@
1
1
  require 'simplecov'
2
2
  SimpleCov.start
3
- require 'era_835_parser'
3
+ require 'era_835_parser'
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.10
4
+ version: 0.1.12
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: 2020-11-05 00:00:00.000000000 Z
11
+ date: 2023-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,6 +78,7 @@ 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
@@ -99,8 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
100
  - !ruby/object:Gem::Version
100
101
  version: '0'
101
102
  requirements: []
102
- rubyforge_project:
103
- rubygems_version: 2.7.6
103
+ rubygems_version: 3.3.26
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Electronic Remittance Advice (ERA) 835 parser
@@ -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