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,6 +15,10 @@ module CandidApiClient
15
15
  module V2
16
16
  module Types
17
17
  class ServiceLineCreate
18
+ # @return [Array<Integer>] Indices (zero-indexed) of all the diagnoses this service line references
19
+ attr_reader :diagnosis_pointers
20
+ # @return [String]
21
+ attr_reader :procedure_code
18
22
  # @return [Array<CandidApiClient::Commons::Types::ProcedureModifier>]
19
23
  attr_reader :modifiers
20
24
  # @return [Boolean] Maps to SV1-11 on the 837-P and Box 24H on the CMS-1500.
@@ -25,31 +29,32 @@ module CandidApiClient
25
29
  # If the value is true, the box will be populated with "Y". Otherwise, the box
26
30
  # will not be populated.
27
31
  attr_reader :has_family_planning_indicator
28
- # @return [String]
29
- attr_reader :procedure_code
30
32
  # @return [String] String representation of a Decimal that can be parsed by most libraries.
31
- # A ServiceLine quantity cannot contain more than one digit of precision.
32
- # Example: 1.1 is valid, 1.11 is not.
33
+ # For professional claims, a ServiceLine quantity cannot contain more than one
34
+ # digit of precision
35
+ # (Example: 1.1 is valid, 1.11 is not). For institutional claims, a ServiceLine
36
+ # quantity cannot contain
37
+ # more than three decimal digits of precision.
33
38
  attr_reader :quantity
34
39
  # @return [CandidApiClient::Commons::Types::ServiceLineUnits]
35
40
  attr_reader :units
36
- # @return [Integer] The total amount charged for this service line taking quantity into account. For
37
- # example, if a single unit
38
- # costs 100 cents and 2 units were rendered, the `charge_amount_cents` should be
39
- # 200. Should be greater than or
40
- # equal to 0.
41
+ # @return [Integer] The total amount charged for this service line, factoring in quantity. If
42
+ # procedure_code is updated and this is not, the system will attempt to set it
43
+ # based on chargemasters entries and the service line’s quantity. For example, if
44
+ # a single unit has an entry of 100 cents and 2 units were rendered, the
45
+ # charge_amount_cents will be set to 200, if there is no chargemaster entry, it
46
+ # will default to the amount set in this field.
41
47
  attr_reader :charge_amount_cents
42
- # @return [Array<Integer>] Indices (zero-indexed) of all the diagnoses this service line references
43
- attr_reader :diagnosis_pointers
44
48
  # @return [CandidApiClient::ServiceLines::V2::Types::DrugIdentification]
45
49
  attr_reader :drug_identification
46
- # @return [CandidApiClient::Commons::Types::FacilityTypeCode] 837p Loop2300, SV105. If your organization does not intend to submit claims with
47
- # a different place of service at the service line level, this field should not be
48
- # populated. 02 for telemedicine, 11 for in-person. Full list
50
+ # @return [CandidApiClient::Commons::Types::FacilityTypeCode] 837p Loop2300, SV105. This enum is not used or required for institutional
51
+ # claims. If your organization does not intend to submit claims with a different
52
+ # place of service at the service line level, this field should not be populated.
53
+ # 02 for telemedicine, 11 for in-person. Full list
49
54
  # //www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
50
55
  attr_reader :place_of_service_code
51
56
  # @return [String] A free-form description to clarify the related data elements and their content.
52
- # Maps to SV1-01, C003-07 on the 837-P.
57
+ # Maps to SV1-01, C003-07 on a 837-P and SV2-02, C003-07 on a 837-I form.
53
58
  attr_reader :description
54
59
  # @return [Date]
55
60
  attr_reader :date_of_service
@@ -61,6 +66,7 @@ module CandidApiClient
61
66
  attr_reader :ordering_provider
62
67
  # @return [Array<CandidApiClient::ServiceLines::V2::Types::TestResult>] Contains a list of test results. Test result types may map to MEA-02 on the
63
68
  # 837-P (ex: Hemoglobin, Hematocrit).
69
+ # This is unused by 837-i and ignored for institutional service lines.
64
70
  # No more than 5 MEA-02 test results may be submitted per service line.
65
71
  attr_reader :test_results
66
72
  # @return [String] Maps to NTE02 loop 2400 on the EDI 837.
@@ -73,6 +79,8 @@ module CandidApiClient
73
79
 
74
80
  OMIT = Object.new
75
81
 
82
+ # @param diagnosis_pointers [Array<Integer>] Indices (zero-indexed) of all the diagnoses this service line references
83
+ # @param procedure_code [String]
76
84
  # @param modifiers [Array<CandidApiClient::Commons::Types::ProcedureModifier>]
77
85
  # @param has_epsdt_indicator [Boolean] Maps to SV1-11 on the 837-P and Box 24H on the CMS-1500.
78
86
  # If the value is true, the box will be populated with "Y". Otherwise, the box
@@ -80,24 +88,27 @@ module CandidApiClient
80
88
  # @param has_family_planning_indicator [Boolean] Maps to SV1-12 on the 837-P and Box 24I on the CMS-1500.
81
89
  # If the value is true, the box will be populated with "Y". Otherwise, the box
82
90
  # will not be populated.
83
- # @param procedure_code [String]
84
91
  # @param quantity [String] String representation of a Decimal that can be parsed by most libraries.
85
- # A ServiceLine quantity cannot contain more than one digit of precision.
86
- # Example: 1.1 is valid, 1.11 is not.
92
+ # For professional claims, a ServiceLine quantity cannot contain more than one
93
+ # digit of precision
94
+ # (Example: 1.1 is valid, 1.11 is not). For institutional claims, a ServiceLine
95
+ # quantity cannot contain
96
+ # more than three decimal digits of precision.
87
97
  # @param units [CandidApiClient::Commons::Types::ServiceLineUnits]
88
- # @param charge_amount_cents [Integer] The total amount charged for this service line taking quantity into account. For
89
- # example, if a single unit
90
- # costs 100 cents and 2 units were rendered, the `charge_amount_cents` should be
91
- # 200. Should be greater than or
92
- # equal to 0.
93
- # @param diagnosis_pointers [Array<Integer>] Indices (zero-indexed) of all the diagnoses this service line references
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.
94
104
  # @param drug_identification [CandidApiClient::ServiceLines::V2::Types::DrugIdentification]
95
- # @param place_of_service_code [CandidApiClient::Commons::Types::FacilityTypeCode] 837p Loop2300, SV105. If your organization does not intend to submit claims with
96
- # a different place of service at the service line level, this field should not be
97
- # populated. 02 for telemedicine, 11 for in-person. Full list
105
+ # @param place_of_service_code [CandidApiClient::Commons::Types::FacilityTypeCode] 837p Loop2300, SV105. This enum is not used or required for institutional
106
+ # claims. If your organization does not intend to submit claims with a different
107
+ # place of service at the service line level, this field should not be populated.
108
+ # 02 for telemedicine, 11 for in-person. Full list
98
109
  # //www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
99
110
  # @param description [String] A free-form description to clarify the related data elements and their content.
100
- # Maps to SV1-01, C003-07 on the 837-P.
111
+ # Maps to SV1-01, C003-07 on a 837-P and SV2-02, C003-07 on a 837-I form.
101
112
  # @param date_of_service [Date]
102
113
  # @param end_date_of_service [Date]
103
114
  # @param ordering_provider [CandidApiClient::EncounterProviders::V2::Types::OrderingProvider] Required when the service or supply was ordered by a provider who is different
@@ -105,20 +116,21 @@ module CandidApiClient
105
116
  # If not required by this implementation guide, do not send.
106
117
  # @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
107
118
  # 837-P (ex: Hemoglobin, Hematocrit).
119
+ # This is unused by 837-i and ignored for institutional service lines.
108
120
  # No more than 5 MEA-02 test results may be submitted per service line.
109
121
  # @param note [String] Maps to NTE02 loop 2400 on the EDI 837.
110
122
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
111
123
  # @return [CandidApiClient::ServiceLines::V2::Types::ServiceLineCreate]
112
- def initialize(procedure_code:, quantity:, units:, diagnosis_pointers:, modifiers: OMIT,
113
- has_epsdt_indicator: OMIT, has_family_planning_indicator: OMIT, charge_amount_cents: OMIT, drug_identification: OMIT, place_of_service_code: OMIT, description: OMIT, date_of_service: OMIT, end_date_of_service: OMIT, ordering_provider: OMIT, test_results: OMIT, note: OMIT, additional_properties: nil)
124
+ def initialize(diagnosis_pointers:, procedure_code:, quantity:, units:, modifiers: OMIT, has_epsdt_indicator: OMIT,
125
+ has_family_planning_indicator: OMIT, charge_amount_cents: OMIT, drug_identification: OMIT, place_of_service_code: OMIT, description: OMIT, date_of_service: OMIT, end_date_of_service: OMIT, ordering_provider: OMIT, test_results: OMIT, note: OMIT, additional_properties: nil)
126
+ @diagnosis_pointers = diagnosis_pointers
127
+ @procedure_code = procedure_code
114
128
  @modifiers = modifiers if modifiers != OMIT
115
129
  @has_epsdt_indicator = has_epsdt_indicator if has_epsdt_indicator != OMIT
116
130
  @has_family_planning_indicator = has_family_planning_indicator if has_family_planning_indicator != OMIT
117
- @procedure_code = procedure_code
118
131
  @quantity = quantity
119
132
  @units = units
120
133
  @charge_amount_cents = charge_amount_cents if charge_amount_cents != OMIT
121
- @diagnosis_pointers = diagnosis_pointers
122
134
  @drug_identification = drug_identification if drug_identification != OMIT
123
135
  @place_of_service_code = place_of_service_code if place_of_service_code != OMIT
124
136
  @description = description if description != OMIT
@@ -129,14 +141,14 @@ module CandidApiClient
129
141
  @note = note if note != OMIT
130
142
  @additional_properties = additional_properties
131
143
  @_field_set = {
144
+ "diagnosis_pointers": diagnosis_pointers,
145
+ "procedure_code": procedure_code,
132
146
  "modifiers": modifiers,
133
147
  "has_epsdt_indicator": has_epsdt_indicator,
134
148
  "has_family_planning_indicator": has_family_planning_indicator,
135
- "procedure_code": procedure_code,
136
149
  "quantity": quantity,
137
150
  "units": units,
138
151
  "charge_amount_cents": charge_amount_cents,
139
- "diagnosis_pointers": diagnosis_pointers,
140
152
  "drug_identification": drug_identification,
141
153
  "place_of_service_code": place_of_service_code,
142
154
  "description": description,
@@ -157,14 +169,14 @@ module CandidApiClient
157
169
  def self.from_json(json_object:)
158
170
  struct = JSON.parse(json_object, object_class: OpenStruct)
159
171
  parsed_json = JSON.parse(json_object)
172
+ diagnosis_pointers = struct["diagnosis_pointers"]
173
+ procedure_code = struct["procedure_code"]
160
174
  modifiers = struct["modifiers"]
161
175
  has_epsdt_indicator = struct["has_epsdt_indicator"]
162
176
  has_family_planning_indicator = struct["has_family_planning_indicator"]
163
- procedure_code = struct["procedure_code"]
164
177
  quantity = struct["quantity"]
165
178
  units = struct["units"]
166
179
  charge_amount_cents = struct["charge_amount_cents"]
167
- diagnosis_pointers = struct["diagnosis_pointers"]
168
180
  if parsed_json["drug_identification"].nil?
169
181
  drug_identification = nil
170
182
  else
@@ -189,14 +201,14 @@ module CandidApiClient
189
201
  end
190
202
  note = struct["note"]
191
203
  new(
204
+ diagnosis_pointers: diagnosis_pointers,
205
+ procedure_code: procedure_code,
192
206
  modifiers: modifiers,
193
207
  has_epsdt_indicator: has_epsdt_indicator,
194
208
  has_family_planning_indicator: has_family_planning_indicator,
195
- procedure_code: procedure_code,
196
209
  quantity: quantity,
197
210
  units: units,
198
211
  charge_amount_cents: charge_amount_cents,
199
- diagnosis_pointers: diagnosis_pointers,
200
212
  drug_identification: drug_identification,
201
213
  place_of_service_code: place_of_service_code,
202
214
  description: description,
@@ -223,14 +235,14 @@ module CandidApiClient
223
235
  # @param obj [Object]
224
236
  # @return [Void]
225
237
  def self.validate_raw(obj:)
238
+ obj.diagnosis_pointers.is_a?(Array) != false || raise("Passed value for field obj.diagnosis_pointers is not the expected type, validation failed.")
239
+ obj.procedure_code.is_a?(String) != false || raise("Passed value for field obj.procedure_code is not the expected type, validation failed.")
226
240
  obj.modifiers&.is_a?(Array) != false || raise("Passed value for field obj.modifiers is not the expected type, validation failed.")
227
241
  obj.has_epsdt_indicator&.is_a?(Boolean) != false || raise("Passed value for field obj.has_epsdt_indicator is not the expected type, validation failed.")
228
242
  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.")
229
- obj.procedure_code.is_a?(String) != false || raise("Passed value for field obj.procedure_code is not the expected type, validation failed.")
230
243
  obj.quantity.is_a?(String) != false || raise("Passed value for field obj.quantity is not the expected type, validation failed.")
231
244
  obj.units.is_a?(CandidApiClient::Commons::Types::ServiceLineUnits) != false || raise("Passed value for field obj.units is not the expected type, validation failed.")
232
245
  obj.charge_amount_cents&.is_a?(Integer) != false || raise("Passed value for field obj.charge_amount_cents is not the expected type, validation failed.")
233
- obj.diagnosis_pointers.is_a?(Array) != false || raise("Passed value for field obj.diagnosis_pointers is not the expected type, validation failed.")
234
246
  obj.drug_identification.nil? || CandidApiClient::ServiceLines::V2::Types::DrugIdentification.validate_raw(obj: obj.drug_identification)
235
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.")
236
248
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
@@ -0,0 +1,251 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../commons/types/procedure_modifier"
4
+ require_relative "../../../commons/types/service_line_units"
5
+ require_relative "drug_identification"
6
+ require_relative "../../../commons/types/facility_type_code"
7
+ require "date"
8
+ require_relative "../../../encounter_providers/v_2/types/ordering_provider"
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 ServiceLineCreateBase
18
+ # @return [String]
19
+ attr_reader :procedure_code
20
+ # @return [Array<CandidApiClient::Commons::Types::ProcedureModifier>]
21
+ attr_reader :modifiers
22
+ # @return [Boolean] Maps to SV1-11 on the 837-P and Box 24H on the CMS-1500.
23
+ # If the value is true, the box will be populated with "Y". Otherwise, the box
24
+ # will not be populated.
25
+ attr_reader :has_epsdt_indicator
26
+ # @return [Boolean] Maps to SV1-12 on the 837-P and Box 24I on the CMS-1500.
27
+ # If the value is true, the box will be populated with "Y". Otherwise, the box
28
+ # will not be populated.
29
+ attr_reader :has_family_planning_indicator
30
+ # @return [String] String representation of a Decimal that can be parsed by most libraries.
31
+ # For professional claims, a ServiceLine quantity cannot contain more than one
32
+ # digit of precision
33
+ # (Example: 1.1 is valid, 1.11 is not). For institutional claims, a ServiceLine
34
+ # quantity cannot contain
35
+ # more than three decimal digits of precision.
36
+ attr_reader :quantity
37
+ # @return [CandidApiClient::Commons::Types::ServiceLineUnits]
38
+ attr_reader :units
39
+ # @return [Integer] The total amount charged for this service line, factoring in quantity. If
40
+ # procedure_code is updated and this is not, the system will attempt to set it
41
+ # based on chargemasters entries and the service line’s quantity. For example, if
42
+ # a single unit has an entry of 100 cents and 2 units were rendered, the
43
+ # charge_amount_cents will be set to 200, if there is no chargemaster entry, it
44
+ # will default to the amount set in this field.
45
+ attr_reader :charge_amount_cents
46
+ # @return [CandidApiClient::ServiceLines::V2::Types::DrugIdentification]
47
+ attr_reader :drug_identification
48
+ # @return [CandidApiClient::Commons::Types::FacilityTypeCode] 837p Loop2300, SV105. This enum is not used or required for institutional
49
+ # claims. If your organization does not intend to submit claims with a different
50
+ # place of service at the service line level, this field should not be populated.
51
+ # 02 for telemedicine, 11 for in-person. Full list
52
+ # //www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
53
+ attr_reader :place_of_service_code
54
+ # @return [String] A free-form description to clarify the related data elements and their content.
55
+ # Maps to SV1-01, C003-07 on a 837-P and SV2-02, C003-07 on a 837-I form.
56
+ attr_reader :description
57
+ # @return [Date]
58
+ attr_reader :date_of_service
59
+ # @return [Date]
60
+ attr_reader :end_date_of_service
61
+ # @return [CandidApiClient::EncounterProviders::V2::Types::OrderingProvider] Required when the service or supply was ordered by a provider who is different
62
+ # than the rendering provider for this service line.
63
+ # If not required by this implementation guide, do not send.
64
+ attr_reader :ordering_provider
65
+ # @return [Array<CandidApiClient::ServiceLines::V2::Types::TestResult>] Contains a list of test results. Test result types may map to MEA-02 on the
66
+ # 837-P (ex: Hemoglobin, Hematocrit).
67
+ # This is unused by 837-i and ignored for institutional service lines.
68
+ # No more than 5 MEA-02 test results may be submitted per service line.
69
+ attr_reader :test_results
70
+ # @return [String] Maps to NTE02 loop 2400 on the EDI 837.
71
+ attr_reader :note
72
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
73
+ attr_reader :additional_properties
74
+ # @return [Object]
75
+ attr_reader :_field_set
76
+ protected :_field_set
77
+
78
+ OMIT = Object.new
79
+
80
+ # @param procedure_code [String]
81
+ # @param modifiers [Array<CandidApiClient::Commons::Types::ProcedureModifier>]
82
+ # @param has_epsdt_indicator [Boolean] Maps to SV1-11 on the 837-P and Box 24H on the CMS-1500.
83
+ # If the value is true, the box will be populated with "Y". Otherwise, the box
84
+ # will not be populated.
85
+ # @param has_family_planning_indicator [Boolean] Maps to SV1-12 on the 837-P and Box 24I on the CMS-1500.
86
+ # If the value is true, the box will be populated with "Y". Otherwise, the box
87
+ # will not be populated.
88
+ # @param quantity [String] String representation of a Decimal that can be parsed by most libraries.
89
+ # For professional claims, a ServiceLine quantity cannot contain more than one
90
+ # digit of precision
91
+ # (Example: 1.1 is valid, 1.11 is not). For institutional claims, a ServiceLine
92
+ # quantity cannot contain
93
+ # more than three decimal digits of precision.
94
+ # @param units [CandidApiClient::Commons::Types::ServiceLineUnits]
95
+ # @param charge_amount_cents [Integer] The total amount charged for this service line, factoring in quantity. If
96
+ # procedure_code is updated and this is not, the system will attempt to set it
97
+ # based on chargemasters entries and the service line’s quantity. For example, if
98
+ # a single unit has an entry of 100 cents and 2 units were rendered, the
99
+ # charge_amount_cents will be set to 200, if there is no chargemaster entry, it
100
+ # will default to the amount set in this field.
101
+ # @param drug_identification [CandidApiClient::ServiceLines::V2::Types::DrugIdentification]
102
+ # @param place_of_service_code [CandidApiClient::Commons::Types::FacilityTypeCode] 837p Loop2300, SV105. This enum is not used or required for institutional
103
+ # claims. If your organization does not intend to submit claims with a different
104
+ # place of service at the service line level, this field should not be populated.
105
+ # 02 for telemedicine, 11 for in-person. Full list
106
+ # //www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
107
+ # @param description [String] A free-form description to clarify the related data elements and their content.
108
+ # Maps to SV1-01, C003-07 on a 837-P and SV2-02, C003-07 on a 837-I form.
109
+ # @param date_of_service [Date]
110
+ # @param end_date_of_service [Date]
111
+ # @param ordering_provider [CandidApiClient::EncounterProviders::V2::Types::OrderingProvider] Required when the service or supply was ordered by a provider who is different
112
+ # than the rendering provider for this service line.
113
+ # If not required by this implementation guide, do not send.
114
+ # @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
115
+ # 837-P (ex: Hemoglobin, Hematocrit).
116
+ # This is unused by 837-i and ignored for institutional service lines.
117
+ # No more than 5 MEA-02 test results may be submitted per service line.
118
+ # @param note [String] Maps to NTE02 loop 2400 on the EDI 837.
119
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
120
+ # @return [CandidApiClient::ServiceLines::V2::Types::ServiceLineCreateBase]
121
+ def initialize(procedure_code:, quantity:, units:, modifiers: OMIT, has_epsdt_indicator: OMIT,
122
+ has_family_planning_indicator: OMIT, charge_amount_cents: OMIT, drug_identification: OMIT, place_of_service_code: OMIT, description: OMIT, date_of_service: OMIT, end_date_of_service: OMIT, ordering_provider: OMIT, test_results: OMIT, note: OMIT, additional_properties: nil)
123
+ @procedure_code = procedure_code
124
+ @modifiers = modifiers if modifiers != OMIT
125
+ @has_epsdt_indicator = has_epsdt_indicator if has_epsdt_indicator != OMIT
126
+ @has_family_planning_indicator = has_family_planning_indicator if has_family_planning_indicator != OMIT
127
+ @quantity = quantity
128
+ @units = units
129
+ @charge_amount_cents = charge_amount_cents if charge_amount_cents != OMIT
130
+ @drug_identification = drug_identification if drug_identification != OMIT
131
+ @place_of_service_code = place_of_service_code if place_of_service_code != OMIT
132
+ @description = description if description != OMIT
133
+ @date_of_service = date_of_service if date_of_service != OMIT
134
+ @end_date_of_service = end_date_of_service if end_date_of_service != OMIT
135
+ @ordering_provider = ordering_provider if ordering_provider != OMIT
136
+ @test_results = test_results if test_results != OMIT
137
+ @note = note if note != OMIT
138
+ @additional_properties = additional_properties
139
+ @_field_set = {
140
+ "procedure_code": procedure_code,
141
+ "modifiers": modifiers,
142
+ "has_epsdt_indicator": has_epsdt_indicator,
143
+ "has_family_planning_indicator": has_family_planning_indicator,
144
+ "quantity": quantity,
145
+ "units": units,
146
+ "charge_amount_cents": charge_amount_cents,
147
+ "drug_identification": drug_identification,
148
+ "place_of_service_code": place_of_service_code,
149
+ "description": description,
150
+ "date_of_service": date_of_service,
151
+ "end_date_of_service": end_date_of_service,
152
+ "ordering_provider": ordering_provider,
153
+ "test_results": test_results,
154
+ "note": note
155
+ }.reject do |_k, v|
156
+ v == OMIT
157
+ end
158
+ end
159
+
160
+ # Deserialize a JSON object to an instance of ServiceLineCreateBase
161
+ #
162
+ # @param json_object [String]
163
+ # @return [CandidApiClient::ServiceLines::V2::Types::ServiceLineCreateBase]
164
+ def self.from_json(json_object:)
165
+ struct = JSON.parse(json_object, object_class: OpenStruct)
166
+ parsed_json = JSON.parse(json_object)
167
+ procedure_code = struct["procedure_code"]
168
+ modifiers = struct["modifiers"]
169
+ has_epsdt_indicator = struct["has_epsdt_indicator"]
170
+ has_family_planning_indicator = struct["has_family_planning_indicator"]
171
+ quantity = struct["quantity"]
172
+ units = struct["units"]
173
+ charge_amount_cents = struct["charge_amount_cents"]
174
+ if parsed_json["drug_identification"].nil?
175
+ drug_identification = nil
176
+ else
177
+ drug_identification = parsed_json["drug_identification"].to_json
178
+ drug_identification = CandidApiClient::ServiceLines::V2::Types::DrugIdentification.from_json(json_object: drug_identification)
179
+ end
180
+ place_of_service_code = struct["place_of_service_code"]
181
+ description = struct["description"]
182
+ date_of_service = (Date.parse(parsed_json["date_of_service"]) unless parsed_json["date_of_service"].nil?)
183
+ end_date_of_service = unless parsed_json["end_date_of_service"].nil?
184
+ Date.parse(parsed_json["end_date_of_service"])
185
+ end
186
+ if parsed_json["ordering_provider"].nil?
187
+ ordering_provider = nil
188
+ else
189
+ ordering_provider = parsed_json["ordering_provider"].to_json
190
+ ordering_provider = CandidApiClient::EncounterProviders::V2::Types::OrderingProvider.from_json(json_object: ordering_provider)
191
+ end
192
+ test_results = parsed_json["test_results"]&.map do |item|
193
+ item = item.to_json
194
+ CandidApiClient::ServiceLines::V2::Types::TestResult.from_json(json_object: item)
195
+ end
196
+ note = struct["note"]
197
+ new(
198
+ procedure_code: procedure_code,
199
+ modifiers: modifiers,
200
+ has_epsdt_indicator: has_epsdt_indicator,
201
+ has_family_planning_indicator: has_family_planning_indicator,
202
+ quantity: quantity,
203
+ units: units,
204
+ charge_amount_cents: charge_amount_cents,
205
+ drug_identification: drug_identification,
206
+ place_of_service_code: place_of_service_code,
207
+ description: description,
208
+ date_of_service: date_of_service,
209
+ end_date_of_service: end_date_of_service,
210
+ ordering_provider: ordering_provider,
211
+ test_results: test_results,
212
+ note: note,
213
+ additional_properties: struct
214
+ )
215
+ end
216
+
217
+ # Serialize an instance of ServiceLineCreateBase to a JSON object
218
+ #
219
+ # @return [String]
220
+ def to_json(*_args)
221
+ @_field_set&.to_json
222
+ end
223
+
224
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
225
+ # hash and check each fields type against the current object's property
226
+ # definitions.
227
+ #
228
+ # @param obj [Object]
229
+ # @return [Void]
230
+ def self.validate_raw(obj:)
231
+ obj.procedure_code.is_a?(String) != false || raise("Passed value for field obj.procedure_code is not the expected type, validation failed.")
232
+ obj.modifiers&.is_a?(Array) != false || raise("Passed value for field obj.modifiers is not the expected type, validation failed.")
233
+ obj.has_epsdt_indicator&.is_a?(Boolean) != false || raise("Passed value for field obj.has_epsdt_indicator is not the expected type, validation failed.")
234
+ 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.")
235
+ obj.quantity.is_a?(String) != false || raise("Passed value for field obj.quantity is not the expected type, validation failed.")
236
+ obj.units.is_a?(CandidApiClient::Commons::Types::ServiceLineUnits) != false || raise("Passed value for field obj.units is not the expected type, validation failed.")
237
+ obj.charge_amount_cents&.is_a?(Integer) != false || raise("Passed value for field obj.charge_amount_cents is not the expected type, validation failed.")
238
+ obj.drug_identification.nil? || CandidApiClient::ServiceLines::V2::Types::DrugIdentification.validate_raw(obj: obj.drug_identification)
239
+ 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.")
240
+ obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
241
+ obj.date_of_service&.is_a?(Date) != false || raise("Passed value for field obj.date_of_service is not the expected type, validation failed.")
242
+ 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.")
243
+ obj.ordering_provider.nil? || CandidApiClient::EncounterProviders::V2::Types::OrderingProvider.validate_raw(obj: obj.ordering_provider)
244
+ obj.test_results&.is_a?(Array) != false || raise("Passed value for field obj.test_results is not the expected type, validation failed.")
245
+ obj.note&.is_a?(String) != false || raise("Passed value for field obj.note is not the expected type, validation failed.")
246
+ end
247
+ end
248
+ end
249
+ end
250
+ end
251
+ end