redox-engine 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/redox-engine/client.rb +81 -25
- data/lib/redox-engine/request_helpers.rb +20 -9
- data/lib/redox-engine/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ecef52e6dcbca9882a871ce572fc23ab8779997b098b2ef7570cd70d1201257
|
4
|
+
data.tar.gz: ec4580d43ba4347f26be8e295fb281f0a813e61f7a41915116792e66cdbe48a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57c9aaded6bc7ea8752e7563d747decefd932b6167407084a7a6365032d5d791b718107f8afa6a1f3852a3ea3ec9a68a3ff3b17b798999f2918c09c09bb45ebb
|
7
|
+
data.tar.gz: 842d07675d0ed7d60605dffe5af08938574d7db7d1ba04cd391087c7cda5ed85bd7fb11d009606791437c94a9b26d14bf94525b825ea58f54fdbdac98b302d49
|
data/README.md
CHANGED
@@ -117,4 +117,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
117
117
|
|
118
118
|
## Contributing
|
119
119
|
|
120
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
120
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/pdeona/redox.
|
data/lib/redox-engine/client.rb
CHANGED
@@ -45,9 +45,13 @@ module RedoxEngine
|
|
45
45
|
# @return [Hash] parsed response object
|
46
46
|
# @example
|
47
47
|
# RedoxEngine::Client.new(*connection_params).add_patient(
|
48
|
-
# Identifiers: [
|
48
|
+
# Identifiers: [{
|
49
|
+
# ID: string
|
50
|
+
# IDType: string
|
51
|
+
# }*],
|
49
52
|
# Demographics: {
|
50
|
-
# FirstName:
|
53
|
+
# FirstName: string
|
54
|
+
# ...
|
51
55
|
# }
|
52
56
|
# )
|
53
57
|
def add_patient(patient_params)
|
@@ -60,13 +64,18 @@ module RedoxEngine
|
|
60
64
|
|
61
65
|
# Send PatientAdmin#PatientUpdate message
|
62
66
|
#
|
63
|
-
# @param [Hash] patient_params data to send in the
|
67
|
+
# @param [Hash] <Patient> patient_params data to send in the
|
68
|
+
# Patient JSON object
|
64
69
|
# @return [Hash] parsed response object
|
65
70
|
# @example
|
66
71
|
# RedoxEngine::Client.new(*connection_params).update_patient(
|
67
|
-
# Identifiers: [
|
72
|
+
# Identifiers: [{
|
73
|
+
# ID: string
|
74
|
+
# IDType: string
|
75
|
+
# }*],
|
68
76
|
# Demographics: {
|
69
|
-
# FirstName:
|
77
|
+
# FirstName: string
|
78
|
+
# ...
|
70
79
|
# }
|
71
80
|
# )
|
72
81
|
def update_patient(patient_params)
|
@@ -79,12 +88,12 @@ module RedoxEngine
|
|
79
88
|
|
80
89
|
# Send PatientSearch#Query message
|
81
90
|
#
|
82
|
-
# @param [Hash]
|
91
|
+
# @param [Hash] <Patient> data to send in the Patient JSON object
|
83
92
|
# @return [Hash] parsed response object
|
84
93
|
# @example
|
85
94
|
# RedoxEngine::Client.new(*connection_params).search_patient(
|
86
95
|
# demographics: {
|
87
|
-
# FirstName:
|
96
|
+
# FirstName: string
|
88
97
|
# ...
|
89
98
|
# }
|
90
99
|
# )
|
@@ -98,14 +107,14 @@ module RedoxEngine
|
|
98
107
|
|
99
108
|
# Send ClinicalSummary#PatientQuery message
|
100
109
|
#
|
101
|
-
# @param [Hash]
|
110
|
+
# @param [Hash] <Patient> data to send in the Patient JSON object
|
102
111
|
# @return [Hash] parsed response object
|
103
112
|
# @example
|
104
113
|
# RedoxEngine::Client.new(*connection_params).search_patient(
|
105
114
|
# identifiers: [
|
106
115
|
# {
|
107
|
-
# id:
|
108
|
-
# id_type:
|
116
|
+
# id: string
|
117
|
+
# id_type: string
|
109
118
|
# }
|
110
119
|
# ]
|
111
120
|
# )
|
@@ -122,34 +131,81 @@ module RedoxEngine
|
|
122
131
|
|
123
132
|
# Send Scheduling#BookedSlots message
|
124
133
|
#
|
125
|
-
#
|
134
|
+
# NOTE: Endpoint not supported by all Health Systems, talk to your
|
135
|
+
# redox rep for more information
|
136
|
+
# @param [Hash] query_data to send in the <Visit>/<Patient> JSON objects
|
126
137
|
# @param [String|Time] start_time datetime to search from
|
127
138
|
# @params [String|Time] end_time datetime to search until
|
128
139
|
# @return [Hash] parsed response object
|
129
140
|
# @example
|
130
141
|
# RedoxEngine::Client.new(*connection_params).get_booked_slots(
|
131
|
-
#
|
132
|
-
#
|
133
|
-
#
|
134
|
-
#
|
135
|
-
#
|
136
|
-
#
|
137
|
-
#
|
138
|
-
|
139
|
-
|
140
|
-
|
142
|
+
# query_data: {
|
143
|
+
# visit: <Visit>
|
144
|
+
# patient: <Patient>
|
145
|
+
# }
|
146
|
+
# start_time?: Time | String (ISO-8601 Time String)
|
147
|
+
# end_time?: Time | String (ISO-8601 Time String)
|
148
|
+
# )
|
149
|
+
def get_booked_slots(visit:, patient: nil, start_time: nil, end_time: nil)
|
150
|
+
request_body = scheduling_query(
|
151
|
+
query_data: { visit: visit, patient: patient },
|
152
|
+
start_time: start_time,
|
153
|
+
end_time: end_time,
|
154
|
+
type: 'Booked'
|
155
|
+
)
|
156
|
+
handle_request(
|
157
|
+
request_body,
|
158
|
+
'Error fetching Booked Slots.'
|
159
|
+
)
|
160
|
+
end
|
161
|
+
|
162
|
+
# Send Scheduling#AvailableSlots message
|
163
|
+
#
|
164
|
+
# NOTE: Endpoint not supported by all Health Systems, talk to your
|
165
|
+
# redox rep for more information
|
166
|
+
# @param [Hash] query_data to send in the <Visit>/<Patient> JSON objects
|
167
|
+
# @param [String|Time] start_time datetime to search from
|
168
|
+
# @params [String|Time] end_time datetime to search until
|
169
|
+
# @return [Hash] parsed response object
|
170
|
+
# @example
|
171
|
+
# RedoxEngine::Client.new(*connection_params).get_available_slots(
|
172
|
+
# query_data: {
|
173
|
+
# visit: <Visit>
|
174
|
+
# patient: <Patient>
|
175
|
+
# }
|
141
176
|
# start_time?: Time | String (ISO-8601 Time String)
|
142
177
|
# end_time?: Time | String (ISO-8601 Time String)
|
143
178
|
# )
|
144
|
-
def
|
179
|
+
def get_available_slots(
|
180
|
+
visit:, patient: nil, start_time: nil, end_time: nil
|
181
|
+
)
|
182
|
+
visit[:reasons] = ['-1']
|
145
183
|
request_body = scheduling_query(
|
146
|
-
visit: visit,
|
184
|
+
query_data: { visit: visit, patient: patient },
|
147
185
|
start_time: start_time,
|
148
|
-
end_time: end_time
|
186
|
+
end_time: end_time,
|
187
|
+
type: 'AvailableSlots'
|
188
|
+
)
|
189
|
+
handle_request(request_body, 'Error fetching Available Slots.')
|
190
|
+
end
|
191
|
+
|
192
|
+
# Send Scheduling#New message
|
193
|
+
#
|
194
|
+
# @param [Hash] <Visit>
|
195
|
+
# @param [Hash] <Patient>
|
196
|
+
# @return [Hash] parsed response object
|
197
|
+
# @example
|
198
|
+
# RedoxEngine::Client.new(*connection_params).get_available_slots(
|
199
|
+
# visit: <Visit>
|
200
|
+
# patient: <Patient>
|
201
|
+
# )
|
202
|
+
def add_appointment(visit:, patient:)
|
203
|
+
request_body = scheduling_query(
|
204
|
+
query_data: { visit: visit, patient: patient }, type: 'New'
|
149
205
|
)
|
150
206
|
handle_request(
|
151
207
|
request_body,
|
152
|
-
'Error
|
208
|
+
'Error posting New Appointment.'
|
153
209
|
)
|
154
210
|
end
|
155
211
|
end
|
@@ -28,7 +28,7 @@ module RedoxEngine
|
|
28
28
|
meta: {
|
29
29
|
data_model: data_model,
|
30
30
|
event_type: event_type,
|
31
|
-
event_date_time: Time.now.iso8601,
|
31
|
+
event_date_time: Time.now.utc.iso8601,
|
32
32
|
test: @test,
|
33
33
|
source: @source,
|
34
34
|
destinations: find_destination(data_model)
|
@@ -36,16 +36,27 @@ module RedoxEngine
|
|
36
36
|
}.redoxify_keys
|
37
37
|
end
|
38
38
|
|
39
|
-
def scheduling_query(
|
39
|
+
def scheduling_query(query_data:, start_time: nil, end_time: nil, type:)
|
40
|
+
request_meta(data_model: 'Scheduling', event_type: type)
|
41
|
+
.merge(
|
42
|
+
scheduling_body(
|
43
|
+
query_data: query_data,
|
44
|
+
start_time: start_time,
|
45
|
+
end_time: end_time
|
46
|
+
)
|
47
|
+
).redoxify_keys
|
48
|
+
end
|
49
|
+
|
50
|
+
def scheduling_body(query_data:, start_time: nil, end_time: nil)
|
40
51
|
start_time = start_time ? Time.parse(start_time.to_s) : Time.now
|
41
52
|
end_time = end_time ? Time.parse(end_time.to_s) : start_time + 864_000
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
53
|
+
{
|
54
|
+
visit: query_data[:visit],
|
55
|
+
start_date_time: start_time.utc.iso8601,
|
56
|
+
end_date_time: end_time.utc.iso8601,
|
57
|
+
patient: query_data[:patient],
|
58
|
+
visit_number: query_data[:visit][:visit_number]
|
59
|
+
}
|
49
60
|
end
|
50
61
|
|
51
62
|
def login_request(refresh_token = nil)
|
data/lib/redox-engine/version.rb
CHANGED