candidhealth 0.27.0 → 0.28.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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/candidhealth/pre_encounter/appointments/client.rb +32 -0
  3. data/lib/candidhealth/pre_encounter/appointments/v_1/client.rb +607 -0
  4. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment.rb +257 -0
  5. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_reason.rb +19 -0
  6. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_sort_field.rb +16 -0
  7. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_type.rb +17 -0
  8. data/lib/candidhealth/pre_encounter/appointments/v_1/types/appointment_work_queue.rb +17 -0
  9. data/lib/candidhealth/pre_encounter/appointments/v_1/types/mutable_appointment.rb +203 -0
  10. data/lib/candidhealth/pre_encounter/appointments/v_1/types/service.rb +82 -0
  11. data/lib/candidhealth/pre_encounter/appointments/v_1/types/universal_service_identifier.rb +18 -0
  12. data/lib/candidhealth/pre_encounter/common/types/external_provider.rb +11 -2
  13. data/lib/candidhealth/pre_encounter/common/types/external_provider_type.rb +1 -0
  14. data/lib/candidhealth/pre_encounter/common/types/resource_page.rb +72 -0
  15. data/lib/candidhealth/pre_encounter/common/types/sort_direction.rb +14 -0
  16. data/lib/candidhealth/pre_encounter/coverages/v_1/client.rb +267 -8
  17. data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverage.rb +31 -3
  18. data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_benefits.rb +88 -0
  19. data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_eligibility_check_response.rb +94 -0
  20. data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_value.rb +74 -0
  21. data/lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check.rb +62 -0
  22. data/lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check_metadata.rb +103 -0
  23. data/lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check_status.rb +19 -0
  24. data/lib/candidhealth/pre_encounter/coverages/v_1/types/insurance_type_code.rb +0 -1
  25. data/lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb +31 -3
  26. data/lib/candidhealth/pre_encounter/coverages/v_1/types/plan_coverage.rb +86 -0
  27. data/lib/candidhealth/pre_encounter/coverages/v_1/types/plan_coverage_details.rb +124 -0
  28. data/lib/candidhealth/pre_encounter/coverages/v_1/types/service_coverage.rb +98 -0
  29. data/lib/candidhealth/pre_encounter/coverages/v_1/types/service_coverage_details.rb +124 -0
  30. data/lib/candidhealth/pre_encounter/coverages/v_1/types/service_type_code.rb +203 -0
  31. data/lib/candidhealth/pre_encounter/patients/v_1/client.rb +108 -24
  32. data/lib/candidhealth/pre_encounter/patients/v_1/types/contact.rb +11 -2
  33. data/lib/candidhealth/pre_encounter/patients/v_1/types/patient.rb +4 -2
  34. data/lib/candidhealth/pre_encounter/patients/v_1/types/patient_page.rb +90 -0
  35. data/lib/requests.rb +2 -2
  36. data/lib/types_export.rb +22 -0
  37. metadata +26 -2
@@ -0,0 +1,257 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "date"
4
+ require_relative "../../../common/types/external_provider"
5
+ require_relative "service"
6
+ require_relative "appointment_reason"
7
+ require_relative "appointment_type"
8
+ require_relative "appointment_work_queue"
9
+ require "ostruct"
10
+ require "json"
11
+
12
+ module CandidApiClient
13
+ module PreEncounter
14
+ module Appointments
15
+ module V1
16
+ module Types
17
+ # An appointment object with immutable server-owned properties.
18
+ class Appointment
19
+ # @return [String]
20
+ attr_reader :id
21
+ # @return [String] The organization that owns this appointment.
22
+ attr_reader :organization_id
23
+ # @return [Boolean] True if the appointment is deactivated. Deactivated appointments are not
24
+ # returned in search results but are returned in all other endpoints including
25
+ # scan.
26
+ attr_reader :deactivated
27
+ # @return [Integer] The version of the appointment. Any update to any property of an appointment
28
+ # object will create a new version.
29
+ attr_reader :version
30
+ # @return [DateTime]
31
+ attr_reader :updated_at
32
+ # @return [String] The user ID of the user who last updated the appointment.
33
+ attr_reader :updating_user_id
34
+ # @return [String] The Candid-defined patient identifier.
35
+ attr_reader :patient_id
36
+ # @return [Boolean] True if the patient has checked in. Defaults to false.
37
+ attr_reader :checked_in
38
+ # @return [String] Patient’s initial assigned location or the location to which the patient is
39
+ # being moved. This location is stored on the Patient Demographics tab and is used
40
+ # when creating orders.
41
+ attr_reader :assigned_patient_location
42
+ # @return [CandidApiClient::PreEncounter::Common::Types::ExternalProvider] Attending physician information. The attending physician will be stored as the
43
+ # Current MD for the patient.
44
+ attr_reader :attending_doctor
45
+ # @return [CandidApiClient::PreEncounter::Common::Types::ExternalProvider] Referring physician information. The referring physician will be stored as the
46
+ # Referring MD in the patient’s Providers list.
47
+ attr_reader :referring_doctor
48
+ # @return [DateTime]
49
+ attr_reader :start_timestamp
50
+ # @return [Integer] The requested length of time allotted for the appointment. The units are in
51
+ # minutes.
52
+ attr_reader :service_duration
53
+ # @return [Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Service>]
54
+ attr_reader :services
55
+ # @return [String] ID for the appointment/order for the event.
56
+ attr_reader :placer_appointment_id
57
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentReason]
58
+ attr_reader :appointment_reason
59
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentType] Contains the identifier code for the appointment.
60
+ attr_reader :appointment_type
61
+ # @return [String] Contains the coded identification of the location being scheduled. Components:
62
+ # <Identifier (ST)>^<Text (ST)>
63
+ attr_reader :location_resource_id
64
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentWorkQueue] The work queue that the appointment belongs to. It is not recommended to change
65
+ # this value manually via API.
66
+ attr_reader :work_queue
67
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
68
+ attr_reader :additional_properties
69
+ # @return [Object]
70
+ attr_reader :_field_set
71
+ protected :_field_set
72
+
73
+ OMIT = Object.new
74
+
75
+ # @param id [String]
76
+ # @param organization_id [String] The organization that owns this appointment.
77
+ # @param deactivated [Boolean] True if the appointment is deactivated. Deactivated appointments are not
78
+ # returned in search results but are returned in all other endpoints including
79
+ # scan.
80
+ # @param version [Integer] The version of the appointment. Any update to any property of an appointment
81
+ # object will create a new version.
82
+ # @param updated_at [DateTime]
83
+ # @param updating_user_id [String] The user ID of the user who last updated the appointment.
84
+ # @param patient_id [String] The Candid-defined patient identifier.
85
+ # @param checked_in [Boolean] True if the patient has checked in. Defaults to false.
86
+ # @param assigned_patient_location [String] Patient’s initial assigned location or the location to which the patient is
87
+ # being moved. This location is stored on the Patient Demographics tab and is used
88
+ # when creating orders.
89
+ # @param attending_doctor [CandidApiClient::PreEncounter::Common::Types::ExternalProvider] Attending physician information. The attending physician will be stored as the
90
+ # Current MD for the patient.
91
+ # @param referring_doctor [CandidApiClient::PreEncounter::Common::Types::ExternalProvider] Referring physician information. The referring physician will be stored as the
92
+ # Referring MD in the patient’s Providers list.
93
+ # @param start_timestamp [DateTime]
94
+ # @param service_duration [Integer] The requested length of time allotted for the appointment. The units are in
95
+ # minutes.
96
+ # @param services [Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Service>]
97
+ # @param placer_appointment_id [String] ID for the appointment/order for the event.
98
+ # @param appointment_reason [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentReason]
99
+ # @param appointment_type [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentType] Contains the identifier code for the appointment.
100
+ # @param location_resource_id [String] Contains the coded identification of the location being scheduled. Components:
101
+ # <Identifier (ST)>^<Text (ST)>
102
+ # @param work_queue [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentWorkQueue] The work queue that the appointment belongs to. It is not recommended to change
103
+ # this value manually via API.
104
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
105
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment]
106
+ def initialize(id:, organization_id:, deactivated:, version:, updated_at:, updating_user_id:, patient_id:, service_duration:, services:,
107
+ checked_in: OMIT, assigned_patient_location: OMIT, attending_doctor: OMIT, referring_doctor: OMIT, start_timestamp: OMIT, placer_appointment_id: OMIT, appointment_reason: OMIT, appointment_type: OMIT, location_resource_id: OMIT, work_queue: OMIT, additional_properties: nil)
108
+ @id = id
109
+ @organization_id = organization_id
110
+ @deactivated = deactivated
111
+ @version = version
112
+ @updated_at = updated_at
113
+ @updating_user_id = updating_user_id
114
+ @patient_id = patient_id
115
+ @checked_in = checked_in if checked_in != OMIT
116
+ @assigned_patient_location = assigned_patient_location if assigned_patient_location != OMIT
117
+ @attending_doctor = attending_doctor if attending_doctor != OMIT
118
+ @referring_doctor = referring_doctor if referring_doctor != OMIT
119
+ @start_timestamp = start_timestamp if start_timestamp != OMIT
120
+ @service_duration = service_duration
121
+ @services = services
122
+ @placer_appointment_id = placer_appointment_id if placer_appointment_id != OMIT
123
+ @appointment_reason = appointment_reason if appointment_reason != OMIT
124
+ @appointment_type = appointment_type if appointment_type != OMIT
125
+ @location_resource_id = location_resource_id if location_resource_id != OMIT
126
+ @work_queue = work_queue if work_queue != OMIT
127
+ @additional_properties = additional_properties
128
+ @_field_set = {
129
+ "id": id,
130
+ "organization_id": organization_id,
131
+ "deactivated": deactivated,
132
+ "version": version,
133
+ "updated_at": updated_at,
134
+ "updating_user_id": updating_user_id,
135
+ "patient_id": patient_id,
136
+ "checked_in": checked_in,
137
+ "assigned_patient_location": assigned_patient_location,
138
+ "attending_doctor": attending_doctor,
139
+ "referring_doctor": referring_doctor,
140
+ "start_timestamp": start_timestamp,
141
+ "service_duration": service_duration,
142
+ "services": services,
143
+ "placer_appointment_id": placer_appointment_id,
144
+ "appointment_reason": appointment_reason,
145
+ "appointment_type": appointment_type,
146
+ "location_resource_id": location_resource_id,
147
+ "work_queue": work_queue
148
+ }.reject do |_k, v|
149
+ v == OMIT
150
+ end
151
+ end
152
+
153
+ # Deserialize a JSON object to an instance of Appointment
154
+ #
155
+ # @param json_object [String]
156
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::Appointment]
157
+ def self.from_json(json_object:)
158
+ struct = JSON.parse(json_object, object_class: OpenStruct)
159
+ parsed_json = JSON.parse(json_object)
160
+ id = struct["id"]
161
+ organization_id = struct["organization_id"]
162
+ deactivated = struct["deactivated"]
163
+ version = struct["version"]
164
+ updated_at = (DateTime.parse(parsed_json["updated_at"]) unless parsed_json["updated_at"].nil?)
165
+ updating_user_id = struct["updating_user_id"]
166
+ patient_id = struct["patient_id"]
167
+ checked_in = struct["checked_in"]
168
+ assigned_patient_location = struct["assigned_patient_location"]
169
+ if parsed_json["attending_doctor"].nil?
170
+ attending_doctor = nil
171
+ else
172
+ attending_doctor = parsed_json["attending_doctor"].to_json
173
+ attending_doctor = CandidApiClient::PreEncounter::Common::Types::ExternalProvider.from_json(json_object: attending_doctor)
174
+ end
175
+ if parsed_json["referring_doctor"].nil?
176
+ referring_doctor = nil
177
+ else
178
+ referring_doctor = parsed_json["referring_doctor"].to_json
179
+ referring_doctor = CandidApiClient::PreEncounter::Common::Types::ExternalProvider.from_json(json_object: referring_doctor)
180
+ end
181
+ start_timestamp = unless parsed_json["start_timestamp"].nil?
182
+ DateTime.parse(parsed_json["start_timestamp"])
183
+ end
184
+ service_duration = struct["service_duration"]
185
+ services = parsed_json["services"]&.map do |item|
186
+ item = item.to_json
187
+ CandidApiClient::PreEncounter::Appointments::V1::Types::Service.from_json(json_object: item)
188
+ end
189
+ placer_appointment_id = struct["placer_appointment_id"]
190
+ appointment_reason = struct["appointment_reason"]
191
+ appointment_type = struct["appointment_type"]
192
+ location_resource_id = struct["location_resource_id"]
193
+ work_queue = struct["work_queue"]
194
+ new(
195
+ id: id,
196
+ organization_id: organization_id,
197
+ deactivated: deactivated,
198
+ version: version,
199
+ updated_at: updated_at,
200
+ updating_user_id: updating_user_id,
201
+ patient_id: patient_id,
202
+ checked_in: checked_in,
203
+ assigned_patient_location: assigned_patient_location,
204
+ attending_doctor: attending_doctor,
205
+ referring_doctor: referring_doctor,
206
+ start_timestamp: start_timestamp,
207
+ service_duration: service_duration,
208
+ services: services,
209
+ placer_appointment_id: placer_appointment_id,
210
+ appointment_reason: appointment_reason,
211
+ appointment_type: appointment_type,
212
+ location_resource_id: location_resource_id,
213
+ work_queue: work_queue,
214
+ additional_properties: struct
215
+ )
216
+ end
217
+
218
+ # Serialize an instance of Appointment to a JSON object
219
+ #
220
+ # @return [String]
221
+ def to_json(*_args)
222
+ @_field_set&.to_json
223
+ end
224
+
225
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
226
+ # hash and check each fields type against the current object's property
227
+ # definitions.
228
+ #
229
+ # @param obj [Object]
230
+ # @return [Void]
231
+ def self.validate_raw(obj:)
232
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
233
+ obj.organization_id.is_a?(String) != false || raise("Passed value for field obj.organization_id is not the expected type, validation failed.")
234
+ obj.deactivated.is_a?(Boolean) != false || raise("Passed value for field obj.deactivated is not the expected type, validation failed.")
235
+ obj.version.is_a?(Integer) != false || raise("Passed value for field obj.version is not the expected type, validation failed.")
236
+ obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
237
+ obj.updating_user_id.is_a?(String) != false || raise("Passed value for field obj.updating_user_id is not the expected type, validation failed.")
238
+ obj.patient_id.is_a?(String) != false || raise("Passed value for field obj.patient_id is not the expected type, validation failed.")
239
+ obj.checked_in&.is_a?(Boolean) != false || raise("Passed value for field obj.checked_in is not the expected type, validation failed.")
240
+ obj.assigned_patient_location&.is_a?(String) != false || raise("Passed value for field obj.assigned_patient_location is not the expected type, validation failed.")
241
+ obj.attending_doctor.nil? || CandidApiClient::PreEncounter::Common::Types::ExternalProvider.validate_raw(obj: obj.attending_doctor)
242
+ obj.referring_doctor.nil? || CandidApiClient::PreEncounter::Common::Types::ExternalProvider.validate_raw(obj: obj.referring_doctor)
243
+ obj.start_timestamp&.is_a?(DateTime) != false || raise("Passed value for field obj.start_timestamp is not the expected type, validation failed.")
244
+ obj.service_duration.is_a?(Integer) != false || raise("Passed value for field obj.service_duration is not the expected type, validation failed.")
245
+ obj.services.is_a?(Array) != false || raise("Passed value for field obj.services is not the expected type, validation failed.")
246
+ obj.placer_appointment_id&.is_a?(String) != false || raise("Passed value for field obj.placer_appointment_id is not the expected type, validation failed.")
247
+ obj.appointment_reason&.is_a?(CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentReason) != false || raise("Passed value for field obj.appointment_reason is not the expected type, validation failed.")
248
+ obj.appointment_type&.is_a?(CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentType) != false || raise("Passed value for field obj.appointment_type is not the expected type, validation failed.")
249
+ obj.location_resource_id&.is_a?(String) != false || raise("Passed value for field obj.location_resource_id is not the expected type, validation failed.")
250
+ obj.work_queue&.is_a?(CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentWorkQueue) != false || raise("Passed value for field obj.work_queue is not the expected type, validation failed.")
251
+ end
252
+ end
253
+ end
254
+ end
255
+ end
256
+ end
257
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CandidApiClient
4
+ module PreEncounter
5
+ module Appointments
6
+ module V1
7
+ module Types
8
+ class AppointmentReason
9
+ CHECKUP = "CHECKUP"
10
+ EMERGENCY = "EMERGENCY"
11
+ FOLLOWUP = "FOLLOWUP"
12
+ ROUTINE = "ROUTINE"
13
+ WALKIN = "WALKIN"
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CandidApiClient
4
+ module PreEncounter
5
+ module Appointments
6
+ module V1
7
+ module Types
8
+ class AppointmentSortField
9
+ START_TIMESTAMP = "startTimestamp"
10
+ UPDATED_AT = "updatedAt"
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CandidApiClient
4
+ module PreEncounter
5
+ module Appointments
6
+ module V1
7
+ module Types
8
+ class AppointmentType
9
+ COMPLETE = "Complete"
10
+ NORMAL = "Normal"
11
+ TENTATIVE = "Tentative"
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CandidApiClient
4
+ module PreEncounter
5
+ module Appointments
6
+ module V1
7
+ module Types
8
+ class AppointmentWorkQueue
9
+ EMERGENT_ISSUE = "EMERGENT_ISSUE"
10
+ NEW_PATIENT = "NEW_PATIENT"
11
+ RETURNING_PATIENT = "RETURNING_PATIENT"
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,203 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../../common/types/external_provider"
4
+ require "date"
5
+ require_relative "service"
6
+ require_relative "appointment_reason"
7
+ require_relative "appointment_type"
8
+ require_relative "appointment_work_queue"
9
+ require "ostruct"
10
+ require "json"
11
+
12
+ module CandidApiClient
13
+ module PreEncounter
14
+ module Appointments
15
+ module V1
16
+ module Types
17
+ # An object representing a appointment.
18
+ class MutableAppointment
19
+ # @return [String] The Candid-defined patient identifier.
20
+ attr_reader :patient_id
21
+ # @return [Boolean] True if the patient has checked in. Defaults to false.
22
+ attr_reader :checked_in
23
+ # @return [String] Patient’s initial assigned location or the location to which the patient is
24
+ # being moved. This location is stored on the Patient Demographics tab and is used
25
+ # when creating orders.
26
+ attr_reader :assigned_patient_location
27
+ # @return [CandidApiClient::PreEncounter::Common::Types::ExternalProvider] Attending physician information. The attending physician will be stored as the
28
+ # Current MD for the patient.
29
+ attr_reader :attending_doctor
30
+ # @return [CandidApiClient::PreEncounter::Common::Types::ExternalProvider] Referring physician information. The referring physician will be stored as the
31
+ # Referring MD in the patient’s Providers list.
32
+ attr_reader :referring_doctor
33
+ # @return [DateTime]
34
+ attr_reader :start_timestamp
35
+ # @return [Integer] The requested length of time allotted for the appointment. The units are in
36
+ # minutes.
37
+ attr_reader :service_duration
38
+ # @return [Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Service>]
39
+ attr_reader :services
40
+ # @return [String] ID for the appointment/order for the event.
41
+ attr_reader :placer_appointment_id
42
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentReason]
43
+ attr_reader :appointment_reason
44
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentType] Contains the identifier code for the appointment.
45
+ attr_reader :appointment_type
46
+ # @return [String] Contains the coded identification of the location being scheduled. Components:
47
+ # <Identifier (ST)>^<Text (ST)>
48
+ attr_reader :location_resource_id
49
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentWorkQueue] The work queue that the appointment belongs to. It is not recommended to change
50
+ # this value manually via API.
51
+ attr_reader :work_queue
52
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
53
+ attr_reader :additional_properties
54
+ # @return [Object]
55
+ attr_reader :_field_set
56
+ protected :_field_set
57
+
58
+ OMIT = Object.new
59
+
60
+ # @param patient_id [String] The Candid-defined patient identifier.
61
+ # @param checked_in [Boolean] True if the patient has checked in. Defaults to false.
62
+ # @param assigned_patient_location [String] Patient’s initial assigned location or the location to which the patient is
63
+ # being moved. This location is stored on the Patient Demographics tab and is used
64
+ # when creating orders.
65
+ # @param attending_doctor [CandidApiClient::PreEncounter::Common::Types::ExternalProvider] Attending physician information. The attending physician will be stored as the
66
+ # Current MD for the patient.
67
+ # @param referring_doctor [CandidApiClient::PreEncounter::Common::Types::ExternalProvider] Referring physician information. The referring physician will be stored as the
68
+ # Referring MD in the patient’s Providers list.
69
+ # @param start_timestamp [DateTime]
70
+ # @param service_duration [Integer] The requested length of time allotted for the appointment. The units are in
71
+ # minutes.
72
+ # @param services [Array<CandidApiClient::PreEncounter::Appointments::V1::Types::Service>]
73
+ # @param placer_appointment_id [String] ID for the appointment/order for the event.
74
+ # @param appointment_reason [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentReason]
75
+ # @param appointment_type [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentType] Contains the identifier code for the appointment.
76
+ # @param location_resource_id [String] Contains the coded identification of the location being scheduled. Components:
77
+ # <Identifier (ST)>^<Text (ST)>
78
+ # @param work_queue [CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentWorkQueue] The work queue that the appointment belongs to. It is not recommended to change
79
+ # this value manually via API.
80
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
81
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::MutableAppointment]
82
+ def initialize(patient_id:, service_duration:, services:, checked_in: OMIT, assigned_patient_location: OMIT, attending_doctor: OMIT,
83
+ referring_doctor: OMIT, start_timestamp: OMIT, placer_appointment_id: OMIT, appointment_reason: OMIT, appointment_type: OMIT, location_resource_id: OMIT, work_queue: OMIT, additional_properties: nil)
84
+ @patient_id = patient_id
85
+ @checked_in = checked_in if checked_in != OMIT
86
+ @assigned_patient_location = assigned_patient_location if assigned_patient_location != OMIT
87
+ @attending_doctor = attending_doctor if attending_doctor != OMIT
88
+ @referring_doctor = referring_doctor if referring_doctor != OMIT
89
+ @start_timestamp = start_timestamp if start_timestamp != OMIT
90
+ @service_duration = service_duration
91
+ @services = services
92
+ @placer_appointment_id = placer_appointment_id if placer_appointment_id != OMIT
93
+ @appointment_reason = appointment_reason if appointment_reason != OMIT
94
+ @appointment_type = appointment_type if appointment_type != OMIT
95
+ @location_resource_id = location_resource_id if location_resource_id != OMIT
96
+ @work_queue = work_queue if work_queue != OMIT
97
+ @additional_properties = additional_properties
98
+ @_field_set = {
99
+ "patient_id": patient_id,
100
+ "checked_in": checked_in,
101
+ "assigned_patient_location": assigned_patient_location,
102
+ "attending_doctor": attending_doctor,
103
+ "referring_doctor": referring_doctor,
104
+ "start_timestamp": start_timestamp,
105
+ "service_duration": service_duration,
106
+ "services": services,
107
+ "placer_appointment_id": placer_appointment_id,
108
+ "appointment_reason": appointment_reason,
109
+ "appointment_type": appointment_type,
110
+ "location_resource_id": location_resource_id,
111
+ "work_queue": work_queue
112
+ }.reject do |_k, v|
113
+ v == OMIT
114
+ end
115
+ end
116
+
117
+ # Deserialize a JSON object to an instance of MutableAppointment
118
+ #
119
+ # @param json_object [String]
120
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::MutableAppointment]
121
+ def self.from_json(json_object:)
122
+ struct = JSON.parse(json_object, object_class: OpenStruct)
123
+ parsed_json = JSON.parse(json_object)
124
+ patient_id = struct["patient_id"]
125
+ checked_in = struct["checked_in"]
126
+ assigned_patient_location = struct["assigned_patient_location"]
127
+ if parsed_json["attending_doctor"].nil?
128
+ attending_doctor = nil
129
+ else
130
+ attending_doctor = parsed_json["attending_doctor"].to_json
131
+ attending_doctor = CandidApiClient::PreEncounter::Common::Types::ExternalProvider.from_json(json_object: attending_doctor)
132
+ end
133
+ if parsed_json["referring_doctor"].nil?
134
+ referring_doctor = nil
135
+ else
136
+ referring_doctor = parsed_json["referring_doctor"].to_json
137
+ referring_doctor = CandidApiClient::PreEncounter::Common::Types::ExternalProvider.from_json(json_object: referring_doctor)
138
+ end
139
+ start_timestamp = unless parsed_json["start_timestamp"].nil?
140
+ DateTime.parse(parsed_json["start_timestamp"])
141
+ end
142
+ service_duration = struct["service_duration"]
143
+ services = parsed_json["services"]&.map do |item|
144
+ item = item.to_json
145
+ CandidApiClient::PreEncounter::Appointments::V1::Types::Service.from_json(json_object: item)
146
+ end
147
+ placer_appointment_id = struct["placer_appointment_id"]
148
+ appointment_reason = struct["appointment_reason"]
149
+ appointment_type = struct["appointment_type"]
150
+ location_resource_id = struct["location_resource_id"]
151
+ work_queue = struct["work_queue"]
152
+ new(
153
+ patient_id: patient_id,
154
+ checked_in: checked_in,
155
+ assigned_patient_location: assigned_patient_location,
156
+ attending_doctor: attending_doctor,
157
+ referring_doctor: referring_doctor,
158
+ start_timestamp: start_timestamp,
159
+ service_duration: service_duration,
160
+ services: services,
161
+ placer_appointment_id: placer_appointment_id,
162
+ appointment_reason: appointment_reason,
163
+ appointment_type: appointment_type,
164
+ location_resource_id: location_resource_id,
165
+ work_queue: work_queue,
166
+ additional_properties: struct
167
+ )
168
+ end
169
+
170
+ # Serialize an instance of MutableAppointment to a JSON object
171
+ #
172
+ # @return [String]
173
+ def to_json(*_args)
174
+ @_field_set&.to_json
175
+ end
176
+
177
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
178
+ # hash and check each fields type against the current object's property
179
+ # definitions.
180
+ #
181
+ # @param obj [Object]
182
+ # @return [Void]
183
+ def self.validate_raw(obj:)
184
+ obj.patient_id.is_a?(String) != false || raise("Passed value for field obj.patient_id is not the expected type, validation failed.")
185
+ obj.checked_in&.is_a?(Boolean) != false || raise("Passed value for field obj.checked_in is not the expected type, validation failed.")
186
+ obj.assigned_patient_location&.is_a?(String) != false || raise("Passed value for field obj.assigned_patient_location is not the expected type, validation failed.")
187
+ obj.attending_doctor.nil? || CandidApiClient::PreEncounter::Common::Types::ExternalProvider.validate_raw(obj: obj.attending_doctor)
188
+ obj.referring_doctor.nil? || CandidApiClient::PreEncounter::Common::Types::ExternalProvider.validate_raw(obj: obj.referring_doctor)
189
+ obj.start_timestamp&.is_a?(DateTime) != false || raise("Passed value for field obj.start_timestamp is not the expected type, validation failed.")
190
+ obj.service_duration.is_a?(Integer) != false || raise("Passed value for field obj.service_duration is not the expected type, validation failed.")
191
+ obj.services.is_a?(Array) != false || raise("Passed value for field obj.services is not the expected type, validation failed.")
192
+ obj.placer_appointment_id&.is_a?(String) != false || raise("Passed value for field obj.placer_appointment_id is not the expected type, validation failed.")
193
+ obj.appointment_reason&.is_a?(CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentReason) != false || raise("Passed value for field obj.appointment_reason is not the expected type, validation failed.")
194
+ obj.appointment_type&.is_a?(CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentType) != false || raise("Passed value for field obj.appointment_type is not the expected type, validation failed.")
195
+ obj.location_resource_id&.is_a?(String) != false || raise("Passed value for field obj.location_resource_id is not the expected type, validation failed.")
196
+ obj.work_queue&.is_a?(CandidApiClient::PreEncounter::Appointments::V1::Types::AppointmentWorkQueue) != false || raise("Passed value for field obj.work_queue is not the expected type, validation failed.")
197
+ end
198
+ end
199
+ end
200
+ end
201
+ end
202
+ end
203
+ end
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "universal_service_identifier"
4
+ require "date"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module CandidApiClient
9
+ module PreEncounter
10
+ module Appointments
11
+ module V1
12
+ module Types
13
+ class Service
14
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::UniversalServiceIdentifier] Contains the code describing the activity type that is being scheduled.
15
+ attr_reader :universal_service_identifier
16
+ # @return [DateTime]
17
+ attr_reader :start_timestamp
18
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
19
+ attr_reader :additional_properties
20
+ # @return [Object]
21
+ attr_reader :_field_set
22
+ protected :_field_set
23
+
24
+ OMIT = Object.new
25
+
26
+ # @param universal_service_identifier [CandidApiClient::PreEncounter::Appointments::V1::Types::UniversalServiceIdentifier] Contains the code describing the activity type that is being scheduled.
27
+ # @param start_timestamp [DateTime]
28
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
29
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::Service]
30
+ def initialize(universal_service_identifier: OMIT, start_timestamp: OMIT, additional_properties: nil)
31
+ @universal_service_identifier = universal_service_identifier if universal_service_identifier != OMIT
32
+ @start_timestamp = start_timestamp if start_timestamp != OMIT
33
+ @additional_properties = additional_properties
34
+ @_field_set = {
35
+ "universal_service_identifier": universal_service_identifier,
36
+ "start_timestamp": start_timestamp
37
+ }.reject do |_k, v|
38
+ v == OMIT
39
+ end
40
+ end
41
+
42
+ # Deserialize a JSON object to an instance of Service
43
+ #
44
+ # @param json_object [String]
45
+ # @return [CandidApiClient::PreEncounter::Appointments::V1::Types::Service]
46
+ def self.from_json(json_object:)
47
+ struct = JSON.parse(json_object, object_class: OpenStruct)
48
+ parsed_json = JSON.parse(json_object)
49
+ universal_service_identifier = struct["universal_service_identifier"]
50
+ start_timestamp = unless parsed_json["start_timestamp"].nil?
51
+ DateTime.parse(parsed_json["start_timestamp"])
52
+ end
53
+ new(
54
+ universal_service_identifier: universal_service_identifier,
55
+ start_timestamp: start_timestamp,
56
+ additional_properties: struct
57
+ )
58
+ end
59
+
60
+ # Serialize an instance of Service to a JSON object
61
+ #
62
+ # @return [String]
63
+ def to_json(*_args)
64
+ @_field_set&.to_json
65
+ end
66
+
67
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
68
+ # hash and check each fields type against the current object's property
69
+ # definitions.
70
+ #
71
+ # @param obj [Object]
72
+ # @return [Void]
73
+ def self.validate_raw(obj:)
74
+ obj.universal_service_identifier&.is_a?(CandidApiClient::PreEncounter::Appointments::V1::Types::UniversalServiceIdentifier) != false || raise("Passed value for field obj.universal_service_identifier is not the expected type, validation failed.")
75
+ obj.start_timestamp&.is_a?(DateTime) != false || raise("Passed value for field obj.start_timestamp is not the expected type, validation failed.")
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CandidApiClient
4
+ module PreEncounter
5
+ module Appointments
6
+ module V1
7
+ module Types
8
+ class UniversalServiceIdentifier
9
+ MD_VISIT = "MD_Visit"
10
+ TREATMENT = "Treatment"
11
+ TESTS = "Tests"
12
+ ACTIVITY = "Activity"
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end