candidhealth 0.17.5 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/candidhealth/claim_submission/v_1/types/claim_submission_record_create.rb +15 -4
  3. data/lib/candidhealth/commons/types/entity_conflict_error_message.rb +47 -0
  4. data/lib/candidhealth/commons/types/intended_submission_medium.rb +11 -0
  5. data/lib/candidhealth/commons/types/network_type.rb +27 -0
  6. data/lib/candidhealth/commons/types/rate_id.rb +7 -0
  7. data/lib/candidhealth/commons/types/source_of_payment_code.rb +1 -0
  8. data/lib/candidhealth/contracts/v_2/types/contract.rb +2 -2
  9. data/lib/candidhealth/contracts/v_2/types/contract_with_providers.rb +3 -3
  10. data/lib/candidhealth/eligibility/v_2/client.rb +2 -2
  11. data/lib/candidhealth/fee_schedules/client.rb +28 -0
  12. data/lib/candidhealth/fee_schedules/v_3/client.rb +499 -0
  13. data/lib/candidhealth/fee_schedules/v_3/types/dimension_match.rb +157 -0
  14. data/lib/candidhealth/fee_schedules/v_3/types/dimension_name.rb +14 -0
  15. data/lib/candidhealth/fee_schedules/v_3/types/dimensions.rb +136 -0
  16. data/lib/candidhealth/fee_schedules/v_3/types/dimensions_page.rb +69 -0
  17. data/lib/candidhealth/fee_schedules/v_3/types/match_cpt_code.rb +60 -0
  18. data/lib/candidhealth/fee_schedules/v_3/types/match_date.rb +61 -0
  19. data/lib/candidhealth/fee_schedules/v_3/types/match_facility_type_code.rb +61 -0
  20. data/lib/candidhealth/fee_schedules/v_3/types/match_geo.rb +66 -0
  21. data/lib/candidhealth/fee_schedules/v_3/types/match_license_type.rb +61 -0
  22. data/lib/candidhealth/fee_schedules/v_3/types/match_modifiers.rb +66 -0
  23. data/lib/candidhealth/fee_schedules/v_3/types/match_network_types.rb +66 -0
  24. data/lib/candidhealth/fee_schedules/v_3/types/match_payer.rb +61 -0
  25. data/lib/candidhealth/fee_schedules/v_3/types/match_provider.rb +61 -0
  26. data/lib/candidhealth/fee_schedules/v_3/types/match_result.rb +61 -0
  27. data/lib/candidhealth/fee_schedules/v_3/types/match_test_result.rb +66 -0
  28. data/lib/candidhealth/fee_schedules/v_3/types/new_rate.rb +64 -0
  29. data/lib/candidhealth/fee_schedules/v_3/types/new_rate_version.rb +64 -0
  30. data/lib/candidhealth/fee_schedules/v_3/types/optional_dimensions.rb +136 -0
  31. data/lib/candidhealth/fee_schedules/v_3/types/overlapping_rate_entries_error.rb +71 -0
  32. data/lib/candidhealth/fee_schedules/v_3/types/payer_threshold.rb +66 -0
  33. data/lib/candidhealth/fee_schedules/v_3/types/payer_thresholds_page.rb +68 -0
  34. data/lib/candidhealth/fee_schedules/v_3/types/rate.rb +96 -0
  35. data/lib/candidhealth/fee_schedules/v_3/types/rate_entry.rb +72 -0
  36. data/lib/candidhealth/fee_schedules/v_3/types/rate_upload.rb +94 -0
  37. data/lib/candidhealth/fee_schedules/v_3/types/rate_upload_with_possible_errors.rb +76 -0
  38. data/lib/candidhealth/fee_schedules/v_3/types/rates_page.rb +65 -0
  39. data/lib/candidhealth/fee_schedules/v_3/types/threshold_match.rb +72 -0
  40. data/lib/candidhealth/fee_schedules/v_3/types/validation_error.rb +129 -0
  41. data/lib/requests.rb +2 -2
  42. data/lib/types_export.rb +32 -0
  43. metadata +36 -2
@@ -0,0 +1,499 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../requests"
4
+ require_relative "../../commons/types/service_line_id"
5
+ require_relative "types/match_result"
6
+ require_relative "../../commons/types/rate_id"
7
+ require_relative "types/match_test_result"
8
+ require_relative "../../commons/types/page_token"
9
+ require "date"
10
+ require_relative "../../payers/v_3/types/payer_uuid"
11
+ require_relative "../../organization_providers/v_2/types/organization_provider_id"
12
+ require_relative "../../commons/types/state"
13
+ require_relative "../../organization_providers/v_2/types/license_type"
14
+ require_relative "../../commons/types/facility_type_code"
15
+ require_relative "../../commons/types/network_type"
16
+ require_relative "../../commons/types/procedure_modifier"
17
+ require_relative "types/rates_page"
18
+ require_relative "types/dimension_name"
19
+ require_relative "types/dimensions_page"
20
+ require_relative "types/rate"
21
+ require_relative "types/rate_upload"
22
+ require_relative "types/payer_threshold"
23
+ require_relative "types/payer_thresholds_page"
24
+ require "async"
25
+
26
+ module CandidApiClient
27
+ module FeeSchedules
28
+ module V3
29
+ class V3Client
30
+ attr_reader :request_client
31
+
32
+ # @param request_client [RequestClient]
33
+ # @return [FeeSchedules::V3::V3Client]
34
+ def initialize(request_client:)
35
+ # @type [RequestClient]
36
+ @request_client = request_client
37
+ end
38
+
39
+ # Gets the rate that matches a service line. No result means no rate exists matching the service line's dimensions.
40
+ #
41
+ # @param service_line_id [Commons::SERVICE_LINE_ID]
42
+ # @param request_options [RequestOptions]
43
+ # @return [FeeSchedules::V3::MatchResult]
44
+ def get_match(service_line_id:, request_options: nil)
45
+ response = @request_client.conn.get("/api/fee-schedules/v3/service-line/#{service_line_id}/match") do |req|
46
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
47
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
48
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
49
+ end
50
+ FeeSchedules::V3::MatchResult.from_json(json_object: response.body)
51
+ end
52
+
53
+ # Tests a service line against a rate to see if it matches.
54
+ #
55
+ # @param service_line_id [Commons::SERVICE_LINE_ID]
56
+ # @param rate_id [Commons::RATE_ID]
57
+ # @param request_options [RequestOptions]
58
+ # @return [FeeSchedules::V3::MatchTestResult]
59
+ def test_match(service_line_id:, rate_id:, request_options: nil)
60
+ response = @request_client.conn.get("/api/fee-schedules/v3/service-line/#{service_line_id}/match/#{rate_id}") do |req|
61
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
62
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
63
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
64
+ end
65
+ FeeSchedules::V3::MatchTestResult.from_json(json_object: response.body)
66
+ end
67
+
68
+ # Gets a list of dimensions with their rates. The rates returned will always be the most recent versions of those rates.
69
+ #
70
+ # @param page_token [Commons::PAGE_TOKEN]
71
+ # @param limit [Integer] Max number of dimensions returned. Defaults to 100. Max is 100.
72
+ # @param active_date [Date]
73
+ # @param payer_uuid [Payers::V3::PAYER_UUID]
74
+ # @param organization_billing_provider_id [OrganizationProviders::V2::ORGANIZATION_PROVIDER_ID]
75
+ # @param states [Commons::State]
76
+ # @param zip_codes [String]
77
+ # @param license_types [OrganizationProviders::V2::LicenseType]
78
+ # @param facility_type_codes [Commons::FacilityTypeCode]
79
+ # @param network_types [Commons::NetworkType]
80
+ # @param cpt_code [String]
81
+ # @param modifiers [Commons::ProcedureModifier]
82
+ # @param request_options [RequestOptions]
83
+ # @return [FeeSchedules::V3::RatesPage]
84
+ def get_multi(page_token: nil, limit: nil, active_date: nil, payer_uuid: nil,
85
+ organization_billing_provider_id: nil, states: nil, zip_codes: nil, license_types: nil, facility_type_codes: nil, network_types: nil, cpt_code: nil, modifiers: nil, request_options: nil)
86
+ response = @request_client.conn.get("/api/fee-schedules/v3") do |req|
87
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
88
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
89
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
90
+ req.params = {
91
+ **(request_options&.additional_query_parameters || {}),
92
+ "page_token": page_token,
93
+ "limit": limit,
94
+ "active_date": active_date,
95
+ "payer_uuid": payer_uuid,
96
+ "organization_billing_provider_id": organization_billing_provider_id,
97
+ "states": states,
98
+ "zip_codes": zip_codes,
99
+ "license_types": license_types,
100
+ "facility_type_codes": facility_type_codes,
101
+ "network_types": network_types,
102
+ "cpt_code": cpt_code,
103
+ "modifiers": modifiers
104
+ }.compact
105
+ end
106
+ FeeSchedules::V3::RatesPage.from_json(json_object: response.body)
107
+ end
108
+
109
+ # Gets unique values for a dimension based on other selection criteria. The response is a list of dimensions with your criteria and the unique values populated. This API is useful for driving pivots on dimension values.
110
+ #
111
+ # @param page_token [Commons::PAGE_TOKEN]
112
+ # @param limit [Integer] Max number of values returned. Defaults to 1000. Max is 1000.
113
+ # @param pivot_dimension [FeeSchedules::V3::DimensionName] The name of the dimension to fetch unique values for.
114
+ # @param payer_uuid [Payers::V3::PAYER_UUID]
115
+ # @param organization_billing_provider_id [OrganizationProviders::V2::ORGANIZATION_PROVIDER_ID]
116
+ # @param states [Commons::State]
117
+ # @param zip_codes [String]
118
+ # @param license_types [OrganizationProviders::V2::LicenseType]
119
+ # @param facility_type_codes [Commons::FacilityTypeCode]
120
+ # @param network_types [Commons::NetworkType]
121
+ # @param cpt_code [String]
122
+ # @param modifiers [Commons::ProcedureModifier]
123
+ # @param request_options [RequestOptions]
124
+ # @return [FeeSchedules::V3::DimensionsPage]
125
+ def get_unique_values_for_dimension(pivot_dimension:, page_token: nil, limit: nil, payer_uuid: nil,
126
+ organization_billing_provider_id: nil, states: nil, zip_codes: nil, license_types: nil, facility_type_codes: nil, network_types: nil, cpt_code: nil, modifiers: nil, request_options: nil)
127
+ response = @request_client.conn.get("/api/fee-schedules/v3/unique-dimension-values") do |req|
128
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
129
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
130
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
131
+ req.params = {
132
+ **(request_options&.additional_query_parameters || {}),
133
+ "page_token": page_token,
134
+ "limit": limit,
135
+ "pivot_dimension": pivot_dimension,
136
+ "payer_uuid": payer_uuid,
137
+ "organization_billing_provider_id": organization_billing_provider_id,
138
+ "states": states,
139
+ "zip_codes": zip_codes,
140
+ "license_types": license_types,
141
+ "facility_type_codes": facility_type_codes,
142
+ "network_types": network_types,
143
+ "cpt_code": cpt_code,
144
+ "modifiers": modifiers
145
+ }.compact
146
+ end
147
+ FeeSchedules::V3::DimensionsPage.from_json(json_object: response.body)
148
+ end
149
+
150
+ # Gets every version of a rate.
151
+ #
152
+ # @param rate_id [Commons::RATE_ID]
153
+ # @param request_options [RequestOptions]
154
+ # @return [Array<FeeSchedules::V3::Rate>]
155
+ def get_rate_history(rate_id:, request_options: nil)
156
+ response = @request_client.conn.get("/api/fee-schedules/v3/#{rate_id}/history") do |req|
157
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
158
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
159
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
160
+ end
161
+ return if response.body.nil?
162
+
163
+ response.body.map do |v|
164
+ v = v.to_json
165
+ FeeSchedules::V3::Rate.from_json(json_object: v)
166
+ end
167
+ end
168
+
169
+ # Uploads a new fee schedule.\n Each rate may either be totally new as qualified by it's dimensions or a new version for an existing rate.\n If adding a new version to an existing rate, the rate must be posted with the next version number (previous version + 1) or a EntityConflictError will be returned.\n Use the dry run flag to discover already existing rates and to run validations. If validations for any rate fail, no rates will be saved to the system.
170
+ #
171
+ # @param dry_run [Boolean]
172
+ # @param rates [Array<Hash>] Request of type Array<FeeSchedules::V3::RateUpload>, as a Hash
173
+ # @param request_options [RequestOptions]
174
+ # @return [Array<FeeSchedules::V3::Rate>]
175
+ def upload_fee_schedule(dry_run:, rates:, request_options: nil)
176
+ response = @request_client.conn.post("/api/fee-schedules/v3") do |req|
177
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
178
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
179
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
180
+ req.body = { **(request_options&.additional_body_parameters || {}), dry_run: dry_run, rates: rates }.compact
181
+ end
182
+ return if response.body.nil?
183
+
184
+ response.body.map do |v|
185
+ v = v.to_json
186
+ FeeSchedules::V3::Rate.from_json(json_object: v)
187
+ end
188
+ end
189
+
190
+ # Soft deletes a rate from the system. Only the most recent version of a rate can be deleted.
191
+ #
192
+ # @param rate_id [Commons::RATE_ID]
193
+ # @param version [Integer]
194
+ # @param request_options [RequestOptions]
195
+ # @return [Void]
196
+ def delete_rate(rate_id:, version:, request_options: nil)
197
+ @request_client.conn.delete("/api/fee-schedules/v3/#{rate_id}/#{version}") do |req|
198
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
199
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
200
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
201
+ end
202
+ end
203
+
204
+ # Gets the default payer threshold
205
+ #
206
+ # @param request_options [RequestOptions]
207
+ # @return [FeeSchedules::V3::PayerThreshold]
208
+ def get_payer_thresholds_default(request_options: nil)
209
+ response = @request_client.conn.get("/api/fee-schedules/v3/payer-threshold/default") do |req|
210
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
211
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
212
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
213
+ end
214
+ FeeSchedules::V3::PayerThreshold.from_json(json_object: response.body)
215
+ end
216
+
217
+ # Gets a list of payers and thresholds by their uuids
218
+ #
219
+ # @param payer_uuids [Payers::V3::PAYER_UUID]
220
+ # @param request_options [RequestOptions]
221
+ # @return [FeeSchedules::V3::PayerThresholdsPage]
222
+ def get_payer_thresholds(payer_uuids:, request_options: nil)
223
+ response = @request_client.conn.get("/api/fee-schedules/v3/payer-threshold") do |req|
224
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
225
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
226
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
227
+ req.params = { **(request_options&.additional_query_parameters || {}), "payer_uuids": payer_uuids }.compact
228
+ end
229
+ FeeSchedules::V3::PayerThresholdsPage.from_json(json_object: response.body)
230
+ end
231
+
232
+ # Sets the threshold information for a payer
233
+ #
234
+ # @param payer_uuid [Payers::V3::PAYER_UUID]
235
+ # @param request [Hash] Request of type FeeSchedules::V3::PayerThreshold, as a Hash
236
+ # * :upper_threshold_cents (Integer)
237
+ # * :lower_threshold_cents (Integer)
238
+ # * :disable_paid_incorrectly (Boolean)
239
+ # @param request_options [RequestOptions]
240
+ # @return [FeeSchedules::V3::PayerThreshold]
241
+ def set_payer_threshold(payer_uuid:, request:, request_options: nil)
242
+ response = @request_client.conn.put("/api/fee-schedules/v3/payer-threshold/#{payer_uuid}") do |req|
243
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
244
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
245
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
246
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
247
+ end
248
+ FeeSchedules::V3::PayerThreshold.from_json(json_object: response.body)
249
+ end
250
+ end
251
+
252
+ class AsyncV3Client
253
+ attr_reader :request_client
254
+
255
+ # @param request_client [AsyncRequestClient]
256
+ # @return [FeeSchedules::V3::AsyncV3Client]
257
+ def initialize(request_client:)
258
+ # @type [AsyncRequestClient]
259
+ @request_client = request_client
260
+ end
261
+
262
+ # Gets the rate that matches a service line. No result means no rate exists matching the service line's dimensions.
263
+ #
264
+ # @param service_line_id [Commons::SERVICE_LINE_ID]
265
+ # @param request_options [RequestOptions]
266
+ # @return [FeeSchedules::V3::MatchResult]
267
+ def get_match(service_line_id:, request_options: nil)
268
+ Async do
269
+ response = @request_client.conn.get("/api/fee-schedules/v3/service-line/#{service_line_id}/match") do |req|
270
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
271
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
272
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
273
+ end
274
+ FeeSchedules::V3::MatchResult.from_json(json_object: response.body)
275
+ end
276
+ end
277
+
278
+ # Tests a service line against a rate to see if it matches.
279
+ #
280
+ # @param service_line_id [Commons::SERVICE_LINE_ID]
281
+ # @param rate_id [Commons::RATE_ID]
282
+ # @param request_options [RequestOptions]
283
+ # @return [FeeSchedules::V3::MatchTestResult]
284
+ def test_match(service_line_id:, rate_id:, request_options: nil)
285
+ Async do
286
+ response = @request_client.conn.get("/api/fee-schedules/v3/service-line/#{service_line_id}/match/#{rate_id}") do |req|
287
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
288
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
289
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
290
+ end
291
+ FeeSchedules::V3::MatchTestResult.from_json(json_object: response.body)
292
+ end
293
+ end
294
+
295
+ # Gets a list of dimensions with their rates. The rates returned will always be the most recent versions of those rates.
296
+ #
297
+ # @param page_token [Commons::PAGE_TOKEN]
298
+ # @param limit [Integer] Max number of dimensions returned. Defaults to 100. Max is 100.
299
+ # @param active_date [Date]
300
+ # @param payer_uuid [Payers::V3::PAYER_UUID]
301
+ # @param organization_billing_provider_id [OrganizationProviders::V2::ORGANIZATION_PROVIDER_ID]
302
+ # @param states [Commons::State]
303
+ # @param zip_codes [String]
304
+ # @param license_types [OrganizationProviders::V2::LicenseType]
305
+ # @param facility_type_codes [Commons::FacilityTypeCode]
306
+ # @param network_types [Commons::NetworkType]
307
+ # @param cpt_code [String]
308
+ # @param modifiers [Commons::ProcedureModifier]
309
+ # @param request_options [RequestOptions]
310
+ # @return [FeeSchedules::V3::RatesPage]
311
+ def get_multi(page_token: nil, limit: nil, active_date: nil, payer_uuid: nil,
312
+ organization_billing_provider_id: nil, states: nil, zip_codes: nil, license_types: nil, facility_type_codes: nil, network_types: nil, cpt_code: nil, modifiers: nil, request_options: nil)
313
+ Async do
314
+ response = @request_client.conn.get("/api/fee-schedules/v3") do |req|
315
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
316
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
317
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
318
+ req.params = {
319
+ **(request_options&.additional_query_parameters || {}),
320
+ "page_token": page_token,
321
+ "limit": limit,
322
+ "active_date": active_date,
323
+ "payer_uuid": payer_uuid,
324
+ "organization_billing_provider_id": organization_billing_provider_id,
325
+ "states": states,
326
+ "zip_codes": zip_codes,
327
+ "license_types": license_types,
328
+ "facility_type_codes": facility_type_codes,
329
+ "network_types": network_types,
330
+ "cpt_code": cpt_code,
331
+ "modifiers": modifiers
332
+ }.compact
333
+ end
334
+ FeeSchedules::V3::RatesPage.from_json(json_object: response.body)
335
+ end
336
+ end
337
+
338
+ # Gets unique values for a dimension based on other selection criteria. The response is a list of dimensions with your criteria and the unique values populated. This API is useful for driving pivots on dimension values.
339
+ #
340
+ # @param page_token [Commons::PAGE_TOKEN]
341
+ # @param limit [Integer] Max number of values returned. Defaults to 1000. Max is 1000.
342
+ # @param pivot_dimension [FeeSchedules::V3::DimensionName] The name of the dimension to fetch unique values for.
343
+ # @param payer_uuid [Payers::V3::PAYER_UUID]
344
+ # @param organization_billing_provider_id [OrganizationProviders::V2::ORGANIZATION_PROVIDER_ID]
345
+ # @param states [Commons::State]
346
+ # @param zip_codes [String]
347
+ # @param license_types [OrganizationProviders::V2::LicenseType]
348
+ # @param facility_type_codes [Commons::FacilityTypeCode]
349
+ # @param network_types [Commons::NetworkType]
350
+ # @param cpt_code [String]
351
+ # @param modifiers [Commons::ProcedureModifier]
352
+ # @param request_options [RequestOptions]
353
+ # @return [FeeSchedules::V3::DimensionsPage]
354
+ def get_unique_values_for_dimension(pivot_dimension:, page_token: nil, limit: nil, payer_uuid: nil,
355
+ organization_billing_provider_id: nil, states: nil, zip_codes: nil, license_types: nil, facility_type_codes: nil, network_types: nil, cpt_code: nil, modifiers: nil, request_options: nil)
356
+ Async do
357
+ response = @request_client.conn.get("/api/fee-schedules/v3/unique-dimension-values") do |req|
358
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
359
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
360
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
361
+ req.params = {
362
+ **(request_options&.additional_query_parameters || {}),
363
+ "page_token": page_token,
364
+ "limit": limit,
365
+ "pivot_dimension": pivot_dimension,
366
+ "payer_uuid": payer_uuid,
367
+ "organization_billing_provider_id": organization_billing_provider_id,
368
+ "states": states,
369
+ "zip_codes": zip_codes,
370
+ "license_types": license_types,
371
+ "facility_type_codes": facility_type_codes,
372
+ "network_types": network_types,
373
+ "cpt_code": cpt_code,
374
+ "modifiers": modifiers
375
+ }.compact
376
+ end
377
+ FeeSchedules::V3::DimensionsPage.from_json(json_object: response.body)
378
+ end
379
+ end
380
+
381
+ # Gets every version of a rate.
382
+ #
383
+ # @param rate_id [Commons::RATE_ID]
384
+ # @param request_options [RequestOptions]
385
+ # @return [Array<FeeSchedules::V3::Rate>]
386
+ def get_rate_history(rate_id:, request_options: nil)
387
+ Async do
388
+ response = @request_client.conn.get("/api/fee-schedules/v3/#{rate_id}/history") do |req|
389
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
390
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
391
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
392
+ end
393
+ response.body&.map do |v|
394
+ v = v.to_json
395
+ FeeSchedules::V3::Rate.from_json(json_object: v)
396
+ end
397
+ end
398
+ end
399
+
400
+ # Uploads a new fee schedule.\n Each rate may either be totally new as qualified by it's dimensions or a new version for an existing rate.\n If adding a new version to an existing rate, the rate must be posted with the next version number (previous version + 1) or a EntityConflictError will be returned.\n Use the dry run flag to discover already existing rates and to run validations. If validations for any rate fail, no rates will be saved to the system.
401
+ #
402
+ # @param dry_run [Boolean]
403
+ # @param rates [Array<Hash>] Request of type Array<FeeSchedules::V3::RateUpload>, as a Hash
404
+ # @param request_options [RequestOptions]
405
+ # @return [Array<FeeSchedules::V3::Rate>]
406
+ def upload_fee_schedule(dry_run:, rates:, request_options: nil)
407
+ Async do
408
+ response = @request_client.conn.post("/api/fee-schedules/v3") do |req|
409
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
410
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
411
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
412
+ req.body = {
413
+ **(request_options&.additional_body_parameters || {}),
414
+ dry_run: dry_run,
415
+ rates: rates
416
+ }.compact
417
+ end
418
+ response.body&.map do |v|
419
+ v = v.to_json
420
+ FeeSchedules::V3::Rate.from_json(json_object: v)
421
+ end
422
+ end
423
+ end
424
+
425
+ # Soft deletes a rate from the system. Only the most recent version of a rate can be deleted.
426
+ #
427
+ # @param rate_id [Commons::RATE_ID]
428
+ # @param version [Integer]
429
+ # @param request_options [RequestOptions]
430
+ # @return [Void]
431
+ def delete_rate(rate_id:, version:, request_options: nil)
432
+ Async do
433
+ @request_client.conn.delete("/api/fee-schedules/v3/#{rate_id}/#{version}") do |req|
434
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
435
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
436
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
437
+ end
438
+ end
439
+ end
440
+
441
+ # Gets the default payer threshold
442
+ #
443
+ # @param request_options [RequestOptions]
444
+ # @return [FeeSchedules::V3::PayerThreshold]
445
+ def get_payer_thresholds_default(request_options: nil)
446
+ Async do
447
+ response = @request_client.conn.get("/api/fee-schedules/v3/payer-threshold/default") do |req|
448
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
449
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
450
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
451
+ end
452
+ FeeSchedules::V3::PayerThreshold.from_json(json_object: response.body)
453
+ end
454
+ end
455
+
456
+ # Gets a list of payers and thresholds by their uuids
457
+ #
458
+ # @param payer_uuids [Payers::V3::PAYER_UUID]
459
+ # @param request_options [RequestOptions]
460
+ # @return [FeeSchedules::V3::PayerThresholdsPage]
461
+ def get_payer_thresholds(payer_uuids:, request_options: nil)
462
+ Async do
463
+ response = @request_client.conn.get("/api/fee-schedules/v3/payer-threshold") do |req|
464
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
465
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
466
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
467
+ req.params = {
468
+ **(request_options&.additional_query_parameters || {}),
469
+ "payer_uuids": payer_uuids
470
+ }.compact
471
+ end
472
+ FeeSchedules::V3::PayerThresholdsPage.from_json(json_object: response.body)
473
+ end
474
+ end
475
+
476
+ # Sets the threshold information for a payer
477
+ #
478
+ # @param payer_uuid [Payers::V3::PAYER_UUID]
479
+ # @param request [Hash] Request of type FeeSchedules::V3::PayerThreshold, as a Hash
480
+ # * :upper_threshold_cents (Integer)
481
+ # * :lower_threshold_cents (Integer)
482
+ # * :disable_paid_incorrectly (Boolean)
483
+ # @param request_options [RequestOptions]
484
+ # @return [FeeSchedules::V3::PayerThreshold]
485
+ def set_payer_threshold(payer_uuid:, request:, request_options: nil)
486
+ Async do
487
+ response = @request_client.conn.put("/api/fee-schedules/v3/payer-threshold/#{payer_uuid}") do |req|
488
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
489
+ req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
490
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
491
+ req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
492
+ end
493
+ FeeSchedules::V3::PayerThreshold.from_json(json_object: response.body)
494
+ end
495
+ end
496
+ end
497
+ end
498
+ end
499
+ end
@@ -0,0 +1,157 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "match_payer"
4
+ require_relative "match_geo"
5
+ require_relative "match_provider"
6
+ require_relative "match_date"
7
+ require_relative "match_cpt_code"
8
+ require_relative "match_modifiers"
9
+ require_relative "match_license_type"
10
+ require_relative "match_facility_type_code"
11
+ require_relative "match_network_types"
12
+ require "json"
13
+
14
+ module CandidApiClient
15
+ module FeeSchedules
16
+ module V3
17
+ # Dimension matching for a service line
18
+ class DimensionMatch
19
+ attr_reader :payer, :geography, :organization_billing_provider, :date_of_service, :cpt_code, :modifiers,
20
+ :license_type, :facility_type_code, :network_types, :additional_properties
21
+
22
+ # @param payer [FeeSchedules::V3::MatchPayer]
23
+ # @param geography [FeeSchedules::V3::MatchGeo]
24
+ # @param organization_billing_provider [FeeSchedules::V3::MatchProvider]
25
+ # @param date_of_service [FeeSchedules::V3::MatchDate]
26
+ # @param cpt_code [FeeSchedules::V3::MatchCptCode]
27
+ # @param modifiers [FeeSchedules::V3::MatchModifiers]
28
+ # @param license_type [FeeSchedules::V3::MatchLicenseType]
29
+ # @param facility_type_code [FeeSchedules::V3::MatchFacilityTypeCode]
30
+ # @param network_types [FeeSchedules::V3::MatchNetworkTypes]
31
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
32
+ # @return [FeeSchedules::V3::DimensionMatch]
33
+ def initialize(payer:, geography:, organization_billing_provider:, date_of_service:, cpt_code:, modifiers:,
34
+ license_type:, facility_type_code:, network_types:, additional_properties: nil)
35
+ # @type [FeeSchedules::V3::MatchPayer]
36
+ @payer = payer
37
+ # @type [FeeSchedules::V3::MatchGeo]
38
+ @geography = geography
39
+ # @type [FeeSchedules::V3::MatchProvider]
40
+ @organization_billing_provider = organization_billing_provider
41
+ # @type [FeeSchedules::V3::MatchDate]
42
+ @date_of_service = date_of_service
43
+ # @type [FeeSchedules::V3::MatchCptCode]
44
+ @cpt_code = cpt_code
45
+ # @type [FeeSchedules::V3::MatchModifiers]
46
+ @modifiers = modifiers
47
+ # @type [FeeSchedules::V3::MatchLicenseType]
48
+ @license_type = license_type
49
+ # @type [FeeSchedules::V3::MatchFacilityTypeCode]
50
+ @facility_type_code = facility_type_code
51
+ # @type [FeeSchedules::V3::MatchNetworkTypes]
52
+ @network_types = network_types
53
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
54
+ @additional_properties = additional_properties
55
+ end
56
+
57
+ # Deserialize a JSON object to an instance of DimensionMatch
58
+ #
59
+ # @param json_object [JSON]
60
+ # @return [FeeSchedules::V3::DimensionMatch]
61
+ def self.from_json(json_object:)
62
+ struct = JSON.parse(json_object, object_class: OpenStruct)
63
+ parsed_json = JSON.parse(json_object)
64
+ if parsed_json["payer"].nil?
65
+ payer = nil
66
+ else
67
+ payer = parsed_json["payer"].to_json
68
+ payer = FeeSchedules::V3::MatchPayer.from_json(json_object: payer)
69
+ end
70
+ if parsed_json["geography"].nil?
71
+ geography = nil
72
+ else
73
+ geography = parsed_json["geography"].to_json
74
+ geography = FeeSchedules::V3::MatchGeo.from_json(json_object: geography)
75
+ end
76
+ if parsed_json["organization_billing_provider"].nil?
77
+ organization_billing_provider = nil
78
+ else
79
+ organization_billing_provider = parsed_json["organization_billing_provider"].to_json
80
+ organization_billing_provider = FeeSchedules::V3::MatchProvider.from_json(json_object: organization_billing_provider)
81
+ end
82
+ if parsed_json["date_of_service"].nil?
83
+ date_of_service = nil
84
+ else
85
+ date_of_service = parsed_json["date_of_service"].to_json
86
+ date_of_service = FeeSchedules::V3::MatchDate.from_json(json_object: date_of_service)
87
+ end
88
+ if parsed_json["cpt_code"].nil?
89
+ cpt_code = nil
90
+ else
91
+ cpt_code = parsed_json["cpt_code"].to_json
92
+ cpt_code = FeeSchedules::V3::MatchCptCode.from_json(json_object: cpt_code)
93
+ end
94
+ if parsed_json["modifiers"].nil?
95
+ modifiers = nil
96
+ else
97
+ modifiers = parsed_json["modifiers"].to_json
98
+ modifiers = FeeSchedules::V3::MatchModifiers.from_json(json_object: modifiers)
99
+ end
100
+ if parsed_json["license_type"].nil?
101
+ license_type = nil
102
+ else
103
+ license_type = parsed_json["license_type"].to_json
104
+ license_type = FeeSchedules::V3::MatchLicenseType.from_json(json_object: license_type)
105
+ end
106
+ if parsed_json["facility_type_code"].nil?
107
+ facility_type_code = nil
108
+ else
109
+ facility_type_code = parsed_json["facility_type_code"].to_json
110
+ facility_type_code = FeeSchedules::V3::MatchFacilityTypeCode.from_json(json_object: facility_type_code)
111
+ end
112
+ if parsed_json["network_types"].nil?
113
+ network_types = nil
114
+ else
115
+ network_types = parsed_json["network_types"].to_json
116
+ network_types = FeeSchedules::V3::MatchNetworkTypes.from_json(json_object: network_types)
117
+ end
118
+ new(payer: payer, geography: geography, organization_billing_provider: organization_billing_provider,
119
+ date_of_service: date_of_service, cpt_code: cpt_code, modifiers: modifiers, license_type: license_type, facility_type_code: facility_type_code, network_types: network_types, additional_properties: struct)
120
+ end
121
+
122
+ # Serialize an instance of DimensionMatch to a JSON object
123
+ #
124
+ # @return [JSON]
125
+ def to_json(*_args)
126
+ {
127
+ "payer": @payer,
128
+ "geography": @geography,
129
+ "organization_billing_provider": @organization_billing_provider,
130
+ "date_of_service": @date_of_service,
131
+ "cpt_code": @cpt_code,
132
+ "modifiers": @modifiers,
133
+ "license_type": @license_type,
134
+ "facility_type_code": @facility_type_code,
135
+ "network_types": @network_types
136
+ }.to_json
137
+ end
138
+
139
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
140
+ #
141
+ # @param obj [Object]
142
+ # @return [Void]
143
+ def self.validate_raw(obj:)
144
+ FeeSchedules::V3::MatchPayer.validate_raw(obj: obj.payer)
145
+ FeeSchedules::V3::MatchGeo.validate_raw(obj: obj.geography)
146
+ FeeSchedules::V3::MatchProvider.validate_raw(obj: obj.organization_billing_provider)
147
+ FeeSchedules::V3::MatchDate.validate_raw(obj: obj.date_of_service)
148
+ FeeSchedules::V3::MatchCptCode.validate_raw(obj: obj.cpt_code)
149
+ FeeSchedules::V3::MatchModifiers.validate_raw(obj: obj.modifiers)
150
+ FeeSchedules::V3::MatchLicenseType.validate_raw(obj: obj.license_type)
151
+ FeeSchedules::V3::MatchFacilityTypeCode.validate_raw(obj: obj.facility_type_code)
152
+ FeeSchedules::V3::MatchNetworkTypes.validate_raw(obj: obj.network_types)
153
+ end
154
+ end
155
+ end
156
+ end
157
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CandidApiClient
4
+ module FeeSchedules
5
+ module V3
6
+ # The name of a dimension.
7
+ class DimensionName
8
+ PAYER_UUID = "payer_uuid"
9
+ ORGANIZATION_BILLING_PROVIDER_ID = "organization_billing_provider_id"
10
+ CPT_CODE = "cpt_code"
11
+ end
12
+ end
13
+ end
14
+ end