candidhealth 0.24.3 → 0.24.5

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/lib/candidhealth/commons/types/procedure_modifier.rb +1 -0
  3. data/lib/candidhealth/custom_schemas/v_1/client.rb +20 -20
  4. data/lib/candidhealth/financials/types/account_type.rb +1 -0
  5. data/lib/candidhealth/pre_encounter/common/types/disability_status.rb +14 -0
  6. data/lib/candidhealth/pre_encounter/common/types/ethnicity.rb +16 -0
  7. data/lib/candidhealth/pre_encounter/common/types/gender.rb +5 -2
  8. data/lib/candidhealth/pre_encounter/common/types/race.rb +21 -0
  9. data/lib/candidhealth/pre_encounter/common/types/sex.rb +16 -0
  10. data/lib/candidhealth/pre_encounter/common/types/sexual_orientation.rb +19 -0
  11. data/lib/candidhealth/pre_encounter/coverages/client.rb +6 -6
  12. data/lib/candidhealth/pre_encounter/coverages/v_1/client.rb +464 -11
  13. data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverage.rb +183 -0
  14. data/lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_status.rb +20 -0
  15. data/lib/candidhealth/pre_encounter/coverages/v_1/types/insurance_plan.rb +134 -0
  16. data/lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb +129 -0
  17. data/lib/candidhealth/pre_encounter/coverages/v_1/types/network_type.rb +33 -0
  18. data/lib/candidhealth/pre_encounter/coverages/v_1/types/subscriber.rb +88 -0
  19. data/lib/candidhealth/pre_encounter/patients/client.rb +6 -6
  20. data/lib/candidhealth/pre_encounter/patients/v_1/client.rb +607 -11
  21. data/lib/candidhealth/pre_encounter/patients/v_1/types/contact.rb +133 -0
  22. data/lib/candidhealth/pre_encounter/patients/v_1/types/external_provenance.rb +73 -0
  23. data/lib/candidhealth/pre_encounter/patients/v_1/types/external_provider.rb +122 -0
  24. data/lib/candidhealth/pre_encounter/patients/v_1/types/filing_order.rb +63 -0
  25. data/lib/candidhealth/pre_encounter/patients/v_1/types/marital_status.rb +26 -0
  26. data/lib/candidhealth/pre_encounter/patients/v_1/types/mutable_patient.rb +325 -0
  27. data/lib/candidhealth/pre_encounter/patients/v_1/types/patient.rb +389 -0
  28. data/lib/candidhealth/service_lines/v_2/types/service_line.rb +25 -1
  29. data/lib/candidhealth.rb +7 -7
  30. data/lib/requests.rb +2 -2
  31. data/lib/types_export.rb +18 -12
  32. metadata +20 -16
  33. data/lib/candidhealth/pre_encounter/coverages/v_1/coverages/client.rb +0 -487
  34. data/lib/candidhealth/pre_encounter/coverages/v_1/coverages/types/coverage.rb +0 -185
  35. data/lib/candidhealth/pre_encounter/coverages/v_1/coverages/types/coverage_status.rb +0 -22
  36. data/lib/candidhealth/pre_encounter/coverages/v_1/coverages/types/coverage_type.rb +0 -18
  37. data/lib/candidhealth/pre_encounter/coverages/v_1/coverages/types/insurance_plan.rb +0 -136
  38. data/lib/candidhealth/pre_encounter/coverages/v_1/coverages/types/mutable_coverage.rb +0 -131
  39. data/lib/candidhealth/pre_encounter/coverages/v_1/coverages/types/subscriber.rb +0 -90
  40. data/lib/candidhealth/pre_encounter/patients/v_1/patients/client.rb +0 -590
  41. data/lib/candidhealth/pre_encounter/patients/v_1/patients/types/contact.rb +0 -135
  42. data/lib/candidhealth/pre_encounter/patients/v_1/patients/types/external_provenance.rb +0 -75
  43. data/lib/candidhealth/pre_encounter/patients/v_1/patients/types/external_provider.rb +0 -116
  44. data/lib/candidhealth/pre_encounter/patients/v_1/patients/types/marital_status.rb +0 -28
  45. data/lib/candidhealth/pre_encounter/patients/v_1/patients/types/mutable_patient.rb +0 -242
  46. data/lib/candidhealth/pre_encounter/patients/v_1/patients/types/patient.rb +0 -294
@@ -1,590 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../../../../requests"
4
- require_relative "types/mutable_patient"
5
- require_relative "types/patient"
6
- require "json"
7
- require "date"
8
- require "async"
9
-
10
- module CandidApiClient
11
- module PreEncounter
12
- module Patients
13
- module V1
14
- class PatientsClient
15
- # @return [CandidApiClient::RequestClient]
16
- attr_reader :request_client
17
-
18
- # @param request_client [CandidApiClient::RequestClient]
19
- # @return [CandidApiClient::PreEncounter::Patients::V1::PatientsClient]
20
- def initialize(request_client:)
21
- @request_client = request_client
22
- end
23
-
24
- # Adds a patient. VersionConflictError is returned when the patient's external ID
25
- # is already in use.
26
- #
27
- # @param request [Hash] Request of type CandidApiClient::PreEncounter::Patients::V1::Patients::Types::MutablePatient, as a Hash
28
- # * :name (Hash)
29
- # * :family (String)
30
- # * :given (Array<String>)
31
- # * :use (CandidApiClient::PreEncounter::Common::Types::NameUse)
32
- # * :period (Hash)
33
- # * :start (Date)
34
- # * :end_ (Date)
35
- # * :other_names (Array<CandidApiClient::PreEncounter::Common::Types::HumanName>)
36
- # * :gender (CandidApiClient::PreEncounter::Common::Types::Gender)
37
- # * :birth_date (Date)
38
- # * :marital_status (CandidApiClient::PreEncounter::Patients::V1::Patients::Types::MaritalStatus)
39
- # * :deceased (DateTime)
40
- # * :multiple_birth (Integer)
41
- # * :primary_address (Hash)
42
- # * :use (CandidApiClient::PreEncounter::Common::Types::AddressUse)
43
- # * :line (Array<String>)
44
- # * :city (String)
45
- # * :state (String)
46
- # * :postal_code (String)
47
- # * :country (String)
48
- # * :period (Hash)
49
- # * :start (Date)
50
- # * :end_ (Date)
51
- # * :other_addresses (Array<CandidApiClient::PreEncounter::Common::Types::Address>)
52
- # * :primary_telecom (Hash)
53
- # * :value (String)
54
- # * :use (CandidApiClient::PreEncounter::Common::Types::ContactPointUse)
55
- # * :period (Hash)
56
- # * :start (Date)
57
- # * :end_ (Date)
58
- # * :other_telecoms (Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>)
59
- # * :photo (String)
60
- # * :language (String)
61
- # * :external_provenance (Hash)
62
- # * :external_id (String)
63
- # * :system_name (String)
64
- # * :contacts (Array<CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Contact>)
65
- # * :general_practitioners (Array<CandidApiClient::PreEncounter::Patients::V1::Patients::Types::ExternalProvider>)
66
- # @param request_options [CandidApiClient::RequestOptions]
67
- # @return [CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient]
68
- # @example
69
- # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
70
- # api.pre_encounter.patients.v_1.patients.create(request: { name: { family: "string", given: ["string"], use: USUAL, period: { } }, other_names: [{ family: "string", given: ["string"], use: USUAL, period: { } }], gender: FEMALE, birth_date: DateTime.parse(2023-01-15), marital_status: ANNULLED, deceased: DateTime.parse(2024-01-15T09:30:00.000Z), multiple_birth: 1, primary_address: { use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }, other_addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }], primary_telecom: { value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }, other_telecoms: [{ value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], photo: "string", language: "string", external_provenance: { external_id: "string", system_name: "string" }, contacts: [{ relationship: [SELF], name: { family: "string", given: ["string"], use: USUAL, period: { } }, gender: FEMALE, telecoms: [{ value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }], period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], general_practitioners: [{ name: { family: "string", given: ["string"], use: USUAL, period: { } }, telecoms: [{ value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }], period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }] })
71
- def create(request:, request_options: nil)
72
- response = @request_client.conn.post do |req|
73
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
74
- req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
75
- req.headers = {
76
- **(req.headers || {}),
77
- **@request_client.get_headers,
78
- **(request_options&.additional_headers || {})
79
- }.compact
80
- req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
81
- req.url "#{@request_client.get_url(environment: PreEncounter,
82
- request_options: request_options)}/patients/v1"
83
- end
84
- CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient.from_json(json_object: response.body)
85
- end
86
-
87
- # Gets a patient.
88
- #
89
- # @param id [String]
90
- # @param request_options [CandidApiClient::RequestOptions]
91
- # @return [CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient]
92
- # @example
93
- # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
94
- # api.pre_encounter.patients.v_1.patients.get(id: "string")
95
- def get(id:, request_options: nil)
96
- response = @request_client.conn.get do |req|
97
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
98
- req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
99
- req.headers = {
100
- **(req.headers || {}),
101
- **@request_client.get_headers,
102
- **(request_options&.additional_headers || {})
103
- }.compact
104
- req.url "#{@request_client.get_url(environment: PreEncounter,
105
- request_options: request_options)}/patients/v1/#{id}"
106
- end
107
- CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient.from_json(json_object: response.body)
108
- end
109
-
110
- # Gets a patient along with it's full history. The return list is ordered by
111
- # version ascending.
112
- #
113
- # @param id [String]
114
- # @param request_options [CandidApiClient::RequestOptions]
115
- # @return [Array<CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient>]
116
- # @example
117
- # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
118
- # api.pre_encounter.patients.v_1.patients.get_history(id: "string")
119
- def get_history(id:, request_options: nil)
120
- response = @request_client.conn.get do |req|
121
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
122
- req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
123
- req.headers = {
124
- **(req.headers || {}),
125
- **@request_client.get_headers,
126
- **(request_options&.additional_headers || {})
127
- }.compact
128
- req.url "#{@request_client.get_url(environment: PreEncounter,
129
- request_options: request_options)}/patients/v1/#{id}/history"
130
- end
131
- parsed_json = JSON.parse(response.body)
132
- parsed_json&.map do |item|
133
- item = item.to_json
134
- CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient.from_json(json_object: item)
135
- end
136
- end
137
-
138
- # Updates a patient. The path must contain the most recent version to prevent
139
- # races. Updating historic versions is not supported.
140
- #
141
- # @param id [String]
142
- # @param version [Integer]
143
- # @param request [Hash] Request of type CandidApiClient::PreEncounter::Patients::V1::Patients::Types::MutablePatient, as a Hash
144
- # * :name (Hash)
145
- # * :family (String)
146
- # * :given (Array<String>)
147
- # * :use (CandidApiClient::PreEncounter::Common::Types::NameUse)
148
- # * :period (Hash)
149
- # * :start (Date)
150
- # * :end_ (Date)
151
- # * :other_names (Array<CandidApiClient::PreEncounter::Common::Types::HumanName>)
152
- # * :gender (CandidApiClient::PreEncounter::Common::Types::Gender)
153
- # * :birth_date (Date)
154
- # * :marital_status (CandidApiClient::PreEncounter::Patients::V1::Patients::Types::MaritalStatus)
155
- # * :deceased (DateTime)
156
- # * :multiple_birth (Integer)
157
- # * :primary_address (Hash)
158
- # * :use (CandidApiClient::PreEncounter::Common::Types::AddressUse)
159
- # * :line (Array<String>)
160
- # * :city (String)
161
- # * :state (String)
162
- # * :postal_code (String)
163
- # * :country (String)
164
- # * :period (Hash)
165
- # * :start (Date)
166
- # * :end_ (Date)
167
- # * :other_addresses (Array<CandidApiClient::PreEncounter::Common::Types::Address>)
168
- # * :primary_telecom (Hash)
169
- # * :value (String)
170
- # * :use (CandidApiClient::PreEncounter::Common::Types::ContactPointUse)
171
- # * :period (Hash)
172
- # * :start (Date)
173
- # * :end_ (Date)
174
- # * :other_telecoms (Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>)
175
- # * :photo (String)
176
- # * :language (String)
177
- # * :external_provenance (Hash)
178
- # * :external_id (String)
179
- # * :system_name (String)
180
- # * :contacts (Array<CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Contact>)
181
- # * :general_practitioners (Array<CandidApiClient::PreEncounter::Patients::V1::Patients::Types::ExternalProvider>)
182
- # @param request_options [CandidApiClient::RequestOptions]
183
- # @return [CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient]
184
- # @example
185
- # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
186
- # api.pre_encounter.patients.v_1.patients.update(
187
- # id: "string",
188
- # version: 1,
189
- # request: { name: { family: "string", given: ["string"], use: USUAL, period: { } }, other_names: [{ family: "string", given: ["string"], use: USUAL, period: { } }], gender: FEMALE, birth_date: DateTime.parse(2023-01-15), marital_status: ANNULLED, deceased: DateTime.parse(2024-01-15T09:30:00.000Z), multiple_birth: 1, primary_address: { use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }, other_addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }], primary_telecom: { value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }, other_telecoms: [{ value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], photo: "string", language: "string", external_provenance: { external_id: "string", system_name: "string" }, contacts: [{ relationship: [SELF], name: { family: "string", given: ["string"], use: USUAL, period: { } }, gender: FEMALE, telecoms: [{ value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }], period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], general_practitioners: [{ name: { family: "string", given: ["string"], use: USUAL, period: { } }, telecoms: [{ value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }], period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }] }
190
- # )
191
- def update(id:, version:, request:, request_options: nil)
192
- response = @request_client.conn.put do |req|
193
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
194
- req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
195
- req.headers = {
196
- **(req.headers || {}),
197
- **@request_client.get_headers,
198
- **(request_options&.additional_headers || {})
199
- }.compact
200
- req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
201
- req.url "#{@request_client.get_url(environment: PreEncounter,
202
- request_options: request_options)}/patients/v1/#{id}/#{version}"
203
- end
204
- CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient.from_json(json_object: response.body)
205
- end
206
-
207
- # Sets a patient as deactivated. The path must contain the most recent version to
208
- # prevent races. Dactivating historic versions is not supported. Subsequent
209
- # updates via PUT to the patient will "reactivate" the patient and set the
210
- # deactivated flag to false.
211
- #
212
- # @param id [String]
213
- # @param version [Integer]
214
- # @param request_options [CandidApiClient::RequestOptions]
215
- # @return [Void]
216
- # @example
217
- # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
218
- # api.pre_encounter.patients.v_1.patients.deactivate(id: "string", version: 1)
219
- def deactivate(id:, version:, request_options: nil)
220
- @request_client.conn.delete do |req|
221
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
222
- req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
223
- req.headers = {
224
- **(req.headers || {}),
225
- **@request_client.get_headers,
226
- **(request_options&.additional_headers || {})
227
- }.compact
228
- req.url "#{@request_client.get_url(environment: PreEncounter,
229
- request_options: request_options)}/patients/v1/#{id}/#{version}"
230
- end
231
- end
232
-
233
- # Searches for patients that match the query parameters.
234
- #
235
- # @param name_contains [String]
236
- # @param request_options [CandidApiClient::RequestOptions]
237
- # @return [Array<CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient>]
238
- # @example
239
- # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
240
- # api.pre_encounter.patients.v_1.patients.search(name_contains: "string")
241
- def search(name_contains: nil, request_options: nil)
242
- response = @request_client.conn.get do |req|
243
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
244
- req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
245
- req.headers = {
246
- **(req.headers || {}),
247
- **@request_client.get_headers,
248
- **(request_options&.additional_headers || {})
249
- }.compact
250
- req.params = {
251
- **(request_options&.additional_query_parameters || {}),
252
- "name_contains": name_contains
253
- }.compact
254
- req.url "#{@request_client.get_url(environment: PreEncounter,
255
- request_options: request_options)}/patients/v1"
256
- end
257
- parsed_json = JSON.parse(response.body)
258
- parsed_json&.map do |item|
259
- item = item.to_json
260
- CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient.from_json(json_object: item)
261
- end
262
- end
263
-
264
- # Scans up to 100 patient updates. The since query parameter is inclusive, and the
265
- # result list is ordered by updatedAt descending.
266
- #
267
- # @param since [DateTime]
268
- # @param request_options [CandidApiClient::RequestOptions]
269
- # @return [Array<CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient>]
270
- # @example
271
- # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
272
- # api.pre_encounter.patients.v_1.patients.scan(since: DateTime.parse(2024-01-15T09:30:00.000Z))
273
- def scan(since:, request_options: nil)
274
- response = @request_client.conn.get do |req|
275
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
276
- req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
277
- req.headers = {
278
- **(req.headers || {}),
279
- **@request_client.get_headers,
280
- **(request_options&.additional_headers || {})
281
- }.compact
282
- req.params = { **(request_options&.additional_query_parameters || {}), "since": since }.compact
283
- req.url "#{@request_client.get_url(environment: PreEncounter,
284
- request_options: request_options)}/patients/v1/updates/scan"
285
- end
286
- parsed_json = JSON.parse(response.body)
287
- parsed_json&.map do |item|
288
- item = item.to_json
289
- CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient.from_json(json_object: item)
290
- end
291
- end
292
- end
293
-
294
- class AsyncPatientsClient
295
- # @return [CandidApiClient::AsyncRequestClient]
296
- attr_reader :request_client
297
-
298
- # @param request_client [CandidApiClient::AsyncRequestClient]
299
- # @return [CandidApiClient::PreEncounter::Patients::V1::AsyncPatientsClient]
300
- def initialize(request_client:)
301
- @request_client = request_client
302
- end
303
-
304
- # Adds a patient. VersionConflictError is returned when the patient's external ID
305
- # is already in use.
306
- #
307
- # @param request [Hash] Request of type CandidApiClient::PreEncounter::Patients::V1::Patients::Types::MutablePatient, as a Hash
308
- # * :name (Hash)
309
- # * :family (String)
310
- # * :given (Array<String>)
311
- # * :use (CandidApiClient::PreEncounter::Common::Types::NameUse)
312
- # * :period (Hash)
313
- # * :start (Date)
314
- # * :end_ (Date)
315
- # * :other_names (Array<CandidApiClient::PreEncounter::Common::Types::HumanName>)
316
- # * :gender (CandidApiClient::PreEncounter::Common::Types::Gender)
317
- # * :birth_date (Date)
318
- # * :marital_status (CandidApiClient::PreEncounter::Patients::V1::Patients::Types::MaritalStatus)
319
- # * :deceased (DateTime)
320
- # * :multiple_birth (Integer)
321
- # * :primary_address (Hash)
322
- # * :use (CandidApiClient::PreEncounter::Common::Types::AddressUse)
323
- # * :line (Array<String>)
324
- # * :city (String)
325
- # * :state (String)
326
- # * :postal_code (String)
327
- # * :country (String)
328
- # * :period (Hash)
329
- # * :start (Date)
330
- # * :end_ (Date)
331
- # * :other_addresses (Array<CandidApiClient::PreEncounter::Common::Types::Address>)
332
- # * :primary_telecom (Hash)
333
- # * :value (String)
334
- # * :use (CandidApiClient::PreEncounter::Common::Types::ContactPointUse)
335
- # * :period (Hash)
336
- # * :start (Date)
337
- # * :end_ (Date)
338
- # * :other_telecoms (Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>)
339
- # * :photo (String)
340
- # * :language (String)
341
- # * :external_provenance (Hash)
342
- # * :external_id (String)
343
- # * :system_name (String)
344
- # * :contacts (Array<CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Contact>)
345
- # * :general_practitioners (Array<CandidApiClient::PreEncounter::Patients::V1::Patients::Types::ExternalProvider>)
346
- # @param request_options [CandidApiClient::RequestOptions]
347
- # @return [CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient]
348
- # @example
349
- # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
350
- # api.pre_encounter.patients.v_1.patients.create(request: { name: { family: "string", given: ["string"], use: USUAL, period: { } }, other_names: [{ family: "string", given: ["string"], use: USUAL, period: { } }], gender: FEMALE, birth_date: DateTime.parse(2023-01-15), marital_status: ANNULLED, deceased: DateTime.parse(2024-01-15T09:30:00.000Z), multiple_birth: 1, primary_address: { use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }, other_addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }], primary_telecom: { value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }, other_telecoms: [{ value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], photo: "string", language: "string", external_provenance: { external_id: "string", system_name: "string" }, contacts: [{ relationship: [SELF], name: { family: "string", given: ["string"], use: USUAL, period: { } }, gender: FEMALE, telecoms: [{ value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }], period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], general_practitioners: [{ name: { family: "string", given: ["string"], use: USUAL, period: { } }, telecoms: [{ value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }], period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }] })
351
- def create(request:, request_options: nil)
352
- Async do
353
- response = @request_client.conn.post do |req|
354
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
355
- req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
356
- req.headers = {
357
- **(req.headers || {}),
358
- **@request_client.get_headers,
359
- **(request_options&.additional_headers || {})
360
- }.compact
361
- req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
362
- req.url "#{@request_client.get_url(environment: PreEncounter,
363
- request_options: request_options)}/patients/v1"
364
- end
365
- CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient.from_json(json_object: response.body)
366
- end
367
- end
368
-
369
- # Gets a patient.
370
- #
371
- # @param id [String]
372
- # @param request_options [CandidApiClient::RequestOptions]
373
- # @return [CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient]
374
- # @example
375
- # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
376
- # api.pre_encounter.patients.v_1.patients.get(id: "string")
377
- def get(id:, request_options: nil)
378
- Async do
379
- response = @request_client.conn.get do |req|
380
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
381
- req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
382
- req.headers = {
383
- **(req.headers || {}),
384
- **@request_client.get_headers,
385
- **(request_options&.additional_headers || {})
386
- }.compact
387
- req.url "#{@request_client.get_url(environment: PreEncounter,
388
- request_options: request_options)}/patients/v1/#{id}"
389
- end
390
- CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient.from_json(json_object: response.body)
391
- end
392
- end
393
-
394
- # Gets a patient along with it's full history. The return list is ordered by
395
- # version ascending.
396
- #
397
- # @param id [String]
398
- # @param request_options [CandidApiClient::RequestOptions]
399
- # @return [Array<CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient>]
400
- # @example
401
- # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
402
- # api.pre_encounter.patients.v_1.patients.get_history(id: "string")
403
- def get_history(id:, request_options: nil)
404
- Async do
405
- response = @request_client.conn.get do |req|
406
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
407
- req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
408
- req.headers = {
409
- **(req.headers || {}),
410
- **@request_client.get_headers,
411
- **(request_options&.additional_headers || {})
412
- }.compact
413
- req.url "#{@request_client.get_url(environment: PreEncounter,
414
- request_options: request_options)}/patients/v1/#{id}/history"
415
- end
416
- parsed_json = JSON.parse(response.body)
417
- parsed_json&.map do |item|
418
- item = item.to_json
419
- CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient.from_json(json_object: item)
420
- end
421
- end
422
- end
423
-
424
- # Updates a patient. The path must contain the most recent version to prevent
425
- # races. Updating historic versions is not supported.
426
- #
427
- # @param id [String]
428
- # @param version [Integer]
429
- # @param request [Hash] Request of type CandidApiClient::PreEncounter::Patients::V1::Patients::Types::MutablePatient, as a Hash
430
- # * :name (Hash)
431
- # * :family (String)
432
- # * :given (Array<String>)
433
- # * :use (CandidApiClient::PreEncounter::Common::Types::NameUse)
434
- # * :period (Hash)
435
- # * :start (Date)
436
- # * :end_ (Date)
437
- # * :other_names (Array<CandidApiClient::PreEncounter::Common::Types::HumanName>)
438
- # * :gender (CandidApiClient::PreEncounter::Common::Types::Gender)
439
- # * :birth_date (Date)
440
- # * :marital_status (CandidApiClient::PreEncounter::Patients::V1::Patients::Types::MaritalStatus)
441
- # * :deceased (DateTime)
442
- # * :multiple_birth (Integer)
443
- # * :primary_address (Hash)
444
- # * :use (CandidApiClient::PreEncounter::Common::Types::AddressUse)
445
- # * :line (Array<String>)
446
- # * :city (String)
447
- # * :state (String)
448
- # * :postal_code (String)
449
- # * :country (String)
450
- # * :period (Hash)
451
- # * :start (Date)
452
- # * :end_ (Date)
453
- # * :other_addresses (Array<CandidApiClient::PreEncounter::Common::Types::Address>)
454
- # * :primary_telecom (Hash)
455
- # * :value (String)
456
- # * :use (CandidApiClient::PreEncounter::Common::Types::ContactPointUse)
457
- # * :period (Hash)
458
- # * :start (Date)
459
- # * :end_ (Date)
460
- # * :other_telecoms (Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>)
461
- # * :photo (String)
462
- # * :language (String)
463
- # * :external_provenance (Hash)
464
- # * :external_id (String)
465
- # * :system_name (String)
466
- # * :contacts (Array<CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Contact>)
467
- # * :general_practitioners (Array<CandidApiClient::PreEncounter::Patients::V1::Patients::Types::ExternalProvider>)
468
- # @param request_options [CandidApiClient::RequestOptions]
469
- # @return [CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient]
470
- # @example
471
- # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
472
- # api.pre_encounter.patients.v_1.patients.update(
473
- # id: "string",
474
- # version: 1,
475
- # request: { name: { family: "string", given: ["string"], use: USUAL, period: { } }, other_names: [{ family: "string", given: ["string"], use: USUAL, period: { } }], gender: FEMALE, birth_date: DateTime.parse(2023-01-15), marital_status: ANNULLED, deceased: DateTime.parse(2024-01-15T09:30:00.000Z), multiple_birth: 1, primary_address: { use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }, other_addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }], primary_telecom: { value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }, other_telecoms: [{ value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], photo: "string", language: "string", external_provenance: { external_id: "string", system_name: "string" }, contacts: [{ relationship: [SELF], name: { family: "string", given: ["string"], use: USUAL, period: { } }, gender: FEMALE, telecoms: [{ value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }], period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], general_practitioners: [{ name: { family: "string", given: ["string"], use: USUAL, period: { } }, telecoms: [{ value: "string", use: HOME, period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }], addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: { } }], period: { start: DateTime.parse(2023-01-15), end_: DateTime.parse(2023-01-15) } }] }
476
- # )
477
- def update(id:, version:, request:, request_options: nil)
478
- Async do
479
- response = @request_client.conn.put do |req|
480
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
481
- req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
482
- req.headers = {
483
- **(req.headers || {}),
484
- **@request_client.get_headers,
485
- **(request_options&.additional_headers || {})
486
- }.compact
487
- req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
488
- req.url "#{@request_client.get_url(environment: PreEncounter,
489
- request_options: request_options)}/patients/v1/#{id}/#{version}"
490
- end
491
- CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient.from_json(json_object: response.body)
492
- end
493
- end
494
-
495
- # Sets a patient as deactivated. The path must contain the most recent version to
496
- # prevent races. Dactivating historic versions is not supported. Subsequent
497
- # updates via PUT to the patient will "reactivate" the patient and set the
498
- # deactivated flag to false.
499
- #
500
- # @param id [String]
501
- # @param version [Integer]
502
- # @param request_options [CandidApiClient::RequestOptions]
503
- # @return [Void]
504
- # @example
505
- # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
506
- # api.pre_encounter.patients.v_1.patients.deactivate(id: "string", version: 1)
507
- def deactivate(id:, version:, request_options: nil)
508
- Async do
509
- @request_client.conn.delete do |req|
510
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
511
- req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
512
- req.headers = {
513
- **(req.headers || {}),
514
- **@request_client.get_headers,
515
- **(request_options&.additional_headers || {})
516
- }.compact
517
- req.url "#{@request_client.get_url(environment: PreEncounter,
518
- request_options: request_options)}/patients/v1/#{id}/#{version}"
519
- end
520
- end
521
- end
522
-
523
- # Searches for patients that match the query parameters.
524
- #
525
- # @param name_contains [String]
526
- # @param request_options [CandidApiClient::RequestOptions]
527
- # @return [Array<CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient>]
528
- # @example
529
- # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
530
- # api.pre_encounter.patients.v_1.patients.search(name_contains: "string")
531
- def search(name_contains: nil, request_options: nil)
532
- Async do
533
- response = @request_client.conn.get do |req|
534
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
535
- req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
536
- req.headers = {
537
- **(req.headers || {}),
538
- **@request_client.get_headers,
539
- **(request_options&.additional_headers || {})
540
- }.compact
541
- req.params = {
542
- **(request_options&.additional_query_parameters || {}),
543
- "name_contains": name_contains
544
- }.compact
545
- req.url "#{@request_client.get_url(environment: PreEncounter,
546
- request_options: request_options)}/patients/v1"
547
- end
548
- parsed_json = JSON.parse(response.body)
549
- parsed_json&.map do |item|
550
- item = item.to_json
551
- CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient.from_json(json_object: item)
552
- end
553
- end
554
- end
555
-
556
- # Scans up to 100 patient updates. The since query parameter is inclusive, and the
557
- # result list is ordered by updatedAt descending.
558
- #
559
- # @param since [DateTime]
560
- # @param request_options [CandidApiClient::RequestOptions]
561
- # @return [Array<CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient>]
562
- # @example
563
- # api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
564
- # api.pre_encounter.patients.v_1.patients.scan(since: DateTime.parse(2024-01-15T09:30:00.000Z))
565
- def scan(since:, request_options: nil)
566
- Async do
567
- response = @request_client.conn.get do |req|
568
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
569
- req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
570
- req.headers = {
571
- **(req.headers || {}),
572
- **@request_client.get_headers,
573
- **(request_options&.additional_headers || {})
574
- }.compact
575
- req.params = { **(request_options&.additional_query_parameters || {}), "since": since }.compact
576
- req.url "#{@request_client.get_url(environment: PreEncounter,
577
- request_options: request_options)}/patients/v1/updates/scan"
578
- end
579
- parsed_json = JSON.parse(response.body)
580
- parsed_json&.map do |item|
581
- item = item.to_json
582
- CandidApiClient::PreEncounter::Patients::V1::Patients::Types::Patient.from_json(json_object: item)
583
- end
584
- end
585
- end
586
- end
587
- end
588
- end
589
- end
590
- end