change_health 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0ce7d0b0648eeebabb95a1d8cbd2ddd81f778f5cea329f755b8734d754821e9
4
- data.tar.gz: a81b263ebb9adc652ca914effc3b14ba047b429bb6a9ddff6faa89d73f9895fa
3
+ metadata.gz: eef3b2530820969a781c893ec5079573073cf31124243bf781d3415186a45cb1
4
+ data.tar.gz: a48072bc0dd1437314eef45596569b6be7e56200c578164b4d8ff0cd98646df8
5
5
  SHA512:
6
- metadata.gz: d34f0ac2d23fe74bcc4674ff3c223ded869869bc62668578ead46a6dce495bce00cfd3d812d06faef795d8512eb59b93a492d0eeac627710bf73d8eec589ca6b
7
- data.tar.gz: 24bcddfa9679442ece9d63a2ec3092f456394bb325a863bec29b8bc376d7052d0771b193572dc58610ee5a6c9b8f4cb64b28562fffa9adb039fcf057ca3d3502
6
+ metadata.gz: 2f67e82f2eb5660f767a297aa000cd4028606aab717b0db035b85b3933ad033276cb34bcb5373a5b716cd1bf611fd3b72d26fb3baae80a9d2783b2190a386179
7
+ data.tar.gz: f8e33bf4dece3c99287b0474bdaadf9d3b8ac1d39dccbfb35fc43c979cbb706973c93ae07adaa9202be5e20adb2ba74766b78fa615191fa29caf548526692597
data/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@ 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.1.0] - 2021-12-21
8
+ ### Added
9
+ #### Claim Submission
10
+ * ServiceLine - drugIdentification & renderingProvider
11
+ * Subscriber - groupNumber
12
+ * Address model w/ postalCode that is formatted to remove dashes, '-'
13
+ * Note: Using a plain hash for address still works
14
+ * Auto formatting of postal code fields
15
+
7
16
  ## [3.0.0] - 2021-12-08
8
17
  ### Added
9
18
  * Report277Claim - specific to claims from 277 reports
@@ -216,6 +225,7 @@ Added the ability to hit professional claim submission API. For more details, se
216
225
  - Authentication
217
226
  - Configuration
218
227
 
228
+ [3.1.0]: https://github.com/WeInfuse/change_health/compare/v3.0.0...v3.1.0
219
229
  [3.0.0]: https://github.com/WeInfuse/change_health/compare/v2.3.0...v3.0.0
220
230
  [2.3.0]: https://github.com/WeInfuse/change_health/compare/v2.2.1...v2.3.0
221
231
  [2.2.1]: https://github.com/WeInfuse/change_health/compare/v2.2.0...v2.2.1
data/README.md CHANGED
@@ -109,12 +109,13 @@ claim_submitter = ChangeHealth::Models::Claim::Submitter.new(
109
109
  )
110
110
 
111
111
  receiver = { organizationName: "EXTRA HEALTHY INSURANCE"}
112
- address = {
113
- "address1": "123 address1",
114
- "city": "city1",
115
- "state": "wa",
116
- "postalCode": "981010000"
117
- }
112
+ address = ChangeHealth::Models::Claim::Address.new(
113
+ address1: "123 address1",
114
+ city: "city1",
115
+ state: "wa",
116
+ postalCode: "98101-0000"
117
+ )
118
+
118
119
  subscriber = ChangeHealth::Models::Claim::Subscriber.new(
119
120
  member_id: "0000000001",
120
121
  payment_responsibility_level_code: "P",
@@ -126,45 +127,45 @@ subscriber = ChangeHealth::Models::Claim::Subscriber.new(
126
127
  )
127
128
  provider = ChangeHealth::Models::Claim::Provider.new(
128
129
  address: address,
129
- employer_id: "000000000",
130
- first_name: "johnone",
131
- last_name: "doetwo",
132
- npi: "1760854442",
133
- provider_type: "BillingProvider"
130
+ employer_id: "000000000",
131
+ first_name: "johnone",
132
+ last_name: "doetwo",
133
+ npi: "1760854442",
134
+ provider_type: "BillingProvider"
134
135
  )
135
136
 
136
137
  health_care_code_information1 = {
137
- "diagnosisTypeCode": "ABK",
138
- "diagnosisCode": "S93401A"
138
+ diagnosisTypeCode: "ABK",
139
+ diagnosisCode: "S93401A"
139
140
  }
140
141
  health_care_code_information2 = {
141
- "diagnosisTypeCode": "ABF",
142
- "diagnosisCode": "S72044G"
142
+ diagnosisTypeCode: "ABF",
143
+ diagnosisCode: "S72044G"
143
144
 
144
145
  }
145
146
  service_line1 = ChangeHealth::Models::Claim::ServiceLine.new(
146
147
  service_date: "2018-05-14",
147
148
  professional_service: {
148
- "procedureIdentifier": "HC",
149
- "lineItemChargeAmount": "25",
150
- "procedureCode": "E0570",
151
- "measurementUnit": "UN",
152
- "serviceUnitCount": "1",
153
- "compositeDiagnosisCodePointers": {
154
- "diagnosisCodePointers": ["1","2"]
149
+ procedureIdentifier: "HC",
150
+ lineItemChargeAmount: "25",
151
+ procedureCode: "E0570",
152
+ measurementUnit: "UN",
153
+ serviceUnitCount: "1",
154
+ compositeDiagnosisCodePointers: {
155
+ diagnosisCodePointers: ["1","2"]
155
156
  }
156
157
  }
157
158
  )
158
159
  service_line2 = ChangeHealth::Models::Claim::ServiceLine.new(
159
160
  service_date: "20180514",
160
161
  professional_service: {
161
- "procedureIdentifier": "HC",
162
- "lineItemChargeAmount": "3.75",
163
- "procedureCode": "A7003",
164
- "measurementUnit": "UN",
165
- "serviceUnitCount": "1",
166
- "compositeDiagnosisCodePointers": {
167
- "diagnosisCodePointers": ["1"]
162
+ procedureIdentifier: "HC",
163
+ lineItemChargeAmount: "3.75",
164
+ procedureCode: "A7003",
165
+ measurementUnit: "UN",
166
+ serviceUnitCount: "1",
167
+ compositeDiagnosisCodePointers: {
168
+ diagnosisCodePointers: ["1"]
168
169
  }
169
170
  }
170
171
  )
@@ -0,0 +1,13 @@
1
+ module ChangeHealth
2
+ module Models
3
+ module Claim
4
+ class Address < Model
5
+ property :address1, required: false
6
+ property :address2, required: false
7
+ property :city, required: false
8
+ property :postalCode, from: :postal_code, required: false
9
+ property :state, required: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ module ChangeHealth
2
+ module Models
3
+ module Claim
4
+ class DrugIdentification < Model
5
+ property :measurementUnitCode, from: :measurement_unit_code, required: false
6
+ property :nationalDrugCode, from: :national_drug_code, required: false
7
+ property :nationalDrugUnitCount, from: :national_drug_unit_count, required: false
8
+ property :serviceIdQualifier, from: :service_id_qualifier, required: false
9
+ end
10
+ end
11
+ end
12
+ end
@@ -2,10 +2,10 @@ module ChangeHealth
2
2
  module Models
3
3
  module Claim
4
4
  class ServiceLine < Model
5
-
5
+ property :drugIdentification, from: :drug_identification, required: false
6
6
  property :serviceDate, from: :service_date, required: false
7
7
  property :professionalService, from: :professional_service, required: false
8
-
8
+ property :renderingProvider, from: :rendering_provider, required: false
9
9
  end
10
10
  end
11
11
  end
@@ -6,6 +6,7 @@ module ChangeHealth
6
6
  property :dateOfBirth, from: :date_of_birth, required: false
7
7
  property :firstName, from: :first_name, required: false
8
8
  property :gender, required: false
9
+ property :groupNumber, from: :group_number, required: false
9
10
  property :lastName, from: :last_name, required: false
10
11
  property :memberId, from: :member_id, required: false
11
12
  property :paymentResponsibilityLevelCode, from: :payment_responsibility_level_code, required: false
@@ -1,7 +1,7 @@
1
1
  module ChangeHealth
2
2
  module Models
3
3
  DATE_FORMAT = '%Y%m%d'
4
- DATE_FORMATTER = ->(d) {
4
+ DATE_FORMATTER = lambda { |d|
5
5
  begin
6
6
  d = Date.parse(d) if d.is_a?(String)
7
7
  rescue ArgumentError
@@ -12,37 +12,65 @@ module ChangeHealth
12
12
  d
13
13
  }
14
14
 
15
- PARSE_DATE = ->(d) {
15
+ PARSE_DATE = lambda { |d|
16
16
  begin
17
17
  d = Date.strptime(d, ChangeHealth::Models::DATE_FORMAT)
18
- rescue
18
+ rescue StandardError
19
19
  end
20
20
 
21
21
  d
22
22
  }
23
23
 
24
- CONTROL_NUMBER = ->() { '%09d' % rand(1_000_000_000) }
24
+ POSTAL_CODE_FORMATTER = lambda { |postal_code|
25
+ begin
26
+ formatted_postal_code = postal_code&.to_s&.tr('-', '')
27
+ rescue StandardError
28
+ end
29
+ formatted_postal_code || postal_code
30
+ }
31
+
32
+ CONTROL_NUMBER = -> { '%09d' % rand(1_000_000_000) }
25
33
 
26
34
  class Model < Hashie::Trash
27
35
  def to_h
28
- result = super.to_h
36
+ self.class.hashify(self)
37
+ end
38
+
39
+ def self.hashify(model)
40
+ model.map do |key, value|
41
+ formatted_value = case value
42
+ when Hash
43
+ hashify(model[key])
44
+ when Array
45
+ value.map do |element|
46
+ if element.is_a?(Hash)
47
+ hashify(element)
48
+ else # if it's an array of arrays, can't handle it
49
+ format_value(key, element)
50
+ end
51
+ end
52
+ else
53
+ format_value(key, value)
54
+ end
55
+ [key, formatted_value]
56
+ end.to_h
57
+ end
58
+
59
+ def self.format_value(key, value)
60
+ return nil if value == ''
29
61
 
30
- self.each_pair do |key, value|
31
- if key.to_s.downcase.include?('date')
32
- result[key] = ChangeHealth::Models::DATE_FORMATTER.call(result[key])
33
- end
34
- result[key] = nil if value == ""
35
- end
62
+ return ChangeHealth::Models::DATE_FORMATTER.call(value) if key.to_s.downcase.include?('date')
63
+ return ChangeHealth::Models::POSTAL_CODE_FORMATTER.call(value) if key.to_s.downcase.include?('postalcode')
36
64
 
37
- result
65
+ value
38
66
  end
39
67
 
40
- def as_json(args = {})
41
- self.to_h
68
+ def as_json(_args = {})
69
+ to_h
42
70
  end
43
71
 
44
- def to_json
45
- self.to_h.to_json
72
+ def to_json(*_args)
73
+ to_h.to_json
46
74
  end
47
75
  end
48
76
  end
@@ -2,7 +2,6 @@ module ChangeHealth
2
2
  module Request
3
3
  module Claim
4
4
  class Submission < Hashie::Trash
5
-
6
5
  ENDPOINT = '/medicalnetwork/professionalclaims/v3'.freeze
7
6
  HEALTH_CHECK_ENDPOINT = ENDPOINT + '/healthcheck'.freeze
8
7
  SUBMISSION_ENDPOINT = ENDPOINT + '/submission'.freeze
@@ -25,11 +24,15 @@ module ChangeHealth
25
24
  end
26
25
 
27
26
  def submission
28
- ChangeHealth::Response::Claim::SubmissionData.new(response: ChangeHealth::Connection.new.request(endpoint: SUBMISSION_ENDPOINT, body: self.to_h, headers: professional_headers))
27
+ ChangeHealth::Response::Claim::SubmissionData.new(response: ChangeHealth::Connection.new.request(
28
+ endpoint: SUBMISSION_ENDPOINT, body: to_h, headers: professional_headers
29
+ ))
29
30
  end
30
31
 
31
32
  def validation
32
- ChangeHealth::Response::Claim::SubmissionData.new(response: ChangeHealth::Connection.new.request(endpoint: VALIDATION_ENDPOINT, body: self.to_h, headers: professional_headers))
33
+ ChangeHealth::Response::Claim::SubmissionData.new(response: ChangeHealth::Connection.new.request(
34
+ endpoint: VALIDATION_ENDPOINT, body: to_h, headers: professional_headers
35
+ ))
33
36
  end
34
37
 
35
38
  def self.health_check
@@ -37,19 +40,17 @@ module ChangeHealth
37
40
  end
38
41
 
39
42
  def self.ping
40
- self.health_check
43
+ health_check
41
44
  end
42
45
 
43
46
  def professional_headers
44
47
  if self[:headers]
45
48
  extra_headers = {}
46
- extra_headers["X-CHC-ClaimSubmission-SubmitterId"] = self[:headers][:submitter_id]
47
- extra_headers["X-CHC-ClaimSubmission-BillerId"] = self[:headers][:biller_id]
48
- extra_headers["X-CHC-ClaimSubmission-Username"] = self[:headers][:username]
49
- extra_headers["X-CHC-ClaimSubmission-Pwd"] = self[:headers][:password]
49
+ extra_headers['X-CHC-ClaimSubmission-SubmitterId'] = self[:headers][:submitter_id]
50
+ extra_headers['X-CHC-ClaimSubmission-BillerId'] = self[:headers][:biller_id]
51
+ extra_headers['X-CHC-ClaimSubmission-Username'] = self[:headers][:username]
52
+ extra_headers['X-CHC-ClaimSubmission-Pwd'] = self[:headers][:password]
50
53
  extra_headers
51
- else
52
- nil
53
54
  end
54
55
  end
55
56
  end
@@ -1,3 +1,3 @@
1
1
  module ChangeHealth
2
- VERSION = '3.0.0'.freeze
2
+ VERSION = '3.1.0'.freeze
3
3
  end
data/lib/change_health.rb CHANGED
@@ -6,7 +6,9 @@ require 'change_health/change_health_exception'
6
6
  require 'change_health/connection'
7
7
  require 'change_health/extensions'
8
8
  require 'change_health/models/model'
9
+ require 'change_health/models/claim/submission/address'
9
10
  require 'change_health/models/claim/submission/claim_information'
11
+ require 'change_health/models/claim/submission/drug_identification'
10
12
  require 'change_health/models/claim/submission/provider'
11
13
  require 'change_health/models/claim/submission/service_line'
12
14
  require 'change_health/models/claim/submission/submitter'
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: 3.0.0
4
+ version: 3.1.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-12-09 00:00:00.000000000 Z
11
+ date: 2021-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -147,7 +147,9 @@ 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/claim/submission/address.rb
150
151
  - lib/change_health/models/claim/submission/claim_information.rb
152
+ - lib/change_health/models/claim/submission/drug_identification.rb
151
153
  - lib/change_health/models/claim/submission/provider.rb
152
154
  - lib/change_health/models/claim/submission/service_line.rb
153
155
  - lib/change_health/models/claim/submission/submitter.rb