candidhealth 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/lib/candidhealth/auth/default/client.rb +34 -6
  3. data/lib/candidhealth/charge_capture/v_1/client.rb +48 -48
  4. data/lib/candidhealth/charge_capture/v_1/types/charge_capture_data.rb +70 -56
  5. data/lib/candidhealth/commons/types/clearinghouse.rb +18 -0
  6. data/lib/candidhealth/commons/types/procedure_modifier.rb +11 -0
  7. data/lib/candidhealth/encounter_providers/v_2/types/billing_provider.rb +1 -1
  8. data/lib/candidhealth/encounter_providers/v_2/types/billing_provider_update.rb +1 -1
  9. data/lib/candidhealth/encounter_providers/v_2/types/billing_provider_update_with_optional_address.rb +1 -1
  10. data/lib/candidhealth/encounters/v_4/client.rb +3253 -2040
  11. data/lib/candidhealth/encounters/v_4/types/encounter.rb +111 -86
  12. data/lib/candidhealth/encounters/v_4/types/encounter_base.rb +39 -33
  13. data/lib/candidhealth/encounters/v_4/types/encounter_create.rb +796 -0
  14. data/lib/candidhealth/encounters/v_4/types/encounter_create_from_pre_encounter.rb +131 -117
  15. data/lib/candidhealth/encounters/v_4/types/encounter_deep_optional.rb +70 -56
  16. data/lib/candidhealth/encounters/v_4/types/encounter_optional.rb +29 -39
  17. data/lib/candidhealth/encounters/v_4/types/encounter_rendering_or_attending_provider_required_error.rb +55 -0
  18. data/lib/candidhealth/encounters/v_4/types/encounter_update.rb +736 -0
  19. data/lib/candidhealth/encounters_universal/types/universal_encounter_create.rb +944 -0
  20. data/lib/candidhealth/encounters_universal/types/universal_encounter_create_base.rb +691 -0
  21. data/lib/candidhealth/encounters_universal/types/universal_encounter_create_from_pre_encounter.rb +791 -0
  22. data/lib/candidhealth/encounters_universal/types/universal_encounter_create_from_pre_encounter_base.rb +572 -0
  23. data/lib/candidhealth/encounters_universal/types/universal_encounter_update.rb +872 -0
  24. data/lib/candidhealth/encounters_universal/types/universal_encounter_update_base.rb +700 -0
  25. data/lib/candidhealth/fee_schedules/v_3/client.rb +57 -0
  26. data/lib/candidhealth/fee_schedules/v_3/types/validation_error.rb +12 -0
  27. data/lib/candidhealth/financials/types/patient_transaction_source.rb +1 -0
  28. data/lib/candidhealth/health_care_code_information/v_1/types/admitting_diagnosis_new.rb +206 -0
  29. data/lib/candidhealth/health_care_code_information/v_1/types/condition_information_new.rb +207 -0
  30. data/lib/candidhealth/health_care_code_information/v_1/types/diagnosis_related_group_new.rb +206 -0
  31. data/lib/candidhealth/health_care_code_information/v_1/types/external_cause_of_injury_new.rb +245 -0
  32. data/lib/candidhealth/health_care_code_information/v_1/types/health_care_code_information_create.rb +225 -0
  33. data/lib/candidhealth/health_care_code_information/v_1/types/occurrence_information_new.rb +219 -0
  34. data/lib/candidhealth/health_care_code_information/v_1/types/occurrence_span_information_new.rb +222 -0
  35. data/lib/candidhealth/health_care_code_information/v_1/types/other_diagnosis_information_new.rb +215 -0
  36. data/lib/candidhealth/health_care_code_information/v_1/types/other_procedure_information_new.rb +218 -0
  37. data/lib/candidhealth/health_care_code_information/v_1/types/patient_reason_for_visit_new.rb +206 -0
  38. data/lib/candidhealth/health_care_code_information/v_1/types/principal_diagnosis_new.rb +215 -0
  39. data/lib/candidhealth/health_care_code_information/v_1/types/principal_procedure_information_new.rb +216 -0
  40. data/lib/candidhealth/health_care_code_information/v_1/types/treatment_code_information_new.rb +206 -0
  41. data/lib/candidhealth/health_care_code_information/v_1/types/value_information_new.rb +215 -0
  42. data/lib/candidhealth/individual/types/patient.rb +6 -6
  43. data/lib/candidhealth/individual/types/patient_base.rb +6 -6
  44. data/lib/candidhealth/individual/types/patient_create.rb +6 -6
  45. data/lib/candidhealth/individual/types/patient_update.rb +6 -6
  46. data/lib/candidhealth/individual/types/patient_update_with_optional_address.rb +6 -6
  47. data/lib/candidhealth/organization_providers/v_2/types/license_type.rb +2 -0
  48. data/lib/candidhealth/payers/client.rb +7 -0
  49. data/lib/candidhealth/payers/v_4/client.rb +137 -0
  50. data/lib/candidhealth/payers/v_4/types/clearinghouse_payer_info.rb +93 -0
  51. data/lib/candidhealth/payers/v_4/types/payer.rb +116 -0
  52. data/lib/candidhealth/payers/v_4/types/payer_ids.rb +107 -0
  53. data/lib/candidhealth/payers/v_4/types/payer_page.rb +88 -0
  54. data/lib/candidhealth/payers/v_4/types/support_state.rb +15 -0
  55. data/lib/candidhealth/pre_encounter/coverages/v_1/client.rb +4 -4
  56. data/lib/candidhealth/pre_encounter/coverages/v_1/types/subscriber.rb +3 -3
  57. data/lib/candidhealth/pre_encounter/patients/v_1/client.rb +72 -6
  58. data/lib/candidhealth/pre_encounter/patients/v_1/types/guarantor.rb +3 -3
  59. data/lib/candidhealth/pre_encounter/patients/v_1/types/inferred_patient_metadata.rb +80 -0
  60. data/lib/candidhealth/pre_encounter/patients/v_1/types/mutable_patient.rb +19 -5
  61. data/lib/candidhealth/pre_encounter/patients/v_1/types/mutable_patient_with_mrn.rb +19 -5
  62. data/lib/candidhealth/pre_encounter/patients/v_1/types/patient.rb +18 -4
  63. data/lib/candidhealth/pre_encounter/patients/v_1/types/referral_type.rb +1 -0
  64. data/lib/candidhealth/service_lines/v_2/client.rb +252 -10
  65. data/lib/candidhealth/service_lines/v_2/types/service_line.rb +28 -10
  66. data/lib/candidhealth/service_lines/v_2/types/service_line_create.rb +52 -40
  67. data/lib/candidhealth/service_lines/v_2/types/service_line_create_base.rb +251 -0
  68. data/lib/candidhealth/service_lines/v_2/types/service_line_create_base_base.rb +243 -0
  69. data/lib/candidhealth/service_lines/v_2/types/service_line_create_optional.rb +48 -24
  70. data/lib/candidhealth/service_lines/v_2/types/service_line_create_standalone.rb +58 -46
  71. data/lib/candidhealth/service_lines/v_2/types/service_line_create_standalone_base.rb +273 -0
  72. data/lib/candidhealth/service_lines/v_2/types/service_line_create_standalone_base_base.rb +265 -0
  73. data/lib/candidhealth/service_lines/v_2/types/service_line_update.rb +64 -54
  74. data/lib/candidhealth/service_lines/v_2/types/service_line_update_base.rb +263 -0
  75. data/lib/candidhealth/service_lines/v_2/types/universal_service_line_create.rb +271 -0
  76. data/lib/candidhealth/service_lines/v_2/types/universal_service_line_create_standalone.rb +317 -0
  77. data/lib/candidhealth/service_lines/v_2/types/universal_service_line_update.rb +307 -0
  78. data/lib/candidhealth/x_12/v_1/types/type_of_bill_composite.rb +2 -2
  79. data/lib/candidhealth/x_12/v_1/types/type_of_bill_composite_base.rb +90 -0
  80. data/lib/candidhealth/x_12/v_1/types/type_of_bill_composite_update.rb +112 -0
  81. data/lib/requests.rb +2 -2
  82. data/lib/types_export.rb +44 -4
  83. metadata +43 -2
@@ -15,17 +15,6 @@ module CandidApiClient
15
15
  module V2
16
16
  module Types
17
17
  class ServiceLineUpdate
18
- # @return [String]
19
- attr_reader :edit_reason
20
- # @return [Array<CandidApiClient::Commons::Types::ProcedureModifier>]
21
- attr_reader :modifiers
22
- # @return [Integer] The total amount charged for this service line, factoring in quantity. If
23
- # `procedure_code` is updated and this is not, the system will attempt
24
- # to set it based on chargemasters entries and the service line's quantity. For
25
- # example, if a single unit has an entry of 100 cents and 2
26
- # units were rendered, the `charge_amount_cents` will be set to 200, if this field
27
- # is unfilled.
28
- attr_reader :charge_amount_cents
29
18
  # @return [String]
30
19
  attr_reader :diagnosis_id_zero
31
20
  # @return [String]
@@ -34,13 +23,25 @@ module CandidApiClient
34
23
  attr_reader :diagnosis_id_two
35
24
  # @return [String]
36
25
  attr_reader :diagnosis_id_three
26
+ # @return [String]
27
+ attr_reader :edit_reason
28
+ # @return [Array<CandidApiClient::Commons::Types::ProcedureModifier>]
29
+ attr_reader :modifiers
30
+ # @return [Integer] The total amount charged for this service line, factoring in quantity. If
31
+ # procedure_code is updated and this is not, the system will attempt to set it
32
+ # based on chargemasters entries and the service line’s quantity. For example, if
33
+ # a single unit has an entry of 100 cents and 2 units were rendered, the
34
+ # charge_amount_cents will be set to 200, if there is no chargemaster entry, it
35
+ # will default to the amount set in this field.
36
+ attr_reader :charge_amount_cents
37
37
  # @return [CandidApiClient::ServiceLines::V2::Types::DrugIdentification]
38
38
  attr_reader :drug_identification
39
39
  # @return [CandidApiClient::ServiceLines::V2::Types::ServiceLineDenialReason]
40
40
  attr_reader :denial_reason
41
- # @return [CandidApiClient::Commons::Types::FacilityTypeCode] 837p Loop2300, SV105. If your organization does not intend to submit claims with
42
- # a different place of service at the service line level, this field should not be
43
- # populated. 02 for telemedicine, 11 for in-person. Full list
41
+ # @return [CandidApiClient::Commons::Types::FacilityTypeCode] 837p Loop2300, SV105. This enum is not used or required in 837i claims. If your
42
+ # organization does not intend to submit claims with a different place of service
43
+ # at the service line level, this field should not be populated. 02 for
44
+ # telemedicine, 11 for in-person. Full list
44
45
  # //www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
45
46
  attr_reader :place_of_service_code
46
47
  # @return [CandidApiClient::Commons::Types::ServiceLineUnits]
@@ -49,11 +50,14 @@ module CandidApiClient
49
50
  # `charge_amount_cents` will be set by the system.
50
51
  attr_reader :procedure_code
51
52
  # @return [String] String representation of a Decimal that can be parsed by most libraries.
52
- # A ServiceLine quantity cannot contain more than one digit of precision.
53
- # Example: 1.1 is valid, 1.11 is not.
53
+ # For professional claims, a ServiceLine quantity cannot contain more than one
54
+ # digit of precision
55
+ # (Example: 1.1 is valid, 1.11 is not). For institutional claims, a ServiceLine
56
+ # quantity cannot contain
57
+ # more than three decimal digits of precision.
54
58
  attr_reader :quantity
55
59
  # @return [String] A free-form description to clarify the related data elements and their content.
56
- # Maps to SV1-01, C003-07 on the 837-P.
60
+ # Maps to SV1-01, C003-07 on a 837-P and SV2-02, C003-07 on a 837-I form.
57
61
  attr_reader :description
58
62
  # @return [Date] date_of_service must be defined on either the encounter or the service lines but
59
63
  # not both.
@@ -62,13 +66,14 @@ module CandidApiClient
62
66
  attr_reader :end_date_of_service
63
67
  # @return [Array<CandidApiClient::ServiceLines::V2::Types::TestResult>] Contains a list of test results. Test result types may map to MEA-02 on the
64
68
  # 837-P (ex: Hemoglobin, Hematocrit).
69
+ # This is unused by 837-i and ignored for institutional service lines.
65
70
  # No more than 5 MEA-02 test results may be submitted per service line.
66
71
  # Updating test results utilizes PUT semantics, so the test results on the service
67
72
  # line will be set to whatever inputs are provided.
68
73
  attr_reader :test_results
69
- # @return [Boolean] Maps to SV1-11 on the 837-P and Box 24H on the CMS-1500.
70
- # If the value is true, the box will be populated with "Y". Otherwise, the box
71
- # will not be populated.
74
+ # @return [Boolean] Maps to SV1-12 on the 837-P and Box 24I on the CMS-1500. If the value is true,
75
+ # the box will be populated with Y”. Otherwise, the box will not be populated.
76
+ # This box is not used on an 837i.
72
77
  attr_reader :has_epsdt_indicator
73
78
  # @return [Boolean] Maps to SV1-12 on the 837-P and Box 24I on the CMS-1500.
74
79
  # If the value is true, the box will be populated with "Y". Otherwise, the box
@@ -84,58 +89,63 @@ module CandidApiClient
84
89
 
85
90
  OMIT = Object.new
86
91
 
87
- # @param edit_reason [String]
88
- # @param modifiers [Array<CandidApiClient::Commons::Types::ProcedureModifier>]
89
- # @param charge_amount_cents [Integer] The total amount charged for this service line, factoring in quantity. If
90
- # `procedure_code` is updated and this is not, the system will attempt
91
- # to set it based on chargemasters entries and the service line's quantity. For
92
- # example, if a single unit has an entry of 100 cents and 2
93
- # units were rendered, the `charge_amount_cents` will be set to 200, if this field
94
- # is unfilled.
95
92
  # @param diagnosis_id_zero [String]
96
93
  # @param diagnosis_id_one [String]
97
94
  # @param diagnosis_id_two [String]
98
95
  # @param diagnosis_id_three [String]
96
+ # @param edit_reason [String]
97
+ # @param modifiers [Array<CandidApiClient::Commons::Types::ProcedureModifier>]
98
+ # @param charge_amount_cents [Integer] The total amount charged for this service line, factoring in quantity. If
99
+ # procedure_code is updated and this is not, the system will attempt to set it
100
+ # based on chargemasters entries and the service line’s quantity. For example, if
101
+ # a single unit has an entry of 100 cents and 2 units were rendered, the
102
+ # charge_amount_cents will be set to 200, if there is no chargemaster entry, it
103
+ # will default to the amount set in this field.
99
104
  # @param drug_identification [CandidApiClient::ServiceLines::V2::Types::DrugIdentification]
100
105
  # @param denial_reason [CandidApiClient::ServiceLines::V2::Types::ServiceLineDenialReason]
101
- # @param place_of_service_code [CandidApiClient::Commons::Types::FacilityTypeCode] 837p Loop2300, SV105. If your organization does not intend to submit claims with
102
- # a different place of service at the service line level, this field should not be
103
- # populated. 02 for telemedicine, 11 for in-person. Full list
106
+ # @param place_of_service_code [CandidApiClient::Commons::Types::FacilityTypeCode] 837p Loop2300, SV105. This enum is not used or required in 837i claims. If your
107
+ # organization does not intend to submit claims with a different place of service
108
+ # at the service line level, this field should not be populated. 02 for
109
+ # telemedicine, 11 for in-person. Full list
104
110
  # //www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
105
111
  # @param units [CandidApiClient::Commons::Types::ServiceLineUnits]
106
112
  # @param procedure_code [String] If `procedure_code` is updated, and `charge_amount_cents` is not, then
107
113
  # `charge_amount_cents` will be set by the system.
108
114
  # @param quantity [String] String representation of a Decimal that can be parsed by most libraries.
109
- # A ServiceLine quantity cannot contain more than one digit of precision.
110
- # Example: 1.1 is valid, 1.11 is not.
115
+ # For professional claims, a ServiceLine quantity cannot contain more than one
116
+ # digit of precision
117
+ # (Example: 1.1 is valid, 1.11 is not). For institutional claims, a ServiceLine
118
+ # quantity cannot contain
119
+ # more than three decimal digits of precision.
111
120
  # @param description [String] A free-form description to clarify the related data elements and their content.
112
- # Maps to SV1-01, C003-07 on the 837-P.
121
+ # Maps to SV1-01, C003-07 on a 837-P and SV2-02, C003-07 on a 837-I form.
113
122
  # @param date_of_service [Date] date_of_service must be defined on either the encounter or the service lines but
114
123
  # not both.
115
124
  # @param end_date_of_service [Date]
116
125
  # @param test_results [Array<CandidApiClient::ServiceLines::V2::Types::TestResult>] Contains a list of test results. Test result types may map to MEA-02 on the
117
126
  # 837-P (ex: Hemoglobin, Hematocrit).
127
+ # This is unused by 837-i and ignored for institutional service lines.
118
128
  # No more than 5 MEA-02 test results may be submitted per service line.
119
129
  # Updating test results utilizes PUT semantics, so the test results on the service
120
130
  # line will be set to whatever inputs are provided.
121
- # @param has_epsdt_indicator [Boolean] Maps to SV1-11 on the 837-P and Box 24H on the CMS-1500.
122
- # If the value is true, the box will be populated with "Y". Otherwise, the box
123
- # will not be populated.
131
+ # @param has_epsdt_indicator [Boolean] Maps to SV1-12 on the 837-P and Box 24I on the CMS-1500. If the value is true,
132
+ # the box will be populated with Y”. Otherwise, the box will not be populated.
133
+ # This box is not used on an 837i.
124
134
  # @param has_family_planning_indicator [Boolean] Maps to SV1-12 on the 837-P and Box 24I on the CMS-1500.
125
135
  # If the value is true, the box will be populated with "Y". Otherwise, the box
126
136
  # will not be populated.
127
137
  # @param note [String] Maps to NTE02 loop 2400 on the EDI 837.
128
138
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
129
139
  # @return [CandidApiClient::ServiceLines::V2::Types::ServiceLineUpdate]
130
- def initialize(edit_reason: OMIT, modifiers: OMIT, charge_amount_cents: OMIT, diagnosis_id_zero: OMIT,
131
- diagnosis_id_one: OMIT, diagnosis_id_two: OMIT, diagnosis_id_three: OMIT, drug_identification: OMIT, denial_reason: OMIT, place_of_service_code: OMIT, units: OMIT, procedure_code: OMIT, quantity: OMIT, description: OMIT, date_of_service: OMIT, end_date_of_service: OMIT, test_results: OMIT, has_epsdt_indicator: OMIT, has_family_planning_indicator: OMIT, note: OMIT, additional_properties: nil)
132
- @edit_reason = edit_reason if edit_reason != OMIT
133
- @modifiers = modifiers if modifiers != OMIT
134
- @charge_amount_cents = charge_amount_cents if charge_amount_cents != OMIT
140
+ def initialize(diagnosis_id_zero: OMIT, diagnosis_id_one: OMIT, diagnosis_id_two: OMIT,
141
+ diagnosis_id_three: OMIT, edit_reason: OMIT, modifiers: OMIT, charge_amount_cents: OMIT, drug_identification: OMIT, denial_reason: OMIT, place_of_service_code: OMIT, units: OMIT, procedure_code: OMIT, quantity: OMIT, description: OMIT, date_of_service: OMIT, end_date_of_service: OMIT, test_results: OMIT, has_epsdt_indicator: OMIT, has_family_planning_indicator: OMIT, note: OMIT, additional_properties: nil)
135
142
  @diagnosis_id_zero = diagnosis_id_zero if diagnosis_id_zero != OMIT
136
143
  @diagnosis_id_one = diagnosis_id_one if diagnosis_id_one != OMIT
137
144
  @diagnosis_id_two = diagnosis_id_two if diagnosis_id_two != OMIT
138
145
  @diagnosis_id_three = diagnosis_id_three if diagnosis_id_three != OMIT
146
+ @edit_reason = edit_reason if edit_reason != OMIT
147
+ @modifiers = modifiers if modifiers != OMIT
148
+ @charge_amount_cents = charge_amount_cents if charge_amount_cents != OMIT
139
149
  @drug_identification = drug_identification if drug_identification != OMIT
140
150
  @denial_reason = denial_reason if denial_reason != OMIT
141
151
  @place_of_service_code = place_of_service_code if place_of_service_code != OMIT
@@ -151,13 +161,13 @@ module CandidApiClient
151
161
  @note = note if note != OMIT
152
162
  @additional_properties = additional_properties
153
163
  @_field_set = {
154
- "edit_reason": edit_reason,
155
- "modifiers": modifiers,
156
- "charge_amount_cents": charge_amount_cents,
157
164
  "diagnosis_id_zero": diagnosis_id_zero,
158
165
  "diagnosis_id_one": diagnosis_id_one,
159
166
  "diagnosis_id_two": diagnosis_id_two,
160
167
  "diagnosis_id_three": diagnosis_id_three,
168
+ "edit_reason": edit_reason,
169
+ "modifiers": modifiers,
170
+ "charge_amount_cents": charge_amount_cents,
161
171
  "drug_identification": drug_identification,
162
172
  "denial_reason": denial_reason,
163
173
  "place_of_service_code": place_of_service_code,
@@ -183,13 +193,13 @@ module CandidApiClient
183
193
  def self.from_json(json_object:)
184
194
  struct = JSON.parse(json_object, object_class: OpenStruct)
185
195
  parsed_json = JSON.parse(json_object)
186
- edit_reason = struct["edit_reason"]
187
- modifiers = struct["modifiers"]
188
- charge_amount_cents = struct["charge_amount_cents"]
189
196
  diagnosis_id_zero = struct["diagnosis_id_zero"]
190
197
  diagnosis_id_one = struct["diagnosis_id_one"]
191
198
  diagnosis_id_two = struct["diagnosis_id_two"]
192
199
  diagnosis_id_three = struct["diagnosis_id_three"]
200
+ edit_reason = struct["edit_reason"]
201
+ modifiers = struct["modifiers"]
202
+ charge_amount_cents = struct["charge_amount_cents"]
193
203
  if parsed_json["drug_identification"].nil?
194
204
  drug_identification = nil
195
205
  else
@@ -219,13 +229,13 @@ module CandidApiClient
219
229
  has_family_planning_indicator = struct["has_family_planning_indicator"]
220
230
  note = struct["note"]
221
231
  new(
222
- edit_reason: edit_reason,
223
- modifiers: modifiers,
224
- charge_amount_cents: charge_amount_cents,
225
232
  diagnosis_id_zero: diagnosis_id_zero,
226
233
  diagnosis_id_one: diagnosis_id_one,
227
234
  diagnosis_id_two: diagnosis_id_two,
228
235
  diagnosis_id_three: diagnosis_id_three,
236
+ edit_reason: edit_reason,
237
+ modifiers: modifiers,
238
+ charge_amount_cents: charge_amount_cents,
229
239
  drug_identification: drug_identification,
230
240
  denial_reason: denial_reason,
231
241
  place_of_service_code: place_of_service_code,
@@ -257,13 +267,13 @@ module CandidApiClient
257
267
  # @param obj [Object]
258
268
  # @return [Void]
259
269
  def self.validate_raw(obj:)
260
- obj.edit_reason&.is_a?(String) != false || raise("Passed value for field obj.edit_reason is not the expected type, validation failed.")
261
- obj.modifiers&.is_a?(Array) != false || raise("Passed value for field obj.modifiers is not the expected type, validation failed.")
262
- obj.charge_amount_cents&.is_a?(Integer) != false || raise("Passed value for field obj.charge_amount_cents is not the expected type, validation failed.")
263
270
  obj.diagnosis_id_zero&.is_a?(String) != false || raise("Passed value for field obj.diagnosis_id_zero is not the expected type, validation failed.")
264
271
  obj.diagnosis_id_one&.is_a?(String) != false || raise("Passed value for field obj.diagnosis_id_one is not the expected type, validation failed.")
265
272
  obj.diagnosis_id_two&.is_a?(String) != false || raise("Passed value for field obj.diagnosis_id_two is not the expected type, validation failed.")
266
273
  obj.diagnosis_id_three&.is_a?(String) != false || raise("Passed value for field obj.diagnosis_id_three is not the expected type, validation failed.")
274
+ obj.edit_reason&.is_a?(String) != false || raise("Passed value for field obj.edit_reason is not the expected type, validation failed.")
275
+ obj.modifiers&.is_a?(Array) != false || raise("Passed value for field obj.modifiers is not the expected type, validation failed.")
276
+ obj.charge_amount_cents&.is_a?(Integer) != false || raise("Passed value for field obj.charge_amount_cents is not the expected type, validation failed.")
267
277
  obj.drug_identification.nil? || CandidApiClient::ServiceLines::V2::Types::DrugIdentification.validate_raw(obj: obj.drug_identification)
268
278
  obj.denial_reason.nil? || CandidApiClient::ServiceLines::V2::Types::ServiceLineDenialReason.validate_raw(obj: obj.denial_reason)
269
279
  obj.place_of_service_code&.is_a?(CandidApiClient::Commons::Types::FacilityTypeCode) != false || raise("Passed value for field obj.place_of_service_code is not the expected type, validation failed.")
@@ -0,0 +1,263 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../commons/types/procedure_modifier"
4
+ require_relative "drug_identification"
5
+ require_relative "service_line_denial_reason"
6
+ require_relative "../../../commons/types/facility_type_code"
7
+ require_relative "../../../commons/types/service_line_units"
8
+ require "date"
9
+ require_relative "test_result"
10
+ require "ostruct"
11
+ require "json"
12
+
13
+ module CandidApiClient
14
+ module ServiceLines
15
+ module V2
16
+ module Types
17
+ class ServiceLineUpdateBase
18
+ # @return [String]
19
+ attr_reader :edit_reason
20
+ # @return [Array<CandidApiClient::Commons::Types::ProcedureModifier>]
21
+ attr_reader :modifiers
22
+ # @return [Integer] The total amount charged for this service line, factoring in quantity. If
23
+ # procedure_code is updated and this is not, the system will attempt to set it
24
+ # based on chargemasters entries and the service line’s quantity. For example, if
25
+ # a single unit has an entry of 100 cents and 2 units were rendered, the
26
+ # charge_amount_cents will be set to 200, if there is no chargemaster entry, it
27
+ # will default to the amount set in this field.
28
+ attr_reader :charge_amount_cents
29
+ # @return [CandidApiClient::ServiceLines::V2::Types::DrugIdentification]
30
+ attr_reader :drug_identification
31
+ # @return [CandidApiClient::ServiceLines::V2::Types::ServiceLineDenialReason]
32
+ attr_reader :denial_reason
33
+ # @return [CandidApiClient::Commons::Types::FacilityTypeCode] 837p Loop2300, SV105. This enum is not used or required in 837i claims. If your
34
+ # organization does not intend to submit claims with a different place of service
35
+ # at the service line level, this field should not be populated. 02 for
36
+ # telemedicine, 11 for in-person. Full list
37
+ # //www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
38
+ attr_reader :place_of_service_code
39
+ # @return [CandidApiClient::Commons::Types::ServiceLineUnits]
40
+ attr_reader :units
41
+ # @return [String] If `procedure_code` is updated, and `charge_amount_cents` is not, then
42
+ # `charge_amount_cents` will be set by the system.
43
+ attr_reader :procedure_code
44
+ # @return [String] String representation of a Decimal that can be parsed by most libraries.
45
+ # For professional claims, a ServiceLine quantity cannot contain more than one
46
+ # digit of precision
47
+ # (Example: 1.1 is valid, 1.11 is not). For institutional claims, a ServiceLine
48
+ # quantity cannot contain
49
+ # more than three decimal digits of precision.
50
+ attr_reader :quantity
51
+ # @return [String] A free-form description to clarify the related data elements and their content.
52
+ # Maps to SV1-01, C003-07 on a 837-P and SV2-02, C003-07 on a 837-I form.
53
+ attr_reader :description
54
+ # @return [Date] date_of_service must be defined on either the encounter or the service lines but
55
+ # not both.
56
+ attr_reader :date_of_service
57
+ # @return [Date]
58
+ attr_reader :end_date_of_service
59
+ # @return [Array<CandidApiClient::ServiceLines::V2::Types::TestResult>] Contains a list of test results. Test result types may map to MEA-02 on the
60
+ # 837-P (ex: Hemoglobin, Hematocrit).
61
+ # This is unused by 837-i and ignored for institutional service lines.
62
+ # No more than 5 MEA-02 test results may be submitted per service line.
63
+ # Updating test results utilizes PUT semantics, so the test results on the service
64
+ # line will be set to whatever inputs are provided.
65
+ attr_reader :test_results
66
+ # @return [Boolean] Maps to SV1-12 on the 837-P and Box 24I on the CMS-1500. If the value is true,
67
+ # the box will be populated with “Y”. Otherwise, the box will not be populated.
68
+ # This box is not used on an 837i.
69
+ attr_reader :has_epsdt_indicator
70
+ # @return [Boolean] Maps to SV1-12 on the 837-P and Box 24I on the CMS-1500.
71
+ # If the value is true, the box will be populated with "Y". Otherwise, the box
72
+ # will not be populated.
73
+ attr_reader :has_family_planning_indicator
74
+ # @return [String] Maps to NTE02 loop 2400 on the EDI 837.
75
+ attr_reader :note
76
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
77
+ attr_reader :additional_properties
78
+ # @return [Object]
79
+ attr_reader :_field_set
80
+ protected :_field_set
81
+
82
+ OMIT = Object.new
83
+
84
+ # @param edit_reason [String]
85
+ # @param modifiers [Array<CandidApiClient::Commons::Types::ProcedureModifier>]
86
+ # @param charge_amount_cents [Integer] The total amount charged for this service line, factoring in quantity. If
87
+ # procedure_code is updated and this is not, the system will attempt to set it
88
+ # based on chargemasters entries and the service line’s quantity. For example, if
89
+ # a single unit has an entry of 100 cents and 2 units were rendered, the
90
+ # charge_amount_cents will be set to 200, if there is no chargemaster entry, it
91
+ # will default to the amount set in this field.
92
+ # @param drug_identification [CandidApiClient::ServiceLines::V2::Types::DrugIdentification]
93
+ # @param denial_reason [CandidApiClient::ServiceLines::V2::Types::ServiceLineDenialReason]
94
+ # @param place_of_service_code [CandidApiClient::Commons::Types::FacilityTypeCode] 837p Loop2300, SV105. This enum is not used or required in 837i claims. If your
95
+ # organization does not intend to submit claims with a different place of service
96
+ # at the service line level, this field should not be populated. 02 for
97
+ # telemedicine, 11 for in-person. Full list
98
+ # //www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
99
+ # @param units [CandidApiClient::Commons::Types::ServiceLineUnits]
100
+ # @param procedure_code [String] If `procedure_code` is updated, and `charge_amount_cents` is not, then
101
+ # `charge_amount_cents` will be set by the system.
102
+ # @param quantity [String] String representation of a Decimal that can be parsed by most libraries.
103
+ # For professional claims, a ServiceLine quantity cannot contain more than one
104
+ # digit of precision
105
+ # (Example: 1.1 is valid, 1.11 is not). For institutional claims, a ServiceLine
106
+ # quantity cannot contain
107
+ # more than three decimal digits of precision.
108
+ # @param description [String] A free-form description to clarify the related data elements and their content.
109
+ # Maps to SV1-01, C003-07 on a 837-P and SV2-02, C003-07 on a 837-I form.
110
+ # @param date_of_service [Date] date_of_service must be defined on either the encounter or the service lines but
111
+ # not both.
112
+ # @param end_date_of_service [Date]
113
+ # @param test_results [Array<CandidApiClient::ServiceLines::V2::Types::TestResult>] Contains a list of test results. Test result types may map to MEA-02 on the
114
+ # 837-P (ex: Hemoglobin, Hematocrit).
115
+ # This is unused by 837-i and ignored for institutional service lines.
116
+ # No more than 5 MEA-02 test results may be submitted per service line.
117
+ # Updating test results utilizes PUT semantics, so the test results on the service
118
+ # line will be set to whatever inputs are provided.
119
+ # @param has_epsdt_indicator [Boolean] Maps to SV1-12 on the 837-P and Box 24I on the CMS-1500. If the value is true,
120
+ # the box will be populated with “Y”. Otherwise, the box will not be populated.
121
+ # This box is not used on an 837i.
122
+ # @param has_family_planning_indicator [Boolean] Maps to SV1-12 on the 837-P and Box 24I on the CMS-1500.
123
+ # If the value is true, the box will be populated with "Y". Otherwise, the box
124
+ # will not be populated.
125
+ # @param note [String] Maps to NTE02 loop 2400 on the EDI 837.
126
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
127
+ # @return [CandidApiClient::ServiceLines::V2::Types::ServiceLineUpdateBase]
128
+ def initialize(edit_reason: OMIT, modifiers: OMIT, charge_amount_cents: OMIT, drug_identification: OMIT,
129
+ denial_reason: OMIT, place_of_service_code: OMIT, units: OMIT, procedure_code: OMIT, quantity: OMIT, description: OMIT, date_of_service: OMIT, end_date_of_service: OMIT, test_results: OMIT, has_epsdt_indicator: OMIT, has_family_planning_indicator: OMIT, note: OMIT, additional_properties: nil)
130
+ @edit_reason = edit_reason if edit_reason != OMIT
131
+ @modifiers = modifiers if modifiers != OMIT
132
+ @charge_amount_cents = charge_amount_cents if charge_amount_cents != OMIT
133
+ @drug_identification = drug_identification if drug_identification != OMIT
134
+ @denial_reason = denial_reason if denial_reason != OMIT
135
+ @place_of_service_code = place_of_service_code if place_of_service_code != OMIT
136
+ @units = units if units != OMIT
137
+ @procedure_code = procedure_code if procedure_code != OMIT
138
+ @quantity = quantity if quantity != OMIT
139
+ @description = description if description != OMIT
140
+ @date_of_service = date_of_service if date_of_service != OMIT
141
+ @end_date_of_service = end_date_of_service if end_date_of_service != OMIT
142
+ @test_results = test_results if test_results != OMIT
143
+ @has_epsdt_indicator = has_epsdt_indicator if has_epsdt_indicator != OMIT
144
+ @has_family_planning_indicator = has_family_planning_indicator if has_family_planning_indicator != OMIT
145
+ @note = note if note != OMIT
146
+ @additional_properties = additional_properties
147
+ @_field_set = {
148
+ "edit_reason": edit_reason,
149
+ "modifiers": modifiers,
150
+ "charge_amount_cents": charge_amount_cents,
151
+ "drug_identification": drug_identification,
152
+ "denial_reason": denial_reason,
153
+ "place_of_service_code": place_of_service_code,
154
+ "units": units,
155
+ "procedure_code": procedure_code,
156
+ "quantity": quantity,
157
+ "description": description,
158
+ "date_of_service": date_of_service,
159
+ "end_date_of_service": end_date_of_service,
160
+ "test_results": test_results,
161
+ "has_epsdt_indicator": has_epsdt_indicator,
162
+ "has_family_planning_indicator": has_family_planning_indicator,
163
+ "note": note
164
+ }.reject do |_k, v|
165
+ v == OMIT
166
+ end
167
+ end
168
+
169
+ # Deserialize a JSON object to an instance of ServiceLineUpdateBase
170
+ #
171
+ # @param json_object [String]
172
+ # @return [CandidApiClient::ServiceLines::V2::Types::ServiceLineUpdateBase]
173
+ def self.from_json(json_object:)
174
+ struct = JSON.parse(json_object, object_class: OpenStruct)
175
+ parsed_json = JSON.parse(json_object)
176
+ edit_reason = struct["edit_reason"]
177
+ modifiers = struct["modifiers"]
178
+ charge_amount_cents = struct["charge_amount_cents"]
179
+ if parsed_json["drug_identification"].nil?
180
+ drug_identification = nil
181
+ else
182
+ drug_identification = parsed_json["drug_identification"].to_json
183
+ drug_identification = CandidApiClient::ServiceLines::V2::Types::DrugIdentification.from_json(json_object: drug_identification)
184
+ end
185
+ if parsed_json["denial_reason"].nil?
186
+ denial_reason = nil
187
+ else
188
+ denial_reason = parsed_json["denial_reason"].to_json
189
+ denial_reason = CandidApiClient::ServiceLines::V2::Types::ServiceLineDenialReason.from_json(json_object: denial_reason)
190
+ end
191
+ place_of_service_code = struct["place_of_service_code"]
192
+ units = struct["units"]
193
+ procedure_code = struct["procedure_code"]
194
+ quantity = struct["quantity"]
195
+ description = struct["description"]
196
+ date_of_service = (Date.parse(parsed_json["date_of_service"]) unless parsed_json["date_of_service"].nil?)
197
+ end_date_of_service = unless parsed_json["end_date_of_service"].nil?
198
+ Date.parse(parsed_json["end_date_of_service"])
199
+ end
200
+ test_results = parsed_json["test_results"]&.map do |item|
201
+ item = item.to_json
202
+ CandidApiClient::ServiceLines::V2::Types::TestResult.from_json(json_object: item)
203
+ end
204
+ has_epsdt_indicator = struct["has_epsdt_indicator"]
205
+ has_family_planning_indicator = struct["has_family_planning_indicator"]
206
+ note = struct["note"]
207
+ new(
208
+ edit_reason: edit_reason,
209
+ modifiers: modifiers,
210
+ charge_amount_cents: charge_amount_cents,
211
+ drug_identification: drug_identification,
212
+ denial_reason: denial_reason,
213
+ place_of_service_code: place_of_service_code,
214
+ units: units,
215
+ procedure_code: procedure_code,
216
+ quantity: quantity,
217
+ description: description,
218
+ date_of_service: date_of_service,
219
+ end_date_of_service: end_date_of_service,
220
+ test_results: test_results,
221
+ has_epsdt_indicator: has_epsdt_indicator,
222
+ has_family_planning_indicator: has_family_planning_indicator,
223
+ note: note,
224
+ additional_properties: struct
225
+ )
226
+ end
227
+
228
+ # Serialize an instance of ServiceLineUpdateBase to a JSON object
229
+ #
230
+ # @return [String]
231
+ def to_json(*_args)
232
+ @_field_set&.to_json
233
+ end
234
+
235
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
236
+ # hash and check each fields type against the current object's property
237
+ # definitions.
238
+ #
239
+ # @param obj [Object]
240
+ # @return [Void]
241
+ def self.validate_raw(obj:)
242
+ obj.edit_reason&.is_a?(String) != false || raise("Passed value for field obj.edit_reason is not the expected type, validation failed.")
243
+ obj.modifiers&.is_a?(Array) != false || raise("Passed value for field obj.modifiers is not the expected type, validation failed.")
244
+ obj.charge_amount_cents&.is_a?(Integer) != false || raise("Passed value for field obj.charge_amount_cents is not the expected type, validation failed.")
245
+ obj.drug_identification.nil? || CandidApiClient::ServiceLines::V2::Types::DrugIdentification.validate_raw(obj: obj.drug_identification)
246
+ obj.denial_reason.nil? || CandidApiClient::ServiceLines::V2::Types::ServiceLineDenialReason.validate_raw(obj: obj.denial_reason)
247
+ obj.place_of_service_code&.is_a?(CandidApiClient::Commons::Types::FacilityTypeCode) != false || raise("Passed value for field obj.place_of_service_code is not the expected type, validation failed.")
248
+ obj.units&.is_a?(CandidApiClient::Commons::Types::ServiceLineUnits) != false || raise("Passed value for field obj.units is not the expected type, validation failed.")
249
+ obj.procedure_code&.is_a?(String) != false || raise("Passed value for field obj.procedure_code is not the expected type, validation failed.")
250
+ obj.quantity&.is_a?(String) != false || raise("Passed value for field obj.quantity is not the expected type, validation failed.")
251
+ obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
252
+ obj.date_of_service&.is_a?(Date) != false || raise("Passed value for field obj.date_of_service is not the expected type, validation failed.")
253
+ obj.end_date_of_service&.is_a?(Date) != false || raise("Passed value for field obj.end_date_of_service is not the expected type, validation failed.")
254
+ obj.test_results&.is_a?(Array) != false || raise("Passed value for field obj.test_results is not the expected type, validation failed.")
255
+ obj.has_epsdt_indicator&.is_a?(Boolean) != false || raise("Passed value for field obj.has_epsdt_indicator is not the expected type, validation failed.")
256
+ obj.has_family_planning_indicator&.is_a?(Boolean) != false || raise("Passed value for field obj.has_family_planning_indicator is not the expected type, validation failed.")
257
+ obj.note&.is_a?(String) != false || raise("Passed value for field obj.note is not the expected type, validation failed.")
258
+ end
259
+ end
260
+ end
261
+ end
262
+ end
263
+ end