candidhealth 0.35.3 → 0.36.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/lib/candidhealth/billing_notes/v_2/client.rb +90 -0
  3. data/lib/candidhealth/commons/types/billing_provider_commercial_license_type.rb +20 -0
  4. data/lib/candidhealth/commons/types/procedure_modifier.rb +1 -0
  5. data/lib/candidhealth/contracts/v_2/types/contract_invalid_expiration_date_error.rb +60 -0
  6. data/lib/candidhealth/diagnoses/client.rb +2 -2
  7. data/lib/candidhealth/encounter_providers/v_2/types/billing_provider.rb +15 -2
  8. data/lib/candidhealth/encounter_providers/v_2/types/billing_provider_update.rb +15 -2
  9. data/lib/candidhealth/encounter_providers/v_2/types/encounter_provider.rb +14 -1
  10. data/lib/candidhealth/encounters/v_4/client.rb +96 -154
  11. data/lib/candidhealth/encounters/v_4/types/encounter.rb +8 -8
  12. data/lib/candidhealth/encounters/v_4/types/encounter_optional.rb +633 -0
  13. data/lib/candidhealth/guarantor/v_1/client.rb +2 -2
  14. data/lib/candidhealth/non_insurance_payer_refunds/v_1/client.rb +4 -2
  15. data/lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund.rb +9 -1
  16. data/lib/candidhealth/non_insurance_payer_refunds/v_1/types/non_insurance_payer_refund_create.rb +9 -1
  17. data/lib/candidhealth/service_lines/v_2/types/service_line.rb +8 -4
  18. data/lib/candidhealth/service_lines/v_2/types/service_line_create.rb +8 -2
  19. data/lib/candidhealth/service_lines/v_2/types/service_line_create_standalone.rb +8 -2
  20. data/lib/candidhealth/service_lines/v_2/types/service_line_update.rb +8 -2
  21. data/lib/requests.rb +2 -2
  22. data/lib/types_export.rb +3 -0
  23. metadata +5 -2
@@ -0,0 +1,633 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "date"
4
+ require_relative "clinical_note_category_create"
5
+ require_relative "../../../commons/types/street_address_long_zip"
6
+ require_relative "billable_status_type"
7
+ require_relative "responsible_party_type"
8
+ require_relative "synchronicity_type"
9
+ require_relative "../../../commons/types/facility_type_code"
10
+ require_relative "../../../individual/types/subscriber_create"
11
+ require_relative "service_authorization_exception_code"
12
+ require_relative "../../../commons/types/delay_reason_code"
13
+ require_relative "../../../individual/types/patient_update"
14
+ require_relative "../../../custom_schemas/v_1/types/schema_instance"
15
+ require_relative "vitals_update"
16
+ require_relative "medication"
17
+ require_relative "../../../encounter_providers/v_2/types/rendering_provider_update"
18
+ require_relative "../../../service_facility/types/encounter_service_facility_update"
19
+ require_relative "../../../guarantor/v_1/types/guarantor_update"
20
+ require_relative "../../../encounter_providers/v_2/types/billing_provider_update"
21
+ require_relative "../../../encounter_providers/v_2/types/supervising_provider_update"
22
+ require_relative "../../../encounter_providers/v_2/types/referring_provider_update"
23
+ require_relative "../../../encounter_providers/v_2/types/initial_referring_provider_update"
24
+ require "ostruct"
25
+ require "json"
26
+
27
+ module CandidApiClient
28
+ module Encounters
29
+ module V4
30
+ module Types
31
+ class EncounterOptional
32
+ # @return [Boolean] Whether this patient has authorized insurance payments to be made to you, not
33
+ # them. If false, patient may receive reimbursement. Box 13 on the CMS-1500 claim
34
+ # form.
35
+ attr_reader :benefits_assigned_to_provider
36
+ # @return [String] Box 23 on the CMS-1500 claim form.
37
+ attr_reader :prior_authorization_number
38
+ # @return [String] A client-specified unique ID to associate with this encounter;
39
+ # for example, your internal encounter ID or a Dr. Chrono encounter ID.
40
+ # This field should not contain PHI.
41
+ attr_reader :external_id
42
+ # @return [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-24.
43
+ # This date must be the local date in the timezone where the service occurred.
44
+ # Box 24a on the CMS-1500 claim form.
45
+ # If service occurred over a range of dates, this should be the start date.
46
+ # If service lines have distinct date_of_service values, updating the encounter's
47
+ # date_of_service will fail. If all service line date_of_service values are the
48
+ # same, updating the encounter's date_of_service will update all service line
49
+ # date_of_service values.
50
+ attr_reader :date_of_service
51
+ # @return [Array<String>] Names of tags that should be on the encounter. Note all tags on encounter will
52
+ # be overridden with this list.
53
+ attr_reader :tag_ids
54
+ # @return [Array<CandidApiClient::Encounters::V4::Types::ClinicalNoteCategoryCreate>] Holds a collection of clinical observations made by healthcare providers during
55
+ # patient encounters.
56
+ attr_reader :clinical_notes
57
+ # @return [CandidApiClient::Commons::Types::StreetAddressLongZip] Specifies the address to which payments for the claim should be sent.
58
+ attr_reader :pay_to_address
59
+ # @return [CandidApiClient::Encounters::V4::Types::BillableStatusType] Defines if the Encounter is to be billed by Candid to the responsible_party.
60
+ # Examples for when this should be set to NOT_BILLABLE include if the Encounter
61
+ # has not occurred yet or if there is no intention of ever billing the
62
+ # responsible_party.
63
+ attr_reader :billable_status
64
+ # @return [CandidApiClient::Encounters::V4::Types::ResponsiblePartyType] Defines the party to be billed with the initial balance owed on the claim. Use
65
+ # SELF_PAY if you intend to bill self pay/cash pay.
66
+ attr_reader :responsible_party
67
+ # @return [Boolean] Whether you have accepted the patient's authorization for insurance payments to
68
+ # be made to you, not them. Box 27 on the CMS-1500 claim form.
69
+ attr_reader :provider_accepts_assignment
70
+ # @return [CandidApiClient::Encounters::V4::Types::SynchronicityType] Whether or not this was a synchronous or asynchronous encounter. Asynchronous
71
+ # encounters occur when providers and patients communicate online using forms,
72
+ # instant messaging, or other pre-recorded digital mediums. Synchronous encounters
73
+ # occur in live, real-time settings where the patient interacts directly with the
74
+ # provider, such as over video or a phone call.
75
+ attr_reader :synchronicity
76
+ # @return [CandidApiClient::Commons::Types::FacilityTypeCode] Box 24B on the CMS-1500 claim form. 837p Loop2300, CLM-05-1. 02 for
77
+ # telemedicine, 11 for in-person. Full list
78
+ # //www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
79
+ attr_reader :place_of_service_code
80
+ # @return [String] Human-readable description of the appointment type (ex: "Acupuncture -
81
+ # Headaches").
82
+ attr_reader :appointment_type
83
+ # @return [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-25.
84
+ # This date must be the local date in the timezone where the service occurred.
85
+ # If omitted, the Encounter is assumed to be for a single day.
86
+ # Must not be temporally before the date_of_service field.
87
+ # If service lines have distinct end_date_of_service values, updating the
88
+ # encounter's end_date_of_service will fail. If all service line
89
+ # end_date_of_service values are the same, updating the encounter's
90
+ # end_date_of_service will update all service line date_of_service values.
91
+ attr_reader :end_date_of_service
92
+ # @return [CandidApiClient::Individual::Types::SubscriberCreate] Contains details of the primary insurance subscriber.
93
+ attr_reader :subscriber_primary
94
+ # @return [CandidApiClient::Individual::Types::SubscriberCreate] Contains details of the secondary insurance subscriber.
95
+ attr_reader :subscriber_secondary
96
+ # @return [String] Defines additional information on the claim needed by the payer.
97
+ # Box 19 on the CMS-1500 claim form.
98
+ attr_reader :additional_information
99
+ # @return [CandidApiClient::Encounters::V4::Types::ServiceAuthorizationExceptionCode] 837p Loop2300 REF\*4N
100
+ # Required when mandated by government law or regulation to obtain authorization
101
+ # for specific service(s) but, for the
102
+ # reasons listed in one of the enum values of ServiceAuthorizationExceptionCode,
103
+ # the service was performed without
104
+ # obtaining the authorization.
105
+ attr_reader :service_authorization_exception_code
106
+ # @return [Date] 837p Loop2300 DTP\*435, CMS-1500 Box 18
107
+ # Required on all ambulance claims when the patient was known to be admitted to
108
+ # the hospital.
109
+ # OR
110
+ # Required on all claims involving inpatient medical visits.
111
+ attr_reader :admission_date
112
+ # @return [Date] 837p Loop2300 DTP\*096, CMS-1500 Box 18
113
+ # Required for inpatient claims when the patient was discharged from the facility
114
+ # and the discharge date is known.
115
+ attr_reader :discharge_date
116
+ # @return [Date] 837p Loop2300 DTP\*431, CMS-1500 Box 14
117
+ # Required for the initial medical service or visit performed in response to a
118
+ # medical emergency when the date is available and is different than the date of
119
+ # service.
120
+ # OR
121
+ # This date is the onset of acute symptoms for the current illness or condition.
122
+ attr_reader :onset_of_current_illness_or_symptom_date
123
+ # @return [Date] 837p Loop2300 DTP\*484, CMS-1500 Box 14
124
+ # Required when, in the judgment of the provider, the services on this claim are
125
+ # related to the patient's pregnancy.de
126
+ attr_reader :last_menstrual_period_date
127
+ # @return [CandidApiClient::Commons::Types::DelayReasonCode] 837i Loop2300, CLM-1300 Box 20
128
+ # Code indicating the reason why a request was delayed
129
+ attr_reader :delay_reason_code
130
+ # @return [CandidApiClient::Individual::Types::PatientUpdate] Contains the identification information of the individual receiving medical
131
+ # services.
132
+ attr_reader :patient
133
+ # @return [Boolean] Whether this patient has authorized the release of medical information
134
+ # for billing purpose.
135
+ # Box 12 on the CMS-1500 claim form.
136
+ attr_reader :patient_authorized_release
137
+ # @return [Array<CandidApiClient::CustomSchemas::V1::Types::SchemaInstance>] Key-value pairs that must adhere to a schema created via the Custom Schema API.
138
+ # Multiple schema
139
+ # instances cannot be created for the same schema on an encounter. Updating schema
140
+ # instances utilizes PUT
141
+ # semantics, so the schema instances on the encounter will be set to whatever
142
+ # inputs are provided. If null
143
+ # is provided as an input, then the encounter's schema instances will be cleared.
144
+ attr_reader :schema_instances
145
+ # @return [CandidApiClient::Encounters::V4::Types::VitalsUpdate] If a vitals entity already exists for the encounter, then all values will be
146
+ # updated to the provided values.
147
+ # Otherwise, a new vitals object will be created for the encounter.
148
+ attr_reader :vitals
149
+ # @return [Array<CandidApiClient::Encounters::V4::Types::Medication>] Existing medications that should be on the encounter.
150
+ # Note all current existing medications on encounter will be overridden with this
151
+ # list.
152
+ attr_reader :existing_medications
153
+ # @return [CandidApiClient::EncounterProviders::V2::Types::RenderingProviderUpdate] The rendering provider is the practitioner -- physician, nurse practitioner,
154
+ # etc. -- performing the service.
155
+ # For telehealth services, the rendering provider performs the visit, asynchronous
156
+ # communication, or other service. The rendering provider address should generally
157
+ # be the same as the service facility address.
158
+ attr_reader :rendering_provider
159
+ # @return [CandidApiClient::ServiceFacility::Types::EncounterServiceFacilityUpdate] Encounter Service facility is typically the location a medical service was
160
+ # rendered, such as a provider office or hospital. For telehealth, service
161
+ # facility can represent the provider's location when the service was delivered
162
+ # (e.g., home), or the location where an in-person visit would have taken place,
163
+ # whichever is easier to identify. If the provider is in-network, service facility
164
+ # may be defined in payer contracts. Box 32 on the CMS-1500 claim form. Note that
165
+ # for an in-network claim to be successfully adjudicated, the service facility
166
+ # address listed on claims must match what was provided to the payer during the
167
+ # credentialing process.
168
+ attr_reader :service_facility
169
+ # @return [CandidApiClient::Guarantor::V1::Types::GuarantorUpdate] Personal and contact info for the guarantor of the patient responsibility.
170
+ attr_reader :guarantor
171
+ # @return [CandidApiClient::EncounterProviders::V2::Types::BillingProviderUpdate] The billing provider is the provider or business entity submitting the claim.
172
+ # Billing provider may be, but is not necessarily, the same person/NPI as the
173
+ # rendering provider. From a payer's perspective, this represents the person or
174
+ # entity being reimbursed. When a contract exists with the target payer, the
175
+ # billing provider should be the entity contracted with the payer. In some
176
+ # circumstances, this will be an individual provider. In that case, submit that
177
+ # provider's NPI and the tax ID (TIN) that the provider gave to the payer during
178
+ # contracting. In other cases, the billing entity will be a medical group. If so,
179
+ # submit the group NPI and the group's tax ID. Box 33 on the CMS-1500 claim form.
180
+ attr_reader :billing_provider
181
+ # @return [CandidApiClient::EncounterProviders::V2::Types::SupervisingProviderUpdate] Required when the rendering provider is supervised by a physician. If not
182
+ # required by this implementation guide, do not send.
183
+ attr_reader :supervising_provider
184
+ # @return [CandidApiClient::EncounterProviders::V2::Types::ReferringProviderUpdate] The final provider who referred the services that were rendered.
185
+ # All physicians who order services or refer Medicare beneficiaries must
186
+ # report this data.
187
+ attr_reader :referring_provider
188
+ # @return [CandidApiClient::EncounterProviders::V2::Types::InitialReferringProviderUpdate] The second iteration of Loop ID-2310. Use code "P3 - Primary Care Provider" in
189
+ # this loop to
190
+ # indicate the initial referral from the primary care provider or whatever
191
+ # provider wrote the initial referral for this patient's episode of care being
192
+ # billed/reported in this transaction.
193
+ attr_reader :initial_referring_provider
194
+ # @return [String] Refers to REF\*9F on the 837p. Value cannot be greater than 50 characters.
195
+ attr_reader :referral_number
196
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
197
+ attr_reader :additional_properties
198
+ # @return [Object]
199
+ attr_reader :_field_set
200
+ protected :_field_set
201
+
202
+ OMIT = Object.new
203
+
204
+ # @param benefits_assigned_to_provider [Boolean] Whether this patient has authorized insurance payments to be made to you, not
205
+ # them. If false, patient may receive reimbursement. Box 13 on the CMS-1500 claim
206
+ # form.
207
+ # @param prior_authorization_number [String] Box 23 on the CMS-1500 claim form.
208
+ # @param external_id [String] A client-specified unique ID to associate with this encounter;
209
+ # for example, your internal encounter ID or a Dr. Chrono encounter ID.
210
+ # This field should not contain PHI.
211
+ # @param date_of_service [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-24.
212
+ # This date must be the local date in the timezone where the service occurred.
213
+ # Box 24a on the CMS-1500 claim form.
214
+ # If service occurred over a range of dates, this should be the start date.
215
+ # If service lines have distinct date_of_service values, updating the encounter's
216
+ # date_of_service will fail. If all service line date_of_service values are the
217
+ # same, updating the encounter's date_of_service will update all service line
218
+ # date_of_service values.
219
+ # @param tag_ids [Array<String>] Names of tags that should be on the encounter. Note all tags on encounter will
220
+ # be overridden with this list.
221
+ # @param clinical_notes [Array<CandidApiClient::Encounters::V4::Types::ClinicalNoteCategoryCreate>] Holds a collection of clinical observations made by healthcare providers during
222
+ # patient encounters.
223
+ # @param pay_to_address [CandidApiClient::Commons::Types::StreetAddressLongZip] Specifies the address to which payments for the claim should be sent.
224
+ # @param billable_status [CandidApiClient::Encounters::V4::Types::BillableStatusType] Defines if the Encounter is to be billed by Candid to the responsible_party.
225
+ # Examples for when this should be set to NOT_BILLABLE include if the Encounter
226
+ # has not occurred yet or if there is no intention of ever billing the
227
+ # responsible_party.
228
+ # @param responsible_party [CandidApiClient::Encounters::V4::Types::ResponsiblePartyType] Defines the party to be billed with the initial balance owed on the claim. Use
229
+ # SELF_PAY if you intend to bill self pay/cash pay.
230
+ # @param provider_accepts_assignment [Boolean] Whether you have accepted the patient's authorization for insurance payments to
231
+ # be made to you, not them. Box 27 on the CMS-1500 claim form.
232
+ # @param synchronicity [CandidApiClient::Encounters::V4::Types::SynchronicityType] Whether or not this was a synchronous or asynchronous encounter. Asynchronous
233
+ # encounters occur when providers and patients communicate online using forms,
234
+ # instant messaging, or other pre-recorded digital mediums. Synchronous encounters
235
+ # occur in live, real-time settings where the patient interacts directly with the
236
+ # provider, such as over video or a phone call.
237
+ # @param place_of_service_code [CandidApiClient::Commons::Types::FacilityTypeCode] Box 24B on the CMS-1500 claim form. 837p Loop2300, CLM-05-1. 02 for
238
+ # telemedicine, 11 for in-person. Full list
239
+ # //www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
240
+ # @param appointment_type [String] Human-readable description of the appointment type (ex: "Acupuncture -
241
+ # Headaches").
242
+ # @param end_date_of_service [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-25.
243
+ # This date must be the local date in the timezone where the service occurred.
244
+ # If omitted, the Encounter is assumed to be for a single day.
245
+ # Must not be temporally before the date_of_service field.
246
+ # If service lines have distinct end_date_of_service values, updating the
247
+ # encounter's end_date_of_service will fail. If all service line
248
+ # end_date_of_service values are the same, updating the encounter's
249
+ # end_date_of_service will update all service line date_of_service values.
250
+ # @param subscriber_primary [CandidApiClient::Individual::Types::SubscriberCreate] Contains details of the primary insurance subscriber.
251
+ # @param subscriber_secondary [CandidApiClient::Individual::Types::SubscriberCreate] Contains details of the secondary insurance subscriber.
252
+ # @param additional_information [String] Defines additional information on the claim needed by the payer.
253
+ # Box 19 on the CMS-1500 claim form.
254
+ # @param service_authorization_exception_code [CandidApiClient::Encounters::V4::Types::ServiceAuthorizationExceptionCode] 837p Loop2300 REF\*4N
255
+ # Required when mandated by government law or regulation to obtain authorization
256
+ # for specific service(s) but, for the
257
+ # reasons listed in one of the enum values of ServiceAuthorizationExceptionCode,
258
+ # the service was performed without
259
+ # obtaining the authorization.
260
+ # @param admission_date [Date] 837p Loop2300 DTP\*435, CMS-1500 Box 18
261
+ # Required on all ambulance claims when the patient was known to be admitted to
262
+ # the hospital.
263
+ # OR
264
+ # Required on all claims involving inpatient medical visits.
265
+ # @param discharge_date [Date] 837p Loop2300 DTP\*096, CMS-1500 Box 18
266
+ # Required for inpatient claims when the patient was discharged from the facility
267
+ # and the discharge date is known.
268
+ # @param onset_of_current_illness_or_symptom_date [Date] 837p Loop2300 DTP\*431, CMS-1500 Box 14
269
+ # Required for the initial medical service or visit performed in response to a
270
+ # medical emergency when the date is available and is different than the date of
271
+ # service.
272
+ # OR
273
+ # This date is the onset of acute symptoms for the current illness or condition.
274
+ # @param last_menstrual_period_date [Date] 837p Loop2300 DTP\*484, CMS-1500 Box 14
275
+ # Required when, in the judgment of the provider, the services on this claim are
276
+ # related to the patient's pregnancy.de
277
+ # @param delay_reason_code [CandidApiClient::Commons::Types::DelayReasonCode] 837i Loop2300, CLM-1300 Box 20
278
+ # Code indicating the reason why a request was delayed
279
+ # @param patient [CandidApiClient::Individual::Types::PatientUpdate] Contains the identification information of the individual receiving medical
280
+ # services.
281
+ # @param patient_authorized_release [Boolean] Whether this patient has authorized the release of medical information
282
+ # for billing purpose.
283
+ # Box 12 on the CMS-1500 claim form.
284
+ # @param schema_instances [Array<CandidApiClient::CustomSchemas::V1::Types::SchemaInstance>] Key-value pairs that must adhere to a schema created via the Custom Schema API.
285
+ # Multiple schema
286
+ # instances cannot be created for the same schema on an encounter. Updating schema
287
+ # instances utilizes PUT
288
+ # semantics, so the schema instances on the encounter will be set to whatever
289
+ # inputs are provided. If null
290
+ # is provided as an input, then the encounter's schema instances will be cleared.
291
+ # @param vitals [CandidApiClient::Encounters::V4::Types::VitalsUpdate] If a vitals entity already exists for the encounter, then all values will be
292
+ # updated to the provided values.
293
+ # Otherwise, a new vitals object will be created for the encounter.
294
+ # @param existing_medications [Array<CandidApiClient::Encounters::V4::Types::Medication>] Existing medications that should be on the encounter.
295
+ # Note all current existing medications on encounter will be overridden with this
296
+ # list.
297
+ # @param rendering_provider [CandidApiClient::EncounterProviders::V2::Types::RenderingProviderUpdate] The rendering provider is the practitioner -- physician, nurse practitioner,
298
+ # etc. -- performing the service.
299
+ # For telehealth services, the rendering provider performs the visit, asynchronous
300
+ # communication, or other service. The rendering provider address should generally
301
+ # be the same as the service facility address.
302
+ # @param service_facility [CandidApiClient::ServiceFacility::Types::EncounterServiceFacilityUpdate] Encounter Service facility is typically the location a medical service was
303
+ # rendered, such as a provider office or hospital. For telehealth, service
304
+ # facility can represent the provider's location when the service was delivered
305
+ # (e.g., home), or the location where an in-person visit would have taken place,
306
+ # whichever is easier to identify. If the provider is in-network, service facility
307
+ # may be defined in payer contracts. Box 32 on the CMS-1500 claim form. Note that
308
+ # for an in-network claim to be successfully adjudicated, the service facility
309
+ # address listed on claims must match what was provided to the payer during the
310
+ # credentialing process.
311
+ # @param guarantor [CandidApiClient::Guarantor::V1::Types::GuarantorUpdate] Personal and contact info for the guarantor of the patient responsibility.
312
+ # @param billing_provider [CandidApiClient::EncounterProviders::V2::Types::BillingProviderUpdate] The billing provider is the provider or business entity submitting the claim.
313
+ # Billing provider may be, but is not necessarily, the same person/NPI as the
314
+ # rendering provider. From a payer's perspective, this represents the person or
315
+ # entity being reimbursed. When a contract exists with the target payer, the
316
+ # billing provider should be the entity contracted with the payer. In some
317
+ # circumstances, this will be an individual provider. In that case, submit that
318
+ # provider's NPI and the tax ID (TIN) that the provider gave to the payer during
319
+ # contracting. In other cases, the billing entity will be a medical group. If so,
320
+ # submit the group NPI and the group's tax ID. Box 33 on the CMS-1500 claim form.
321
+ # @param supervising_provider [CandidApiClient::EncounterProviders::V2::Types::SupervisingProviderUpdate] Required when the rendering provider is supervised by a physician. If not
322
+ # required by this implementation guide, do not send.
323
+ # @param referring_provider [CandidApiClient::EncounterProviders::V2::Types::ReferringProviderUpdate] The final provider who referred the services that were rendered.
324
+ # All physicians who order services or refer Medicare beneficiaries must
325
+ # report this data.
326
+ # @param initial_referring_provider [CandidApiClient::EncounterProviders::V2::Types::InitialReferringProviderUpdate] The second iteration of Loop ID-2310. Use code "P3 - Primary Care Provider" in
327
+ # this loop to
328
+ # indicate the initial referral from the primary care provider or whatever
329
+ # provider wrote the initial referral for this patient's episode of care being
330
+ # billed/reported in this transaction.
331
+ # @param referral_number [String] Refers to REF\*9F on the 837p. Value cannot be greater than 50 characters.
332
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
333
+ # @return [CandidApiClient::Encounters::V4::Types::EncounterOptional]
334
+ def initialize(benefits_assigned_to_provider: OMIT, prior_authorization_number: OMIT, external_id: OMIT,
335
+ date_of_service: OMIT, tag_ids: OMIT, clinical_notes: OMIT, pay_to_address: OMIT, billable_status: OMIT, responsible_party: OMIT, provider_accepts_assignment: OMIT, synchronicity: OMIT, place_of_service_code: OMIT, appointment_type: OMIT, end_date_of_service: OMIT, subscriber_primary: OMIT, subscriber_secondary: OMIT, additional_information: OMIT, service_authorization_exception_code: OMIT, admission_date: OMIT, discharge_date: OMIT, onset_of_current_illness_or_symptom_date: OMIT, last_menstrual_period_date: OMIT, delay_reason_code: OMIT, patient: OMIT, patient_authorized_release: OMIT, schema_instances: OMIT, vitals: OMIT, existing_medications: OMIT, rendering_provider: OMIT, service_facility: OMIT, guarantor: OMIT, billing_provider: OMIT, supervising_provider: OMIT, referring_provider: OMIT, initial_referring_provider: OMIT, referral_number: OMIT, additional_properties: nil)
336
+ @benefits_assigned_to_provider = benefits_assigned_to_provider if benefits_assigned_to_provider != OMIT
337
+ @prior_authorization_number = prior_authorization_number if prior_authorization_number != OMIT
338
+ @external_id = external_id if external_id != OMIT
339
+ @date_of_service = date_of_service if date_of_service != OMIT
340
+ @tag_ids = tag_ids if tag_ids != OMIT
341
+ @clinical_notes = clinical_notes if clinical_notes != OMIT
342
+ @pay_to_address = pay_to_address if pay_to_address != OMIT
343
+ @billable_status = billable_status if billable_status != OMIT
344
+ @responsible_party = responsible_party if responsible_party != OMIT
345
+ @provider_accepts_assignment = provider_accepts_assignment if provider_accepts_assignment != OMIT
346
+ @synchronicity = synchronicity if synchronicity != OMIT
347
+ @place_of_service_code = place_of_service_code if place_of_service_code != OMIT
348
+ @appointment_type = appointment_type if appointment_type != OMIT
349
+ @end_date_of_service = end_date_of_service if end_date_of_service != OMIT
350
+ @subscriber_primary = subscriber_primary if subscriber_primary != OMIT
351
+ @subscriber_secondary = subscriber_secondary if subscriber_secondary != OMIT
352
+ @additional_information = additional_information if additional_information != OMIT
353
+ if service_authorization_exception_code != OMIT
354
+ @service_authorization_exception_code = service_authorization_exception_code
355
+ end
356
+ @admission_date = admission_date if admission_date != OMIT
357
+ @discharge_date = discharge_date if discharge_date != OMIT
358
+ if onset_of_current_illness_or_symptom_date != OMIT
359
+ @onset_of_current_illness_or_symptom_date = onset_of_current_illness_or_symptom_date
360
+ end
361
+ @last_menstrual_period_date = last_menstrual_period_date if last_menstrual_period_date != OMIT
362
+ @delay_reason_code = delay_reason_code if delay_reason_code != OMIT
363
+ @patient = patient if patient != OMIT
364
+ @patient_authorized_release = patient_authorized_release if patient_authorized_release != OMIT
365
+ @schema_instances = schema_instances if schema_instances != OMIT
366
+ @vitals = vitals if vitals != OMIT
367
+ @existing_medications = existing_medications if existing_medications != OMIT
368
+ @rendering_provider = rendering_provider if rendering_provider != OMIT
369
+ @service_facility = service_facility if service_facility != OMIT
370
+ @guarantor = guarantor if guarantor != OMIT
371
+ @billing_provider = billing_provider if billing_provider != OMIT
372
+ @supervising_provider = supervising_provider if supervising_provider != OMIT
373
+ @referring_provider = referring_provider if referring_provider != OMIT
374
+ @initial_referring_provider = initial_referring_provider if initial_referring_provider != OMIT
375
+ @referral_number = referral_number if referral_number != OMIT
376
+ @additional_properties = additional_properties
377
+ @_field_set = {
378
+ "benefits_assigned_to_provider": benefits_assigned_to_provider,
379
+ "prior_authorization_number": prior_authorization_number,
380
+ "external_id": external_id,
381
+ "date_of_service": date_of_service,
382
+ "tag_ids": tag_ids,
383
+ "clinical_notes": clinical_notes,
384
+ "pay_to_address": pay_to_address,
385
+ "billable_status": billable_status,
386
+ "responsible_party": responsible_party,
387
+ "provider_accepts_assignment": provider_accepts_assignment,
388
+ "synchronicity": synchronicity,
389
+ "place_of_service_code": place_of_service_code,
390
+ "appointment_type": appointment_type,
391
+ "end_date_of_service": end_date_of_service,
392
+ "subscriber_primary": subscriber_primary,
393
+ "subscriber_secondary": subscriber_secondary,
394
+ "additional_information": additional_information,
395
+ "service_authorization_exception_code": service_authorization_exception_code,
396
+ "admission_date": admission_date,
397
+ "discharge_date": discharge_date,
398
+ "onset_of_current_illness_or_symptom_date": onset_of_current_illness_or_symptom_date,
399
+ "last_menstrual_period_date": last_menstrual_period_date,
400
+ "delay_reason_code": delay_reason_code,
401
+ "patient": patient,
402
+ "patient_authorized_release": patient_authorized_release,
403
+ "schema_instances": schema_instances,
404
+ "vitals": vitals,
405
+ "existing_medications": existing_medications,
406
+ "rendering_provider": rendering_provider,
407
+ "service_facility": service_facility,
408
+ "guarantor": guarantor,
409
+ "billing_provider": billing_provider,
410
+ "supervising_provider": supervising_provider,
411
+ "referring_provider": referring_provider,
412
+ "initial_referring_provider": initial_referring_provider,
413
+ "referral_number": referral_number
414
+ }.reject do |_k, v|
415
+ v == OMIT
416
+ end
417
+ end
418
+
419
+ # Deserialize a JSON object to an instance of EncounterOptional
420
+ #
421
+ # @param json_object [String]
422
+ # @return [CandidApiClient::Encounters::V4::Types::EncounterOptional]
423
+ def self.from_json(json_object:)
424
+ struct = JSON.parse(json_object, object_class: OpenStruct)
425
+ parsed_json = JSON.parse(json_object)
426
+ benefits_assigned_to_provider = struct["benefits_assigned_to_provider"]
427
+ prior_authorization_number = struct["prior_authorization_number"]
428
+ external_id = struct["external_id"]
429
+ date_of_service = (Date.parse(parsed_json["date_of_service"]) unless parsed_json["date_of_service"].nil?)
430
+ tag_ids = struct["tag_ids"]
431
+ clinical_notes = parsed_json["clinical_notes"]&.map do |item|
432
+ item = item.to_json
433
+ CandidApiClient::Encounters::V4::Types::ClinicalNoteCategoryCreate.from_json(json_object: item)
434
+ end
435
+ if parsed_json["pay_to_address"].nil?
436
+ pay_to_address = nil
437
+ else
438
+ pay_to_address = parsed_json["pay_to_address"].to_json
439
+ pay_to_address = CandidApiClient::Commons::Types::StreetAddressLongZip.from_json(json_object: pay_to_address)
440
+ end
441
+ billable_status = struct["billable_status"]
442
+ responsible_party = struct["responsible_party"]
443
+ provider_accepts_assignment = struct["provider_accepts_assignment"]
444
+ synchronicity = struct["synchronicity"]
445
+ place_of_service_code = struct["place_of_service_code"]
446
+ appointment_type = struct["appointment_type"]
447
+ end_date_of_service = unless parsed_json["end_date_of_service"].nil?
448
+ Date.parse(parsed_json["end_date_of_service"])
449
+ end
450
+ if parsed_json["subscriber_primary"].nil?
451
+ subscriber_primary = nil
452
+ else
453
+ subscriber_primary = parsed_json["subscriber_primary"].to_json
454
+ subscriber_primary = CandidApiClient::Individual::Types::SubscriberCreate.from_json(json_object: subscriber_primary)
455
+ end
456
+ if parsed_json["subscriber_secondary"].nil?
457
+ subscriber_secondary = nil
458
+ else
459
+ subscriber_secondary = parsed_json["subscriber_secondary"].to_json
460
+ subscriber_secondary = CandidApiClient::Individual::Types::SubscriberCreate.from_json(json_object: subscriber_secondary)
461
+ end
462
+ additional_information = struct["additional_information"]
463
+ service_authorization_exception_code = struct["service_authorization_exception_code"]
464
+ admission_date = (Date.parse(parsed_json["admission_date"]) unless parsed_json["admission_date"].nil?)
465
+ discharge_date = (Date.parse(parsed_json["discharge_date"]) unless parsed_json["discharge_date"].nil?)
466
+ onset_of_current_illness_or_symptom_date = unless parsed_json["onset_of_current_illness_or_symptom_date"].nil?
467
+ Date.parse(parsed_json["onset_of_current_illness_or_symptom_date"])
468
+ end
469
+ last_menstrual_period_date = unless parsed_json["last_menstrual_period_date"].nil?
470
+ Date.parse(parsed_json["last_menstrual_period_date"])
471
+ end
472
+ delay_reason_code = struct["delay_reason_code"]
473
+ if parsed_json["patient"].nil?
474
+ patient = nil
475
+ else
476
+ patient = parsed_json["patient"].to_json
477
+ patient = CandidApiClient::Individual::Types::PatientUpdate.from_json(json_object: patient)
478
+ end
479
+ patient_authorized_release = struct["patient_authorized_release"]
480
+ schema_instances = parsed_json["schema_instances"]&.map do |item|
481
+ item = item.to_json
482
+ CandidApiClient::CustomSchemas::V1::Types::SchemaInstance.from_json(json_object: item)
483
+ end
484
+ if parsed_json["vitals"].nil?
485
+ vitals = nil
486
+ else
487
+ vitals = parsed_json["vitals"].to_json
488
+ vitals = CandidApiClient::Encounters::V4::Types::VitalsUpdate.from_json(json_object: vitals)
489
+ end
490
+ existing_medications = parsed_json["existing_medications"]&.map do |item|
491
+ item = item.to_json
492
+ CandidApiClient::Encounters::V4::Types::Medication.from_json(json_object: item)
493
+ end
494
+ if parsed_json["rendering_provider"].nil?
495
+ rendering_provider = nil
496
+ else
497
+ rendering_provider = parsed_json["rendering_provider"].to_json
498
+ rendering_provider = CandidApiClient::EncounterProviders::V2::Types::RenderingProviderUpdate.from_json(json_object: rendering_provider)
499
+ end
500
+ if parsed_json["service_facility"].nil?
501
+ service_facility = nil
502
+ else
503
+ service_facility = parsed_json["service_facility"].to_json
504
+ service_facility = CandidApiClient::ServiceFacility::Types::EncounterServiceFacilityUpdate.from_json(json_object: service_facility)
505
+ end
506
+ if parsed_json["guarantor"].nil?
507
+ guarantor = nil
508
+ else
509
+ guarantor = parsed_json["guarantor"].to_json
510
+ guarantor = CandidApiClient::Guarantor::V1::Types::GuarantorUpdate.from_json(json_object: guarantor)
511
+ end
512
+ if parsed_json["billing_provider"].nil?
513
+ billing_provider = nil
514
+ else
515
+ billing_provider = parsed_json["billing_provider"].to_json
516
+ billing_provider = CandidApiClient::EncounterProviders::V2::Types::BillingProviderUpdate.from_json(json_object: billing_provider)
517
+ end
518
+ if parsed_json["supervising_provider"].nil?
519
+ supervising_provider = nil
520
+ else
521
+ supervising_provider = parsed_json["supervising_provider"].to_json
522
+ supervising_provider = CandidApiClient::EncounterProviders::V2::Types::SupervisingProviderUpdate.from_json(json_object: supervising_provider)
523
+ end
524
+ if parsed_json["referring_provider"].nil?
525
+ referring_provider = nil
526
+ else
527
+ referring_provider = parsed_json["referring_provider"].to_json
528
+ referring_provider = CandidApiClient::EncounterProviders::V2::Types::ReferringProviderUpdate.from_json(json_object: referring_provider)
529
+ end
530
+ if parsed_json["initial_referring_provider"].nil?
531
+ initial_referring_provider = nil
532
+ else
533
+ initial_referring_provider = parsed_json["initial_referring_provider"].to_json
534
+ initial_referring_provider = CandidApiClient::EncounterProviders::V2::Types::InitialReferringProviderUpdate.from_json(json_object: initial_referring_provider)
535
+ end
536
+ referral_number = struct["referral_number"]
537
+ new(
538
+ benefits_assigned_to_provider: benefits_assigned_to_provider,
539
+ prior_authorization_number: prior_authorization_number,
540
+ external_id: external_id,
541
+ date_of_service: date_of_service,
542
+ tag_ids: tag_ids,
543
+ clinical_notes: clinical_notes,
544
+ pay_to_address: pay_to_address,
545
+ billable_status: billable_status,
546
+ responsible_party: responsible_party,
547
+ provider_accepts_assignment: provider_accepts_assignment,
548
+ synchronicity: synchronicity,
549
+ place_of_service_code: place_of_service_code,
550
+ appointment_type: appointment_type,
551
+ end_date_of_service: end_date_of_service,
552
+ subscriber_primary: subscriber_primary,
553
+ subscriber_secondary: subscriber_secondary,
554
+ additional_information: additional_information,
555
+ service_authorization_exception_code: service_authorization_exception_code,
556
+ admission_date: admission_date,
557
+ discharge_date: discharge_date,
558
+ onset_of_current_illness_or_symptom_date: onset_of_current_illness_or_symptom_date,
559
+ last_menstrual_period_date: last_menstrual_period_date,
560
+ delay_reason_code: delay_reason_code,
561
+ patient: patient,
562
+ patient_authorized_release: patient_authorized_release,
563
+ schema_instances: schema_instances,
564
+ vitals: vitals,
565
+ existing_medications: existing_medications,
566
+ rendering_provider: rendering_provider,
567
+ service_facility: service_facility,
568
+ guarantor: guarantor,
569
+ billing_provider: billing_provider,
570
+ supervising_provider: supervising_provider,
571
+ referring_provider: referring_provider,
572
+ initial_referring_provider: initial_referring_provider,
573
+ referral_number: referral_number,
574
+ additional_properties: struct
575
+ )
576
+ end
577
+
578
+ # Serialize an instance of EncounterOptional to a JSON object
579
+ #
580
+ # @return [String]
581
+ def to_json(*_args)
582
+ @_field_set&.to_json
583
+ end
584
+
585
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
586
+ # hash and check each fields type against the current object's property
587
+ # definitions.
588
+ #
589
+ # @param obj [Object]
590
+ # @return [Void]
591
+ def self.validate_raw(obj:)
592
+ obj.benefits_assigned_to_provider&.is_a?(Boolean) != false || raise("Passed value for field obj.benefits_assigned_to_provider is not the expected type, validation failed.")
593
+ obj.prior_authorization_number&.is_a?(String) != false || raise("Passed value for field obj.prior_authorization_number is not the expected type, validation failed.")
594
+ obj.external_id&.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
595
+ obj.date_of_service&.is_a?(Date) != false || raise("Passed value for field obj.date_of_service is not the expected type, validation failed.")
596
+ obj.tag_ids&.is_a?(Array) != false || raise("Passed value for field obj.tag_ids is not the expected type, validation failed.")
597
+ obj.clinical_notes&.is_a?(Array) != false || raise("Passed value for field obj.clinical_notes is not the expected type, validation failed.")
598
+ obj.pay_to_address.nil? || CandidApiClient::Commons::Types::StreetAddressLongZip.validate_raw(obj: obj.pay_to_address)
599
+ obj.billable_status&.is_a?(CandidApiClient::Encounters::V4::Types::BillableStatusType) != false || raise("Passed value for field obj.billable_status is not the expected type, validation failed.")
600
+ obj.responsible_party&.is_a?(CandidApiClient::Encounters::V4::Types::ResponsiblePartyType) != false || raise("Passed value for field obj.responsible_party is not the expected type, validation failed.")
601
+ obj.provider_accepts_assignment&.is_a?(Boolean) != false || raise("Passed value for field obj.provider_accepts_assignment is not the expected type, validation failed.")
602
+ obj.synchronicity&.is_a?(CandidApiClient::Encounters::V4::Types::SynchronicityType) != false || raise("Passed value for field obj.synchronicity is not the expected type, validation failed.")
603
+ 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.")
604
+ obj.appointment_type&.is_a?(String) != false || raise("Passed value for field obj.appointment_type is not the expected type, validation failed.")
605
+ 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.")
606
+ obj.subscriber_primary.nil? || CandidApiClient::Individual::Types::SubscriberCreate.validate_raw(obj: obj.subscriber_primary)
607
+ obj.subscriber_secondary.nil? || CandidApiClient::Individual::Types::SubscriberCreate.validate_raw(obj: obj.subscriber_secondary)
608
+ obj.additional_information&.is_a?(String) != false || raise("Passed value for field obj.additional_information is not the expected type, validation failed.")
609
+ obj.service_authorization_exception_code&.is_a?(CandidApiClient::Encounters::V4::Types::ServiceAuthorizationExceptionCode) != false || raise("Passed value for field obj.service_authorization_exception_code is not the expected type, validation failed.")
610
+ obj.admission_date&.is_a?(Date) != false || raise("Passed value for field obj.admission_date is not the expected type, validation failed.")
611
+ obj.discharge_date&.is_a?(Date) != false || raise("Passed value for field obj.discharge_date is not the expected type, validation failed.")
612
+ obj.onset_of_current_illness_or_symptom_date&.is_a?(Date) != false || raise("Passed value for field obj.onset_of_current_illness_or_symptom_date is not the expected type, validation failed.")
613
+ obj.last_menstrual_period_date&.is_a?(Date) != false || raise("Passed value for field obj.last_menstrual_period_date is not the expected type, validation failed.")
614
+ obj.delay_reason_code&.is_a?(CandidApiClient::Commons::Types::DelayReasonCode) != false || raise("Passed value for field obj.delay_reason_code is not the expected type, validation failed.")
615
+ obj.patient.nil? || CandidApiClient::Individual::Types::PatientUpdate.validate_raw(obj: obj.patient)
616
+ obj.patient_authorized_release&.is_a?(Boolean) != false || raise("Passed value for field obj.patient_authorized_release is not the expected type, validation failed.")
617
+ obj.schema_instances&.is_a?(Array) != false || raise("Passed value for field obj.schema_instances is not the expected type, validation failed.")
618
+ obj.vitals.nil? || CandidApiClient::Encounters::V4::Types::VitalsUpdate.validate_raw(obj: obj.vitals)
619
+ obj.existing_medications&.is_a?(Array) != false || raise("Passed value for field obj.existing_medications is not the expected type, validation failed.")
620
+ obj.rendering_provider.nil? || CandidApiClient::EncounterProviders::V2::Types::RenderingProviderUpdate.validate_raw(obj: obj.rendering_provider)
621
+ obj.service_facility.nil? || CandidApiClient::ServiceFacility::Types::EncounterServiceFacilityUpdate.validate_raw(obj: obj.service_facility)
622
+ obj.guarantor.nil? || CandidApiClient::Guarantor::V1::Types::GuarantorUpdate.validate_raw(obj: obj.guarantor)
623
+ obj.billing_provider.nil? || CandidApiClient::EncounterProviders::V2::Types::BillingProviderUpdate.validate_raw(obj: obj.billing_provider)
624
+ obj.supervising_provider.nil? || CandidApiClient::EncounterProviders::V2::Types::SupervisingProviderUpdate.validate_raw(obj: obj.supervising_provider)
625
+ obj.referring_provider.nil? || CandidApiClient::EncounterProviders::V2::Types::ReferringProviderUpdate.validate_raw(obj: obj.referring_provider)
626
+ obj.initial_referring_provider.nil? || CandidApiClient::EncounterProviders::V2::Types::InitialReferringProviderUpdate.validate_raw(obj: obj.initial_referring_provider)
627
+ obj.referral_number&.is_a?(String) != false || raise("Passed value for field obj.referral_number is not the expected type, validation failed.")
628
+ end
629
+ end
630
+ end
631
+ end
632
+ end
633
+ end