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