change_health 2.3.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -2
- data/README.md +72 -25
- data/lib/change_health/response/claim/report/report_277_claim.rb +40 -0
- data/lib/change_health/response/claim/report/report_277_data.rb +23 -17
- data/lib/change_health/response/claim/report/{report_info_claim_status.rb → report_277_info_claim_status.rb} +1 -1
- data/lib/change_health/response/claim/report/report_835_claim.rb +17 -0
- data/lib/change_health/response/claim/report/report_835_data.rb +108 -0
- data/lib/change_health/response/claim/report/report_835_service_adjustment.rb +15 -0
- data/lib/change_health/response/claim/report/report_835_service_line.rb +13 -0
- data/lib/change_health/response/claim/report/report_claim.rb +7 -38
- data/lib/change_health/{models → response}/error.rb +8 -7
- data/lib/change_health/response/response_data.rb +3 -3
- data/lib/change_health/version.rb +1 -1
- data/lib/change_health.rb +6 -2
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0ce7d0b0648eeebabb95a1d8cbd2ddd81f778f5cea329f755b8734d754821e9
|
4
|
+
data.tar.gz: a81b263ebb9adc652ca914effc3b14ba047b429bb6a9ddff6faa89d73f9895fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d34f0ac2d23fe74bcc4674ff3c223ded869869bc62668578ead46a6dce495bce00cfd3d812d06faef795d8512eb59b93a492d0eeac627710bf73d8eec589ca6b
|
7
|
+
data.tar.gz: 24bcddfa9679442ece9d63a2ec3092f456394bb325a863bec29b8bc376d7052d0771b193572dc58610ee5a6c9b8f4cb64b28562fffa9adb039fcf057ca3d3502
|
data/CHANGELOG.md
CHANGED
@@ -4,10 +4,38 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [3.0.0] - 2021-12-08
|
8
|
+
### Added
|
9
|
+
* Report277Claim - specific to claims from 277 reports
|
10
|
+
* Report835Claim - specific to claims from 835 reports
|
11
|
+
* Report835ServiceAdjustment & Report835ServiceLine - helper classes for readability of claims from 835 reports
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
* ReportClaim - removed 277 report unique fields
|
15
|
+
|
16
|
+
#### Namespace
|
17
|
+
| Previous | Current |
|
18
|
+
|-|-|
|
19
|
+
| ChangeHealth::Models::Error | ChangeHealth::Response::Error |
|
20
|
+
| ChangeHealth::Response::Claim::ReportInfoClaimStatus | ChangeHealth::Response::Claim::Report277InfoClaimStatus|
|
21
|
+
|
22
|
+
#### Methods
|
23
|
+
| Previous | Current |
|
24
|
+
|-|-|
|
25
|
+
| Report277Data#payer_org_name | Report277Data#payer_name |
|
26
|
+
| ReportClaim#latest_total_charge_amount | ReportClaim#total_charge_amount |
|
27
|
+
| ReportClaim#payer_org_name | ReportClaim#payer_name |
|
28
|
+
| ReportClaim#service_begin_date | ReportClaim#service_date_begin |
|
29
|
+
| ReportClaim#service_end_date | ReportClaim#service_date_end |
|
30
|
+
| ReportClaim#subscriber_first_name | ReportClaim#patient_first_name |
|
31
|
+
| ReportClaim#subscriber_last_name | ReportClaim#patient_last_name |
|
32
|
+
| ReportClaim#transaction_set_creation_date | ReportClaim#report_creation_date |
|
33
|
+
|
34
|
+
|
7
35
|
## [2.3.0] - 2021-11-18
|
8
36
|
### Added
|
9
|
-
* Specific classes for 277 & 835 reports
|
10
|
-
* ReportClaim & ReportInfoClaimStatus- only works for json 277 reports
|
37
|
+
* Report277Data & Report835Data - Specific classes for 277 & 835 reports
|
38
|
+
* ReportClaim & ReportInfoClaimStatus - only works for json 277 reports
|
11
39
|
|
12
40
|
### Fixed
|
13
41
|
* Headers can now be nil for requests
|
@@ -188,6 +216,7 @@ Added the ability to hit professional claim submission API. For more details, se
|
|
188
216
|
- Authentication
|
189
217
|
- Configuration
|
190
218
|
|
219
|
+
[3.0.0]: https://github.com/WeInfuse/change_health/compare/v2.3.0...v3.0.0
|
191
220
|
[2.3.0]: https://github.com/WeInfuse/change_health/compare/v2.2.1...v2.3.0
|
192
221
|
[2.2.1]: https://github.com/WeInfuse/change_health/compare/v2.2.0...v2.2.1
|
193
222
|
[2.2.0]: https://github.com/WeInfuse/change_health/compare/v2.1.0...v2.2.0
|
data/README.md
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
[![CircleCI](https://circleci.com/gh/WeInfuse/change_health.svg?style=svg)](https://circleci.com/gh/WeInfuse/change_health)
|
2
2
|
|
3
|
-
|
3
|
+
```
|
4
|
+
____ _ _ _ _ _ _
|
5
|
+
/ ___| |__ __ _ _ __ __ _ ___ | | | | ___ __ _| | |_| |__
|
6
|
+
| | | '_ \ / _` | '_ \ / _` |/ _ \ | |_| |/ _ \/ _` | | __| '_ \
|
7
|
+
| |___| | | | (_| | | | | (_| | __/ | _ | __/ (_| | | |_| | | |
|
8
|
+
\____|_| |_|\__,_|_| |_|\__, |\___| |_| |_|\___|\__,_|_|\__|_| |_|
|
9
|
+
|___/
|
10
|
+
```
|
11
|
+
|
4
12
|
Ruby API wrapper for [Change Health](https://developers.changehealthcare.com/api)
|
5
13
|
|
6
|
-
|
14
|
+
# Installation
|
7
15
|
|
8
16
|
Add this line to your application's Gemfile:
|
9
17
|
|
@@ -19,13 +27,13 @@ Or install it yourself as:
|
|
19
27
|
|
20
28
|
$ gem install change_health
|
21
29
|
|
22
|
-
|
30
|
+
# Usage
|
23
31
|
|
24
|
-
|
32
|
+
## Setup
|
25
33
|
|
26
34
|
Make sure you're [configured](#configuration)!
|
27
35
|
|
28
|
-
|
36
|
+
## Eligibility
|
29
37
|
[Change Healthcare Eligibility Guide](https://developers.changehealthcare.com/eligibilityandclaims/docs)
|
30
38
|
```ruby
|
31
39
|
ChangeHealth::Request::Eligibility.ping # Test your connection
|
@@ -39,7 +47,7 @@ edata = ChangeHealth::Request::Eligibility.new(tradingPartnerServiceId: '000050'
|
|
39
47
|
edata.raw # Raw Hash of JSON response
|
40
48
|
```
|
41
49
|
|
42
|
-
|
50
|
+
### Benefit(s) objects
|
43
51
|
Benefits extends Array and provides a query-like interface.
|
44
52
|
|
45
53
|
Benefit extends Hash and provides helpers for single-benefit.
|
@@ -58,7 +66,7 @@ edata.benefits.where(name: 'Co-Payment', code: 'B', benefitAmount: '30) # Generi
|
|
58
66
|
edata.benefits.find_by(name: 'Co-Payment', code: 'B', benefitAmount: '30) # Generic 'find_by' api returns first object found
|
59
67
|
```
|
60
68
|
|
61
|
-
|
69
|
+
### Response
|
62
70
|
|
63
71
|
Response is EligibilityData object
|
64
72
|
|
@@ -76,7 +84,7 @@ edata.raw == edata.response.parsed_response
|
|
76
84
|
# true
|
77
85
|
```
|
78
86
|
|
79
|
-
|
87
|
+
## Trading Partners
|
80
88
|
```ruby
|
81
89
|
# Query trading partners using a wildcard search
|
82
90
|
# Returns Array of ChangeHealth::Models::TradingPartner Objects
|
@@ -89,7 +97,7 @@ trading_partners.first.service_id
|
|
89
97
|
# "ABC123"
|
90
98
|
```
|
91
99
|
|
92
|
-
|
100
|
+
## Claim Submission
|
93
101
|
[Change Healthcare Claim Submission Guide](https://developers.changehealthcare.com/eligibilityandclaims/docs/professional-claims-v3-getting-started)
|
94
102
|
```ruby
|
95
103
|
ChangeHealth::Request::Claim::Submission.ping # Test your connection
|
@@ -196,10 +204,10 @@ claim_submission_data = claim_submission.submission
|
|
196
204
|
validation = claim_submission.validation
|
197
205
|
```
|
198
206
|
|
199
|
-
|
207
|
+
## Claim Reports
|
200
208
|
[Change Healthcare Claim Responses and Reports Guide](https://developers.changehealthcare.com/eligibilityandclaims/docs/claims-responses-and-reports-getting-started)
|
201
209
|
|
202
|
-
|
210
|
+
### Get Reports
|
203
211
|
```ruby
|
204
212
|
ChangeHealth::Request::Claim::Report.ping # Test your connection
|
205
213
|
|
@@ -226,33 +234,72 @@ reports_edi = report_list.report_names.map {|report_name| ChangeHealth::Request:
|
|
226
234
|
# all reports in edi format
|
227
235
|
```
|
228
236
|
|
229
|
-
|
230
|
-
Currently only works for json 277 reports
|
237
|
+
### Inspect Reports
|
238
|
+
Currently only works for json 277 reports and json 835 reports. Not for EDI reports
|
231
239
|
|
232
|
-
From a report, you can get an array of claims
|
240
|
+
From a report, you can get an array of claims
|
241
|
+
|
242
|
+
#### Report 277
|
233
243
|
|
234
244
|
```ruby
|
235
|
-
|
236
|
-
|
245
|
+
report_277_data = ChangeHealth::Request::Claim::Report.get_report("X3000000.AB", as_json_report: true)
|
246
|
+
|
247
|
+
report_277_data.payer_name
|
248
|
+
# "PREMERA"
|
249
|
+
|
250
|
+
report_277_data.report_creation_date
|
251
|
+
# Tue, 01 Dec 2020
|
237
252
|
|
238
|
-
|
239
|
-
|
253
|
+
claim_277 = report_277_data.claims.first
|
254
|
+
claim_277.payer_name
|
240
255
|
# "PREMERA"
|
241
256
|
|
242
|
-
|
257
|
+
claim_277.patient_first_name
|
243
258
|
# "JOHNONE"
|
244
259
|
|
245
|
-
|
260
|
+
claim_277.report_creation_date
|
246
261
|
# Tue, 01 Dec 2020
|
247
262
|
|
248
|
-
|
263
|
+
# Report 277 specific below
|
264
|
+
claim_277.latest_status_category_codes
|
249
265
|
# ["F1"]
|
250
266
|
|
251
|
-
|
267
|
+
claim_277.total_charge_amount
|
252
268
|
# "100"
|
269
|
+
|
270
|
+
claim_277.procedure_codes
|
271
|
+
# ["97161"]
|
272
|
+
```
|
273
|
+
|
274
|
+
#### Report 835
|
275
|
+
|
276
|
+
```ruby
|
277
|
+
report_835_data = ChangeHealth::Request::Claim::Report.get_report("R5000000.XY", as_json_report: true)
|
278
|
+
|
279
|
+
report_835_data.payment_method_code
|
280
|
+
# "ACH"
|
281
|
+
|
282
|
+
report_835_data.total_actual_provider_payment_amount
|
283
|
+
# "2563.13"
|
284
|
+
|
285
|
+
claim_835 = report_835_data.claims.first
|
286
|
+
claim_835.payer_name
|
287
|
+
# "NATIONAL GOVERNMENT SERVICES, INC."
|
288
|
+
|
289
|
+
claim_835.patient_first_name
|
290
|
+
# "JANE"
|
291
|
+
|
292
|
+
claim_835.report_creation_date
|
293
|
+
# Wed, 22 Apr 2020
|
294
|
+
|
295
|
+
claim_835.procedure_codes
|
296
|
+
# ["21210", "21026", "21208", "30580"]
|
297
|
+
|
298
|
+
claim_835.service_lines.map(&:line_item_charge_amount)
|
299
|
+
# ["3600", "1890", "1836", "1680"]
|
253
300
|
```
|
254
301
|
|
255
|
-
|
302
|
+
## Configuration
|
256
303
|
|
257
304
|
```ruby
|
258
305
|
ChangeHealth.configure do |c|
|
@@ -263,12 +310,12 @@ ChangeHealth.configure do |c|
|
|
263
310
|
end
|
264
311
|
```
|
265
312
|
|
266
|
-
|
313
|
+
# Development
|
267
314
|
|
268
315
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
269
316
|
|
270
317
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
271
318
|
|
272
|
-
|
319
|
+
# Contributing
|
273
320
|
|
274
321
|
Bug reports and pull requests are welcome on GitHub at https://github.com/WeInfuse/change\_health.
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Response
|
3
|
+
module Claim
|
4
|
+
class Report277Claim < ReportClaim
|
5
|
+
property :info_claim_statuses, required: false
|
6
|
+
property :procedure_codes, required: false
|
7
|
+
|
8
|
+
def add_info_claim_status(info_claim_status)
|
9
|
+
self[:info_claim_statuses] ||= []
|
10
|
+
self[:info_claim_statuses] << info_claim_status
|
11
|
+
end
|
12
|
+
|
13
|
+
def add_procedure_code(procedure_code)
|
14
|
+
self[:procedure_codes] ||= []
|
15
|
+
self[:procedure_codes] << procedure_code
|
16
|
+
end
|
17
|
+
|
18
|
+
def latest_status_category_codes
|
19
|
+
latest_info_claim_status&.status_category_codes
|
20
|
+
end
|
21
|
+
|
22
|
+
def total_charge_amount
|
23
|
+
latest_info_claim_status&.total_charge_amount
|
24
|
+
end
|
25
|
+
|
26
|
+
def latest_status_info_effective_date
|
27
|
+
latest_info_claim_status&.status_information_effective_date
|
28
|
+
end
|
29
|
+
|
30
|
+
def latest_info_claim_status
|
31
|
+
info_claim_statuses&.select do |info|
|
32
|
+
!info.status_information_effective_date.nil? &&
|
33
|
+
info.status_information_effective_date.is_a?(Date) &&
|
34
|
+
info.status_information_effective_date <= Date.today
|
35
|
+
end&.max_by(&:status_information_effective_date)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -8,23 +8,28 @@ module ChangeHealth
|
|
8
8
|
end
|
9
9
|
|
10
10
|
# Only one payer per report
|
11
|
-
def
|
11
|
+
def payer_name
|
12
12
|
transactions&.first&.dig('payers')&.first&.dig('organizationName')
|
13
13
|
end
|
14
14
|
|
15
|
+
def report_creation_date
|
16
|
+
ChangeHealth::Models::PARSE_DATE.call(transactions&.first&.dig('transactionSetCreationDate'))
|
17
|
+
end
|
18
|
+
|
15
19
|
def claims
|
16
20
|
report_claims = []
|
17
21
|
|
18
22
|
transactions&.each do |transaction|
|
19
|
-
|
23
|
+
report_creation_date = ChangeHealth::Models::PARSE_DATE.call(transaction['transactionSetCreationDate'])
|
20
24
|
transaction['payers']&.each do |payer|
|
21
|
-
|
25
|
+
payer_identification = payer['payerIdentification']
|
26
|
+
payer_name = payer['organizationName']
|
22
27
|
payer['claimStatusTransactions']&.each do |claim_status_txn|
|
23
28
|
claim_status_txn['claimStatusDetails']&.each do |claim_status_detail|
|
24
29
|
service_provider_npi = claim_status_detail.dig('serviceProvider', 'npi')
|
25
30
|
claim_status_detail['patientClaimStatusDetails']&.each do |patient_claim_status_detail|
|
26
|
-
|
27
|
-
|
31
|
+
patient_first_name = patient_claim_status_detail.dig('subscriber', 'firstName')
|
32
|
+
patient_last_name = patient_claim_status_detail.dig('subscriber', 'lastName')
|
28
33
|
patient_claim_status_detail['claims']&.each do |claim|
|
29
34
|
procedure_codes = []
|
30
35
|
claim['serviceLines']&.each do |service_line|
|
@@ -33,8 +38,8 @@ module ChangeHealth
|
|
33
38
|
claim_status = claim['claimStatus']
|
34
39
|
next if claim_status.nil?
|
35
40
|
|
36
|
-
|
37
|
-
|
41
|
+
service_date_begin = ChangeHealth::Models::PARSE_DATE.call(claim_status['claimServiceBeginDate'] || claim_status['claimServiceDate'])
|
42
|
+
service_date_end = ChangeHealth::Models::PARSE_DATE.call(claim_status['claimServiceEndDate'] || claim_status['claimServiceDate'])
|
38
43
|
|
39
44
|
info_claim_statuses = []
|
40
45
|
claim_status['informationClaimStatuses']&.each do |info_claim_status|
|
@@ -46,22 +51,23 @@ module ChangeHealth
|
|
46
51
|
status_category_codes << info_status['healthCareClaimStatusCategoryCode']
|
47
52
|
end
|
48
53
|
|
49
|
-
info_claim_statuses <<
|
54
|
+
info_claim_statuses << Report277InfoClaimStatus.new(
|
50
55
|
status_category_codes: status_category_codes,
|
51
56
|
total_charge_amount: total_charge_amount,
|
52
57
|
status_information_effective_date: status_information_effective_date
|
53
58
|
)
|
54
59
|
end
|
55
|
-
report_claims <<
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
60
|
+
report_claims << Report277Claim.new(
|
61
|
+
info_claim_statuses: info_claim_statuses,
|
62
|
+
patient_first_name: patient_first_name,
|
63
|
+
patient_last_name: patient_last_name,
|
64
|
+
payer_identification: payer_identification,
|
65
|
+
payer_name: payer_name,
|
61
66
|
procedure_codes: procedure_codes,
|
62
|
-
|
63
|
-
|
64
|
-
|
67
|
+
report_creation_date: report_creation_date,
|
68
|
+
service_date_begin: service_date_begin,
|
69
|
+
service_date_end: service_date_end,
|
70
|
+
service_provider_npi: service_provider_npi
|
65
71
|
)
|
66
72
|
end
|
67
73
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ChangeHealth
|
2
2
|
module Response
|
3
3
|
module Claim
|
4
|
-
class
|
4
|
+
class Report277InfoClaimStatus < Hashie::Trash
|
5
5
|
property :status_category_codes, required: false
|
6
6
|
property :total_charge_amount, required: false
|
7
7
|
property :status_information_effective_date, required: false
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Response
|
3
|
+
module Claim
|
4
|
+
class Report835Claim < ReportClaim
|
5
|
+
property :payer_claim_control_number, required: false
|
6
|
+
property :payment_method_code, required: false
|
7
|
+
property :service_lines, required: false
|
8
|
+
property :total_actual_provider_payment_amount, required: false
|
9
|
+
property :total_charge_amount, required: false
|
10
|
+
|
11
|
+
def procedure_codes
|
12
|
+
service_lines&.map(&:adjudicated_procedure_code)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,7 +1,115 @@
|
|
1
1
|
module ChangeHealth
|
2
2
|
module Response
|
3
3
|
module Claim
|
4
|
+
# Methods only return meaningful data for json reports
|
4
5
|
class Report835Data < ChangeHealth::Response::Claim::ReportData
|
6
|
+
def transactions
|
7
|
+
@raw['transactions']
|
8
|
+
end
|
9
|
+
|
10
|
+
# Only one payer per report
|
11
|
+
def payer_name
|
12
|
+
transactions&.first&.dig('payer')&.dig('name')
|
13
|
+
end
|
14
|
+
|
15
|
+
def payment_method_code
|
16
|
+
transactions&.first&.dig('financialInformation', 'paymentMethodCode')
|
17
|
+
end
|
18
|
+
|
19
|
+
def report_creation_date
|
20
|
+
ChangeHealth::Models::PARSE_DATE.call(transactions&.first&.dig('productionDate'))
|
21
|
+
end
|
22
|
+
|
23
|
+
def total_actual_provider_payment_amount
|
24
|
+
transactions&.first&.dig('financialInformation', 'totalActualProviderPaymentAmount')
|
25
|
+
end
|
26
|
+
|
27
|
+
def claims
|
28
|
+
report_claims = []
|
29
|
+
|
30
|
+
transactions&.each do |transaction|
|
31
|
+
payment_method_code = transaction.dig('financialInformation', 'paymentMethodCode')
|
32
|
+
payer_name = transaction.dig('payer', 'name')
|
33
|
+
payer_identification = transaction.dig('payer', 'payerIdentificationNumber')
|
34
|
+
report_creation_date = ChangeHealth::Models::PARSE_DATE.call(transaction['productionDate'])
|
35
|
+
total_actual_provider_payment_amount = transaction.dig('financialInformation',
|
36
|
+
'totalActualProviderPaymentAmount')
|
37
|
+
|
38
|
+
transaction['detailInfo']&.each do |detail_info|
|
39
|
+
detail_info['paymentInfo']&.each do |payment_info|
|
40
|
+
patient_first_name = payment_info.dig('patientName', 'firstName')
|
41
|
+
patient_last_name = payment_info.dig('patientName', 'lastName')
|
42
|
+
service_provider_npi = payment_info.dig('renderingProvider', 'npi')
|
43
|
+
total_charge_amount = payment_info.dig('claimPaymentInfo', 'totalClaimChargeAmount')
|
44
|
+
payer_claim_control_number = payment_info.dig('claimPaymentInfo', 'payerClaimControlNumber')
|
45
|
+
|
46
|
+
service_date_begin = nil
|
47
|
+
service_date_end = nil
|
48
|
+
service_lines = []
|
49
|
+
payment_info['serviceLines']&.each do |service_line|
|
50
|
+
service_line_date = ChangeHealth::Models::PARSE_DATE.call(service_line['serviceDate'])
|
51
|
+
if service_date_begin.nil? || service_line_date < service_date_begin
|
52
|
+
service_date_begin = service_line_date
|
53
|
+
end
|
54
|
+
if service_date_end.nil? || service_date_end < service_line_date
|
55
|
+
service_date_end = service_line_date
|
56
|
+
end
|
57
|
+
|
58
|
+
adjudicated_procedure_code = service_line.dig('servicePaymentInformation', 'adjudicatedProcedureCode')
|
59
|
+
allowed_actual = service_line.dig('serviceSupplementalAmounts', 'allowedActual')
|
60
|
+
line_item_charge_amount = service_line.dig('servicePaymentInformation', 'lineItemChargeAmount')
|
61
|
+
line_item_provider_payment_amount = service_line.dig('servicePaymentInformation',
|
62
|
+
'lineItemProviderPaymentAmount')
|
63
|
+
|
64
|
+
service_adjustments = []
|
65
|
+
service_line['serviceAdjustments']&.each do |service_adjustment|
|
66
|
+
adjustments = {}
|
67
|
+
# - 2 b/c group code & value, / 2 b/c come in pairs
|
68
|
+
num_adjustments = (service_adjustment.keys.size - 2) / 2
|
69
|
+
(1..num_adjustments).each do |index|
|
70
|
+
adjustment_reason = service_adjustment["adjustmentReasonCode#{index}"]
|
71
|
+
adjustment_amount = service_adjustment["adjustmentAmount#{index}"]
|
72
|
+
adjustments[adjustment_reason] = adjustment_amount
|
73
|
+
end
|
74
|
+
|
75
|
+
claim_adjustment_group_code = service_adjustment['claimAdjustmentGroupCode']
|
76
|
+
|
77
|
+
service_adjustments << Report835ServiceAdjustment.new(
|
78
|
+
adjustments: adjustments,
|
79
|
+
claim_adjustment_group_code: claim_adjustment_group_code
|
80
|
+
)
|
81
|
+
end
|
82
|
+
|
83
|
+
service_lines << Report835ServiceLine.new(
|
84
|
+
adjudicated_procedure_code: adjudicated_procedure_code,
|
85
|
+
allowed_actual: allowed_actual,
|
86
|
+
line_item_charge_amount: line_item_charge_amount,
|
87
|
+
line_item_provider_payment_amount: line_item_provider_payment_amount,
|
88
|
+
service_adjustments: service_adjustments
|
89
|
+
)
|
90
|
+
end
|
91
|
+
|
92
|
+
report_claims << Report835Claim.new(
|
93
|
+
patient_first_name: patient_first_name,
|
94
|
+
patient_last_name: patient_last_name,
|
95
|
+
payer_claim_control_number: payer_claim_control_number,
|
96
|
+
payer_identification: payer_identification,
|
97
|
+
payer_name: payer_name,
|
98
|
+
payment_method_code: payment_method_code,
|
99
|
+
report_creation_date: report_creation_date,
|
100
|
+
service_date_begin: service_date_begin,
|
101
|
+
service_date_end: service_date_end,
|
102
|
+
service_lines: service_lines,
|
103
|
+
service_provider_npi: service_provider_npi,
|
104
|
+
total_actual_provider_payment_amount: total_actual_provider_payment_amount,
|
105
|
+
total_charge_amount: total_charge_amount
|
106
|
+
)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
report_claims
|
112
|
+
end
|
5
113
|
end
|
6
114
|
end
|
7
115
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Response
|
3
|
+
module Claim
|
4
|
+
class Report835ServiceAdjustment < Hashie::Trash
|
5
|
+
property :adjustments, required: false
|
6
|
+
property :claim_adjustment_group_code, required: false
|
7
|
+
|
8
|
+
def add_adjustment(adjustment)
|
9
|
+
self[:adjustments] ||= []
|
10
|
+
self[:adjustments] << adjustment
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Response
|
3
|
+
module Claim
|
4
|
+
class Report835ServiceLine < Hashie::Trash
|
5
|
+
property :adjudicated_procedure_code, required: false
|
6
|
+
property :allowed_actual, required: false
|
7
|
+
property :line_item_charge_amount, required: false
|
8
|
+
property :line_item_provider_payment_amount, required: false
|
9
|
+
property :service_adjustments, required: false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -2,45 +2,14 @@ module ChangeHealth
|
|
2
2
|
module Response
|
3
3
|
module Claim
|
4
4
|
class ReportClaim < Hashie::Trash
|
5
|
-
property :
|
6
|
-
property :
|
5
|
+
property :patient_first_name, required: false
|
6
|
+
property :patient_last_name, required: false
|
7
|
+
property :payer_identification, required: false
|
8
|
+
property :payer_name, required: false
|
9
|
+
property :report_creation_date, required: false
|
10
|
+
property :service_date_begin, required: false
|
11
|
+
property :service_date_end, required: false
|
7
12
|
property :service_provider_npi, required: false
|
8
|
-
property :subscriber_first_name, required: false
|
9
|
-
property :subscriber_last_name, required: false
|
10
|
-
property :procedure_codes, required: false
|
11
|
-
property :service_begin_date, required: false
|
12
|
-
property :service_end_date, required: false
|
13
|
-
property :info_claim_statuses, required: false
|
14
|
-
|
15
|
-
def add_procedure_code(procedure_code)
|
16
|
-
self[:procedure_codes] ||= []
|
17
|
-
self[:procedure_codes] << procedure_code
|
18
|
-
end
|
19
|
-
|
20
|
-
def add_info_claim_status(info_claim_status)
|
21
|
-
self[:info_claim_statuses] ||= []
|
22
|
-
self[:info_claim_statuses] << info_claim_status
|
23
|
-
end
|
24
|
-
|
25
|
-
def latest_status_category_codes
|
26
|
-
latest_info_claim_status&.status_category_codes
|
27
|
-
end
|
28
|
-
|
29
|
-
def latest_total_charge_amount
|
30
|
-
latest_info_claim_status&.total_charge_amount
|
31
|
-
end
|
32
|
-
|
33
|
-
def latest_status_info_effective_date
|
34
|
-
latest_info_claim_status&.status_information_effective_date
|
35
|
-
end
|
36
|
-
|
37
|
-
def latest_info_claim_status
|
38
|
-
info_claim_statuses&.select do |info|
|
39
|
-
!info.status_information_effective_date.nil? &&
|
40
|
-
info.status_information_effective_date.is_a?(Date) &&
|
41
|
-
info.status_information_effective_date <= Date.today
|
42
|
-
end&.max_by(&:status_information_effective_date)
|
43
|
-
end
|
44
13
|
end
|
45
14
|
end
|
46
15
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
module ChangeHealth
|
2
|
-
|
3
|
-
module Models
|
2
|
+
module Response
|
4
3
|
class Error
|
5
4
|
attr_reader :data
|
6
5
|
|
7
6
|
SIMPLE_RETRY_CODES = %w[
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
42
|
8
|
+
80
|
9
|
+
].freeze
|
11
10
|
|
12
11
|
NO_RESUBMIT_MESSAGES = [
|
13
12
|
'resubmission not allowed',
|
@@ -40,7 +39,9 @@ module ChangeHealth
|
|
40
39
|
|
41
40
|
def retryable?
|
42
41
|
represents_down? ||
|
43
|
-
(code? && SIMPLE_RETRY_CODES.include?(code) && followupAction? && NO_RESUBMIT_MESSAGES.none?
|
42
|
+
(code? && SIMPLE_RETRY_CODES.include?(code) && followupAction? && NO_RESUBMIT_MESSAGES.none? do |msg|
|
43
|
+
followupAction.downcase.include?(msg)
|
44
|
+
end)
|
44
45
|
end
|
45
46
|
|
46
47
|
%w[field description code followupAction location].each do |method_name|
|
@@ -48,7 +49,7 @@ module ChangeHealth
|
|
48
49
|
false == send(method_name).nil?
|
49
50
|
end
|
50
51
|
|
51
|
-
define_method(
|
52
|
+
define_method(method_name.to_s) do
|
52
53
|
@data[method_name]
|
53
54
|
end
|
54
55
|
end
|
@@ -16,13 +16,13 @@ module ChangeHealth
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def errors?
|
19
|
-
|
19
|
+
errors.is_a?(Array) && false == errors.empty?
|
20
20
|
end
|
21
21
|
|
22
22
|
def errors
|
23
23
|
errors = @raw.dig('errors') || []
|
24
24
|
|
25
|
-
errors.flatten.map {|error| ChangeHealth::
|
25
|
+
errors.flatten.map { |error| ChangeHealth::Response::Error.new(error) }
|
26
26
|
end
|
27
27
|
|
28
28
|
def recommend_retry?
|
@@ -34,7 +34,7 @@ module ChangeHealth
|
|
34
34
|
|
35
35
|
return false if error_codes.empty?
|
36
36
|
|
37
|
-
|
37
|
+
error_codes.all?(&:retryable?)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
data/lib/change_health.rb
CHANGED
@@ -5,7 +5,6 @@ require 'change_health/authentication'
|
|
5
5
|
require 'change_health/change_health_exception'
|
6
6
|
require 'change_health/connection'
|
7
7
|
require 'change_health/extensions'
|
8
|
-
require 'change_health/models/error'
|
9
8
|
require 'change_health/models/model'
|
10
9
|
require 'change_health/models/claim/submission/claim_information'
|
11
10
|
require 'change_health/models/claim/submission/provider'
|
@@ -20,6 +19,7 @@ require 'change_health/request/eligibility'
|
|
20
19
|
require 'change_health/request/submission'
|
21
20
|
require 'change_health/request/report'
|
22
21
|
require 'change_health/request/trading_partner'
|
22
|
+
require 'change_health/response/error'
|
23
23
|
require 'change_health/response/response_data'
|
24
24
|
require 'change_health/response/claim/submission/submission_data'
|
25
25
|
require 'change_health/response/claim/report/report_list_data'
|
@@ -27,7 +27,11 @@ require 'change_health/response/claim/report/report_data'
|
|
27
27
|
require 'change_health/response/claim/report/report_277_data'
|
28
28
|
require 'change_health/response/claim/report/report_835_data'
|
29
29
|
require 'change_health/response/claim/report/report_claim'
|
30
|
-
require 'change_health/response/claim/report/
|
30
|
+
require 'change_health/response/claim/report/report_277_claim'
|
31
|
+
require 'change_health/response/claim/report/report_277_info_claim_status'
|
32
|
+
require 'change_health/response/claim/report/report_835_claim'
|
33
|
+
require 'change_health/response/claim/report/report_835_service_adjustment'
|
34
|
+
require 'change_health/response/claim/report/report_835_service_line'
|
31
35
|
require 'change_health/response/eligibility/eligibility_benefit'
|
32
36
|
require 'change_health/response/eligibility/eligibility_benefits'
|
33
37
|
require 'change_health/response/eligibility/eligibility_data'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: change_health
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Crockett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -155,23 +155,27 @@ files:
|
|
155
155
|
- lib/change_health/models/eligibility/encounter.rb
|
156
156
|
- lib/change_health/models/eligibility/provider.rb
|
157
157
|
- lib/change_health/models/eligibility/subscriber.rb
|
158
|
-
- lib/change_health/models/error.rb
|
159
158
|
- lib/change_health/models/model.rb
|
160
159
|
- lib/change_health/models/trading_partner/trading_partner.rb
|
161
160
|
- lib/change_health/request/eligibility.rb
|
162
161
|
- lib/change_health/request/report.rb
|
163
162
|
- lib/change_health/request/submission.rb
|
164
163
|
- lib/change_health/request/trading_partner.rb
|
164
|
+
- lib/change_health/response/claim/report/report_277_claim.rb
|
165
165
|
- lib/change_health/response/claim/report/report_277_data.rb
|
166
|
+
- lib/change_health/response/claim/report/report_277_info_claim_status.rb
|
167
|
+
- lib/change_health/response/claim/report/report_835_claim.rb
|
166
168
|
- lib/change_health/response/claim/report/report_835_data.rb
|
169
|
+
- lib/change_health/response/claim/report/report_835_service_adjustment.rb
|
170
|
+
- lib/change_health/response/claim/report/report_835_service_line.rb
|
167
171
|
- lib/change_health/response/claim/report/report_claim.rb
|
168
172
|
- lib/change_health/response/claim/report/report_data.rb
|
169
|
-
- lib/change_health/response/claim/report/report_info_claim_status.rb
|
170
173
|
- lib/change_health/response/claim/report/report_list_data.rb
|
171
174
|
- lib/change_health/response/claim/submission/submission_data.rb
|
172
175
|
- lib/change_health/response/eligibility/eligibility_benefit.rb
|
173
176
|
- lib/change_health/response/eligibility/eligibility_benefits.rb
|
174
177
|
- lib/change_health/response/eligibility/eligibility_data.rb
|
178
|
+
- lib/change_health/response/error.rb
|
175
179
|
- lib/change_health/response/response_data.rb
|
176
180
|
- lib/change_health/response/trading_partner/trading_partner_data.rb
|
177
181
|
- lib/change_health/response/trading_partner/trading_partners_data.rb
|