candidhealth 0.33.0 → 0.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/lib/candidhealth/encounters/v_4/client.rb +1166 -442
  3. data/lib/candidhealth/encounters/v_4/types/encounter.rb +76 -64
  4. data/lib/candidhealth/encounters/v_4/types/encounter_base.rb +48 -29
  5. data/lib/candidhealth/pre_encounter/appointments/v_1/client.rb +32 -270
  6. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment.rb +87 -75
  7. data/lib/candidhealth/pre_encounter/appointments/v_1/types/{appointment_sort_field.rb → appointment_status.rb} +5 -3
  8. data/lib/candidhealth/pre_encounter/appointments/v_1/types/mutable_appointment.rb +87 -75
  9. data/lib/candidhealth/pre_encounter/coverages/v_1/client.rb +4 -4
  10. data/lib/candidhealth/pre_encounter/coverages/v_1/types/plan_date.rb +87 -0
  11. data/lib/candidhealth/pre_encounter/coverages/v_1/types/plan_metadata.rb +13 -10
  12. data/lib/candidhealth/pre_encounter/lists/client.rb +32 -0
  13. data/lib/candidhealth/pre_encounter/lists/v_1/client.rb +213 -0
  14. data/lib/candidhealth/pre_encounter/lists/v_1/types/appointment_list_item.rb +104 -0
  15. data/lib/candidhealth/pre_encounter/lists/v_1/types/appointment_list_page.rb +90 -0
  16. data/lib/candidhealth/pre_encounter/lists/v_1/types/patient_list_item.rb +104 -0
  17. data/lib/candidhealth/pre_encounter/lists/v_1/types/patient_list_page.rb +90 -0
  18. data/lib/candidhealth/pre_encounter/patients/v_1/client.rb +126 -150
  19. data/lib/candidhealth/pre_encounter/patients/v_1/types/guarantor.rb +121 -0
  20. data/lib/candidhealth/pre_encounter/patients/v_1/types/mutable_patient.rb +32 -2
  21. data/lib/candidhealth/pre_encounter/patients/v_1/types/patient.rb +32 -2
  22. data/lib/candidhealth/pre_encounter/patients/v_1/types/potential_duplicate_patient.rb +72 -0
  23. data/lib/candidhealth/pre_encounter/patients/v_1/types/potential_duplicate_patients_error_body.rb +84 -0
  24. data/lib/requests.rb +2 -2
  25. data/lib/types_export.rb +9 -3
  26. metadata +13 -5
  27. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_reason.rb +0 -19
  28. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_type.rb +0 -17
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "date"
4
3
  require_relative "../../../claims/types/claim"
5
4
  require_relative "../../../individual/types/patient"
6
5
  require_relative "../../../guarantor/v_1/types/guarantor"
7
6
  require_relative "../../../encounter_providers/v_2/types/encounter_provider"
8
7
  require_relative "../../../service_facility/types/encounter_service_facility"
9
8
  require_relative "../../../individual/types/subscriber"
9
+ require_relative "responsible_party_type"
10
10
  require_relative "../../../diagnoses/types/diagnosis"
11
11
  require_relative "clinical_note_category"
12
12
  require_relative "../../../billing_notes/v_2/types/billing_note"
@@ -15,6 +15,7 @@ require_relative "patient_history_category"
15
15
  require_relative "../../../patient_payments/v_3/types/patient_payment"
16
16
  require_relative "../../../tags/types/tag"
17
17
  require_relative "coding_attribution_type"
18
+ require "date"
18
19
  require_relative "encounter_owner_of_next_action_type"
19
20
  require_relative "encounter_submission_origin_type"
20
21
  require_relative "../../../custom_schemas/v_1/types/schema_instance"
@@ -24,7 +25,6 @@ require_relative "intervention"
24
25
  require_relative "../../../commons/types/street_address_long_zip"
25
26
  require_relative "synchronicity_type"
26
27
  require_relative "billable_status_type"
27
- require_relative "responsible_party_type"
28
28
  require_relative "service_authorization_exception_code"
29
29
  require_relative "../../../commons/types/delay_reason_code"
30
30
  require "ostruct"
@@ -40,18 +40,6 @@ module CandidApiClient
40
40
  # It's used to track and manage a patient's medical records, treatments, and other
41
41
  # healthcare-related information.
42
42
  attr_reader :patient_control_number
43
- # @return [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-24.
44
- # This date must be the local date in the timezone where the service occurred.
45
- # Box 24a on the CMS-1500 claim form.
46
- # If service occurred over a range of dates, this should be the start date.
47
- # date_of_service must be defined on either the encounter or the service lines but
48
- # not both.
49
- attr_reader :date_of_service
50
- # @return [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-25.
51
- # This date must be the local date in the timezone where the service occurred.
52
- # If omitted, the Encounter is assumed to be for a single day.
53
- # Must not be temporally before the date_of_service field.
54
- attr_reader :end_date_of_service
55
43
  # @return [String]
56
44
  attr_reader :encounter_id
57
45
  # @return [Array<CandidApiClient::Claims::Types::Claim>]
@@ -104,6 +92,13 @@ module CandidApiClient
104
92
  attr_reader :subscriber_primary
105
93
  # @return [CandidApiClient::Individual::Types::Subscriber] Contains details of the secondary insurance subscriber.
106
94
  attr_reader :subscriber_secondary
95
+ # @return [String] Box 23 on the CMS-1500 claim form.
96
+ attr_reader :prior_authorization_number
97
+ # @return [String] Human-readable description of the appointment type (ex: "Acupuncture -
98
+ # Headaches").
99
+ attr_reader :appointment_type
100
+ # @return [CandidApiClient::Encounters::V4::Types::ResponsiblePartyType] Defines the party to be billed with the initial balance owed on the claim.
101
+ attr_reader :responsible_party
107
102
  # @return [String] URL that links directly to the claim created in Candid.
108
103
  attr_reader :url
109
104
  # @return [Array<CandidApiClient::Diagnoses::Types::Diagnosis>] Ideally, this field should contain no more than 12 diagnoses. However, more
@@ -153,8 +148,24 @@ module CandidApiClient
153
148
  # for example, your internal encounter ID or a Dr. Chrono encounter ID.
154
149
  # This field should not contain PHI.
155
150
  attr_reader :external_id
156
- # @return [String] Box 23 on the CMS-1500 claim form.
157
- attr_reader :prior_authorization_number
151
+ # @return [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-24.
152
+ # This date must be the local date in the timezone where the service occurred.
153
+ # Box 24a on the CMS-1500 claim form.
154
+ # If service occurred over a range of dates, this should be the start date.
155
+ # date_of_service must be defined on either the encounter or the service lines but
156
+ # not both.
157
+ # If there are greater than zero service lines, it is recommended to specify
158
+ # date_of_service on the service_line instead of on the encounter to prepare for
159
+ # future API versions.
160
+ attr_reader :date_of_service
161
+ # @return [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-25.
162
+ # This date must be the local date in the timezone where the service occurred.
163
+ # If omitted, the Encounter is assumed to be for a single day.
164
+ # Must not be temporally before the date_of_service field.
165
+ # If there are greater than zero service lines, it is recommended to specify
166
+ # end_date_of_service on the service_line instead of on the encounter to prepare
167
+ # for future API versions.
168
+ attr_reader :end_date_of_service
158
169
  # @return [Boolean] Whether this patient has authorized the release of medical information
159
170
  # for billing purpose.
160
171
  # Box 12 on the CMS-1500 claim form.
@@ -167,9 +178,6 @@ module CandidApiClient
167
178
  # to be made to you, not them.
168
179
  # Box 27 on the CMS-1500 claim form.
169
180
  attr_reader :provider_accepts_assignment
170
- # @return [String] Human-readable description of the appointment type (ex: "Acupuncture -
171
- # Headaches").
172
- attr_reader :appointment_type
173
181
  # @return [Array<CandidApiClient::Encounters::V4::Types::Medication>]
174
182
  attr_reader :existing_medications
175
183
  # @return [CandidApiClient::Encounters::V4::Types::Vitals]
@@ -191,8 +199,6 @@ module CandidApiClient
191
199
  # if the Encounter has not occurred yet or if there is no intention of ever
192
200
  # billing the responsible_party.
193
201
  attr_reader :billable_status
194
- # @return [CandidApiClient::Encounters::V4::Types::ResponsiblePartyType] Defines the party to be billed with the initial balance owed on the claim.
195
- attr_reader :responsible_party
196
202
  # @return [String] Defines additional information on the claim needed by the payer.
197
203
  # Box 19 on the CMS-1500 claim form.
198
204
  attr_reader :additional_information
@@ -239,16 +245,6 @@ module CandidApiClient
239
245
  # within a healthcare system or facility.
240
246
  # It's used to track and manage a patient's medical records, treatments, and other
241
247
  # healthcare-related information.
242
- # @param date_of_service [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-24.
243
- # This date must be the local date in the timezone where the service occurred.
244
- # Box 24a on the CMS-1500 claim form.
245
- # If service occurred over a range of dates, this should be the start date.
246
- # date_of_service must be defined on either the encounter or the service lines but
247
- # not both.
248
- # @param end_date_of_service [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-25.
249
- # This date must be the local date in the timezone where the service occurred.
250
- # If omitted, the Encounter is assumed to be for a single day.
251
- # Must not be temporally before the date_of_service field.
252
248
  # @param encounter_id [String]
253
249
  # @param claims [Array<CandidApiClient::Claims::Types::Claim>]
254
250
  # @param patient [CandidApiClient::Individual::Types::Patient] Contains the identification information of the individual receiving medical
@@ -289,6 +285,10 @@ module CandidApiClient
289
285
  # Note: Cash Pay is no longer a valid payer_id in v4, please use responsible party
290
286
  # to define self-pay claims.
291
287
  # @param subscriber_secondary [CandidApiClient::Individual::Types::Subscriber] Contains details of the secondary insurance subscriber.
288
+ # @param prior_authorization_number [String] Box 23 on the CMS-1500 claim form.
289
+ # @param appointment_type [String] Human-readable description of the appointment type (ex: "Acupuncture -
290
+ # Headaches").
291
+ # @param responsible_party [CandidApiClient::Encounters::V4::Types::ResponsiblePartyType] Defines the party to be billed with the initial balance owed on the claim.
292
292
  # @param url [String] URL that links directly to the claim created in Candid.
293
293
  # @param diagnoses [Array<CandidApiClient::Diagnoses::Types::Diagnosis>] Ideally, this field should contain no more than 12 diagnoses. However, more
294
294
  # diagnoses may be submitted at this time, and coders will later prioritize the 12
@@ -322,7 +322,22 @@ module CandidApiClient
322
322
  # @param external_id [String] A client-specified unique ID to associate with this encounter;
323
323
  # for example, your internal encounter ID or a Dr. Chrono encounter ID.
324
324
  # This field should not contain PHI.
325
- # @param prior_authorization_number [String] Box 23 on the CMS-1500 claim form.
325
+ # @param date_of_service [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-24.
326
+ # This date must be the local date in the timezone where the service occurred.
327
+ # Box 24a on the CMS-1500 claim form.
328
+ # If service occurred over a range of dates, this should be the start date.
329
+ # date_of_service must be defined on either the encounter or the service lines but
330
+ # not both.
331
+ # If there are greater than zero service lines, it is recommended to specify
332
+ # date_of_service on the service_line instead of on the encounter to prepare for
333
+ # future API versions.
334
+ # @param end_date_of_service [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-25.
335
+ # This date must be the local date in the timezone where the service occurred.
336
+ # If omitted, the Encounter is assumed to be for a single day.
337
+ # Must not be temporally before the date_of_service field.
338
+ # If there are greater than zero service lines, it is recommended to specify
339
+ # end_date_of_service on the service_line instead of on the encounter to prepare
340
+ # for future API versions.
326
341
  # @param patient_authorized_release [Boolean] Whether this patient has authorized the release of medical information
327
342
  # for billing purpose.
328
343
  # Box 12 on the CMS-1500 claim form.
@@ -332,8 +347,6 @@ module CandidApiClient
332
347
  # @param provider_accepts_assignment [Boolean] Whether you have accepted the patient's authorization for insurance payments
333
348
  # to be made to you, not them.
334
349
  # Box 27 on the CMS-1500 claim form.
335
- # @param appointment_type [String] Human-readable description of the appointment type (ex: "Acupuncture -
336
- # Headaches").
337
350
  # @param existing_medications [Array<CandidApiClient::Encounters::V4::Types::Medication>]
338
351
  # @param vitals [CandidApiClient::Encounters::V4::Types::Vitals]
339
352
  # @param interventions [Array<CandidApiClient::Encounters::V4::Types::Intervention>]
@@ -349,7 +362,6 @@ module CandidApiClient
349
362
  # Examples for when this should be set to NOT_BILLABLE include
350
363
  # if the Encounter has not occurred yet or if there is no intention of ever
351
364
  # billing the responsible_party.
352
- # @param responsible_party [CandidApiClient::Encounters::V4::Types::ResponsiblePartyType] Defines the party to be billed with the initial balance owed on the claim.
353
365
  # @param additional_information [String] Defines additional information on the claim needed by the payer.
354
366
  # Box 19 on the CMS-1500 claim form.
355
367
  # @param service_authorization_exception_code [CandidApiClient::Encounters::V4::Types::ServiceAuthorizationExceptionCode] 837p Loop2300 REF\*4N
@@ -379,11 +391,9 @@ module CandidApiClient
379
391
  # Code indicating the reason why a request was delayed
380
392
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
381
393
  # @return [CandidApiClient::Encounters::V4::Types::Encounter]
382
- def initialize(date_of_service:, encounter_id:, claims:, patient:, billing_provider:, rendering_provider:,
383
- service_facility:, url:, diagnoses:, clinical_notes:, patient_histories:, patient_payments:, tags:, owner_of_next_action:, submission_origin:, schema_instances:, external_id:, patient_authorized_release:, benefits_assigned_to_provider:, provider_accepts_assignment:, billable_status:, responsible_party:, patient_control_number: OMIT, end_date_of_service: OMIT, guarantor: OMIT, referring_provider: OMIT, initial_referring_provider: OMIT, supervising_provider: OMIT, subscriber_primary: OMIT, subscriber_secondary: OMIT, billing_notes: OMIT, place_of_service_code: OMIT, place_of_service_code_as_submitted: OMIT, coding_attribution: OMIT, work_queue_id: OMIT, work_queue_membership_activated_at: OMIT, prior_authorization_number: OMIT, appointment_type: OMIT, existing_medications: OMIT, vitals: OMIT, interventions: OMIT, pay_to_address: OMIT, synchronicity: 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, additional_properties: nil)
394
+ def initialize(encounter_id:, claims:, patient:, billing_provider:, rendering_provider:, service_facility:,
395
+ responsible_party:, url:, diagnoses:, clinical_notes:, patient_histories:, patient_payments:, tags:, owner_of_next_action:, submission_origin:, schema_instances:, external_id:, patient_authorized_release:, benefits_assigned_to_provider:, provider_accepts_assignment:, billable_status:, patient_control_number: OMIT, guarantor: OMIT, referring_provider: OMIT, initial_referring_provider: OMIT, supervising_provider: OMIT, subscriber_primary: OMIT, subscriber_secondary: OMIT, prior_authorization_number: OMIT, appointment_type: OMIT, billing_notes: OMIT, place_of_service_code: OMIT, place_of_service_code_as_submitted: OMIT, coding_attribution: OMIT, work_queue_id: OMIT, work_queue_membership_activated_at: OMIT, date_of_service: OMIT, end_date_of_service: OMIT, existing_medications: OMIT, vitals: OMIT, interventions: OMIT, pay_to_address: OMIT, synchronicity: 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, additional_properties: nil)
384
396
  @patient_control_number = patient_control_number if patient_control_number != OMIT
385
- @date_of_service = date_of_service
386
- @end_date_of_service = end_date_of_service if end_date_of_service != OMIT
387
397
  @encounter_id = encounter_id
388
398
  @claims = claims
389
399
  @patient = patient
@@ -396,6 +406,9 @@ module CandidApiClient
396
406
  @service_facility = service_facility
397
407
  @subscriber_primary = subscriber_primary if subscriber_primary != OMIT
398
408
  @subscriber_secondary = subscriber_secondary if subscriber_secondary != OMIT
409
+ @prior_authorization_number = prior_authorization_number if prior_authorization_number != OMIT
410
+ @appointment_type = appointment_type if appointment_type != OMIT
411
+ @responsible_party = responsible_party
399
412
  @url = url
400
413
  @diagnoses = diagnoses
401
414
  @clinical_notes = clinical_notes
@@ -416,18 +429,17 @@ module CandidApiClient
416
429
  @submission_origin = submission_origin
417
430
  @schema_instances = schema_instances
418
431
  @external_id = external_id
419
- @prior_authorization_number = prior_authorization_number if prior_authorization_number != OMIT
432
+ @date_of_service = date_of_service if date_of_service != OMIT
433
+ @end_date_of_service = end_date_of_service if end_date_of_service != OMIT
420
434
  @patient_authorized_release = patient_authorized_release
421
435
  @benefits_assigned_to_provider = benefits_assigned_to_provider
422
436
  @provider_accepts_assignment = provider_accepts_assignment
423
- @appointment_type = appointment_type if appointment_type != OMIT
424
437
  @existing_medications = existing_medications if existing_medications != OMIT
425
438
  @vitals = vitals if vitals != OMIT
426
439
  @interventions = interventions if interventions != OMIT
427
440
  @pay_to_address = pay_to_address if pay_to_address != OMIT
428
441
  @synchronicity = synchronicity if synchronicity != OMIT
429
442
  @billable_status = billable_status
430
- @responsible_party = responsible_party
431
443
  @additional_information = additional_information if additional_information != OMIT
432
444
  if service_authorization_exception_code != OMIT
433
445
  @service_authorization_exception_code = service_authorization_exception_code
@@ -442,8 +454,6 @@ module CandidApiClient
442
454
  @additional_properties = additional_properties
443
455
  @_field_set = {
444
456
  "patient_control_number": patient_control_number,
445
- "date_of_service": date_of_service,
446
- "end_date_of_service": end_date_of_service,
447
457
  "encounter_id": encounter_id,
448
458
  "claims": claims,
449
459
  "patient": patient,
@@ -456,6 +466,9 @@ module CandidApiClient
456
466
  "service_facility": service_facility,
457
467
  "subscriber_primary": subscriber_primary,
458
468
  "subscriber_secondary": subscriber_secondary,
469
+ "prior_authorization_number": prior_authorization_number,
470
+ "appointment_type": appointment_type,
471
+ "responsible_party": responsible_party,
459
472
  "url": url,
460
473
  "diagnoses": diagnoses,
461
474
  "clinical_notes": clinical_notes,
@@ -472,18 +485,17 @@ module CandidApiClient
472
485
  "submission_origin": submission_origin,
473
486
  "schema_instances": schema_instances,
474
487
  "external_id": external_id,
475
- "prior_authorization_number": prior_authorization_number,
488
+ "date_of_service": date_of_service,
489
+ "end_date_of_service": end_date_of_service,
476
490
  "patient_authorized_release": patient_authorized_release,
477
491
  "benefits_assigned_to_provider": benefits_assigned_to_provider,
478
492
  "provider_accepts_assignment": provider_accepts_assignment,
479
- "appointment_type": appointment_type,
480
493
  "existing_medications": existing_medications,
481
494
  "vitals": vitals,
482
495
  "interventions": interventions,
483
496
  "pay_to_address": pay_to_address,
484
497
  "synchronicity": synchronicity,
485
498
  "billable_status": billable_status,
486
- "responsible_party": responsible_party,
487
499
  "additional_information": additional_information,
488
500
  "service_authorization_exception_code": service_authorization_exception_code,
489
501
  "admission_date": admission_date,
@@ -504,10 +516,6 @@ module CandidApiClient
504
516
  struct = JSON.parse(json_object, object_class: OpenStruct)
505
517
  parsed_json = JSON.parse(json_object)
506
518
  patient_control_number = struct["patient_control_number"]
507
- date_of_service = (Date.parse(parsed_json["date_of_service"]) unless parsed_json["date_of_service"].nil?)
508
- end_date_of_service = unless parsed_json["end_date_of_service"].nil?
509
- Date.parse(parsed_json["end_date_of_service"])
510
- end
511
519
  encounter_id = struct["encounter_id"]
512
520
  claims = parsed_json["claims"]&.map do |item|
513
521
  item = item.to_json
@@ -573,6 +581,9 @@ module CandidApiClient
573
581
  subscriber_secondary = parsed_json["subscriber_secondary"].to_json
574
582
  subscriber_secondary = CandidApiClient::Individual::Types::Subscriber.from_json(json_object: subscriber_secondary)
575
583
  end
584
+ prior_authorization_number = struct["prior_authorization_number"]
585
+ appointment_type = struct["appointment_type"]
586
+ responsible_party = struct["responsible_party"]
576
587
  url = struct["url"]
577
588
  diagnoses = parsed_json["diagnoses"]&.map do |item|
578
589
  item = item.to_json
@@ -612,11 +623,13 @@ module CandidApiClient
612
623
  CandidApiClient::CustomSchemas::V1::Types::SchemaInstance.from_json(json_object: item)
613
624
  end
614
625
  external_id = struct["external_id"]
615
- prior_authorization_number = struct["prior_authorization_number"]
626
+ date_of_service = (Date.parse(parsed_json["date_of_service"]) unless parsed_json["date_of_service"].nil?)
627
+ end_date_of_service = unless parsed_json["end_date_of_service"].nil?
628
+ Date.parse(parsed_json["end_date_of_service"])
629
+ end
616
630
  patient_authorized_release = struct["patient_authorized_release"]
617
631
  benefits_assigned_to_provider = struct["benefits_assigned_to_provider"]
618
632
  provider_accepts_assignment = struct["provider_accepts_assignment"]
619
- appointment_type = struct["appointment_type"]
620
633
  existing_medications = parsed_json["existing_medications"]&.map do |item|
621
634
  item = item.to_json
622
635
  CandidApiClient::Encounters::V4::Types::Medication.from_json(json_object: item)
@@ -639,7 +652,6 @@ module CandidApiClient
639
652
  end
640
653
  synchronicity = struct["synchronicity"]
641
654
  billable_status = struct["billable_status"]
642
- responsible_party = struct["responsible_party"]
643
655
  additional_information = struct["additional_information"]
644
656
  service_authorization_exception_code = struct["service_authorization_exception_code"]
645
657
  admission_date = (Date.parse(parsed_json["admission_date"]) unless parsed_json["admission_date"].nil?)
@@ -653,8 +665,6 @@ module CandidApiClient
653
665
  delay_reason_code = struct["delay_reason_code"]
654
666
  new(
655
667
  patient_control_number: patient_control_number,
656
- date_of_service: date_of_service,
657
- end_date_of_service: end_date_of_service,
658
668
  encounter_id: encounter_id,
659
669
  claims: claims,
660
670
  patient: patient,
@@ -667,6 +677,9 @@ module CandidApiClient
667
677
  service_facility: service_facility,
668
678
  subscriber_primary: subscriber_primary,
669
679
  subscriber_secondary: subscriber_secondary,
680
+ prior_authorization_number: prior_authorization_number,
681
+ appointment_type: appointment_type,
682
+ responsible_party: responsible_party,
670
683
  url: url,
671
684
  diagnoses: diagnoses,
672
685
  clinical_notes: clinical_notes,
@@ -683,18 +696,17 @@ module CandidApiClient
683
696
  submission_origin: submission_origin,
684
697
  schema_instances: schema_instances,
685
698
  external_id: external_id,
686
- prior_authorization_number: prior_authorization_number,
699
+ date_of_service: date_of_service,
700
+ end_date_of_service: end_date_of_service,
687
701
  patient_authorized_release: patient_authorized_release,
688
702
  benefits_assigned_to_provider: benefits_assigned_to_provider,
689
703
  provider_accepts_assignment: provider_accepts_assignment,
690
- appointment_type: appointment_type,
691
704
  existing_medications: existing_medications,
692
705
  vitals: vitals,
693
706
  interventions: interventions,
694
707
  pay_to_address: pay_to_address,
695
708
  synchronicity: synchronicity,
696
709
  billable_status: billable_status,
697
- responsible_party: responsible_party,
698
710
  additional_information: additional_information,
699
711
  service_authorization_exception_code: service_authorization_exception_code,
700
712
  admission_date: admission_date,
@@ -721,8 +733,6 @@ module CandidApiClient
721
733
  # @return [Void]
722
734
  def self.validate_raw(obj:)
723
735
  obj.patient_control_number&.is_a?(String) != false || raise("Passed value for field obj.patient_control_number is not the expected type, validation failed.")
724
- obj.date_of_service.is_a?(Date) != false || raise("Passed value for field obj.date_of_service is not the expected type, validation failed.")
725
- 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.")
726
736
  obj.encounter_id.is_a?(String) != false || raise("Passed value for field obj.encounter_id is not the expected type, validation failed.")
727
737
  obj.claims.is_a?(Array) != false || raise("Passed value for field obj.claims is not the expected type, validation failed.")
728
738
  CandidApiClient::Individual::Types::Patient.validate_raw(obj: obj.patient)
@@ -735,6 +745,9 @@ module CandidApiClient
735
745
  CandidApiClient::ServiceFacility::Types::EncounterServiceFacility.validate_raw(obj: obj.service_facility)
736
746
  obj.subscriber_primary.nil? || CandidApiClient::Individual::Types::Subscriber.validate_raw(obj: obj.subscriber_primary)
737
747
  obj.subscriber_secondary.nil? || CandidApiClient::Individual::Types::Subscriber.validate_raw(obj: obj.subscriber_secondary)
748
+ obj.prior_authorization_number&.is_a?(String) != false || raise("Passed value for field obj.prior_authorization_number is not the expected type, validation failed.")
749
+ obj.appointment_type&.is_a?(String) != false || raise("Passed value for field obj.appointment_type is not the expected type, validation failed.")
750
+ 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.")
738
751
  obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
739
752
  obj.diagnoses.is_a?(Array) != false || raise("Passed value for field obj.diagnoses is not the expected type, validation failed.")
740
753
  obj.clinical_notes.is_a?(Array) != false || raise("Passed value for field obj.clinical_notes is not the expected type, validation failed.")
@@ -751,18 +764,17 @@ module CandidApiClient
751
764
  obj.submission_origin.is_a?(CandidApiClient::Encounters::V4::Types::EncounterSubmissionOriginType) != false || raise("Passed value for field obj.submission_origin is not the expected type, validation failed.")
752
765
  obj.schema_instances.is_a?(Array) != false || raise("Passed value for field obj.schema_instances is not the expected type, validation failed.")
753
766
  obj.external_id.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
754
- obj.prior_authorization_number&.is_a?(String) != false || raise("Passed value for field obj.prior_authorization_number is not the expected type, validation failed.")
767
+ obj.date_of_service&.is_a?(Date) != false || raise("Passed value for field obj.date_of_service is not the expected type, validation failed.")
768
+ 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.")
755
769
  obj.patient_authorized_release.is_a?(Boolean) != false || raise("Passed value for field obj.patient_authorized_release is not the expected type, validation failed.")
756
770
  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.")
757
771
  obj.provider_accepts_assignment.is_a?(Boolean) != false || raise("Passed value for field obj.provider_accepts_assignment is not the expected type, validation failed.")
758
- obj.appointment_type&.is_a?(String) != false || raise("Passed value for field obj.appointment_type is not the expected type, validation failed.")
759
772
  obj.existing_medications&.is_a?(Array) != false || raise("Passed value for field obj.existing_medications is not the expected type, validation failed.")
760
773
  obj.vitals.nil? || CandidApiClient::Encounters::V4::Types::Vitals.validate_raw(obj: obj.vitals)
761
774
  obj.interventions&.is_a?(Array) != false || raise("Passed value for field obj.interventions is not the expected type, validation failed.")
762
775
  obj.pay_to_address.nil? || CandidApiClient::Commons::Types::StreetAddressLongZip.validate_raw(obj: obj.pay_to_address)
763
776
  obj.synchronicity&.is_a?(CandidApiClient::Encounters::V4::Types::SynchronicityType) != false || raise("Passed value for field obj.synchronicity is not the expected type, validation failed.")
764
777
  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.")
765
- 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.")
766
778
  obj.additional_information&.is_a?(String) != false || raise("Passed value for field obj.additional_information is not the expected type, validation failed.")
767
779
  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.")
768
780
  obj.admission_date&.is_a?(Date) != false || raise("Passed value for field obj.admission_date is not the expected type, validation failed.")
@@ -1,14 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "date"
3
4
  require_relative "medication"
4
5
  require_relative "vitals"
5
6
  require_relative "intervention"
6
7
  require_relative "../../../commons/types/street_address_long_zip"
7
8
  require_relative "synchronicity_type"
8
9
  require_relative "billable_status_type"
9
- require_relative "responsible_party_type"
10
10
  require_relative "service_authorization_exception_code"
11
- require "date"
12
11
  require_relative "../../../commons/types/delay_reason_code"
13
12
  require "ostruct"
14
13
  require "json"
@@ -22,8 +21,24 @@ module CandidApiClient
22
21
  # for example, your internal encounter ID or a Dr. Chrono encounter ID.
23
22
  # This field should not contain PHI.
24
23
  attr_reader :external_id
25
- # @return [String] Box 23 on the CMS-1500 claim form.
26
- attr_reader :prior_authorization_number
24
+ # @return [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-24.
25
+ # This date must be the local date in the timezone where the service occurred.
26
+ # Box 24a on the CMS-1500 claim form.
27
+ # If service occurred over a range of dates, this should be the start date.
28
+ # date_of_service must be defined on either the encounter or the service lines but
29
+ # not both.
30
+ # If there are greater than zero service lines, it is recommended to specify
31
+ # date_of_service on the service_line instead of on the encounter to prepare for
32
+ # future API versions.
33
+ attr_reader :date_of_service
34
+ # @return [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-25.
35
+ # This date must be the local date in the timezone where the service occurred.
36
+ # If omitted, the Encounter is assumed to be for a single day.
37
+ # Must not be temporally before the date_of_service field.
38
+ # If there are greater than zero service lines, it is recommended to specify
39
+ # end_date_of_service on the service_line instead of on the encounter to prepare
40
+ # for future API versions.
41
+ attr_reader :end_date_of_service
27
42
  # @return [Boolean] Whether this patient has authorized the release of medical information
28
43
  # for billing purpose.
29
44
  # Box 12 on the CMS-1500 claim form.
@@ -36,9 +51,6 @@ module CandidApiClient
36
51
  # to be made to you, not them.
37
52
  # Box 27 on the CMS-1500 claim form.
38
53
  attr_reader :provider_accepts_assignment
39
- # @return [String] Human-readable description of the appointment type (ex: "Acupuncture -
40
- # Headaches").
41
- attr_reader :appointment_type
42
54
  # @return [Array<CandidApiClient::Encounters::V4::Types::Medication>]
43
55
  attr_reader :existing_medications
44
56
  # @return [CandidApiClient::Encounters::V4::Types::Vitals]
@@ -60,8 +72,6 @@ module CandidApiClient
60
72
  # if the Encounter has not occurred yet or if there is no intention of ever
61
73
  # billing the responsible_party.
62
74
  attr_reader :billable_status
63
- # @return [CandidApiClient::Encounters::V4::Types::ResponsiblePartyType] Defines the party to be billed with the initial balance owed on the claim.
64
- attr_reader :responsible_party
65
75
  # @return [String] Defines additional information on the claim needed by the payer.
66
76
  # Box 19 on the CMS-1500 claim form.
67
77
  attr_reader :additional_information
@@ -107,7 +117,22 @@ module CandidApiClient
107
117
  # @param external_id [String] A client-specified unique ID to associate with this encounter;
108
118
  # for example, your internal encounter ID or a Dr. Chrono encounter ID.
109
119
  # This field should not contain PHI.
110
- # @param prior_authorization_number [String] Box 23 on the CMS-1500 claim form.
120
+ # @param date_of_service [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-24.
121
+ # This date must be the local date in the timezone where the service occurred.
122
+ # Box 24a on the CMS-1500 claim form.
123
+ # If service occurred over a range of dates, this should be the start date.
124
+ # date_of_service must be defined on either the encounter or the service lines but
125
+ # not both.
126
+ # If there are greater than zero service lines, it is recommended to specify
127
+ # date_of_service on the service_line instead of on the encounter to prepare for
128
+ # future API versions.
129
+ # @param end_date_of_service [Date] Date formatted as YYYY-MM-DD; eg: 2019-08-25.
130
+ # This date must be the local date in the timezone where the service occurred.
131
+ # If omitted, the Encounter is assumed to be for a single day.
132
+ # Must not be temporally before the date_of_service field.
133
+ # If there are greater than zero service lines, it is recommended to specify
134
+ # end_date_of_service on the service_line instead of on the encounter to prepare
135
+ # for future API versions.
111
136
  # @param patient_authorized_release [Boolean] Whether this patient has authorized the release of medical information
112
137
  # for billing purpose.
113
138
  # Box 12 on the CMS-1500 claim form.
@@ -117,8 +142,6 @@ module CandidApiClient
117
142
  # @param provider_accepts_assignment [Boolean] Whether you have accepted the patient's authorization for insurance payments
118
143
  # to be made to you, not them.
119
144
  # Box 27 on the CMS-1500 claim form.
120
- # @param appointment_type [String] Human-readable description of the appointment type (ex: "Acupuncture -
121
- # Headaches").
122
145
  # @param existing_medications [Array<CandidApiClient::Encounters::V4::Types::Medication>]
123
146
  # @param vitals [CandidApiClient::Encounters::V4::Types::Vitals]
124
147
  # @param interventions [Array<CandidApiClient::Encounters::V4::Types::Intervention>]
@@ -134,7 +157,6 @@ module CandidApiClient
134
157
  # Examples for when this should be set to NOT_BILLABLE include
135
158
  # if the Encounter has not occurred yet or if there is no intention of ever
136
159
  # billing the responsible_party.
137
- # @param responsible_party [CandidApiClient::Encounters::V4::Types::ResponsiblePartyType] Defines the party to be billed with the initial balance owed on the claim.
138
160
  # @param additional_information [String] Defines additional information on the claim needed by the payer.
139
161
  # Box 19 on the CMS-1500 claim form.
140
162
  # @param service_authorization_exception_code [CandidApiClient::Encounters::V4::Types::ServiceAuthorizationExceptionCode] 837p Loop2300 REF\*4N
@@ -165,20 +187,19 @@ module CandidApiClient
165
187
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
166
188
  # @return [CandidApiClient::Encounters::V4::Types::EncounterBase]
167
189
  def initialize(external_id:, patient_authorized_release:, benefits_assigned_to_provider:,
168
- provider_accepts_assignment:, billable_status:, responsible_party:, prior_authorization_number: OMIT, appointment_type: OMIT, existing_medications: OMIT, vitals: OMIT, interventions: OMIT, pay_to_address: OMIT, synchronicity: 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, additional_properties: nil)
190
+ provider_accepts_assignment:, billable_status:, date_of_service: OMIT, end_date_of_service: OMIT, existing_medications: OMIT, vitals: OMIT, interventions: OMIT, pay_to_address: OMIT, synchronicity: 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, additional_properties: nil)
169
191
  @external_id = external_id
170
- @prior_authorization_number = prior_authorization_number if prior_authorization_number != OMIT
192
+ @date_of_service = date_of_service if date_of_service != OMIT
193
+ @end_date_of_service = end_date_of_service if end_date_of_service != OMIT
171
194
  @patient_authorized_release = patient_authorized_release
172
195
  @benefits_assigned_to_provider = benefits_assigned_to_provider
173
196
  @provider_accepts_assignment = provider_accepts_assignment
174
- @appointment_type = appointment_type if appointment_type != OMIT
175
197
  @existing_medications = existing_medications if existing_medications != OMIT
176
198
  @vitals = vitals if vitals != OMIT
177
199
  @interventions = interventions if interventions != OMIT
178
200
  @pay_to_address = pay_to_address if pay_to_address != OMIT
179
201
  @synchronicity = synchronicity if synchronicity != OMIT
180
202
  @billable_status = billable_status
181
- @responsible_party = responsible_party
182
203
  @additional_information = additional_information if additional_information != OMIT
183
204
  if service_authorization_exception_code != OMIT
184
205
  @service_authorization_exception_code = service_authorization_exception_code
@@ -193,18 +214,17 @@ module CandidApiClient
193
214
  @additional_properties = additional_properties
194
215
  @_field_set = {
195
216
  "external_id": external_id,
196
- "prior_authorization_number": prior_authorization_number,
217
+ "date_of_service": date_of_service,
218
+ "end_date_of_service": end_date_of_service,
197
219
  "patient_authorized_release": patient_authorized_release,
198
220
  "benefits_assigned_to_provider": benefits_assigned_to_provider,
199
221
  "provider_accepts_assignment": provider_accepts_assignment,
200
- "appointment_type": appointment_type,
201
222
  "existing_medications": existing_medications,
202
223
  "vitals": vitals,
203
224
  "interventions": interventions,
204
225
  "pay_to_address": pay_to_address,
205
226
  "synchronicity": synchronicity,
206
227
  "billable_status": billable_status,
207
- "responsible_party": responsible_party,
208
228
  "additional_information": additional_information,
209
229
  "service_authorization_exception_code": service_authorization_exception_code,
210
230
  "admission_date": admission_date,
@@ -225,11 +245,13 @@ module CandidApiClient
225
245
  struct = JSON.parse(json_object, object_class: OpenStruct)
226
246
  parsed_json = JSON.parse(json_object)
227
247
  external_id = struct["external_id"]
228
- prior_authorization_number = struct["prior_authorization_number"]
248
+ date_of_service = (Date.parse(parsed_json["date_of_service"]) unless parsed_json["date_of_service"].nil?)
249
+ end_date_of_service = unless parsed_json["end_date_of_service"].nil?
250
+ Date.parse(parsed_json["end_date_of_service"])
251
+ end
229
252
  patient_authorized_release = struct["patient_authorized_release"]
230
253
  benefits_assigned_to_provider = struct["benefits_assigned_to_provider"]
231
254
  provider_accepts_assignment = struct["provider_accepts_assignment"]
232
- appointment_type = struct["appointment_type"]
233
255
  existing_medications = parsed_json["existing_medications"]&.map do |item|
234
256
  item = item.to_json
235
257
  CandidApiClient::Encounters::V4::Types::Medication.from_json(json_object: item)
@@ -252,7 +274,6 @@ module CandidApiClient
252
274
  end
253
275
  synchronicity = struct["synchronicity"]
254
276
  billable_status = struct["billable_status"]
255
- responsible_party = struct["responsible_party"]
256
277
  additional_information = struct["additional_information"]
257
278
  service_authorization_exception_code = struct["service_authorization_exception_code"]
258
279
  admission_date = (Date.parse(parsed_json["admission_date"]) unless parsed_json["admission_date"].nil?)
@@ -266,18 +287,17 @@ module CandidApiClient
266
287
  delay_reason_code = struct["delay_reason_code"]
267
288
  new(
268
289
  external_id: external_id,
269
- prior_authorization_number: prior_authorization_number,
290
+ date_of_service: date_of_service,
291
+ end_date_of_service: end_date_of_service,
270
292
  patient_authorized_release: patient_authorized_release,
271
293
  benefits_assigned_to_provider: benefits_assigned_to_provider,
272
294
  provider_accepts_assignment: provider_accepts_assignment,
273
- appointment_type: appointment_type,
274
295
  existing_medications: existing_medications,
275
296
  vitals: vitals,
276
297
  interventions: interventions,
277
298
  pay_to_address: pay_to_address,
278
299
  synchronicity: synchronicity,
279
300
  billable_status: billable_status,
280
- responsible_party: responsible_party,
281
301
  additional_information: additional_information,
282
302
  service_authorization_exception_code: service_authorization_exception_code,
283
303
  admission_date: admission_date,
@@ -304,18 +324,17 @@ module CandidApiClient
304
324
  # @return [Void]
305
325
  def self.validate_raw(obj:)
306
326
  obj.external_id.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
307
- obj.prior_authorization_number&.is_a?(String) != false || raise("Passed value for field obj.prior_authorization_number is not the expected type, validation failed.")
327
+ obj.date_of_service&.is_a?(Date) != false || raise("Passed value for field obj.date_of_service is not the expected type, validation failed.")
328
+ 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.")
308
329
  obj.patient_authorized_release.is_a?(Boolean) != false || raise("Passed value for field obj.patient_authorized_release is not the expected type, validation failed.")
309
330
  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.")
310
331
  obj.provider_accepts_assignment.is_a?(Boolean) != false || raise("Passed value for field obj.provider_accepts_assignment is not the expected type, validation failed.")
311
- obj.appointment_type&.is_a?(String) != false || raise("Passed value for field obj.appointment_type is not the expected type, validation failed.")
312
332
  obj.existing_medications&.is_a?(Array) != false || raise("Passed value for field obj.existing_medications is not the expected type, validation failed.")
313
333
  obj.vitals.nil? || CandidApiClient::Encounters::V4::Types::Vitals.validate_raw(obj: obj.vitals)
314
334
  obj.interventions&.is_a?(Array) != false || raise("Passed value for field obj.interventions is not the expected type, validation failed.")
315
335
  obj.pay_to_address.nil? || CandidApiClient::Commons::Types::StreetAddressLongZip.validate_raw(obj: obj.pay_to_address)
316
336
  obj.synchronicity&.is_a?(CandidApiClient::Encounters::V4::Types::SynchronicityType) != false || raise("Passed value for field obj.synchronicity is not the expected type, validation failed.")
317
337
  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.")
318
- 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.")
319
338
  obj.additional_information&.is_a?(String) != false || raise("Passed value for field obj.additional_information is not the expected type, validation failed.")
320
339
  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.")
321
340
  obj.admission_date&.is_a?(Date) != false || raise("Passed value for field obj.admission_date is not the expected type, validation failed.")