candidhealth 1.0.0 → 1.3.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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/lib/candidhealth/auth/client.rb +7 -7
  3. data/lib/candidhealth/auth/{v_2 → default}/client.rb +39 -13
  4. data/lib/candidhealth/auth/{v_2 → default}/types/auth_get_token_response.rb +3 -3
  5. data/lib/candidhealth/auth/default/types/invalid_content_type_error_type.rb +60 -0
  6. data/lib/candidhealth/auth/{v_2 → default}/types/too_many_requests_error_type.rb +3 -3
  7. data/lib/candidhealth/billing_notes/v_2/types/billing_note_base_optional.rb +62 -0
  8. data/lib/candidhealth/charge_capture/v_1/client.rb +504 -482
  9. data/lib/candidhealth/charge_capture/v_1/types/charge_capture.rb +17 -1
  10. data/lib/candidhealth/charge_capture/v_1/types/charge_capture_data.rb +173 -173
  11. data/lib/candidhealth/charge_capture/v_1/types/charge_capture_error.rb +26 -2
  12. data/lib/candidhealth/charge_capture_bundles/v_1/client.rb +58 -0
  13. data/lib/candidhealth/claim_submission/v_1/types/claim_submission_record_create_optional.rb +100 -0
  14. data/lib/candidhealth/claim_submission/v_1/types/external_claim_submission_create_optional.rb +101 -0
  15. data/lib/candidhealth/commons/types/phone_number_optional.rb +71 -0
  16. data/lib/candidhealth/commons/types/procedure_modifier.rb +2 -0
  17. data/lib/candidhealth/commons/types/street_address_long_zip_optional.rb +107 -0
  18. data/lib/candidhealth/custom_schemas/v_1/types/schema_instance_optional.rb +78 -0
  19. data/lib/candidhealth/diagnoses/client.rb +23 -4
  20. data/lib/candidhealth/diagnoses/types/diagnosis.rb +21 -2
  21. data/lib/candidhealth/diagnoses/types/diagnosis_create.rb +25 -2
  22. data/lib/candidhealth/diagnoses/types/diagnosis_create_optional.rb +126 -0
  23. data/lib/candidhealth/diagnoses/types/standalone_diagnosis_create.rb +22 -2
  24. data/lib/candidhealth/encounter_providers/v_2/types/ordering_provider_optional.rb +123 -0
  25. data/lib/candidhealth/encounters/v_4/client.rb +214 -208
  26. data/lib/candidhealth/encounters/v_4/types/claim_supplemental_information_optional.rb +86 -0
  27. data/lib/candidhealth/encounters/v_4/types/clinical_note_category_create_optional.rb +78 -0
  28. data/lib/candidhealth/encounters/v_4/types/clinical_note_optional.rb +93 -0
  29. data/lib/candidhealth/encounters/v_4/types/encounter.rb +16 -4
  30. data/lib/candidhealth/encounters/v_4/types/encounter_create_from_pre_encounter.rb +4 -2
  31. data/lib/candidhealth/encounters/v_4/types/encounter_deep_optional.rb +780 -0
  32. data/lib/candidhealth/encounters/v_4/types/encounter_optional.rb +1 -139
  33. data/lib/candidhealth/encounters/v_4/types/epsdt_referral_optional.rb +85 -0
  34. data/lib/candidhealth/encounters/v_4/types/intake_question_optional.rb +84 -0
  35. data/lib/candidhealth/encounters/v_4/types/intervention_optional.rb +114 -0
  36. data/lib/candidhealth/encounters/v_4/types/lab_optional.rb +80 -0
  37. data/lib/candidhealth/encounters/v_4/types/medication_optional.rb +108 -0
  38. data/lib/candidhealth/encounters/v_4/types/patient_history_category_optional.rb +78 -0
  39. data/lib/candidhealth/guarantor/v_1/types/guarantor_optional.rb +144 -0
  40. data/lib/candidhealth/individual/types/individual_base_optional.rb +78 -0
  41. data/lib/candidhealth/individual/types/patient_non_insurance_payer_info_create_optional.rb +89 -0
  42. data/lib/candidhealth/individual/types/patient_update_with_optional_address.rb +8 -8
  43. data/lib/candidhealth/individual/types/subscriber_base_optional.rb +118 -0
  44. data/lib/candidhealth/individual/types/subscriber_create_optional.rb +132 -0
  45. data/lib/candidhealth/insurance_adjudications/v_1/client.rb +2 -0
  46. data/lib/candidhealth/insurance_adjudications/v_1/types/insurance_adjudication_create.rb +9 -1
  47. data/lib/candidhealth/insurance_cards/v_2/types/insurance_card_create_optional.rb +167 -0
  48. data/lib/candidhealth/pre_encounter/patients/v_1/types/authorization.rb +13 -1
  49. data/lib/candidhealth/service_lines/v_2/types/drug_identification_optional.rb +126 -0
  50. data/lib/candidhealth/service_lines/v_2/types/service_line_create_optional.rb +239 -0
  51. data/lib/candidhealth/service_lines/v_2/types/test_result_optional.rb +73 -0
  52. data/lib/candidhealth/write_offs/v_1/types/insurance_write_off_reason.rb +1 -0
  53. data/lib/candidhealth/write_offs/v_1/types/patient_write_off_reason.rb +1 -0
  54. data/lib/candidhealth/yes_no_indicator/types/yes_no_indicator.rb +14 -0
  55. data/lib/core/oauth.rb +2 -2
  56. data/lib/requests.rb +2 -2
  57. data/lib/types_export.rb +32 -3
  58. metadata +34 -5
@@ -0,0 +1,780 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../diagnoses/types/diagnosis_create_optional"
4
+ require_relative "clinical_note_category_create_optional"
5
+ require_relative "claim_supplemental_information_optional"
6
+ require_relative "epsdt_referral_optional"
7
+ require_relative "medication_optional"
8
+ require_relative "../../../guarantor/v_1/types/guarantor_optional"
9
+ require_relative "../../../individual/types/subscriber_create_optional"
10
+ require_relative "intervention_optional"
11
+ require_relative "../../../custom_schemas/v_1/types/schema_instance_optional"
12
+ require_relative "../../../claim_submission/v_1/types/external_claim_submission_create_optional"
13
+ require_relative "../../../service_lines/v_2/types/service_line_create_optional"
14
+ require_relative "patient_history_category_optional"
15
+ require_relative "../../../billing_notes/v_2/types/billing_note_base_optional"
16
+ require_relative "../../../individual/types/patient_update_with_optional_address"
17
+ require_relative "../../../service_facility/types/encounter_service_facility_update_with_optional_address"
18
+ require_relative "../../../encounter_providers/v_2/types/rendering_provider_update_with_optional_address"
19
+ require_relative "../../../encounter_providers/v_2/types/initial_referring_provider_update_with_optional_address"
20
+ require_relative "../../../encounter_providers/v_2/types/referring_provider_update_with_optional_address"
21
+ require_relative "../../../encounter_providers/v_2/types/supervising_provider_update_with_optional_address"
22
+ require_relative "../../../encounter_providers/v_2/types/billing_provider_update_with_optional_address"
23
+ require_relative "../../../commons/types/street_address_short_zip_optional"
24
+ require "date"
25
+ require_relative "billable_status_type"
26
+ require_relative "responsible_party_type"
27
+ require_relative "synchronicity_type"
28
+ require_relative "../../../commons/types/facility_type_code"
29
+ require_relative "service_authorization_exception_code"
30
+ require_relative "../../../commons/types/delay_reason_code"
31
+ require_relative "vitals_update"
32
+ require "ostruct"
33
+ require "json"
34
+
35
+ module CandidApiClient
36
+ module Encounters
37
+ module V4
38
+ module Types
39
+ class EncounterDeepOptional
40
+ # @return [Array<CandidApiClient::Diagnoses::Types::DiagnosisCreateOptional>] Ideally, this field should contain no more than 12 diagnoses. However, more
41
+ # diagnoses
42
+ # may be submitted at this time, and coders will later prioritize the 12 that will
43
+ # be
44
+ # submitted to the payor.
45
+ attr_reader :diagnoses
46
+ # @return [Array<CandidApiClient::Encounters::V4::Types::ClinicalNoteCategoryCreateOptional>] Holds a collection of clinical observations made by healthcare providers during
47
+ # patient encounters. Please note that medical records for appeals should be sent
48
+ # using the Encounter Attachments API.
49
+ attr_reader :clinical_notes
50
+ # @return [Array<CandidApiClient::Encounters::V4::Types::ClaimSupplementalInformationOptional>] Refers to Loop 2300 - Segment PWK on the 837P form. No more than 10 entries are
51
+ # permitted.
52
+ attr_reader :claim_supplemental_information
53
+ # @return [CandidApiClient::Encounters::V4::Types::EpsdtReferralOptional] Refers Box 24H on the CMS1500 form and Loop 2300 CRC - EPSDT Referral on the
54
+ # 837P form
55
+ attr_reader :epsdt_referral
56
+ # @return [Array<CandidApiClient::Encounters::V4::Types::MedicationOptional>] Existing medications that should be on the encounter.
57
+ # Note all current existing medications on encounter will be overridden with this
58
+ # list.
59
+ attr_reader :existing_medications
60
+ # @return [CandidApiClient::Guarantor::V1::Types::GuarantorOptional] Personal and contact info for the guarantor of the patient responsibility.
61
+ attr_reader :guarantor
62
+ # @return [CandidApiClient::Individual::Types::SubscriberCreateOptional] Contains details of the primary insurance subscriber.
63
+ attr_reader :subscriber_primary
64
+ # @return [CandidApiClient::Individual::Types::SubscriberCreateOptional] Contains details of the secondary insurance subscriber.
65
+ attr_reader :subscriber_secondary
66
+ # @return [CandidApiClient::Individual::Types::SubscriberCreateOptional] Contains details of the tertiary insurance subscriber.
67
+ attr_reader :subscriber_tertiary
68
+ # @return [Array<CandidApiClient::Encounters::V4::Types::InterventionOptional>]
69
+ attr_reader :interventions
70
+ # @return [Array<CandidApiClient::CustomSchemas::V1::Types::SchemaInstanceOptional>] Key-value pairs that must adhere to a schema created via the Custom Schema API.
71
+ # Multiple schema
72
+ # instances cannot be created for the same schema on an encounter. Updating schema
73
+ # instances utilizes PUT
74
+ # semantics, so the schema instances on the encounter will be set to whatever
75
+ # inputs are provided. If null
76
+ # is provided as an input, then the encounter's schema instances will be cleared.
77
+ attr_reader :schema_instances
78
+ # @return [CandidApiClient::ClaimSubmission::V1::Types::ExternalClaimSubmissionCreateOptional] ***This field is in beta.***
79
+ # To be included for claims that have been submitted outside of Candid.
80
+ # Candid supports posting remits and payments to these claims and working them
81
+ # in-platform (e.g. editing, resubmitting).
82
+ attr_reader :external_claim_submission
83
+ # @return [Array<CandidApiClient::ServiceLines::V2::Types::ServiceLineCreateOptional>] Each service line must be linked to a diagnosis. Concretely,
84
+ # `service_line.diagnosis_pointers`must contain at least one entry which should be
85
+ # in bounds of the diagnoses list field.
86
+ attr_reader :service_lines
87
+ # @return [Array<CandidApiClient::Encounters::V4::Types::PatientHistoryCategoryOptional>]
88
+ attr_reader :patient_histories
89
+ # @return [Array<CandidApiClient::BillingNotes::V2::Types::BillingNoteBaseOptional>] Spot to store misc, human-readable, notes about this encounter to be
90
+ # used in the billing process.
91
+ attr_reader :billing_notes
92
+ # @return [CandidApiClient::Individual::Types::PatientUpdateWithOptionalAddress] Contains the identification information of the individual receiving medical
93
+ # services.
94
+ attr_reader :patient
95
+ # @return [CandidApiClient::ServiceFacility::Types::EncounterServiceFacilityUpdateWithOptionalAddress] Encounter Service facility is typically the location a medical service was
96
+ # rendered, such as a provider office or hospital. For telehealth, service
97
+ # facility can represent the provider's location when the service was delivered
98
+ # (e.g., home), or the location where an in-person visit would have taken place,
99
+ # whichever is easier to identify. If the provider is in-network, service facility
100
+ # may be defined in payer contracts. Box 32 on the CMS-1500 claim form. Note that
101
+ # for an in-network claim to be successfully adjudicated, the service facility
102
+ # address listed on claims must match what was provided to the payer during the
103
+ # credentialing process.
104
+ attr_reader :service_facility
105
+ # @return [CandidApiClient::EncounterProviders::V2::Types::RenderingProviderUpdateWithOptionalAddress] The rendering provider is the practitioner -- physician, nurse practitioner,
106
+ # etc. -- performing the service. For telehealth services, the rendering provider
107
+ # performs the visit, asynchronous communication, or other service. The rendering
108
+ # provider address should generally be the same as the service facility address.
109
+ attr_reader :rendering_provider
110
+ # @return [CandidApiClient::EncounterProviders::V2::Types::InitialReferringProviderUpdateWithOptionalAddress] The second iteration of Loop ID-2310. Use code "P3 - Primary Care Provider" in
111
+ # this loop to
112
+ # indicate the initial referral from the primary care provider or whatever
113
+ # provider wrote the initial referral for this patient's episode of care being
114
+ # billed/reported in this transaction.
115
+ attr_reader :initial_referring_provider
116
+ # @return [CandidApiClient::EncounterProviders::V2::Types::ReferringProviderUpdateWithOptionalAddress] The final provider who referred the services that were rendered.
117
+ # All physicians who order services or refer Medicare beneficiaries must
118
+ # report this data.
119
+ attr_reader :referring_provider
120
+ # @return [CandidApiClient::EncounterProviders::V2::Types::SupervisingProviderUpdateWithOptionalAddress] Required when the rendering provider is supervised by a physician. If not
121
+ # required by this implementation guide, do not send.
122
+ attr_reader :supervising_provider
123
+ # @return [CandidApiClient::EncounterProviders::V2::Types::BillingProviderUpdateWithOptionalAddress] The billing provider is the provider or business entity submitting the claim.
124
+ # Billing provider may be, but is not necessarily, the same person/NPI as the
125
+ # rendering provider. From a payer's perspective, this represents the person or
126
+ # entity being reimbursed. When a contract exists with the target payer, the
127
+ # billing provider should be the entity contracted with the payer. In some
128
+ # circumstances, this will be an individual provider. In that case, submit that
129
+ # provider's NPI and the tax ID (TIN) that the provider gave to the payer during
130
+ # contracting. In other cases, the billing entity will be a medical group. If so,
131
+ # submit the group NPI and the group's tax ID. Box 33 on the CMS-1500 claim form.
132
+ attr_reader :billing_provider
133
+ # @return [CandidApiClient::Commons::Types::StreetAddressShortZipOptional] Specifies the address to which payments for the claim should be sent.
134
+ attr_reader :pay_to_address
135
+ # @return [Boolean] Whether this patient has authorized insurance payments to be made to you, not
136
+ # them. If false, patient may receive reimbursement. Box 13 on the CMS-1500 claim
137
+ # form.
138
+ attr_reader :benefits_assigned_to_provider
139
+ # @return [String] Box 23 on the CMS-1500 claim form.
140
+ attr_reader :prior_authorization_number
141
+ # @return [String] A client-specified unique ID to associate with this encounter;
142
+ # for example, your internal encounter ID or a Dr. Chrono encounter ID.
143
+ # This field should not contain PHI.
144
+ attr_reader :external_id
145
+ # @return [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-24.
146
+ # This date must be the local date in the timezone where the service occurred.
147
+ # Box 24a on the CMS-1500 claim form.
148
+ # If service occurred over a range of dates, this should be the start date.
149
+ # If service lines have distinct date_of_service values, updating the encounter's
150
+ # date_of_service will fail. If all service line date_of_service values are the
151
+ # same, updating the encounter's date_of_service will update all service line
152
+ # date_of_service values.
153
+ attr_reader :date_of_service
154
+ # @return [Array<String>] Names of tags that should be on the encounter. Note all tags on encounter will
155
+ # be overridden with this list.
156
+ attr_reader :tag_ids
157
+ # @return [CandidApiClient::Encounters::V4::Types::BillableStatusType] Defines if the Encounter is to be billed by Candid to the responsible_party.
158
+ # Examples for when this should be set to NOT_BILLABLE include if the Encounter
159
+ # has not occurred yet or if there is no intention of ever billing the
160
+ # responsible_party.
161
+ attr_reader :billable_status
162
+ # @return [CandidApiClient::Encounters::V4::Types::ResponsiblePartyType] Defines the party to be billed with the initial balance owed on the claim. Use
163
+ # SELF_PAY if you intend to bill self pay/cash pay.
164
+ attr_reader :responsible_party
165
+ # @return [Boolean] Whether you have accepted the patient's authorization for insurance payments to
166
+ # be made to you, not them. Box 27 on the CMS-1500 claim form.
167
+ attr_reader :provider_accepts_assignment
168
+ # @return [CandidApiClient::Encounters::V4::Types::SynchronicityType] Whether or not this was a synchronous or asynchronous encounter. Asynchronous
169
+ # encounters occur when providers and patients communicate online using forms,
170
+ # instant messaging, or other pre-recorded digital mediums. Synchronous encounters
171
+ # occur in live, real-time settings where the patient interacts directly with the
172
+ # provider, such as over video or a phone call.
173
+ attr_reader :synchronicity
174
+ # @return [CandidApiClient::Commons::Types::FacilityTypeCode] Box 24B on the CMS-1500 claim form. 837p Loop2300, CLM-05-1. 02 for
175
+ # telemedicine, 11 for in-person. Full list
176
+ # //www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
177
+ attr_reader :place_of_service_code
178
+ # @return [String] Human-readable description of the appointment type (ex: "Acupuncture -
179
+ # Headaches").
180
+ attr_reader :appointment_type
181
+ # @return [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-25.
182
+ # This date must be the local date in the timezone where the service occurred.
183
+ # If omitted, the Encounter is assumed to be for a single day.
184
+ # Must not be temporally before the date_of_service field.
185
+ # If service lines have distinct end_date_of_service values, updating the
186
+ # encounter's end_date_of_service will fail. If all service line
187
+ # end_date_of_service values are the same, updating the encounter's
188
+ # end_date_of_service will update all service line date_of_service values.
189
+ attr_reader :end_date_of_service
190
+ # @return [String] Defines additional information on the claim needed by the payer.
191
+ # Box 19 on the CMS-1500 claim form.
192
+ attr_reader :additional_information
193
+ # @return [CandidApiClient::Encounters::V4::Types::ServiceAuthorizationExceptionCode] 837p Loop2300 REF*4N
194
+ # Required when mandated by government law or regulation to obtain authorization
195
+ # for specific service(s) but, for the
196
+ # reasons listed in one of the enum values of ServiceAuthorizationExceptionCode,
197
+ # the service was performed without
198
+ # obtaining the authorization.
199
+ attr_reader :service_authorization_exception_code
200
+ # @return [Date] 837p Loop2300 DTP*435, CMS-1500 Box 18
201
+ # Required on all ambulance claims when the patient was known to be admitted to
202
+ # the hospital.
203
+ # OR
204
+ # Required on all claims involving inpatient medical visits.
205
+ attr_reader :admission_date
206
+ # @return [Date] 837p Loop2300 DTP*096, CMS-1500 Box 18
207
+ # Required for inpatient claims when the patient was discharged from the facility
208
+ # and the discharge date is known.
209
+ attr_reader :discharge_date
210
+ # @return [Date] 837p Loop2300 DTP*431, CMS-1500 Box 14
211
+ # Required for the initial medical service or visit performed in response to a
212
+ # medical emergency when the date is available and is different than the date of
213
+ # service.
214
+ # OR
215
+ # This date is the onset of acute symptoms for the current illness or condition.
216
+ attr_reader :onset_of_current_illness_or_symptom_date
217
+ # @return [Date] 837p Loop2300 DTP*484, CMS-1500 Box 14
218
+ # Required when, in the judgment of the provider, the services on this claim are
219
+ # related to the patient's pregnancy.de
220
+ attr_reader :last_menstrual_period_date
221
+ # @return [CandidApiClient::Commons::Types::DelayReasonCode] 837i Loop2300, CLM-1300 Box 20
222
+ # Code indicating the reason why a request was delayed
223
+ attr_reader :delay_reason_code
224
+ # @return [Boolean] Whether this patient has authorized the release of medical information
225
+ # for billing purpose.
226
+ # Box 12 on the CMS-1500 claim form.
227
+ attr_reader :patient_authorized_release
228
+ # @return [CandidApiClient::Encounters::V4::Types::VitalsUpdate] If a vitals entity already exists for the encounter, then all values will be
229
+ # updated to the provided values.
230
+ # Otherwise, a new vitals object will be created for the encounter.
231
+ attr_reader :vitals
232
+ # @return [String] Refers to REF*9F on the 837p. Value cannot be greater than 50 characters.
233
+ attr_reader :referral_number
234
+ # @return [String] When Medicaid is billed as the secondary payer the Carrier Code is used to
235
+ # identify the primary payer. This is required for certain states.
236
+ attr_reader :secondary_payer_carrier_code
237
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
238
+ attr_reader :additional_properties
239
+ # @return [Object]
240
+ attr_reader :_field_set
241
+ protected :_field_set
242
+
243
+ OMIT = Object.new
244
+
245
+ # @param diagnoses [Array<CandidApiClient::Diagnoses::Types::DiagnosisCreateOptional>] Ideally, this field should contain no more than 12 diagnoses. However, more
246
+ # diagnoses
247
+ # may be submitted at this time, and coders will later prioritize the 12 that will
248
+ # be
249
+ # submitted to the payor.
250
+ # @param clinical_notes [Array<CandidApiClient::Encounters::V4::Types::ClinicalNoteCategoryCreateOptional>] Holds a collection of clinical observations made by healthcare providers during
251
+ # patient encounters. Please note that medical records for appeals should be sent
252
+ # using the Encounter Attachments API.
253
+ # @param claim_supplemental_information [Array<CandidApiClient::Encounters::V4::Types::ClaimSupplementalInformationOptional>] Refers to Loop 2300 - Segment PWK on the 837P form. No more than 10 entries are
254
+ # permitted.
255
+ # @param epsdt_referral [CandidApiClient::Encounters::V4::Types::EpsdtReferralOptional] Refers Box 24H on the CMS1500 form and Loop 2300 CRC - EPSDT Referral on the
256
+ # 837P form
257
+ # @param existing_medications [Array<CandidApiClient::Encounters::V4::Types::MedicationOptional>] Existing medications that should be on the encounter.
258
+ # Note all current existing medications on encounter will be overridden with this
259
+ # list.
260
+ # @param guarantor [CandidApiClient::Guarantor::V1::Types::GuarantorOptional] Personal and contact info for the guarantor of the patient responsibility.
261
+ # @param subscriber_primary [CandidApiClient::Individual::Types::SubscriberCreateOptional] Contains details of the primary insurance subscriber.
262
+ # @param subscriber_secondary [CandidApiClient::Individual::Types::SubscriberCreateOptional] Contains details of the secondary insurance subscriber.
263
+ # @param subscriber_tertiary [CandidApiClient::Individual::Types::SubscriberCreateOptional] Contains details of the tertiary insurance subscriber.
264
+ # @param interventions [Array<CandidApiClient::Encounters::V4::Types::InterventionOptional>]
265
+ # @param schema_instances [Array<CandidApiClient::CustomSchemas::V1::Types::SchemaInstanceOptional>] Key-value pairs that must adhere to a schema created via the Custom Schema API.
266
+ # Multiple schema
267
+ # instances cannot be created for the same schema on an encounter. Updating schema
268
+ # instances utilizes PUT
269
+ # semantics, so the schema instances on the encounter will be set to whatever
270
+ # inputs are provided. If null
271
+ # is provided as an input, then the encounter's schema instances will be cleared.
272
+ # @param external_claim_submission [CandidApiClient::ClaimSubmission::V1::Types::ExternalClaimSubmissionCreateOptional] ***This field is in beta.***
273
+ # To be included for claims that have been submitted outside of Candid.
274
+ # Candid supports posting remits and payments to these claims and working them
275
+ # in-platform (e.g. editing, resubmitting).
276
+ # @param service_lines [Array<CandidApiClient::ServiceLines::V2::Types::ServiceLineCreateOptional>] Each service line must be linked to a diagnosis. Concretely,
277
+ # `service_line.diagnosis_pointers`must contain at least one entry which should be
278
+ # in bounds of the diagnoses list field.
279
+ # @param patient_histories [Array<CandidApiClient::Encounters::V4::Types::PatientHistoryCategoryOptional>]
280
+ # @param billing_notes [Array<CandidApiClient::BillingNotes::V2::Types::BillingNoteBaseOptional>] Spot to store misc, human-readable, notes about this encounter to be
281
+ # used in the billing process.
282
+ # @param patient [CandidApiClient::Individual::Types::PatientUpdateWithOptionalAddress] Contains the identification information of the individual receiving medical
283
+ # services.
284
+ # @param service_facility [CandidApiClient::ServiceFacility::Types::EncounterServiceFacilityUpdateWithOptionalAddress] Encounter Service facility is typically the location a medical service was
285
+ # rendered, such as a provider office or hospital. For telehealth, service
286
+ # facility can represent the provider's location when the service was delivered
287
+ # (e.g., home), or the location where an in-person visit would have taken place,
288
+ # whichever is easier to identify. If the provider is in-network, service facility
289
+ # may be defined in payer contracts. Box 32 on the CMS-1500 claim form. Note that
290
+ # for an in-network claim to be successfully adjudicated, the service facility
291
+ # address listed on claims must match what was provided to the payer during the
292
+ # credentialing process.
293
+ # @param rendering_provider [CandidApiClient::EncounterProviders::V2::Types::RenderingProviderUpdateWithOptionalAddress] The rendering provider is the practitioner -- physician, nurse practitioner,
294
+ # etc. -- performing the service. For telehealth services, the rendering provider
295
+ # performs the visit, asynchronous communication, or other service. The rendering
296
+ # provider address should generally be the same as the service facility address.
297
+ # @param initial_referring_provider [CandidApiClient::EncounterProviders::V2::Types::InitialReferringProviderUpdateWithOptionalAddress] The second iteration of Loop ID-2310. Use code "P3 - Primary Care Provider" in
298
+ # this loop to
299
+ # indicate the initial referral from the primary care provider or whatever
300
+ # provider wrote the initial referral for this patient's episode of care being
301
+ # billed/reported in this transaction.
302
+ # @param referring_provider [CandidApiClient::EncounterProviders::V2::Types::ReferringProviderUpdateWithOptionalAddress] The final provider who referred the services that were rendered.
303
+ # All physicians who order services or refer Medicare beneficiaries must
304
+ # report this data.
305
+ # @param supervising_provider [CandidApiClient::EncounterProviders::V2::Types::SupervisingProviderUpdateWithOptionalAddress] Required when the rendering provider is supervised by a physician. If not
306
+ # required by this implementation guide, do not send.
307
+ # @param billing_provider [CandidApiClient::EncounterProviders::V2::Types::BillingProviderUpdateWithOptionalAddress] The billing provider is the provider or business entity submitting the claim.
308
+ # Billing provider may be, but is not necessarily, the same person/NPI as the
309
+ # rendering provider. From a payer's perspective, this represents the person or
310
+ # entity being reimbursed. When a contract exists with the target payer, the
311
+ # billing provider should be the entity contracted with the payer. In some
312
+ # circumstances, this will be an individual provider. In that case, submit that
313
+ # provider's NPI and the tax ID (TIN) that the provider gave to the payer during
314
+ # contracting. In other cases, the billing entity will be a medical group. If so,
315
+ # submit the group NPI and the group's tax ID. Box 33 on the CMS-1500 claim form.
316
+ # @param pay_to_address [CandidApiClient::Commons::Types::StreetAddressShortZipOptional] Specifies the address to which payments for the claim should be sent.
317
+ # @param benefits_assigned_to_provider [Boolean] Whether this patient has authorized insurance payments to be made to you, not
318
+ # them. If false, patient may receive reimbursement. Box 13 on the CMS-1500 claim
319
+ # form.
320
+ # @param prior_authorization_number [String] Box 23 on the CMS-1500 claim form.
321
+ # @param external_id [String] A client-specified unique ID to associate with this encounter;
322
+ # for example, your internal encounter ID or a Dr. Chrono encounter ID.
323
+ # This field should not contain PHI.
324
+ # @param date_of_service [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-24.
325
+ # This date must be the local date in the timezone where the service occurred.
326
+ # Box 24a on the CMS-1500 claim form.
327
+ # If service occurred over a range of dates, this should be the start date.
328
+ # If service lines have distinct date_of_service values, updating the encounter's
329
+ # date_of_service will fail. If all service line date_of_service values are the
330
+ # same, updating the encounter's date_of_service will update all service line
331
+ # date_of_service values.
332
+ # @param tag_ids [Array<String>] Names of tags that should be on the encounter. Note all tags on encounter will
333
+ # be overridden with this list.
334
+ # @param billable_status [CandidApiClient::Encounters::V4::Types::BillableStatusType] Defines if the Encounter is to be billed by Candid to the responsible_party.
335
+ # Examples for when this should be set to NOT_BILLABLE include if the Encounter
336
+ # has not occurred yet or if there is no intention of ever billing the
337
+ # responsible_party.
338
+ # @param responsible_party [CandidApiClient::Encounters::V4::Types::ResponsiblePartyType] Defines the party to be billed with the initial balance owed on the claim. Use
339
+ # SELF_PAY if you intend to bill self pay/cash pay.
340
+ # @param provider_accepts_assignment [Boolean] Whether you have accepted the patient's authorization for insurance payments to
341
+ # be made to you, not them. Box 27 on the CMS-1500 claim form.
342
+ # @param synchronicity [CandidApiClient::Encounters::V4::Types::SynchronicityType] Whether or not this was a synchronous or asynchronous encounter. Asynchronous
343
+ # encounters occur when providers and patients communicate online using forms,
344
+ # instant messaging, or other pre-recorded digital mediums. Synchronous encounters
345
+ # occur in live, real-time settings where the patient interacts directly with the
346
+ # provider, such as over video or a phone call.
347
+ # @param place_of_service_code [CandidApiClient::Commons::Types::FacilityTypeCode] Box 24B on the CMS-1500 claim form. 837p Loop2300, CLM-05-1. 02 for
348
+ # telemedicine, 11 for in-person. Full list
349
+ # //www.cms.gov/Medicare/Coding/place-of-service-codes/Place_of_Service_Code_Set).
350
+ # @param appointment_type [String] Human-readable description of the appointment type (ex: "Acupuncture -
351
+ # Headaches").
352
+ # @param end_date_of_service [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-25.
353
+ # This date must be the local date in the timezone where the service occurred.
354
+ # If omitted, the Encounter is assumed to be for a single day.
355
+ # Must not be temporally before the date_of_service field.
356
+ # If service lines have distinct end_date_of_service values, updating the
357
+ # encounter's end_date_of_service will fail. If all service line
358
+ # end_date_of_service values are the same, updating the encounter's
359
+ # end_date_of_service will update all service line date_of_service values.
360
+ # @param additional_information [String] Defines additional information on the claim needed by the payer.
361
+ # Box 19 on the CMS-1500 claim form.
362
+ # @param service_authorization_exception_code [CandidApiClient::Encounters::V4::Types::ServiceAuthorizationExceptionCode] 837p Loop2300 REF*4N
363
+ # Required when mandated by government law or regulation to obtain authorization
364
+ # for specific service(s) but, for the
365
+ # reasons listed in one of the enum values of ServiceAuthorizationExceptionCode,
366
+ # the service was performed without
367
+ # obtaining the authorization.
368
+ # @param admission_date [Date] 837p Loop2300 DTP*435, CMS-1500 Box 18
369
+ # Required on all ambulance claims when the patient was known to be admitted to
370
+ # the hospital.
371
+ # OR
372
+ # Required on all claims involving inpatient medical visits.
373
+ # @param discharge_date [Date] 837p Loop2300 DTP*096, CMS-1500 Box 18
374
+ # Required for inpatient claims when the patient was discharged from the facility
375
+ # and the discharge date is known.
376
+ # @param onset_of_current_illness_or_symptom_date [Date] 837p Loop2300 DTP*431, CMS-1500 Box 14
377
+ # Required for the initial medical service or visit performed in response to a
378
+ # medical emergency when the date is available and is different than the date of
379
+ # service.
380
+ # OR
381
+ # This date is the onset of acute symptoms for the current illness or condition.
382
+ # @param last_menstrual_period_date [Date] 837p Loop2300 DTP*484, CMS-1500 Box 14
383
+ # Required when, in the judgment of the provider, the services on this claim are
384
+ # related to the patient's pregnancy.de
385
+ # @param delay_reason_code [CandidApiClient::Commons::Types::DelayReasonCode] 837i Loop2300, CLM-1300 Box 20
386
+ # Code indicating the reason why a request was delayed
387
+ # @param patient_authorized_release [Boolean] Whether this patient has authorized the release of medical information
388
+ # for billing purpose.
389
+ # Box 12 on the CMS-1500 claim form.
390
+ # @param vitals [CandidApiClient::Encounters::V4::Types::VitalsUpdate] If a vitals entity already exists for the encounter, then all values will be
391
+ # updated to the provided values.
392
+ # Otherwise, a new vitals object will be created for the encounter.
393
+ # @param referral_number [String] Refers to REF*9F on the 837p. Value cannot be greater than 50 characters.
394
+ # @param secondary_payer_carrier_code [String] When Medicaid is billed as the secondary payer the Carrier Code is used to
395
+ # identify the primary payer. This is required for certain states.
396
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
397
+ # @return [CandidApiClient::Encounters::V4::Types::EncounterDeepOptional]
398
+ def initialize(diagnoses: OMIT, clinical_notes: OMIT, claim_supplemental_information: OMIT,
399
+ epsdt_referral: OMIT, existing_medications: OMIT, guarantor: OMIT, subscriber_primary: OMIT, subscriber_secondary: OMIT, subscriber_tertiary: OMIT, interventions: OMIT, schema_instances: OMIT, external_claim_submission: OMIT, service_lines: OMIT, patient_histories: OMIT, billing_notes: OMIT, patient: OMIT, service_facility: OMIT, rendering_provider: OMIT, initial_referring_provider: OMIT, referring_provider: OMIT, supervising_provider: OMIT, billing_provider: OMIT, pay_to_address: OMIT, benefits_assigned_to_provider: OMIT, prior_authorization_number: OMIT, external_id: OMIT, date_of_service: OMIT, tag_ids: 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, 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_authorized_release: OMIT, vitals: OMIT, referral_number: OMIT, secondary_payer_carrier_code: OMIT, additional_properties: nil)
400
+ @diagnoses = diagnoses if diagnoses != OMIT
401
+ @clinical_notes = clinical_notes if clinical_notes != OMIT
402
+ @claim_supplemental_information = claim_supplemental_information if claim_supplemental_information != OMIT
403
+ @epsdt_referral = epsdt_referral if epsdt_referral != OMIT
404
+ @existing_medications = existing_medications if existing_medications != OMIT
405
+ @guarantor = guarantor if guarantor != OMIT
406
+ @subscriber_primary = subscriber_primary if subscriber_primary != OMIT
407
+ @subscriber_secondary = subscriber_secondary if subscriber_secondary != OMIT
408
+ @subscriber_tertiary = subscriber_tertiary if subscriber_tertiary != OMIT
409
+ @interventions = interventions if interventions != OMIT
410
+ @schema_instances = schema_instances if schema_instances != OMIT
411
+ @external_claim_submission = external_claim_submission if external_claim_submission != OMIT
412
+ @service_lines = service_lines if service_lines != OMIT
413
+ @patient_histories = patient_histories if patient_histories != OMIT
414
+ @billing_notes = billing_notes if billing_notes != OMIT
415
+ @patient = patient if patient != OMIT
416
+ @service_facility = service_facility if service_facility != OMIT
417
+ @rendering_provider = rendering_provider if rendering_provider != OMIT
418
+ @initial_referring_provider = initial_referring_provider if initial_referring_provider != OMIT
419
+ @referring_provider = referring_provider if referring_provider != OMIT
420
+ @supervising_provider = supervising_provider if supervising_provider != OMIT
421
+ @billing_provider = billing_provider if billing_provider != OMIT
422
+ @pay_to_address = pay_to_address if pay_to_address != OMIT
423
+ @benefits_assigned_to_provider = benefits_assigned_to_provider if benefits_assigned_to_provider != OMIT
424
+ @prior_authorization_number = prior_authorization_number if prior_authorization_number != OMIT
425
+ @external_id = external_id if external_id != OMIT
426
+ @date_of_service = date_of_service if date_of_service != OMIT
427
+ @tag_ids = tag_ids if tag_ids != OMIT
428
+ @billable_status = billable_status if billable_status != OMIT
429
+ @responsible_party = responsible_party if responsible_party != OMIT
430
+ @provider_accepts_assignment = provider_accepts_assignment if provider_accepts_assignment != OMIT
431
+ @synchronicity = synchronicity if synchronicity != OMIT
432
+ @place_of_service_code = place_of_service_code if place_of_service_code != OMIT
433
+ @appointment_type = appointment_type if appointment_type != OMIT
434
+ @end_date_of_service = end_date_of_service if end_date_of_service != OMIT
435
+ @additional_information = additional_information if additional_information != OMIT
436
+ if service_authorization_exception_code != OMIT
437
+ @service_authorization_exception_code = service_authorization_exception_code
438
+ end
439
+ @admission_date = admission_date if admission_date != OMIT
440
+ @discharge_date = discharge_date if discharge_date != OMIT
441
+ if onset_of_current_illness_or_symptom_date != OMIT
442
+ @onset_of_current_illness_or_symptom_date = onset_of_current_illness_or_symptom_date
443
+ end
444
+ @last_menstrual_period_date = last_menstrual_period_date if last_menstrual_period_date != OMIT
445
+ @delay_reason_code = delay_reason_code if delay_reason_code != OMIT
446
+ @patient_authorized_release = patient_authorized_release if patient_authorized_release != OMIT
447
+ @vitals = vitals if vitals != OMIT
448
+ @referral_number = referral_number if referral_number != OMIT
449
+ @secondary_payer_carrier_code = secondary_payer_carrier_code if secondary_payer_carrier_code != OMIT
450
+ @additional_properties = additional_properties
451
+ @_field_set = {
452
+ "diagnoses": diagnoses,
453
+ "clinical_notes": clinical_notes,
454
+ "claim_supplemental_information": claim_supplemental_information,
455
+ "epsdt_referral": epsdt_referral,
456
+ "existing_medications": existing_medications,
457
+ "guarantor": guarantor,
458
+ "subscriber_primary": subscriber_primary,
459
+ "subscriber_secondary": subscriber_secondary,
460
+ "subscriber_tertiary": subscriber_tertiary,
461
+ "interventions": interventions,
462
+ "schema_instances": schema_instances,
463
+ "external_claim_submission": external_claim_submission,
464
+ "service_lines": service_lines,
465
+ "patient_histories": patient_histories,
466
+ "billing_notes": billing_notes,
467
+ "patient": patient,
468
+ "service_facility": service_facility,
469
+ "rendering_provider": rendering_provider,
470
+ "initial_referring_provider": initial_referring_provider,
471
+ "referring_provider": referring_provider,
472
+ "supervising_provider": supervising_provider,
473
+ "billing_provider": billing_provider,
474
+ "pay_to_address": pay_to_address,
475
+ "benefits_assigned_to_provider": benefits_assigned_to_provider,
476
+ "prior_authorization_number": prior_authorization_number,
477
+ "external_id": external_id,
478
+ "date_of_service": date_of_service,
479
+ "tag_ids": tag_ids,
480
+ "billable_status": billable_status,
481
+ "responsible_party": responsible_party,
482
+ "provider_accepts_assignment": provider_accepts_assignment,
483
+ "synchronicity": synchronicity,
484
+ "place_of_service_code": place_of_service_code,
485
+ "appointment_type": appointment_type,
486
+ "end_date_of_service": end_date_of_service,
487
+ "additional_information": additional_information,
488
+ "service_authorization_exception_code": service_authorization_exception_code,
489
+ "admission_date": admission_date,
490
+ "discharge_date": discharge_date,
491
+ "onset_of_current_illness_or_symptom_date": onset_of_current_illness_or_symptom_date,
492
+ "last_menstrual_period_date": last_menstrual_period_date,
493
+ "delay_reason_code": delay_reason_code,
494
+ "patient_authorized_release": patient_authorized_release,
495
+ "vitals": vitals,
496
+ "referral_number": referral_number,
497
+ "secondary_payer_carrier_code": secondary_payer_carrier_code
498
+ }.reject do |_k, v|
499
+ v == OMIT
500
+ end
501
+ end
502
+
503
+ # Deserialize a JSON object to an instance of EncounterDeepOptional
504
+ #
505
+ # @param json_object [String]
506
+ # @return [CandidApiClient::Encounters::V4::Types::EncounterDeepOptional]
507
+ def self.from_json(json_object:)
508
+ struct = JSON.parse(json_object, object_class: OpenStruct)
509
+ parsed_json = JSON.parse(json_object)
510
+ diagnoses = parsed_json["diagnoses"]&.map do |item|
511
+ item = item.to_json
512
+ CandidApiClient::Diagnoses::Types::DiagnosisCreateOptional.from_json(json_object: item)
513
+ end
514
+ clinical_notes = parsed_json["clinical_notes"]&.map do |item|
515
+ item = item.to_json
516
+ CandidApiClient::Encounters::V4::Types::ClinicalNoteCategoryCreateOptional.from_json(json_object: item)
517
+ end
518
+ claim_supplemental_information = parsed_json["claim_supplemental_information"]&.map do |item|
519
+ item = item.to_json
520
+ CandidApiClient::Encounters::V4::Types::ClaimSupplementalInformationOptional.from_json(json_object: item)
521
+ end
522
+ if parsed_json["epsdt_referral"].nil?
523
+ epsdt_referral = nil
524
+ else
525
+ epsdt_referral = parsed_json["epsdt_referral"].to_json
526
+ epsdt_referral = CandidApiClient::Encounters::V4::Types::EpsdtReferralOptional.from_json(json_object: epsdt_referral)
527
+ end
528
+ existing_medications = parsed_json["existing_medications"]&.map do |item|
529
+ item = item.to_json
530
+ CandidApiClient::Encounters::V4::Types::MedicationOptional.from_json(json_object: item)
531
+ end
532
+ if parsed_json["guarantor"].nil?
533
+ guarantor = nil
534
+ else
535
+ guarantor = parsed_json["guarantor"].to_json
536
+ guarantor = CandidApiClient::Guarantor::V1::Types::GuarantorOptional.from_json(json_object: guarantor)
537
+ end
538
+ if parsed_json["subscriber_primary"].nil?
539
+ subscriber_primary = nil
540
+ else
541
+ subscriber_primary = parsed_json["subscriber_primary"].to_json
542
+ subscriber_primary = CandidApiClient::Individual::Types::SubscriberCreateOptional.from_json(json_object: subscriber_primary)
543
+ end
544
+ if parsed_json["subscriber_secondary"].nil?
545
+ subscriber_secondary = nil
546
+ else
547
+ subscriber_secondary = parsed_json["subscriber_secondary"].to_json
548
+ subscriber_secondary = CandidApiClient::Individual::Types::SubscriberCreateOptional.from_json(json_object: subscriber_secondary)
549
+ end
550
+ if parsed_json["subscriber_tertiary"].nil?
551
+ subscriber_tertiary = nil
552
+ else
553
+ subscriber_tertiary = parsed_json["subscriber_tertiary"].to_json
554
+ subscriber_tertiary = CandidApiClient::Individual::Types::SubscriberCreateOptional.from_json(json_object: subscriber_tertiary)
555
+ end
556
+ interventions = parsed_json["interventions"]&.map do |item|
557
+ item = item.to_json
558
+ CandidApiClient::Encounters::V4::Types::InterventionOptional.from_json(json_object: item)
559
+ end
560
+ schema_instances = parsed_json["schema_instances"]&.map do |item|
561
+ item = item.to_json
562
+ CandidApiClient::CustomSchemas::V1::Types::SchemaInstanceOptional.from_json(json_object: item)
563
+ end
564
+ if parsed_json["external_claim_submission"].nil?
565
+ external_claim_submission = nil
566
+ else
567
+ external_claim_submission = parsed_json["external_claim_submission"].to_json
568
+ external_claim_submission = CandidApiClient::ClaimSubmission::V1::Types::ExternalClaimSubmissionCreateOptional.from_json(json_object: external_claim_submission)
569
+ end
570
+ service_lines = parsed_json["service_lines"]&.map do |item|
571
+ item = item.to_json
572
+ CandidApiClient::ServiceLines::V2::Types::ServiceLineCreateOptional.from_json(json_object: item)
573
+ end
574
+ patient_histories = parsed_json["patient_histories"]&.map do |item|
575
+ item = item.to_json
576
+ CandidApiClient::Encounters::V4::Types::PatientHistoryCategoryOptional.from_json(json_object: item)
577
+ end
578
+ billing_notes = parsed_json["billing_notes"]&.map do |item|
579
+ item = item.to_json
580
+ CandidApiClient::BillingNotes::V2::Types::BillingNoteBaseOptional.from_json(json_object: item)
581
+ end
582
+ if parsed_json["patient"].nil?
583
+ patient = nil
584
+ else
585
+ patient = parsed_json["patient"].to_json
586
+ patient = CandidApiClient::Individual::Types::PatientUpdateWithOptionalAddress.from_json(json_object: patient)
587
+ end
588
+ if parsed_json["service_facility"].nil?
589
+ service_facility = nil
590
+ else
591
+ service_facility = parsed_json["service_facility"].to_json
592
+ service_facility = CandidApiClient::ServiceFacility::Types::EncounterServiceFacilityUpdateWithOptionalAddress.from_json(json_object: service_facility)
593
+ end
594
+ if parsed_json["rendering_provider"].nil?
595
+ rendering_provider = nil
596
+ else
597
+ rendering_provider = parsed_json["rendering_provider"].to_json
598
+ rendering_provider = CandidApiClient::EncounterProviders::V2::Types::RenderingProviderUpdateWithOptionalAddress.from_json(json_object: rendering_provider)
599
+ end
600
+ if parsed_json["initial_referring_provider"].nil?
601
+ initial_referring_provider = nil
602
+ else
603
+ initial_referring_provider = parsed_json["initial_referring_provider"].to_json
604
+ initial_referring_provider = CandidApiClient::EncounterProviders::V2::Types::InitialReferringProviderUpdateWithOptionalAddress.from_json(json_object: initial_referring_provider)
605
+ end
606
+ if parsed_json["referring_provider"].nil?
607
+ referring_provider = nil
608
+ else
609
+ referring_provider = parsed_json["referring_provider"].to_json
610
+ referring_provider = CandidApiClient::EncounterProviders::V2::Types::ReferringProviderUpdateWithOptionalAddress.from_json(json_object: referring_provider)
611
+ end
612
+ if parsed_json["supervising_provider"].nil?
613
+ supervising_provider = nil
614
+ else
615
+ supervising_provider = parsed_json["supervising_provider"].to_json
616
+ supervising_provider = CandidApiClient::EncounterProviders::V2::Types::SupervisingProviderUpdateWithOptionalAddress.from_json(json_object: supervising_provider)
617
+ end
618
+ if parsed_json["billing_provider"].nil?
619
+ billing_provider = nil
620
+ else
621
+ billing_provider = parsed_json["billing_provider"].to_json
622
+ billing_provider = CandidApiClient::EncounterProviders::V2::Types::BillingProviderUpdateWithOptionalAddress.from_json(json_object: billing_provider)
623
+ end
624
+ if parsed_json["pay_to_address"].nil?
625
+ pay_to_address = nil
626
+ else
627
+ pay_to_address = parsed_json["pay_to_address"].to_json
628
+ pay_to_address = CandidApiClient::Commons::Types::StreetAddressShortZipOptional.from_json(json_object: pay_to_address)
629
+ end
630
+ benefits_assigned_to_provider = struct["benefits_assigned_to_provider"]
631
+ prior_authorization_number = struct["prior_authorization_number"]
632
+ external_id = struct["external_id"]
633
+ date_of_service = (Date.parse(parsed_json["date_of_service"]) unless parsed_json["date_of_service"].nil?)
634
+ tag_ids = struct["tag_ids"]
635
+ billable_status = struct["billable_status"]
636
+ responsible_party = struct["responsible_party"]
637
+ provider_accepts_assignment = struct["provider_accepts_assignment"]
638
+ synchronicity = struct["synchronicity"]
639
+ place_of_service_code = struct["place_of_service_code"]
640
+ appointment_type = struct["appointment_type"]
641
+ end_date_of_service = unless parsed_json["end_date_of_service"].nil?
642
+ Date.parse(parsed_json["end_date_of_service"])
643
+ end
644
+ additional_information = struct["additional_information"]
645
+ service_authorization_exception_code = struct["service_authorization_exception_code"]
646
+ admission_date = (Date.parse(parsed_json["admission_date"]) unless parsed_json["admission_date"].nil?)
647
+ discharge_date = (Date.parse(parsed_json["discharge_date"]) unless parsed_json["discharge_date"].nil?)
648
+ onset_of_current_illness_or_symptom_date = unless parsed_json["onset_of_current_illness_or_symptom_date"].nil?
649
+ Date.parse(parsed_json["onset_of_current_illness_or_symptom_date"])
650
+ end
651
+ last_menstrual_period_date = unless parsed_json["last_menstrual_period_date"].nil?
652
+ Date.parse(parsed_json["last_menstrual_period_date"])
653
+ end
654
+ delay_reason_code = struct["delay_reason_code"]
655
+ patient_authorized_release = struct["patient_authorized_release"]
656
+ if parsed_json["vitals"].nil?
657
+ vitals = nil
658
+ else
659
+ vitals = parsed_json["vitals"].to_json
660
+ vitals = CandidApiClient::Encounters::V4::Types::VitalsUpdate.from_json(json_object: vitals)
661
+ end
662
+ referral_number = struct["referral_number"]
663
+ secondary_payer_carrier_code = struct["secondary_payer_carrier_code"]
664
+ new(
665
+ diagnoses: diagnoses,
666
+ clinical_notes: clinical_notes,
667
+ claim_supplemental_information: claim_supplemental_information,
668
+ epsdt_referral: epsdt_referral,
669
+ existing_medications: existing_medications,
670
+ guarantor: guarantor,
671
+ subscriber_primary: subscriber_primary,
672
+ subscriber_secondary: subscriber_secondary,
673
+ subscriber_tertiary: subscriber_tertiary,
674
+ interventions: interventions,
675
+ schema_instances: schema_instances,
676
+ external_claim_submission: external_claim_submission,
677
+ service_lines: service_lines,
678
+ patient_histories: patient_histories,
679
+ billing_notes: billing_notes,
680
+ patient: patient,
681
+ service_facility: service_facility,
682
+ rendering_provider: rendering_provider,
683
+ initial_referring_provider: initial_referring_provider,
684
+ referring_provider: referring_provider,
685
+ supervising_provider: supervising_provider,
686
+ billing_provider: billing_provider,
687
+ pay_to_address: pay_to_address,
688
+ benefits_assigned_to_provider: benefits_assigned_to_provider,
689
+ prior_authorization_number: prior_authorization_number,
690
+ external_id: external_id,
691
+ date_of_service: date_of_service,
692
+ tag_ids: tag_ids,
693
+ billable_status: billable_status,
694
+ responsible_party: responsible_party,
695
+ provider_accepts_assignment: provider_accepts_assignment,
696
+ synchronicity: synchronicity,
697
+ place_of_service_code: place_of_service_code,
698
+ appointment_type: appointment_type,
699
+ end_date_of_service: end_date_of_service,
700
+ additional_information: additional_information,
701
+ service_authorization_exception_code: service_authorization_exception_code,
702
+ admission_date: admission_date,
703
+ discharge_date: discharge_date,
704
+ onset_of_current_illness_or_symptom_date: onset_of_current_illness_or_symptom_date,
705
+ last_menstrual_period_date: last_menstrual_period_date,
706
+ delay_reason_code: delay_reason_code,
707
+ patient_authorized_release: patient_authorized_release,
708
+ vitals: vitals,
709
+ referral_number: referral_number,
710
+ secondary_payer_carrier_code: secondary_payer_carrier_code,
711
+ additional_properties: struct
712
+ )
713
+ end
714
+
715
+ # Serialize an instance of EncounterDeepOptional to a JSON object
716
+ #
717
+ # @return [String]
718
+ def to_json(*_args)
719
+ @_field_set&.to_json
720
+ end
721
+
722
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
723
+ # hash and check each fields type against the current object's property
724
+ # definitions.
725
+ #
726
+ # @param obj [Object]
727
+ # @return [Void]
728
+ def self.validate_raw(obj:)
729
+ obj.diagnoses&.is_a?(Array) != false || raise("Passed value for field obj.diagnoses is not the expected type, validation failed.")
730
+ obj.clinical_notes&.is_a?(Array) != false || raise("Passed value for field obj.clinical_notes is not the expected type, validation failed.")
731
+ obj.claim_supplemental_information&.is_a?(Array) != false || raise("Passed value for field obj.claim_supplemental_information is not the expected type, validation failed.")
732
+ obj.epsdt_referral.nil? || CandidApiClient::Encounters::V4::Types::EpsdtReferralOptional.validate_raw(obj: obj.epsdt_referral)
733
+ obj.existing_medications&.is_a?(Array) != false || raise("Passed value for field obj.existing_medications is not the expected type, validation failed.")
734
+ obj.guarantor.nil? || CandidApiClient::Guarantor::V1::Types::GuarantorOptional.validate_raw(obj: obj.guarantor)
735
+ obj.subscriber_primary.nil? || CandidApiClient::Individual::Types::SubscriberCreateOptional.validate_raw(obj: obj.subscriber_primary)
736
+ obj.subscriber_secondary.nil? || CandidApiClient::Individual::Types::SubscriberCreateOptional.validate_raw(obj: obj.subscriber_secondary)
737
+ obj.subscriber_tertiary.nil? || CandidApiClient::Individual::Types::SubscriberCreateOptional.validate_raw(obj: obj.subscriber_tertiary)
738
+ obj.interventions&.is_a?(Array) != false || raise("Passed value for field obj.interventions is not the expected type, validation failed.")
739
+ obj.schema_instances&.is_a?(Array) != false || raise("Passed value for field obj.schema_instances is not the expected type, validation failed.")
740
+ obj.external_claim_submission.nil? || CandidApiClient::ClaimSubmission::V1::Types::ExternalClaimSubmissionCreateOptional.validate_raw(obj: obj.external_claim_submission)
741
+ obj.service_lines&.is_a?(Array) != false || raise("Passed value for field obj.service_lines is not the expected type, validation failed.")
742
+ obj.patient_histories&.is_a?(Array) != false || raise("Passed value for field obj.patient_histories is not the expected type, validation failed.")
743
+ obj.billing_notes&.is_a?(Array) != false || raise("Passed value for field obj.billing_notes is not the expected type, validation failed.")
744
+ obj.patient.nil? || CandidApiClient::Individual::Types::PatientUpdateWithOptionalAddress.validate_raw(obj: obj.patient)
745
+ obj.service_facility.nil? || CandidApiClient::ServiceFacility::Types::EncounterServiceFacilityUpdateWithOptionalAddress.validate_raw(obj: obj.service_facility)
746
+ obj.rendering_provider.nil? || CandidApiClient::EncounterProviders::V2::Types::RenderingProviderUpdateWithOptionalAddress.validate_raw(obj: obj.rendering_provider)
747
+ obj.initial_referring_provider.nil? || CandidApiClient::EncounterProviders::V2::Types::InitialReferringProviderUpdateWithOptionalAddress.validate_raw(obj: obj.initial_referring_provider)
748
+ obj.referring_provider.nil? || CandidApiClient::EncounterProviders::V2::Types::ReferringProviderUpdateWithOptionalAddress.validate_raw(obj: obj.referring_provider)
749
+ obj.supervising_provider.nil? || CandidApiClient::EncounterProviders::V2::Types::SupervisingProviderUpdateWithOptionalAddress.validate_raw(obj: obj.supervising_provider)
750
+ obj.billing_provider.nil? || CandidApiClient::EncounterProviders::V2::Types::BillingProviderUpdateWithOptionalAddress.validate_raw(obj: obj.billing_provider)
751
+ obj.pay_to_address.nil? || CandidApiClient::Commons::Types::StreetAddressShortZipOptional.validate_raw(obj: obj.pay_to_address)
752
+ 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.")
753
+ obj.prior_authorization_number&.is_a?(String) != false || raise("Passed value for field obj.prior_authorization_number is not the expected type, validation failed.")
754
+ obj.external_id&.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
755
+ obj.date_of_service&.is_a?(Date) != false || raise("Passed value for field obj.date_of_service is not the expected type, validation failed.")
756
+ obj.tag_ids&.is_a?(Array) != false || raise("Passed value for field obj.tag_ids is not the expected type, validation failed.")
757
+ 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.")
758
+ 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.")
759
+ obj.provider_accepts_assignment&.is_a?(Boolean) != false || raise("Passed value for field obj.provider_accepts_assignment is not the expected type, validation failed.")
760
+ obj.synchronicity&.is_a?(CandidApiClient::Encounters::V4::Types::SynchronicityType) != false || raise("Passed value for field obj.synchronicity is not the expected type, validation failed.")
761
+ 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.")
762
+ obj.appointment_type&.is_a?(String) != false || raise("Passed value for field obj.appointment_type is not the expected type, validation failed.")
763
+ 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.")
764
+ obj.additional_information&.is_a?(String) != false || raise("Passed value for field obj.additional_information is not the expected type, validation failed.")
765
+ 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.")
766
+ obj.admission_date&.is_a?(Date) != false || raise("Passed value for field obj.admission_date is not the expected type, validation failed.")
767
+ obj.discharge_date&.is_a?(Date) != false || raise("Passed value for field obj.discharge_date is not the expected type, validation failed.")
768
+ 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.")
769
+ 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.")
770
+ 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.")
771
+ obj.patient_authorized_release&.is_a?(Boolean) != false || raise("Passed value for field obj.patient_authorized_release is not the expected type, validation failed.")
772
+ obj.vitals.nil? || CandidApiClient::Encounters::V4::Types::VitalsUpdate.validate_raw(obj: obj.vitals)
773
+ obj.referral_number&.is_a?(String) != false || raise("Passed value for field obj.referral_number is not the expected type, validation failed.")
774
+ obj.secondary_payer_carrier_code&.is_a?(String) != false || raise("Passed value for field obj.secondary_payer_carrier_code is not the expected type, validation failed.")
775
+ end
776
+ end
777
+ end
778
+ end
779
+ end
780
+ end