change_health 1.0.2 → 2.2.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 +57 -5
- data/README.md +138 -15
- data/lib/change_health/connection.rb +1 -1
- data/lib/change_health/models/claim/submission/claim_information.rb +31 -0
- data/lib/change_health/models/claim/submission/provider.rb +17 -0
- data/lib/change_health/models/claim/submission/service_line.rb +12 -0
- data/lib/change_health/models/claim/submission/submitter.rb +11 -0
- data/lib/change_health/models/claim/submission/subscriber.rb +15 -0
- data/lib/change_health/models/eligibility/encounter.rb +22 -0
- data/lib/change_health/models/eligibility/provider.rb +23 -0
- data/lib/change_health/models/eligibility/subscriber.rb +31 -0
- data/lib/change_health/models/error.rb +57 -0
- data/lib/change_health/models/model.rb +13 -1
- data/lib/change_health/models/{trading_partner.rb → trading_partner/trading_partner.rb} +0 -0
- data/lib/change_health/{models → request}/eligibility.rb +5 -5
- data/lib/change_health/request/report.rb +39 -0
- data/lib/change_health/request/submission.rb +38 -0
- data/lib/change_health/response/claim/report/report_data.rb +45 -0
- data/lib/change_health/response/claim/report/report_list_data.rb +13 -0
- data/lib/change_health/response/claim/submission/submission_data.rb +23 -0
- data/lib/change_health/{models → response/eligibility}/eligibility_benefit.rb +6 -6
- data/lib/change_health/{models → response/eligibility}/eligibility_benefits.rb +3 -3
- data/lib/change_health/{models → response/eligibility}/eligibility_data.rb +7 -93
- data/lib/change_health/response/response_data.rb +41 -0
- data/lib/change_health/response/{trading_partner_data.rb → trading_partner/trading_partner_data.rb} +0 -0
- data/lib/change_health/response/{trading_partners_data.rb → trading_partner/trading_partners_data.rb} +0 -0
- data/lib/change_health/version.rb +1 -1
- data/lib/change_health.rb +23 -11
- metadata +29 -17
- data/lib/change_health/models/encounter.rb +0 -20
- data/lib/change_health/models/provider.rb +0 -21
- data/lib/change_health/models/subscriber.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a1ce76c1da3af060d7c36a7a3f22c9e9bb1920b2db4f0f2cb9060ec777c1854
|
4
|
+
data.tar.gz: 2e4553b586e4bf8b13db083f423853708132a0686dac5ec27beea6223e740a0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c15e9b053bdbfbfca3700a3d95971517aa0c07654267cc704ce4d210cc264d6d1f9aab08ccad3c165a59b3d8d56fc82bf4be5c69f6c2155c1127fa4ee5fed5ea
|
7
|
+
data.tar.gz: 5a83d9c160bef86e5a296fea12335cc56cbac2959e1841e3f9382cee6b902586138be8e8e61328c0d3579afec5f904fa4712a9ccf8e8e7c89613e15ae663f668
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,54 @@ 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
|
+
## [2.2.0] - [2021-11-04-21]
|
8
|
+
### Added
|
9
|
+
Ability to hit [Claim Responses and Reports](https://developers.changehealthcare.com/eligibilityandclaims/docs/claims-responses-and-reports-getting-started)
|
10
|
+
* Report
|
11
|
+
* ReportListData
|
12
|
+
* ReportData
|
13
|
+
|
14
|
+
## [2.1.0] - [2021-10-12]
|
15
|
+
### Changed
|
16
|
+
Model#to_h enhanced to change empty values AKA "" to nil. Reason: If a field is empty, Change Healthcare responds with an error - `Invalid value. Item must not be blank value.`. If the empty field is optional, Change Healthcare will accept the field as nil without error. If the empty field is required, Change Healthcare will return an error if the value is empty or nil.
|
17
|
+
|
18
|
+
## [2.0.0] - [2021-10-08]
|
19
|
+
### Added
|
20
|
+
#### Models
|
21
|
+
* ResponseData - for responses from calling change healthcare api used by EligibilityData and SubmissionData
|
22
|
+
#### Claim Submission
|
23
|
+
Added the ability to hit professional claim submission API. For more details, see [Change Healthcare documentation here](https://developers.changehealthcare.com/eligibilityandclaims/docs/professional-claims-v3-getting-started)
|
24
|
+
* ClaimInformation
|
25
|
+
* Provider
|
26
|
+
* ServiceLine
|
27
|
+
* Submission
|
28
|
+
* SubmissionData
|
29
|
+
* Submitter
|
30
|
+
* Subscriber
|
31
|
+
### Changed
|
32
|
+
* Using new Change Healthcare url. From apis to apigw. For more info see [change log here](https://developers.changehealthcare.com/eligibilityandclaims/docs/change-logrelease-notes-1)
|
33
|
+
* PARSE_DATE moved from ChangeHealth::Models::EligibilityData to ChangeHealth::Models
|
34
|
+
* Moved Error class into its own file
|
35
|
+
#### Namespace
|
36
|
+
Many classes moved namespaces to be more consistent across the many endpoints in Change Healthcare
|
37
|
+
| Previous | Current |
|
38
|
+
|-|-|
|
39
|
+
|ChangeHealth::Models::Eligibility | ChangeHealth::Request::Eligibility |
|
40
|
+
| ChangeHealth::Models::Encounter | ChangeHealth::Models::Eligibility::Encounter|
|
41
|
+
| ChangeHealth::Models::Provider | ChangeHealth::Models::Eligibility::Provider|
|
42
|
+
| ChangeHealth::Models::Subscriber | ChangeHealth::Models::Eligibility::Subscriber|
|
43
|
+
| ChangeHealth::Models::EligibilityBenefit | ChangeHealth::Response::EligibilityBenefit|
|
44
|
+
| ChangeHealth::Models::EligibilityBenefits | ChangeHealth::Response::EligibilityBenefits|
|
45
|
+
| ChangeHealth::Models::EligibilityData | ChangeHealth::Response::EligibilityData|
|
46
|
+
### Fixed
|
47
|
+
* Eligibility#add_dependent actually works
|
48
|
+
|
49
|
+
## [1.0.3] - [2021-04-26]
|
50
|
+
### Added
|
51
|
+
- Model::Error#represents_down? - adds ability to distinguish error representing down state
|
52
|
+
- Model::Error#retryable? - retryable when down
|
53
|
+
- EligibilityData#recommend_retry? - recommend retry when down
|
54
|
+
|
7
55
|
## [1.0.2] - [2021-04-06]
|
8
56
|
### Added
|
9
57
|
- EligibilityData#recommend_retry? - fix a bug in the search statement
|
@@ -108,7 +156,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
108
156
|
### Added
|
109
157
|
- Production endpoint
|
110
158
|
|
111
|
-
## [0.2
|
159
|
+
## [0.0.2] - [2020-03-09]
|
112
160
|
### Added
|
113
161
|
- EligibilityData
|
114
162
|
- EligibilityBenefit
|
@@ -117,7 +165,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
117
165
|
### Changed
|
118
166
|
- Eligibility.query returns EligibilityData object
|
119
167
|
|
120
|
-
## [0.1
|
168
|
+
## [0.0.1] - 2020-03-04
|
121
169
|
### Added
|
122
170
|
- Provider
|
123
171
|
- Subscriber
|
@@ -126,6 +174,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
126
174
|
- Authentication
|
127
175
|
- Configuration
|
128
176
|
|
177
|
+
[2.2.0]: https://github.com/WeInfuse/change_health/compare/v2.1.0...v2.2.0
|
178
|
+
[2.1.0]: https://github.com/WeInfuse/change_health/compare/v2.0.0...v2.1.0
|
179
|
+
[2.0.0]: https://github.com/WeInfuse/change_health/compare/v1.0.3...v2.0.0
|
180
|
+
[1.0.3]: https://github.com/WeInfuse/change_health/compare/v1.0.2...v1.0.3
|
129
181
|
[1.0.2]: https://github.com/WeInfuse/change_health/compare/v1.0.1...v1.0.2
|
130
182
|
[1.0.1]: https://github.com/WeInfuse/change_health/compare/v1.0.0...v1.0.1
|
131
183
|
[1.0.0]: https://github.com/WeInfuse/change_health/compare/v0.15.0...v1.0.0
|
@@ -141,6 +193,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
141
193
|
[0.6.0]: https://github.com/WeInfuse/change_health/compare/v0.5.0...v0.6.0
|
142
194
|
[0.5.0]: https://github.com/WeInfuse/change_health/compare/v0.4.0...v0.5.0
|
143
195
|
[0.4.0]: https://github.com/WeInfuse/change_health/compare/v0.3.0...v0.4.0
|
144
|
-
[0.3.0]: https://github.com/WeInfuse/change_health/compare/v0.2
|
145
|
-
[0.2
|
146
|
-
[0.1
|
196
|
+
[0.3.0]: https://github.com/WeInfuse/change_health/compare/v0.0.2...v0.3.0
|
197
|
+
[0.0.2]: https://github.com/WeInfuse/change_health/compare/v0.0.1...v0.0.2
|
198
|
+
[0.0.1]: https://github.com/WeInfuse/change_health/compare/520a8c54d07...v0.0.1
|
data/README.md
CHANGED
@@ -26,24 +26,25 @@ Or install it yourself as:
|
|
26
26
|
Make sure you're [configured](#configuration)!
|
27
27
|
|
28
28
|
### Eligibility
|
29
|
+
[Change Healthcare Eligibility Guide](https://developers.changehealthcare.com/eligibilityandclaims/docs)
|
29
30
|
```ruby
|
30
|
-
ChangeHealth::
|
31
|
+
ChangeHealth::Request::Eligibility.ping # Test your connection
|
31
32
|
|
32
|
-
encounter = ChangeHealth::Models::Encounter.new(date_of_service: Date.current, service_type_codes: ['98'])
|
33
|
-
provider = ChangeHealth::Models::Provider.new(npi: '0123456789', last_name: 'Bobson', first_name: 'Bob')
|
34
|
-
subscriber = ChangeHealth::Models::Subscriber.new(member_id: '0000000000', first_name: 'johnOne', last_name: 'doeOne', date_of_birth: '18800102')
|
33
|
+
encounter = ChangeHealth::Models::Eligibility::Encounter.new(date_of_service: Date.current, service_type_codes: ['98'])
|
34
|
+
provider = ChangeHealth::Models::Eligibility::Provider.new(npi: '0123456789', last_name: 'Bobson', first_name: 'Bob')
|
35
|
+
subscriber = ChangeHealth::Models::Eligibility::Subscriber.new(member_id: '0000000000', first_name: 'johnOne', last_name: 'doeOne', date_of_birth: '18800102')
|
35
36
|
|
36
|
-
edata = ChangeHealth::
|
37
|
+
edata = ChangeHealth::Request::Eligibility.new(tradingPartnerServiceId: '000050', provider: provider, subscriber: subscriber, encounter: encounter).query
|
37
38
|
|
38
39
|
edata.raw # Raw Hash of JSON response
|
39
40
|
```
|
40
41
|
|
41
|
-
|
42
|
+
#### Benefit(s) objects
|
42
43
|
Benefits extends Array and provides a query-like interface.
|
43
44
|
|
44
45
|
Benefit extends Hash and provides helpers for single-benefit.
|
45
46
|
|
46
|
-
```
|
47
|
+
```ruby
|
47
48
|
edata.benefits # Returns Benefits querying object (extends Array)
|
48
49
|
|
49
50
|
edata.benefits.individual # Only benefits matching the 'IND' identifier
|
@@ -57,7 +58,7 @@ edata.benefits.where(name: 'Co-Payment', code: 'B', benefitAmount: '30) # Generi
|
|
57
58
|
edata.benefits.find_by(name: 'Co-Payment', code: 'B', benefitAmount: '30) # Generic 'find_by' api returns first object found
|
58
59
|
```
|
59
60
|
|
60
|
-
|
61
|
+
#### Response
|
61
62
|
|
62
63
|
Response is EligibilityData object
|
63
64
|
|
@@ -77,16 +78,138 @@ true
|
|
77
78
|
|
78
79
|
### Trading Partners
|
79
80
|
```ruby
|
80
|
-
|
81
|
-
|
82
|
-
|
81
|
+
# Query trading partners using a wildcard search
|
82
|
+
# Returns Array of ChangeHealth::Models::TradingPartner Objects
|
83
|
+
trading_partners = ChangeHealth::Request::TradingPartner.query("Aetna")
|
83
84
|
|
84
|
-
|
85
|
-
|
85
|
+
trading_partners.first.name
|
86
|
+
# "Aetna"
|
87
|
+
|
88
|
+
trading_partners.first.service_id
|
89
|
+
# "ABC123"
|
90
|
+
```
|
86
91
|
|
87
|
-
|
88
|
-
|
92
|
+
### Claim Submission
|
93
|
+
[Change Healthcare Claim Submission Guide](https://developers.changehealthcare.com/eligibilityandclaims/docs/professional-claims-v3-getting-started)
|
94
|
+
```ruby
|
95
|
+
ChangeHealth::Request::Claim::Submission.ping # Test your connection
|
96
|
+
|
97
|
+
contact_information = { name: "SUBMITTER CONTACT INFO", phoneNumber: "123456789"}
|
98
|
+
claim_submitter = ChangeHealth::Models::Claim::Submitter.new(
|
99
|
+
organization_name: "REGIONAL PPO NETWORK",
|
100
|
+
contact_information: contact_information
|
101
|
+
)
|
102
|
+
|
103
|
+
receiver = { organizationName: "EXTRA HEALTHY INSURANCE"}
|
104
|
+
address = {
|
105
|
+
"address1": "123 address1",
|
106
|
+
"city": "city1",
|
107
|
+
"state": "wa",
|
108
|
+
"postalCode": "981010000"
|
109
|
+
}
|
110
|
+
subscriber = ChangeHealth::Models::Claim::Subscriber.new(
|
111
|
+
member_id: "0000000001",
|
112
|
+
payment_responsibility_level_code: "P",
|
113
|
+
first_name: "johnone",
|
114
|
+
last_name: "doetwo",
|
115
|
+
gender: "M",
|
116
|
+
date_of_birth: "02/01/1980",
|
117
|
+
address: address
|
118
|
+
)
|
119
|
+
provider = ChangeHealth::Models::Claim::Provider.new(
|
120
|
+
address: address,
|
121
|
+
employer_id: "000000000",
|
122
|
+
first_name: "johnone",
|
123
|
+
last_name: "doetwo",
|
124
|
+
npi: "1760854442",
|
125
|
+
provider_type: "BillingProvider"
|
126
|
+
)
|
127
|
+
|
128
|
+
health_care_code_information1 = {
|
129
|
+
"diagnosisTypeCode": "ABK",
|
130
|
+
"diagnosisCode": "S93401A"
|
131
|
+
}
|
132
|
+
health_care_code_information2 = {
|
133
|
+
"diagnosisTypeCode": "ABF",
|
134
|
+
"diagnosisCode": "S72044G"
|
135
|
+
|
136
|
+
}
|
137
|
+
service_line1 = ChangeHealth::Models::Claim::ServiceLine.new(
|
138
|
+
service_date: "2018-05-14",
|
139
|
+
professional_service: {
|
140
|
+
"procedureIdentifier": "HC",
|
141
|
+
"lineItemChargeAmount": "25",
|
142
|
+
"procedureCode": "E0570",
|
143
|
+
"measurementUnit": "UN",
|
144
|
+
"serviceUnitCount": "1",
|
145
|
+
"compositeDiagnosisCodePointers": {
|
146
|
+
"diagnosisCodePointers": ["1","2"]
|
147
|
+
}
|
148
|
+
}
|
149
|
+
)
|
150
|
+
service_line2 = ChangeHealth::Models::Claim::ServiceLine.new(
|
151
|
+
service_date: "20180514",
|
152
|
+
professional_service: {
|
153
|
+
"procedureIdentifier": "HC",
|
154
|
+
"lineItemChargeAmount": "3.75",
|
155
|
+
"procedureCode": "A7003",
|
156
|
+
"measurementUnit": "UN",
|
157
|
+
"serviceUnitCount": "1",
|
158
|
+
"compositeDiagnosisCodePointers": {
|
159
|
+
"diagnosisCodePointers": ["1"]
|
160
|
+
}
|
161
|
+
}
|
162
|
+
)
|
163
|
+
claim_information = ChangeHealth::Models::Claim::ClaimInformation.new(
|
164
|
+
benefits_assignment_certification_indicator: "Y",
|
165
|
+
claim_charge_amount: "28.75",
|
166
|
+
claim_filing_code: "CI",
|
167
|
+
claim_frequency_code: "1",
|
168
|
+
patient_control_number: "12345",
|
169
|
+
place_of_service_code: "11",
|
170
|
+
plan_participation_code: "A",
|
171
|
+
release_information_code: "Y",
|
172
|
+
signature_indicator: "Y",
|
173
|
+
health_care_code_information: [health_care_code_information1, health_care_code_information2],
|
174
|
+
service_lines: [service_line1, service_line2]
|
175
|
+
)
|
176
|
+
|
177
|
+
|
178
|
+
claim_submission = ChangeHealth::Request::Claim::Submission.new(
|
179
|
+
trading_partner_service_id: "9496",
|
180
|
+
submitter: claim_submitter,
|
181
|
+
receiver: receiver,
|
182
|
+
subscriber: subscriber,
|
183
|
+
providers: [provider],
|
184
|
+
claim_information: claim_information
|
185
|
+
)
|
186
|
+
|
187
|
+
claim_submission_data = claim_submission.submission
|
89
188
|
```
|
189
|
+
|
190
|
+
### Claim Reports
|
191
|
+
[Change Healthcare Claim Responses and Reports Guide](https://developers.changehealthcare.com/eligibilityandclaims/docs/claims-responses-and-reports-getting-started)
|
192
|
+
```ruby
|
193
|
+
ChangeHealth::Request::Claim::Report.ping # Test your connection
|
194
|
+
|
195
|
+
report_list = ChangeHealth::Request::Claim::Report.report_list
|
196
|
+
|
197
|
+
report_list.report_names
|
198
|
+
# ["X3000000.XX", "R5000000.XY", "R5000000.XX", "X3000000.AB", "X3000000.AC", "X3000000.ZZ", "R5000000.XZ", "R5000000.YZ", "R5000000.WA", "R5000000.WB", "R5000000.WC"]
|
199
|
+
|
200
|
+
report1_edi = ChangeHealth::Request::Claim::Report.get_report(report_list.report_names.first, as_json_report: false)
|
201
|
+
# Report in edi format
|
202
|
+
|
203
|
+
report1_json = ChangeHealth::Request::Claim::Report.get_report(report_list.report_names.first, as_json_report: true)
|
204
|
+
# Report in json format
|
205
|
+
|
206
|
+
reports_json = report_list.report_names.map {|report_name| ChangeHealth::Request::Claim::Report.get_report(report_name)}
|
207
|
+
# all reports in json format
|
208
|
+
|
209
|
+
reports_edi = report_list.report_names.map {|report_name| ChangeHealth::Request::Claim::Report.get_report(report_name, as_json_report: false)}
|
210
|
+
# all reports in edi format
|
211
|
+
```
|
212
|
+
|
90
213
|
### Configuration
|
91
214
|
|
92
215
|
```ruby
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module ChangeHealth
|
2
2
|
class Connection
|
3
|
-
URI_BUILDER = ->(host) { "https://#{host}
|
3
|
+
URI_BUILDER = ->(host) { "https://#{host}apigw.changehealthcare.com/".freeze }
|
4
4
|
|
5
5
|
QA_ENDPOINT = URI_BUILDER.call('sandbox.')
|
6
6
|
PROD_ENDPOINT = URI_BUILDER.call('')
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Models
|
3
|
+
module Claim
|
4
|
+
class ClaimInformation < Hashie::Trash
|
5
|
+
property :benefitsAssignmentCertificationIndicator, from: :benefits_assignment_certification_indicator, required: false
|
6
|
+
property :claimChargeAmount, from: :claim_charge_amount, required: false
|
7
|
+
property :claimFilingCode, from: :claim_filing_code, required: false
|
8
|
+
property :claimFrequencyCode, from: :claim_frequency_code, required: false
|
9
|
+
property :claimSupplementalInformation, from: :claim_supplemental_information, required: false
|
10
|
+
property :healthCareCodeInformation, from: :health_care_code_information, required: false
|
11
|
+
property :patientControlNumber, from: :patient_control_number, required: false
|
12
|
+
property :placeOfServiceCode, from: :place_of_service_code, required: false
|
13
|
+
property :planParticipationCode, from: :plan_participation_code, required: false
|
14
|
+
property :releaseInformationCode, from: :release_information_code, required: false
|
15
|
+
property :serviceFacilityLocation, from: :service_facility_location, required: false
|
16
|
+
property :serviceLines, from: :service_lines, required: false
|
17
|
+
property :signatureIndicator, from: :signature_indicator, required: false
|
18
|
+
|
19
|
+
def add_service_line(service_line)
|
20
|
+
self[:serviceLines] ||= []
|
21
|
+
self[:serviceLines] << service_line
|
22
|
+
end
|
23
|
+
|
24
|
+
def add_health_care_code_information(health_care_code_information)
|
25
|
+
self[:healthCareCodeInformation] ||= []
|
26
|
+
self[:healthCareCodeInformation] << health_care_code_information
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Models
|
3
|
+
module Claim
|
4
|
+
class Provider < Hashie::Trash
|
5
|
+
property :address, required: false
|
6
|
+
property :contactInformation, from: :contact_information, required: false
|
7
|
+
property :employerId, from: :employer_id, required: false # or ssn
|
8
|
+
property :firstName, from: :first_name, required: false
|
9
|
+
property :lastName, from: :last_name, required: false
|
10
|
+
property :organizationName, from: :organization_name, required: false
|
11
|
+
property :npi, required: false
|
12
|
+
property :providerType, from: :provider_type, required: false
|
13
|
+
property :ssn, required: false # or employer id
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Models
|
3
|
+
module Claim
|
4
|
+
class Submitter < Hashie::Trash
|
5
|
+
property :organizationName, from: :organization_name, required: false
|
6
|
+
# contact information has a name & phone number inside
|
7
|
+
property :contactInformation, from: :contact_information, required: false
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Models
|
3
|
+
module Claim
|
4
|
+
class Subscriber < Model
|
5
|
+
property :address, required: false
|
6
|
+
property :dateOfBirth, from: :date_of_birth, required: false
|
7
|
+
property :firstName, from: :first_name, required: false
|
8
|
+
property :gender, required: false
|
9
|
+
property :lastName, from: :last_name, required: false
|
10
|
+
property :memberId, from: :member_id, required: false
|
11
|
+
property :paymentResponsibilityLevelCode, from: :payment_responsibility_level_code, required: false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Models
|
3
|
+
module Eligibility
|
4
|
+
class Encounter < Model
|
5
|
+
property :beginningDateOfService, from: :beginning_date_of_service, required: false
|
6
|
+
property :dateOfService, from: :date_of_service, required: false
|
7
|
+
property :dateRange, from: :date_range, required: false, default: false
|
8
|
+
property :endDateOfService, from: :end_date_of_service, required: false
|
9
|
+
property :serviceTypeCodes, from: :service_type_codes, required: false
|
10
|
+
|
11
|
+
alias_method :dateRange?, :dateRange
|
12
|
+
alias_method :date_range?, :dateRange
|
13
|
+
alias_method :service_type_codes, :serviceTypeCodes
|
14
|
+
|
15
|
+
def add_service_type_code(code)
|
16
|
+
self[:serviceTypeCodes] ||= []
|
17
|
+
self[:serviceTypeCodes] << code
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Models
|
3
|
+
module Eligibility
|
4
|
+
class Provider < Hashie::Trash
|
5
|
+
property :firstName, from: :first_name, required: false
|
6
|
+
property :lastName, from: :last_name, required: false
|
7
|
+
property :name, default: true, required: false
|
8
|
+
property :npi, required: false
|
9
|
+
property :organizationName, from: :organization_name, required: false
|
10
|
+
property :payorId, from: :payer_id, required: false
|
11
|
+
property :person, default: true, required: false
|
12
|
+
property :providerCode, from: :provider_code, required: false
|
13
|
+
property :providerName, from: :provider_name, required: false
|
14
|
+
property :providerType, from: :provider_type, required: false
|
15
|
+
property :referenceIdentification, from: :reference_identification, required: false
|
16
|
+
property :serviceProviderNumber, from: :service_provider_number, required: false
|
17
|
+
property :taxId, from: :tax_id, required: false
|
18
|
+
|
19
|
+
alias_method :name?, :name
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Models
|
3
|
+
module Eligibility
|
4
|
+
class Subscriber < Model
|
5
|
+
property :additionalIdentification, required: false
|
6
|
+
property :address, required: false
|
7
|
+
property :birthSequenceNumber, from: :birth_sequence_number, required: false
|
8
|
+
property :caseNumber, from: :case_number, required: false
|
9
|
+
property :dateOfBirth, from: :date_of_birth, required: false
|
10
|
+
property :firstName, from: :first_name, required: false
|
11
|
+
property :gender, required: false
|
12
|
+
property :groupNumber, from: :group_number, required: false
|
13
|
+
property :healthCareCodeInformation, from: :health_care_code_information, required: false
|
14
|
+
property :idCard, from: :id_card, required: false
|
15
|
+
property :idCardIssueDate, from: :id_card_issued_date, required: false
|
16
|
+
property :lastName, from: :last_name, required: false
|
17
|
+
property :medicaidRecipientIdentificationNumber, from: :medicaid_recipient_identification_number, required: false
|
18
|
+
property :memberId, from: :member_id, required: false
|
19
|
+
property :providerCode, from: :provider_code, required: false
|
20
|
+
property :providerIdentifier, from: :provider_identification, required: false
|
21
|
+
property :referenceIdentificationQualifier, from: :reference_identification_qualifier, required: false
|
22
|
+
property :ssn, required: false
|
23
|
+
|
24
|
+
def add_health_care_code_information(value)
|
25
|
+
self[:healthCareCodeInformation] ||= []
|
26
|
+
self[:healthCareCodeInformation] << value
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
# TODO: This should be the response module/folder... next major release
|
3
|
+
module Models
|
4
|
+
class Error
|
5
|
+
attr_reader :data
|
6
|
+
|
7
|
+
SIMPLE_RETRY_CODES = %w[
|
8
|
+
42
|
9
|
+
80
|
10
|
+
].freeze
|
11
|
+
|
12
|
+
NO_RESUBMIT_MESSAGES = [
|
13
|
+
'resubmission not allowed',
|
14
|
+
'do not resubmit'
|
15
|
+
].freeze
|
16
|
+
|
17
|
+
DOWN_FIELD = 'Http Header'.freeze
|
18
|
+
|
19
|
+
DOWN_MESSAGE = 'Please review http headers for this API, please contact support if you are unsure how to resolve.'.freeze
|
20
|
+
|
21
|
+
def initialize(data)
|
22
|
+
@data = data
|
23
|
+
end
|
24
|
+
|
25
|
+
def message
|
26
|
+
field_message || code_message
|
27
|
+
end
|
28
|
+
|
29
|
+
def field_message
|
30
|
+
"#{field}: #{description}" if field?
|
31
|
+
end
|
32
|
+
|
33
|
+
def code_message
|
34
|
+
"#{code}: #{description}" if code?
|
35
|
+
end
|
36
|
+
|
37
|
+
def represents_down?
|
38
|
+
field == DOWN_FIELD && description == DOWN_MESSAGE
|
39
|
+
end
|
40
|
+
|
41
|
+
def retryable?
|
42
|
+
represents_down? ||
|
43
|
+
(code? && SIMPLE_RETRY_CODES.include?(code) && followupAction? && NO_RESUBMIT_MESSAGES.none? {|msg| followupAction.downcase.include?(msg) })
|
44
|
+
end
|
45
|
+
|
46
|
+
%w[field description code followupAction location].each do |method_name|
|
47
|
+
define_method("#{method_name}?") do
|
48
|
+
false == send(method_name).nil?
|
49
|
+
end
|
50
|
+
|
51
|
+
define_method("#{method_name}") do
|
52
|
+
@data[method_name]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -12,14 +12,26 @@ module ChangeHealth
|
|
12
12
|
d
|
13
13
|
}
|
14
14
|
|
15
|
+
PARSE_DATE = ->(d) {
|
16
|
+
begin
|
17
|
+
d = Date.strptime(d, ChangeHealth::Models::DATE_FORMAT)
|
18
|
+
rescue
|
19
|
+
end
|
20
|
+
|
21
|
+
d
|
22
|
+
}
|
23
|
+
|
24
|
+
CONTROL_NUMBER = ->() { '%09d' % rand(1_000_000_000) }
|
25
|
+
|
15
26
|
class Model < Hashie::Trash
|
16
27
|
def to_h
|
17
28
|
result = super.to_h
|
18
29
|
|
19
|
-
self.
|
30
|
+
self.each_pair do |key, value|
|
20
31
|
if key.to_s.downcase.include?('date')
|
21
32
|
result[key] = ChangeHealth::Models::DATE_FORMATTER.call(result[key])
|
22
33
|
end
|
34
|
+
result[key] = nil if value == ""
|
23
35
|
end
|
24
36
|
|
25
37
|
result
|
File without changes
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module ChangeHealth
|
2
|
-
module
|
2
|
+
module Request
|
3
3
|
class Eligibility < Hashie::Trash
|
4
4
|
ENDPOINT = '/medicalnetwork/eligibility/v3'.freeze
|
5
5
|
HEALTH_CHECK_ENDPOINT = ENDPOINT + '/healthcheck'.freeze
|
6
6
|
|
7
|
-
property :controlNumber, from: :control_number, required: true, default:
|
7
|
+
property :controlNumber, from: :control_number, required: true, default: ChangeHealth::Models::CONTROL_NUMBER
|
8
8
|
property :dependents, required: false
|
9
9
|
property :encounter, required: false
|
10
10
|
property :informationReceiverName, from: :information_receiver_name, required: false
|
@@ -20,12 +20,12 @@ module ChangeHealth
|
|
20
20
|
alias_method :partner_id?, :partnerId
|
21
21
|
|
22
22
|
def add_dependent(dependent)
|
23
|
-
self[:
|
24
|
-
self[:
|
23
|
+
self[:dependents] ||= []
|
24
|
+
self[:dependents] << dependent
|
25
25
|
end
|
26
26
|
|
27
27
|
def query
|
28
|
-
ChangeHealth::
|
28
|
+
ChangeHealth::Response::EligibilityData.new(response: ChangeHealth::Connection.new.request(endpoint: ENDPOINT, body: self.to_h))
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.health_check
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Request
|
3
|
+
module Claim
|
4
|
+
class Report
|
5
|
+
ENDPOINT = '/medicalnetwork/reports/v2'.freeze
|
6
|
+
HEALTH_CHECK_ENDPOINT = ENDPOINT + '/healthcheck'.freeze
|
7
|
+
|
8
|
+
def self.report_list
|
9
|
+
ChangeHealth::Response::Claim::ReportListData.new(response: ChangeHealth::Connection.new.request(endpoint: ENDPOINT, verb: :get))
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.get_report(report_name, as_json_report: true)
|
13
|
+
return if report_name.nil? || report_name.empty?
|
14
|
+
|
15
|
+
individual_report_endpoint = ENDPOINT + '/' + report_name
|
16
|
+
if as_json_report
|
17
|
+
# https://developers.changehealthcare.com/eligibilityandclaims/docs/what-file-types-does-this-api-get-from-the-mailbox
|
18
|
+
report_type = ChangeHealth::Response::Claim::ReportData.report_type(report_name)
|
19
|
+
return if report_type.nil?
|
20
|
+
|
21
|
+
individual_report_endpoint += '/' + report_type
|
22
|
+
end
|
23
|
+
|
24
|
+
ChangeHealth::Response::Claim::ReportData.new(report_name,
|
25
|
+
as_json_report,
|
26
|
+
response: ChangeHealth::Connection.new.request(endpoint: individual_report_endpoint, verb: :get))
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.health_check
|
30
|
+
ChangeHealth::Connection.new.request(endpoint: HEALTH_CHECK_ENDPOINT, verb: :get)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.ping
|
34
|
+
self.health_check
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Request
|
3
|
+
module Claim
|
4
|
+
class Submission < Hashie::Trash
|
5
|
+
ENDPOINT = '/medicalnetwork/professionalclaims/v3'.freeze
|
6
|
+
HEALTH_CHECK_ENDPOINT = ENDPOINT + '/healthcheck'.freeze
|
7
|
+
SUBMISSION_ENDPOINT = ENDPOINT + '/submission'.freeze
|
8
|
+
|
9
|
+
property :claimInformation, from: :claim_information, required: false
|
10
|
+
property :controlNumber, from: :control_number, required: true, default: ChangeHealth::Models::CONTROL_NUMBER
|
11
|
+
property :providers, required: false
|
12
|
+
property :receiver, required: false
|
13
|
+
property :submitter, required: false
|
14
|
+
property :subscriber, required: false
|
15
|
+
# Need one or the other, trading partner id or trading partner service id
|
16
|
+
property :tradingPartnerId, from: :trading_partner_id, required: false
|
17
|
+
property :tradingPartnerServiceId, from: :trading_partner_service_id, required: false
|
18
|
+
|
19
|
+
def add_provider(provider)
|
20
|
+
self[:providers] ||= []
|
21
|
+
self[:providers] << provider
|
22
|
+
end
|
23
|
+
|
24
|
+
def submission
|
25
|
+
ChangeHealth::Response::Claim::SubmissionData.new(response: ChangeHealth::Connection.new.request(endpoint: SUBMISSION_ENDPOINT, body: self.to_h))
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.health_check
|
29
|
+
ChangeHealth::Connection.new.request(endpoint: HEALTH_CHECK_ENDPOINT, verb: :get)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.ping
|
33
|
+
self.health_check
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Response
|
3
|
+
module Claim
|
4
|
+
class ReportData < ChangeHealth::Response::ResponseData
|
5
|
+
attr_reader :report_name, :json
|
6
|
+
alias_method :json?, :json
|
7
|
+
|
8
|
+
def initialize(report_name, json, data: nil, response: nil)
|
9
|
+
super(data: data, response: response)
|
10
|
+
@report_name = report_name
|
11
|
+
@json = json
|
12
|
+
end
|
13
|
+
|
14
|
+
def edi?
|
15
|
+
!@json
|
16
|
+
end
|
17
|
+
|
18
|
+
def report_type
|
19
|
+
self.class.report_type(@report_name)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.report_type(report_name)
|
23
|
+
return '277' if is_277?(report_name)
|
24
|
+
return '835' if is_835?(report_name)
|
25
|
+
end
|
26
|
+
|
27
|
+
def is_277?
|
28
|
+
self.class.is_277?(@report_name)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.is_277?(report_name)
|
32
|
+
report_name.start_with?('X3')
|
33
|
+
end
|
34
|
+
|
35
|
+
def is_835?
|
36
|
+
self.class.is_835?(@report_name)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.is_835?(report_name)
|
40
|
+
report_name.start_with?('R5')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Response
|
3
|
+
module Claim
|
4
|
+
class SubmissionData < ChangeHealth::Response::ResponseData
|
5
|
+
|
6
|
+
%w(controlNumber status tradingPartnerId tradingPartnerServiceId).each do |v|
|
7
|
+
define_method(v) do
|
8
|
+
@raw.dig(v)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
alias_method :control_number, :controlNumber
|
13
|
+
alias_method :trading_partner_id, :tradingPartnerId
|
14
|
+
alias_method :trading_partner_service_id, :tradingPartnerServiceId
|
15
|
+
|
16
|
+
def trading_partner?(name)
|
17
|
+
self.trading_partner_id == name || trading_partner_service_id == name
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module ChangeHealth
|
2
|
-
module
|
2
|
+
module Response
|
3
3
|
class EligibilityBenefit < Hash
|
4
4
|
include Hashie::Extensions::MergeInitializer
|
5
5
|
include Hashie::Extensions::IndifferentAccess
|
@@ -54,7 +54,7 @@ module ChangeHealth
|
|
54
54
|
coverageLevelCode: COVERAGES,
|
55
55
|
code: CODES
|
56
56
|
}
|
57
|
-
|
57
|
+
|
58
58
|
HELPERS.each do |key, types|
|
59
59
|
types.each do |method, value|
|
60
60
|
define_method("#{method}?") do
|
@@ -99,13 +99,13 @@ module ChangeHealth
|
|
99
99
|
self.coinsurance? ? self.benefitPercent : self.benefitAmount
|
100
100
|
end
|
101
101
|
|
102
|
-
def services
|
102
|
+
def services
|
103
103
|
self['serviceTypeCodes']&.each_with_index&.map {|stc, i| [stc, self['serviceTypes']&.at(i)]} || []
|
104
104
|
end
|
105
105
|
|
106
106
|
%w(eligibilityBegin eligibilityEnd planBegin planEnd service).each do |f|
|
107
107
|
define_method(f) do
|
108
|
-
return ChangeHealth::Models::
|
108
|
+
return ChangeHealth::Models::PARSE_DATE.call(self.date_info&.dig(f))
|
109
109
|
end
|
110
110
|
end
|
111
111
|
alias_method :eligibility_begin_date, :eligibilityBegin
|
@@ -120,11 +120,11 @@ module ChangeHealth
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def plan_date_range_start
|
123
|
-
ChangeHealth::Models::
|
123
|
+
ChangeHealth::Models::PARSE_DATE.call(self.plan_date_range[0])
|
124
124
|
end
|
125
125
|
|
126
126
|
def plan_date_range_end
|
127
|
-
ChangeHealth::Models::
|
127
|
+
ChangeHealth::Models::PARSE_DATE.call(self.plan_date_range[1])
|
128
128
|
end
|
129
129
|
|
130
130
|
private
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module ChangeHealth
|
2
|
-
module
|
2
|
+
module Response
|
3
3
|
class EligibilityBenefits < Array
|
4
4
|
def initialize(benefits)
|
5
|
-
super(benefits.map {|benefit| ChangeHealth::
|
5
|
+
super(benefits.map {|benefit| ChangeHealth::Response::EligibilityBenefit.new(benefit) })
|
6
6
|
end
|
7
7
|
|
8
8
|
def where(**kwargs)
|
@@ -25,7 +25,7 @@ module ChangeHealth
|
|
25
25
|
self.where(inPlanNetworkIndicatorCode: 'Y')
|
26
26
|
end
|
27
27
|
|
28
|
-
ChangeHealth::
|
28
|
+
ChangeHealth::Response::EligibilityBenefit::HELPERS.each do |key, types|
|
29
29
|
types.each do |method, value|
|
30
30
|
define_method("#{method}s") do
|
31
31
|
self.where(key => value)
|
@@ -1,76 +1,10 @@
|
|
1
1
|
module ChangeHealth
|
2
|
-
module
|
3
|
-
class
|
4
|
-
attr_reader :data
|
5
|
-
|
6
|
-
SIMPLE_RETRY_CODES = %w[
|
7
|
-
42
|
8
|
-
80
|
9
|
-
].freeze
|
10
|
-
|
11
|
-
NO_RESUBMIT_MESSAGES = [
|
12
|
-
'resubmission not allowed',
|
13
|
-
'do not resubmit'
|
14
|
-
].freeze
|
15
|
-
|
16
|
-
def initialize(data)
|
17
|
-
@data = data
|
18
|
-
end
|
19
|
-
|
20
|
-
def message
|
21
|
-
field_message || code_message
|
22
|
-
end
|
23
|
-
|
24
|
-
def field_message
|
25
|
-
"#{field}: #{description}" if field?
|
26
|
-
end
|
27
|
-
|
28
|
-
def code_message
|
29
|
-
"#{code}: #{description}" if code?
|
30
|
-
end
|
31
|
-
|
32
|
-
def retryable?
|
33
|
-
code? && SIMPLE_RETRY_CODES.include?(code) && followupAction? && NO_RESUBMIT_MESSAGES.none? {|msg| followupAction.downcase.include?(msg) }
|
34
|
-
end
|
35
|
-
|
36
|
-
%w[field description code followupAction location].each do |method_name|
|
37
|
-
define_method("#{method_name}?") do
|
38
|
-
false == send(method_name).nil?
|
39
|
-
end
|
40
|
-
|
41
|
-
define_method("#{method_name}") do
|
42
|
-
@data[method_name]
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
class EligibilityData
|
48
|
-
attr_reader :response, :raw
|
2
|
+
module Response
|
3
|
+
class EligibilityData < ChangeHealth::Response::ResponseData
|
49
4
|
|
50
5
|
ACTIVE = '1'
|
51
6
|
INACTIVE = '6'
|
52
7
|
|
53
|
-
PARSE_DATE = ->(d) {
|
54
|
-
begin
|
55
|
-
d = Date.strptime(d, ChangeHealth::Models::DATE_FORMAT)
|
56
|
-
rescue
|
57
|
-
end
|
58
|
-
|
59
|
-
d
|
60
|
-
}
|
61
|
-
|
62
|
-
def initialize(data: nil, response: nil)
|
63
|
-
@response = response
|
64
|
-
@raw = data
|
65
|
-
|
66
|
-
begin
|
67
|
-
@raw ||= response&.parsed_response
|
68
|
-
rescue JSON::ParserError
|
69
|
-
end
|
70
|
-
|
71
|
-
@raw ||= {}
|
72
|
-
end
|
73
|
-
|
74
8
|
def active?(service_code: '30')
|
75
9
|
plan_status(service_code: service_code, single: false).any? {|status| ACTIVE == status['statusCode'] }
|
76
10
|
end
|
@@ -79,26 +13,6 @@ module ChangeHealth
|
|
79
13
|
plan_status(service_code: service_code, single: false).any? {|status| INACTIVE == status['statusCode'] }
|
80
14
|
end
|
81
15
|
|
82
|
-
def errors?
|
83
|
-
self.errors.is_a?(Array) && false == self.errors.empty?
|
84
|
-
end
|
85
|
-
|
86
|
-
def errors
|
87
|
-
errors = @raw.dig('errors') || []
|
88
|
-
|
89
|
-
errors.flatten.map {|error| ChangeHealth::Models::Error.new(error) }
|
90
|
-
end
|
91
|
-
|
92
|
-
def recommend_retry?
|
93
|
-
return false unless errors?
|
94
|
-
|
95
|
-
error_codes = errors.select(&:code?)
|
96
|
-
|
97
|
-
return false if error_codes.empty?
|
98
|
-
|
99
|
-
return error_codes.all?(&:retryable?)
|
100
|
-
end
|
101
|
-
|
102
16
|
def dependents?
|
103
17
|
true == self.dependents&.any?
|
104
18
|
end
|
@@ -111,7 +25,7 @@ module ChangeHealth
|
|
111
25
|
|
112
26
|
%w(eligibilityBegin planBegin service).each do |f|
|
113
27
|
define_method(f) do
|
114
|
-
return PARSE_DATE.call(self.date_info&.dig(f))
|
28
|
+
return ChangeHealth::Models::PARSE_DATE.call(self.date_info&.dig(f))
|
115
29
|
end
|
116
30
|
end
|
117
31
|
alias_method :eligibility_begin_date, :eligibilityBegin
|
@@ -124,11 +38,11 @@ module ChangeHealth
|
|
124
38
|
end
|
125
39
|
|
126
40
|
def plan_date_range_start
|
127
|
-
ChangeHealth::Models::
|
41
|
+
ChangeHealth::Models::PARSE_DATE.call(self.plan_date_range[0])
|
128
42
|
end
|
129
43
|
|
130
44
|
def plan_date_range_end
|
131
|
-
ChangeHealth::Models::
|
45
|
+
ChangeHealth::Models::PARSE_DATE.call(self.plan_date_range[1])
|
132
46
|
end
|
133
47
|
|
134
48
|
def plan_status(service_code: , single: true)
|
@@ -140,9 +54,9 @@ module ChangeHealth
|
|
140
54
|
end
|
141
55
|
|
142
56
|
def benefits
|
143
|
-
kname = "ChangeHealth::
|
57
|
+
kname = "ChangeHealth::Response::EligibilityBenefits#{self.trading_partner_id&.upcase}"
|
144
58
|
klazz = Object.const_get(kname) if Module.const_defined?(kname)
|
145
|
-
klazz ||= ChangeHealth::
|
59
|
+
klazz ||= ChangeHealth::Response::EligibilityBenefits
|
146
60
|
|
147
61
|
if klazz.respond_to?(:factory)
|
148
62
|
klazz = klazz.factory(self)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Response
|
3
|
+
class ResponseData
|
4
|
+
attr_reader :response, :raw
|
5
|
+
|
6
|
+
def initialize(data: nil, response: nil)
|
7
|
+
@response = response
|
8
|
+
@raw = data
|
9
|
+
|
10
|
+
begin
|
11
|
+
@raw ||= response&.parsed_response
|
12
|
+
rescue JSON::ParserError
|
13
|
+
end
|
14
|
+
|
15
|
+
@raw ||= {}
|
16
|
+
end
|
17
|
+
|
18
|
+
def errors?
|
19
|
+
self.errors.is_a?(Array) && false == self.errors.empty?
|
20
|
+
end
|
21
|
+
|
22
|
+
def errors
|
23
|
+
errors = @raw.dig('errors') || []
|
24
|
+
|
25
|
+
errors.flatten.map {|error| ChangeHealth::Models::Error.new(error) }
|
26
|
+
end
|
27
|
+
|
28
|
+
def recommend_retry?
|
29
|
+
return false unless errors?
|
30
|
+
|
31
|
+
return true if errors.any?(&:represents_down?)
|
32
|
+
|
33
|
+
error_codes = errors.select(&:code?)
|
34
|
+
|
35
|
+
return false if error_codes.empty?
|
36
|
+
|
37
|
+
return error_codes.all?(&:retryable?)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/change_health/response/{trading_partner_data.rb → trading_partner/trading_partner_data.rb}
RENAMED
File without changes
|
File without changes
|
data/lib/change_health.rb
CHANGED
@@ -1,22 +1,34 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
require 'hashie'
|
3
3
|
require 'change_health/version'
|
4
|
+
require 'change_health/authentication'
|
4
5
|
require 'change_health/change_health_exception'
|
5
6
|
require 'change_health/connection'
|
6
|
-
require 'change_health/authentication'
|
7
7
|
require 'change_health/extensions'
|
8
|
+
require 'change_health/models/error'
|
8
9
|
require 'change_health/models/model'
|
9
|
-
require 'change_health/models/
|
10
|
-
require 'change_health/models/
|
11
|
-
require 'change_health/models/
|
12
|
-
require 'change_health/models/
|
13
|
-
require 'change_health/models/
|
10
|
+
require 'change_health/models/claim/submission/claim_information'
|
11
|
+
require 'change_health/models/claim/submission/provider'
|
12
|
+
require 'change_health/models/claim/submission/service_line'
|
13
|
+
require 'change_health/models/claim/submission/submitter'
|
14
|
+
require 'change_health/models/claim/submission/subscriber'
|
15
|
+
require 'change_health/models/eligibility/encounter'
|
16
|
+
require 'change_health/models/eligibility/provider'
|
17
|
+
require 'change_health/models/eligibility/subscriber'
|
18
|
+
require 'change_health/models/trading_partner/trading_partner'
|
19
|
+
require 'change_health/request/eligibility'
|
20
|
+
require 'change_health/request/submission'
|
21
|
+
require 'change_health/request/report'
|
14
22
|
require 'change_health/request/trading_partner'
|
15
|
-
require 'change_health/response/
|
16
|
-
require 'change_health/response/
|
17
|
-
require 'change_health/
|
18
|
-
require 'change_health/
|
19
|
-
require 'change_health/
|
23
|
+
require 'change_health/response/response_data'
|
24
|
+
require 'change_health/response/claim/submission/submission_data'
|
25
|
+
require 'change_health/response/claim/report/report_list_data'
|
26
|
+
require 'change_health/response/claim/report/report_data'
|
27
|
+
require 'change_health/response/eligibility/eligibility_benefit'
|
28
|
+
require 'change_health/response/eligibility/eligibility_benefits'
|
29
|
+
require 'change_health/response/eligibility/eligibility_data'
|
30
|
+
require 'change_health/response/trading_partner/trading_partner_data'
|
31
|
+
require 'change_health/response/trading_partner/trading_partners_data'
|
20
32
|
|
21
33
|
module ChangeHealth
|
22
34
|
class Configuration
|
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: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Crockett
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -128,7 +128,7 @@ dependencies:
|
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0.9'
|
131
|
-
description:
|
131
|
+
description:
|
132
132
|
email:
|
133
133
|
- mike.crockett@weinfuse.com
|
134
134
|
executables: []
|
@@ -147,25 +147,37 @@ files:
|
|
147
147
|
- lib/change_health/change_health_exception.rb
|
148
148
|
- lib/change_health/connection.rb
|
149
149
|
- lib/change_health/extensions.rb
|
150
|
-
- lib/change_health/models/
|
151
|
-
- lib/change_health/models/
|
152
|
-
- lib/change_health/models/
|
153
|
-
- lib/change_health/models/
|
154
|
-
- lib/change_health/models/
|
150
|
+
- lib/change_health/models/claim/submission/claim_information.rb
|
151
|
+
- lib/change_health/models/claim/submission/provider.rb
|
152
|
+
- lib/change_health/models/claim/submission/service_line.rb
|
153
|
+
- lib/change_health/models/claim/submission/submitter.rb
|
154
|
+
- lib/change_health/models/claim/submission/subscriber.rb
|
155
|
+
- lib/change_health/models/eligibility/encounter.rb
|
156
|
+
- lib/change_health/models/eligibility/provider.rb
|
157
|
+
- lib/change_health/models/eligibility/subscriber.rb
|
158
|
+
- lib/change_health/models/error.rb
|
155
159
|
- lib/change_health/models/model.rb
|
156
|
-
- lib/change_health/models/
|
157
|
-
- lib/change_health/
|
158
|
-
- lib/change_health/
|
160
|
+
- lib/change_health/models/trading_partner/trading_partner.rb
|
161
|
+
- lib/change_health/request/eligibility.rb
|
162
|
+
- lib/change_health/request/report.rb
|
163
|
+
- lib/change_health/request/submission.rb
|
159
164
|
- lib/change_health/request/trading_partner.rb
|
160
|
-
- lib/change_health/response/
|
161
|
-
- lib/change_health/response/
|
165
|
+
- lib/change_health/response/claim/report/report_data.rb
|
166
|
+
- lib/change_health/response/claim/report/report_list_data.rb
|
167
|
+
- lib/change_health/response/claim/submission/submission_data.rb
|
168
|
+
- lib/change_health/response/eligibility/eligibility_benefit.rb
|
169
|
+
- lib/change_health/response/eligibility/eligibility_benefits.rb
|
170
|
+
- lib/change_health/response/eligibility/eligibility_data.rb
|
171
|
+
- lib/change_health/response/response_data.rb
|
172
|
+
- lib/change_health/response/trading_partner/trading_partner_data.rb
|
173
|
+
- lib/change_health/response/trading_partner/trading_partners_data.rb
|
162
174
|
- lib/change_health/version.rb
|
163
175
|
homepage: https://github.com/WeInfuse/change_health
|
164
176
|
licenses:
|
165
177
|
- MIT
|
166
178
|
metadata:
|
167
179
|
allowed_push_host: https://rubygems.org
|
168
|
-
post_install_message:
|
180
|
+
post_install_message:
|
169
181
|
rdoc_options: []
|
170
182
|
require_paths:
|
171
183
|
- lib
|
@@ -180,8 +192,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
192
|
- !ruby/object:Gem::Version
|
181
193
|
version: '0'
|
182
194
|
requirements: []
|
183
|
-
rubygems_version: 3.
|
184
|
-
signing_key:
|
195
|
+
rubygems_version: 3.1.6
|
196
|
+
signing_key:
|
185
197
|
specification_version: 4
|
186
198
|
summary: Ruby wrapper for the ChangeHealth API
|
187
199
|
test_files: []
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module ChangeHealth
|
2
|
-
module Models
|
3
|
-
class Encounter < Model
|
4
|
-
property :beginningDateOfService, from: :beginning_date_of_service, required: false
|
5
|
-
property :dateOfService, from: :date_of_service, required: false
|
6
|
-
property :dateRange, from: :date_range, required: false, default: false
|
7
|
-
property :endDateOfService, from: :end_date_of_service, required: false
|
8
|
-
property :serviceTypeCodes, from: :service_type_codes, required: false
|
9
|
-
|
10
|
-
alias_method :dateRange?, :dateRange
|
11
|
-
alias_method :date_range?, :dateRange
|
12
|
-
alias_method :service_type_codes, :serviceTypeCodes
|
13
|
-
|
14
|
-
def add_service_type_code(code)
|
15
|
-
self[:serviceTypeCodes] ||= []
|
16
|
-
self[:serviceTypeCodes] << code
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module ChangeHealth
|
2
|
-
module Models
|
3
|
-
class Provider < Hashie::Trash
|
4
|
-
property :firstName, from: :first_name, required: false
|
5
|
-
property :lastName, from: :last_name, required: false
|
6
|
-
property :name, default: true, required: false
|
7
|
-
property :npi, required: false
|
8
|
-
property :organizationName, from: :organization_name, required: false
|
9
|
-
property :payorId, from: :payer_id, required: false
|
10
|
-
property :person, default: true, required: false
|
11
|
-
property :providerCode, from: :provider_code, required: false
|
12
|
-
property :providerName, from: :provider_name, required: false
|
13
|
-
property :providerType, from: :provider_type, required: false
|
14
|
-
property :referenceIdentification, from: :reference_identification, required: false
|
15
|
-
property :serviceProviderNumber, from: :service_provider_number, required: false
|
16
|
-
property :taxId, from: :tax_id, required: false
|
17
|
-
|
18
|
-
alias_method :name?, :name
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module ChangeHealth
|
2
|
-
module Models
|
3
|
-
class Subscriber < Model
|
4
|
-
property :additionalIdentification, required: false
|
5
|
-
property :address, required: false
|
6
|
-
property :birthSequenceNumber, from: :birth_sequence_number, required: false
|
7
|
-
property :caseNumber, from: :case_number, required: false
|
8
|
-
property :dateOfBirth, from: :date_of_birth, required: false
|
9
|
-
property :firstName, from: :first_name, required: false
|
10
|
-
property :gender, required: false
|
11
|
-
property :groupNumber, from: :group_number, required: false
|
12
|
-
property :healthCareCodeInformation, from: :health_care_code_information, required: false
|
13
|
-
property :idCard, from: :id_card, required: false
|
14
|
-
property :idCardIssueDate, from: :id_card_issued_date, required: false
|
15
|
-
property :lastName, from: :last_name, required: false
|
16
|
-
property :medicaidRecipientIdentificationNumber, from: :medicaid_recipient_identification_number, required: false
|
17
|
-
property :memberId, from: :member_id, required: false
|
18
|
-
property :providerCode, from: :provider_code, required: false
|
19
|
-
property :providerIdentifier, from: :provider_identification, required: false
|
20
|
-
property :referenceIdentificationQualifier, from: :reference_identification_qualifier, required: false
|
21
|
-
property :ssn, required: false
|
22
|
-
|
23
|
-
def add_health_care_code_information(value)
|
24
|
-
self[:healthCareCodeInformation] ||= []
|
25
|
-
self[:healthCareCodeInformation] << value
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|