change_health 6.1.0 → 6.1.2
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 +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile +12 -0
- data/Rakefile +2 -0
- data/change_health.gemspec +8 -9
- data/lib/change_health/authentication.rb +20 -16
- data/lib/change_health/change_health_exception.rb +15 -12
- data/lib/change_health/connection.rb +5 -1
- data/lib/change_health/extensions.rb +5 -3
- data/lib/change_health/models/claim/submission/address.rb +2 -0
- data/lib/change_health/models/claim/submission/billing_pay_to_address_name.rb +2 -0
- data/lib/change_health/models/claim/submission/claim_code_information.rb +2 -0
- data/lib/change_health/models/claim/submission/claim_date_information.rb +2 -0
- data/lib/change_health/models/claim/submission/claim_information.rb +2 -0
- data/lib/change_health/models/claim/submission/claim_supplemental_information.rb +2 -0
- data/lib/change_health/models/claim/submission/contact_information.rb +2 -0
- data/lib/change_health/models/claim/submission/dependent.rb +2 -0
- data/lib/change_health/models/claim/submission/diagnosis.rb +2 -0
- data/lib/change_health/models/claim/submission/drug_identification.rb +2 -0
- data/lib/change_health/models/claim/submission/institutional_service.rb +2 -0
- data/lib/change_health/models/claim/submission/line_adjudication_information.rb +2 -0
- data/lib/change_health/models/claim/submission/other_payer_name.rb +2 -0
- data/lib/change_health/models/claim/submission/other_subscriber_information.rb +2 -0
- data/lib/change_health/models/claim/submission/other_subscriber_name.rb +2 -0
- data/lib/change_health/models/claim/submission/professional_service.rb +2 -0
- data/lib/change_health/models/claim/submission/provider.rb +2 -0
- data/lib/change_health/models/claim/submission/receiver.rb +2 -0
- data/lib/change_health/models/claim/submission/report_information.rb +2 -0
- data/lib/change_health/models/claim/submission/service_facility_location.rb +2 -0
- data/lib/change_health/models/claim/submission/service_line.rb +2 -0
- data/lib/change_health/models/claim/submission/submitter.rb +2 -0
- data/lib/change_health/models/claim/submission/subscriber.rb +2 -0
- data/lib/change_health/models/eligibility/encounter.rb +5 -3
- data/lib/change_health/models/eligibility/provider.rb +3 -1
- data/lib/change_health/models/eligibility/subscriber.rb +4 -1
- data/lib/change_health/models/model.rb +20 -8
- data/lib/change_health/models/trading_partner/trading_partner.rb +2 -0
- data/lib/change_health/request/eligibility.rb +9 -6
- data/lib/change_health/request/report.rb +12 -2
- data/lib/change_health/request/submission.rb +10 -8
- data/lib/change_health/request/trading_partner.rb +4 -2
- data/lib/change_health/response/claim/report/report_277_claim.rb +2 -0
- data/lib/change_health/response/claim/report/report_277_data.rb +87 -48
- data/lib/change_health/response/claim/report/report_277_info_claim_status.rb +2 -0
- data/lib/change_health/response/claim/report/report_277_info_status.rb +2 -0
- data/lib/change_health/response/claim/report/report_835_claim.rb +2 -0
- data/lib/change_health/response/claim/report/report_835_data.rb +33 -16
- data/lib/change_health/response/claim/report/report_835_health_care_check_remark_code.rb +2 -0
- data/lib/change_health/response/claim/report/report_835_payment.rb +2 -0
- data/lib/change_health/response/claim/report/report_835_provider_adjustment.rb +2 -0
- data/lib/change_health/response/claim/report/report_835_service_adjustment.rb +2 -0
- data/lib/change_health/response/claim/report/report_835_service_line.rb +2 -0
- data/lib/change_health/response/claim/report/report_claim.rb +2 -0
- data/lib/change_health/response/claim/report/report_data.rb +4 -1
- data/lib/change_health/response/claim/report/report_list_data.rb +3 -3
- data/lib/change_health/response/claim/submission/submission_data.rb +8 -8
- data/lib/change_health/response/eligibility/eligibility_benefit.rb +38 -35
- data/lib/change_health/response/eligibility/eligibility_benefits.rb +66 -47
- data/lib/change_health/response/eligibility/eligibility_data.rb +33 -30
- data/lib/change_health/response/error.rb +5 -3
- data/lib/change_health/response/response_data.rb +6 -2
- data/lib/change_health/response/trading_partner/trading_partner_data.rb +2 -0
- data/lib/change_health/response/trading_partner/trading_partners_data.rb +5 -1
- data/lib/change_health/version.rb +3 -1
- data/lib/change_health.rb +9 -7
- metadata +8 -97
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ChangeHealth
|
2
4
|
module Request
|
3
5
|
module Claim
|
4
6
|
class Report
|
5
|
-
ENDPOINT = '/medicalnetwork/reports/v2'
|
6
|
-
HEALTH_CHECK_ENDPOINT = ENDPOINT
|
7
|
+
ENDPOINT = '/medicalnetwork/reports/v2'
|
8
|
+
HEALTH_CHECK_ENDPOINT = "#{ENDPOINT}/healthcheck"
|
7
9
|
|
8
10
|
def self.report_list(headers: nil, more_url: nil, base_uri: nil, endpoint: nil, auth_headers: nil)
|
9
11
|
endpoint ||= ChangeHealth::Connection.endpoint_for(self)
|
@@ -18,6 +20,10 @@ module ChangeHealth
|
|
18
20
|
))
|
19
21
|
end
|
20
22
|
|
23
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
24
|
+
# rubocop:disable Metrics/MethodLength
|
25
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
26
|
+
# rubocop:disable Metrics/ParameterLists
|
21
27
|
def self.get_report(
|
22
28
|
report_name,
|
23
29
|
as_json_report: true,
|
@@ -67,6 +73,10 @@ module ChangeHealth
|
|
67
73
|
response: response)
|
68
74
|
end
|
69
75
|
end
|
76
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
77
|
+
# rubocop:enable Metrics/MethodLength
|
78
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
79
|
+
# rubocop:enable Metrics/ParameterLists
|
70
80
|
|
71
81
|
def self.delete_report(report_name, headers: nil, base_uri: nil, endpoint: nil, auth_headers: nil)
|
72
82
|
return if report_name.nil? || report_name.empty?
|
@@ -1,18 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ChangeHealth
|
2
4
|
module Request
|
3
5
|
module Claim
|
4
6
|
class Submission < Hashie::Trash
|
5
|
-
PROFESSIONAL_ENDPOINT = '/medicalnetwork/professionalclaims/v3'
|
6
|
-
INSTITUTIONAL_ENDPOINT = '/medicalnetwork/institutionalclaims/v1'
|
7
|
-
HEALTH_CHECK_SUFFIX = '/healthcheck'
|
8
|
-
SUBMISSION_SUFFIX = '/submission'
|
9
|
-
VALIDATION_SUFFIX = '/validation'
|
7
|
+
PROFESSIONAL_ENDPOINT = '/medicalnetwork/professionalclaims/v3'
|
8
|
+
INSTITUTIONAL_ENDPOINT = '/medicalnetwork/institutionalclaims/v1'
|
9
|
+
HEALTH_CHECK_SUFFIX = '/healthcheck'
|
10
|
+
SUBMISSION_SUFFIX = '/submission'
|
11
|
+
VALIDATION_SUFFIX = '/validation'
|
10
12
|
|
11
13
|
# Deprecated but still here for backwards compatibility
|
12
14
|
ENDPOINT = PROFESSIONAL_ENDPOINT
|
13
|
-
HEALTH_CHECK_ENDPOINT = ENDPOINT
|
14
|
-
SUBMISSION_ENDPOINT = ENDPOINT
|
15
|
-
VALIDATION_ENDPOINT = ENDPOINT
|
15
|
+
HEALTH_CHECK_ENDPOINT = "#{ENDPOINT}/healthcheck"
|
16
|
+
SUBMISSION_ENDPOINT = "#{ENDPOINT}/submission"
|
17
|
+
VALIDATION_ENDPOINT = "#{ENDPOINT}/validation"
|
16
18
|
# End Deprecated
|
17
19
|
|
18
20
|
property :attending
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ChangeHealth
|
2
4
|
module Request
|
3
5
|
class TradingPartner < Hashie::Trash
|
4
|
-
ENDPOINT = '/medicalnetwork/payerfinder/v1/payers'
|
6
|
+
ENDPOINT = '/medicalnetwork/payerfinder/v1/payers'
|
5
7
|
|
6
8
|
def self.query(term, service_name: 'Eligibility', clearing_house: 'npd')
|
7
9
|
params = {
|
@@ -12,7 +14,7 @@ module ChangeHealth
|
|
12
14
|
|
13
15
|
response = ChangeHealth::Connection.new.request(endpoint: ENDPOINT, verb: :get, query: params)
|
14
16
|
trading_partners_data = ChangeHealth::Response::TradingPartnersData.new(response['payers'])
|
15
|
-
trading_partners_data.map { |partner| ChangeHealth::Models::TradingPartner.new(name: partner.name, alias: partner.alias, line_of_business: partner.line_of_business, plan_type: partner.plan_type, service_id: partner.service_id
|
17
|
+
trading_partners_data.map { |partner| ChangeHealth::Models::TradingPartner.new(name: partner.name, alias: partner.alias, line_of_business: partner.line_of_business, plan_type: partner.plan_type, service_id: partner.service_id) }
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ChangeHealth
|
2
4
|
module Response
|
3
5
|
module Claim
|
@@ -9,19 +11,27 @@ module ChangeHealth
|
|
9
11
|
|
10
12
|
# Only one payer per report
|
11
13
|
def payer_name
|
12
|
-
transactions&.first&.dig('payers')
|
14
|
+
payers = transactions&.first&.dig('payers')
|
15
|
+
|
16
|
+
payers&.first&.dig('organizationName')
|
13
17
|
end
|
14
18
|
|
15
19
|
def report_creation_date
|
16
20
|
ChangeHealth::Models::PARSE_DATE.call(transactions&.first&.dig('transactionSetCreationDate'))
|
17
21
|
end
|
18
22
|
|
23
|
+
# rubocop:disable Metrics/AbcSize
|
24
|
+
# rubocop:disable Metrics/BlockLength
|
25
|
+
# rubocop:disable Metrics/MethodLength
|
26
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
27
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
19
28
|
def claims
|
20
29
|
report_claims = []
|
21
30
|
|
22
31
|
transactions&.each do |transaction|
|
23
|
-
id = transaction
|
32
|
+
id = transaction['id']
|
24
33
|
report_creation_date = ChangeHealth::Models::PARSE_DATE.call(transaction['transactionSetCreationDate'])
|
34
|
+
|
25
35
|
transaction['payers']&.each do |payer|
|
26
36
|
payer_identification = payer['payerIdentification']
|
27
37
|
payer_name = payer['organizationName']
|
@@ -32,63 +42,23 @@ module ChangeHealth
|
|
32
42
|
patient_first_name = patient_claim_status_detail.dig('subscriber', 'firstName')
|
33
43
|
patient_last_name = patient_claim_status_detail.dig('subscriber', 'lastName')
|
34
44
|
patient_member_id = patient_claim_status_detail.dig('subscriber', 'memberId')
|
45
|
+
|
35
46
|
patient_claim_status_detail['claims']&.each do |claim|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
claim_status = claim['claimStatus']
|
41
|
-
next if claim_status.nil?
|
42
|
-
|
43
|
-
clearinghouse_trace_number = claim_status['clearinghouseTraceNumber']
|
44
|
-
patient_account_number = claim_status['patientAccountNumber']
|
45
|
-
referenced_transaction_trace_number = claim_status['referencedTransactionTraceNumber']
|
46
|
-
trading_partner_claim_number = claim_status['tradingPartnerClaimNumber']
|
47
|
-
|
48
|
-
service_date_begin = ChangeHealth::Models::PARSE_DATE.call(presence(claim_status['claimServiceBeginDate']) || presence(claim_status['claimServiceDate']))
|
49
|
-
service_date_end = ChangeHealth::Models::PARSE_DATE.call(presence(claim_status['claimServiceEndDate']) || presence(claim_status['claimServiceDate']))
|
50
|
-
|
51
|
-
info_claim_statuses = []
|
52
|
-
claim_status['informationClaimStatuses']&.each do |info_claim_status|
|
53
|
-
message = info_claim_status['message']
|
54
|
-
status_information_effective_date = ChangeHealth::Models::PARSE_DATE.call(info_claim_status['statusInformationEffectiveDate'])
|
55
|
-
total_charge_amount = info_claim_status['totalClaimChargeAmount']
|
56
|
-
|
57
|
-
info_statuses = []
|
58
|
-
info_claim_status['informationStatuses']&.each do |info_status|
|
59
|
-
info_statuses << Report277InfoStatus.new(
|
60
|
-
status_category_code: info_status['healthCareClaimStatusCategoryCode'],
|
61
|
-
status_category_code_value: info_status['healthCareClaimStatusCategoryCodeValue'],
|
62
|
-
status_code: info_status['statusCode'],
|
63
|
-
status_code_value: info_status['statusCodeValue']
|
64
|
-
)
|
65
|
-
end
|
66
|
-
|
67
|
-
info_claim_statuses << Report277InfoClaimStatus.new(
|
68
|
-
message: message,
|
69
|
-
info_statuses: info_statuses,
|
70
|
-
total_charge_amount: total_charge_amount,
|
71
|
-
status_information_effective_date: status_information_effective_date
|
72
|
-
)
|
73
|
-
end
|
47
|
+
report_claim_args = parse_patient_claim(claim)
|
48
|
+
|
49
|
+
next if report_claim_args.nil?
|
50
|
+
|
74
51
|
report_claims << Report277Claim.new(
|
75
|
-
clearinghouse_trace_number: clearinghouse_trace_number,
|
76
52
|
id: id,
|
77
|
-
info_claim_statuses: info_claim_statuses,
|
78
|
-
patient_account_number: patient_account_number,
|
79
53
|
patient_first_name: patient_first_name,
|
80
54
|
patient_last_name: patient_last_name,
|
81
55
|
patient_member_id: patient_member_id,
|
82
56
|
payer_identification: payer_identification,
|
83
57
|
payer_name: payer_name,
|
84
|
-
procedure_codes: procedure_codes,
|
85
|
-
referenced_transaction_trace_number: referenced_transaction_trace_number,
|
86
58
|
report_creation_date: report_creation_date,
|
87
59
|
report_name: report_name,
|
88
|
-
service_date_begin: service_date_begin,
|
89
|
-
service_date_end: service_date_end,
|
90
60
|
service_provider_npi: service_provider_npi,
|
91
|
-
|
61
|
+
**report_claim_args
|
92
62
|
)
|
93
63
|
end
|
94
64
|
end
|
@@ -99,6 +69,75 @@ module ChangeHealth
|
|
99
69
|
|
100
70
|
report_claims
|
101
71
|
end
|
72
|
+
# rubocop:enable Metrics/AbcSize
|
73
|
+
# rubocop:enable Metrics/BlockLength
|
74
|
+
# rubocop:enable Metrics/MethodLength
|
75
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
76
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
77
|
+
|
78
|
+
# rubocop:disable Metrics/AbcSize
|
79
|
+
# rubocop:disable Metrics/MethodLength
|
80
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
81
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
82
|
+
def parse_patient_claim(claim)
|
83
|
+
procedure_codes = []
|
84
|
+
claim['serviceLines']&.each do |service_line|
|
85
|
+
procedure_codes << service_line.dig('service', 'procedureCode')
|
86
|
+
end
|
87
|
+
claim_status = claim['claimStatus']
|
88
|
+
return if claim_status.nil?
|
89
|
+
|
90
|
+
clearinghouse_trace_number = claim_status['clearinghouseTraceNumber']
|
91
|
+
patient_account_number = claim_status['patientAccountNumber']
|
92
|
+
referenced_transaction_trace_number = claim_status['referencedTransactionTraceNumber']
|
93
|
+
trading_partner_claim_number = claim_status['tradingPartnerClaimNumber']
|
94
|
+
|
95
|
+
service_date_begin = ChangeHealth::Models::PARSE_DATE.call(
|
96
|
+
presence(claim_status['claimServiceBeginDate']) || presence(claim_status['claimServiceDate'])
|
97
|
+
)
|
98
|
+
service_date_end = ChangeHealth::Models::PARSE_DATE.call(
|
99
|
+
presence(claim_status['claimServiceEndDate']) || presence(claim_status['claimServiceDate'])
|
100
|
+
)
|
101
|
+
|
102
|
+
info_claim_statuses = []
|
103
|
+
claim_status['informationClaimStatuses']&.each do |info_claim_status|
|
104
|
+
message = info_claim_status['message']
|
105
|
+
status_information_effective_date = ChangeHealth::Models::PARSE_DATE.call(info_claim_status['statusInformationEffectiveDate'])
|
106
|
+
total_charge_amount = info_claim_status['totalClaimChargeAmount']
|
107
|
+
|
108
|
+
info_statuses = []
|
109
|
+
info_claim_status['informationStatuses']&.each do |info_status|
|
110
|
+
info_statuses << Report277InfoStatus.new(
|
111
|
+
status_category_code: info_status['healthCareClaimStatusCategoryCode'],
|
112
|
+
status_category_code_value: info_status['healthCareClaimStatusCategoryCodeValue'],
|
113
|
+
status_code: info_status['statusCode'],
|
114
|
+
status_code_value: info_status['statusCodeValue']
|
115
|
+
)
|
116
|
+
end
|
117
|
+
|
118
|
+
info_claim_statuses << Report277InfoClaimStatus.new(
|
119
|
+
message: message,
|
120
|
+
info_statuses: info_statuses,
|
121
|
+
total_charge_amount: total_charge_amount,
|
122
|
+
status_information_effective_date: status_information_effective_date
|
123
|
+
)
|
124
|
+
end
|
125
|
+
|
126
|
+
{
|
127
|
+
clearinghouse_trace_number: clearinghouse_trace_number,
|
128
|
+
info_claim_statuses: info_claim_statuses,
|
129
|
+
patient_account_number: patient_account_number,
|
130
|
+
procedure_codes: procedure_codes,
|
131
|
+
referenced_transaction_trace_number: referenced_transaction_trace_number,
|
132
|
+
service_date_begin: service_date_begin,
|
133
|
+
service_date_end: service_date_end,
|
134
|
+
trading_partner_claim_number: trading_partner_claim_number
|
135
|
+
}
|
136
|
+
end
|
137
|
+
# rubocop:enable Metrics/AbcSize
|
138
|
+
# rubocop:enable Metrics/MethodLength
|
139
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
140
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
102
141
|
end
|
103
142
|
end
|
104
143
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ChangeHealth
|
2
4
|
module Response
|
3
5
|
module Claim
|
@@ -13,7 +15,7 @@ module ChangeHealth
|
|
13
15
|
|
14
16
|
# Only one payer per report
|
15
17
|
def payer_name
|
16
|
-
transactions&.first&.dig('payer'
|
18
|
+
transactions&.first&.dig('payer', 'name')
|
17
19
|
end
|
18
20
|
|
19
21
|
def report_creation_date
|
@@ -24,11 +26,16 @@ module ChangeHealth
|
|
24
26
|
payments.flat_map(&:claims).compact
|
25
27
|
end
|
26
28
|
|
29
|
+
# rubocop:disable Metrics/AbcSize
|
30
|
+
# rubocop:disable Metrics/BlockLength
|
31
|
+
# rubocop:disable Metrics/MethodLength
|
32
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
33
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
27
34
|
def payments
|
28
35
|
report_payments = []
|
29
36
|
|
30
37
|
transactions&.each do |transaction|
|
31
|
-
payment_id = transaction
|
38
|
+
payment_id = transaction['id']
|
32
39
|
check_or_eft_trace_number = transaction.dig('paymentAndRemitReassociationDetails', 'checkOrEFTTraceNumber')
|
33
40
|
check_issue_or_eft_effective_date =
|
34
41
|
ChangeHealth::Models::PARSE_DATE.call(
|
@@ -56,7 +63,7 @@ module ChangeHealth
|
|
56
63
|
total_actual_provider_payment_amount =
|
57
64
|
transaction.dig('financialInformation', 'totalActualProviderPaymentAmount')
|
58
65
|
claims = transaction['detailInfo']&.flat_map do |detail_info|
|
59
|
-
claim_id = detail_info
|
66
|
+
claim_id = detail_info['id']
|
60
67
|
detail_info['paymentInfo']&.map do |payment_info|
|
61
68
|
claim_payment_amount = payment_info.dig('claimPaymentInfo', 'claimPaymentAmount')
|
62
69
|
claim_status_code = payment_info.dig('claimPaymentInfo', 'claimStatusCode')
|
@@ -97,11 +104,14 @@ module ChangeHealth
|
|
97
104
|
service_line_date_begin_parsed = ChangeHealth::Models::PARSE_DATE.call(service_line['serviceStartDate'])
|
98
105
|
service_line_date_end_parsed = ChangeHealth::Models::PARSE_DATE.call(service_line['serviceEndDate'])
|
99
106
|
|
100
|
-
all_dates = [service_line_date_parsed, service_line_date_begin_parsed,
|
107
|
+
all_dates = [service_line_date_parsed, service_line_date_begin_parsed,
|
108
|
+
service_line_date_end_parsed].select do |date|
|
109
|
+
date.is_a?(Date)
|
110
|
+
end
|
101
111
|
|
102
|
-
service_line_date_begin = all_dates.
|
112
|
+
service_line_date_begin = all_dates.min
|
103
113
|
service_line_date = service_line_date_begin
|
104
|
-
service_line_date_end = all_dates.
|
114
|
+
service_line_date_end = all_dates.max
|
105
115
|
|
106
116
|
service_date_begin = [service_date_begin, service_line_date_begin].compact.min
|
107
117
|
service_date_end = [service_date_end, service_line_date_end].compact.max
|
@@ -114,16 +124,18 @@ module ChangeHealth
|
|
114
124
|
|
115
125
|
service_adjustments = adjustments(service_line['serviceAdjustments'])
|
116
126
|
|
117
|
-
health_care_check_remark_codes = presence(
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
+
health_care_check_remark_codes = presence(
|
128
|
+
service_line['healthCareCheckRemarkCodes']&.filter_map do |health_care_check_remark_code|
|
129
|
+
remark_code = health_care_check_remark_code['remarkCode']
|
130
|
+
next unless presence(remark_code)
|
131
|
+
|
132
|
+
Report835HealthCareCheckRemarkCode.new(
|
133
|
+
code_list_qualifier_code: health_care_check_remark_code['codeListQualifierCode'],
|
134
|
+
code_list_qualifier_code_value: health_care_check_remark_code['codeListQualifierCodeValue'],
|
135
|
+
remark_code: remark_code
|
136
|
+
)
|
137
|
+
end
|
138
|
+
)
|
127
139
|
|
128
140
|
Report835ServiceLine.new(
|
129
141
|
adjudicated_procedure_code: adjudicated_procedure_code,
|
@@ -187,6 +199,11 @@ module ChangeHealth
|
|
187
199
|
|
188
200
|
report_payments
|
189
201
|
end
|
202
|
+
# rubocop:enable Metrics/AbcSize
|
203
|
+
# rubocop:enable Metrics/BlockLength
|
204
|
+
# rubocop:enable Metrics/MethodLength
|
205
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
206
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
190
207
|
|
191
208
|
private
|
192
209
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ChangeHealth
|
2
4
|
module Response
|
3
5
|
module Claim
|
@@ -21,7 +23,8 @@ module ChangeHealth
|
|
21
23
|
|
22
24
|
def self.report_type(report_name)
|
23
25
|
return '277' if is_277?(report_name)
|
24
|
-
|
26
|
+
|
27
|
+
'835' if is_835?(report_name)
|
25
28
|
end
|
26
29
|
|
27
30
|
def is_277?
|
@@ -1,22 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ChangeHealth
|
2
4
|
module Response
|
3
5
|
module Claim
|
4
6
|
class SubmissionData < ChangeHealth::Response::ResponseData
|
5
|
-
|
6
|
-
%w(controlNumber status tradingPartnerId tradingPartnerServiceId).each do |v|
|
7
|
+
%w[controlNumber status tradingPartnerId tradingPartnerServiceId].each do |v|
|
7
8
|
define_method(v) do
|
8
|
-
@raw
|
9
|
+
@raw[v]
|
9
10
|
end
|
10
11
|
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
alias control_number controlNumber
|
14
|
+
alias trading_partner_id tradingPartnerId
|
15
|
+
alias trading_partner_service_id tradingPartnerServiceId
|
15
16
|
|
16
17
|
def trading_partner?(name)
|
17
|
-
|
18
|
+
trading_partner_id == name || trading_partner_service_id == name
|
18
19
|
end
|
19
|
-
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ChangeHealth
|
2
4
|
module Response
|
3
5
|
class EligibilityBenefit < Hash
|
@@ -21,8 +23,8 @@ module ChangeHealth
|
|
21
23
|
SERVICE_YEAR = '22'
|
22
24
|
YEAR = '23'
|
23
25
|
YTD = '24'
|
24
|
-
DAY
|
25
|
-
REMAINING
|
26
|
+
DAY = '7'
|
27
|
+
REMAINING = '29'
|
26
28
|
|
27
29
|
CODES = {
|
28
30
|
out_of_pocket: OUT_OF_POCKET,
|
@@ -30,7 +32,7 @@ module ChangeHealth
|
|
30
32
|
coinsurance: COINSURANCE,
|
31
33
|
non_covered: NON_COVERED,
|
32
34
|
deductible: DEDUCTIBLE
|
33
|
-
}
|
35
|
+
}.freeze
|
34
36
|
COVERAGES = {
|
35
37
|
individual: INDIVIDUAL,
|
36
38
|
child: CHILD,
|
@@ -38,99 +40,100 @@ module ChangeHealth
|
|
38
40
|
family: FAMILY,
|
39
41
|
employee_and_child: EMPLOYEE_AND_CHILD,
|
40
42
|
employee_and_spouse: EMPLOYEE_AND_SPOUSE
|
41
|
-
}
|
43
|
+
}.freeze
|
42
44
|
TIMEFRAMES = {
|
43
45
|
visit: VISIT,
|
44
46
|
year: YEAR,
|
45
47
|
remaining: REMAINING
|
46
|
-
}
|
48
|
+
}.freeze
|
47
49
|
MEDICARE = {
|
48
50
|
part_a: 'MA',
|
49
51
|
part_b: 'MB',
|
50
52
|
primary: 'MP'
|
51
|
-
}
|
53
|
+
}.freeze
|
52
54
|
HELPERS = {
|
53
55
|
timeQualifierCode: TIMEFRAMES,
|
54
56
|
coverageLevelCode: COVERAGES,
|
55
57
|
code: CODES
|
56
|
-
}
|
58
|
+
}.freeze
|
57
59
|
|
58
60
|
HELPERS.each do |key, types|
|
59
61
|
types.each do |method, value|
|
60
62
|
define_method("#{method}?") do
|
61
|
-
value == self[key] || :individual == method && self[key].nil? &&
|
63
|
+
value == self[key] || (:individual == method && self[key].nil? && medicare?)
|
62
64
|
end
|
63
65
|
end
|
64
66
|
end
|
65
67
|
|
66
68
|
def medicare?
|
67
|
-
MEDICARE.
|
69
|
+
MEDICARE.value?(insuranceTypeCode)
|
68
70
|
end
|
69
71
|
|
70
|
-
%w
|
71
|
-
define_method(
|
72
|
+
%w[benefitAmount benefitPercent].each do |amount_method|
|
73
|
+
define_method(amount_method.to_s) do
|
72
74
|
format_amount(amount_method)
|
73
75
|
end
|
74
76
|
end
|
75
77
|
|
76
|
-
%w
|
77
|
-
define_method(
|
78
|
+
%w[insuranceType insuranceTypeCode benefitsDateInformation additionalInformation].each do |method|
|
79
|
+
define_method(method.to_s) do
|
78
80
|
self[method]
|
79
81
|
end
|
80
82
|
end
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
83
|
+
alias date_info benefitsDateInformation
|
84
|
+
alias insurance_type insuranceType
|
85
|
+
alias insurance_type_code insuranceTypeCode
|
86
|
+
alias additional_info additionalInformation
|
85
87
|
|
86
88
|
def descriptions
|
87
|
-
data =
|
89
|
+
data = additionalInformation || []
|
88
90
|
|
89
|
-
data.
|
91
|
+
data.filter_map { |info| info['description'] }
|
90
92
|
end
|
91
93
|
|
92
94
|
def in_plan_network?
|
93
|
-
|
95
|
+
'Y' == self[:inPlanNetworkIndicatorCode] || (self[:inPlanNetworkIndicatorCode].nil? && medicare?)
|
94
96
|
end
|
95
|
-
|
96
|
-
|
97
|
+
alias in_plan? in_plan_network?
|
98
|
+
alias in_network? in_plan_network?
|
97
99
|
|
98
100
|
def amount
|
99
|
-
|
101
|
+
coinsurance? ? benefitPercent : benefitAmount
|
100
102
|
end
|
101
103
|
|
102
104
|
def services
|
103
|
-
self['serviceTypeCodes']&.each_with_index&.map {|stc, i| [stc, self['serviceTypes']&.at(i)]} || []
|
105
|
+
self['serviceTypeCodes']&.each_with_index&.map { |stc, i| [stc, self['serviceTypes']&.at(i)] } || []
|
104
106
|
end
|
105
107
|
|
106
|
-
%w
|
108
|
+
%w[eligibilityBegin eligibilityEnd planBegin planEnd service].each do |f|
|
107
109
|
define_method(f) do
|
108
|
-
|
110
|
+
ChangeHealth::Models::PARSE_DATE.call(date_info&.dig(f))
|
109
111
|
end
|
110
112
|
end
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
113
|
+
alias eligibility_begin_date eligibilityBegin
|
114
|
+
alias eligibility_end_date eligibilityEnd
|
115
|
+
alias plan_begin_date planBegin
|
116
|
+
alias plan_end_date planEnd
|
117
|
+
alias service_date service
|
116
118
|
|
117
119
|
def plan_date_range
|
118
|
-
pd =
|
120
|
+
pd = date_info&.dig('plan') || ''
|
119
121
|
pd.split('-')
|
120
122
|
end
|
121
123
|
|
122
124
|
def plan_date_range_start
|
123
|
-
ChangeHealth::Models::PARSE_DATE.call(
|
125
|
+
ChangeHealth::Models::PARSE_DATE.call(plan_date_range[0])
|
124
126
|
end
|
125
127
|
|
126
128
|
def plan_date_range_end
|
127
|
-
ChangeHealth::Models::PARSE_DATE.call(
|
129
|
+
ChangeHealth::Models::PARSE_DATE.call(plan_date_range[1])
|
128
130
|
end
|
129
131
|
|
130
132
|
private
|
133
|
+
|
131
134
|
def format_amount(key)
|
132
135
|
amt = self[key]
|
133
|
-
amt
|
136
|
+
amt&.to_f
|
134
137
|
end
|
135
138
|
end
|
136
139
|
end
|