redox 1.2.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -0
- data/lib/redox.rb +10 -0
- data/lib/redox/models/financial.rb +13 -0
- data/lib/redox/models/model.rb +75 -26
- data/lib/redox/models/ordering_provider.rb +15 -0
- data/lib/redox/models/patient.rb +6 -0
- data/lib/redox/models/patient/contacts.rb +20 -0
- data/lib/redox/models/patient/demographics.rb +3 -3
- data/lib/redox/models/patient/identifier.rb +1 -1
- data/lib/redox/models/patient/p_c_p.rb +1 -5
- data/lib/redox/models/provider.rb +21 -0
- data/lib/redox/models/scheduling.rb +24 -0
- data/lib/redox/models/transaction.rb +75 -0
- data/lib/redox/models/visit.rb +41 -0
- data/lib/redox/request/financial.rb +12 -0
- data/lib/redox/request/patient_admin.rb +2 -8
- data/lib/redox/request/patient_search.rb +1 -1
- data/lib/redox/request/provider.rb +12 -0
- data/lib/redox/request/request.rb +9 -0
- data/lib/redox/request/scheduling.rb +30 -0
- data/lib/redox/version.rb +1 -1
- metadata +17 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8554c8aae232514947dda12f81ef347d9dd6fd81d8364cdf655240001a8bca7
|
4
|
+
data.tar.gz: 704879fb31e3a17965d78482844fed104e178f9ccf6fc68c6ada7d4ca53e0c02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43f9844cab0a114c1496fe8a72792885f62591a628cf0d8b98ef204ce726197593ee772509162af36bc140a6e1bff926a66c74f29496e750570937f71c7db5dc
|
7
|
+
data.tar.gz: ff93495f20309e8e0953200fab80464ca061e86b652aa06269c3a5582382c1a56f03288ffa8146ff5ca819ab927736389322f0f8112104b4d74a04bba7e1ad3d
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,41 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [1.5.1] - 2020-12-22
|
8
|
+
### Added
|
9
|
+
|
10
|
+
- Contacts model
|
11
|
+
- Patient#contacts
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
- typo of martialstatus is now maritalstatus for Demographics model
|
15
|
+
|
16
|
+
## [1.5.0] - 2020-12-15
|
17
|
+
### Added
|
18
|
+
- Scheduling model
|
19
|
+
- Scheduling#create
|
20
|
+
- Scheduling#cancel
|
21
|
+
- Scheduling#reschedule
|
22
|
+
- Scheduling#modification
|
23
|
+
|
24
|
+
## [1.4.0] - 2020-10-13
|
25
|
+
### Added
|
26
|
+
- AbstractModel that does not add top level key
|
27
|
+
- OrderingProvider that is the base for PCP
|
28
|
+
- Provider model
|
29
|
+
- Provider#query
|
30
|
+
- Created new method that can add helpers dynamically from response
|
31
|
+
|
32
|
+
## [1.3.1] - 2020-10-02
|
33
|
+
### Added
|
34
|
+
- Transaction#as\_json
|
35
|
+
- Visit#as\_json
|
36
|
+
|
37
|
+
## [1.3.0] - 2020-09-17
|
38
|
+
### Added
|
39
|
+
- Transaction model
|
40
|
+
- Financial#create
|
41
|
+
|
7
42
|
## [1.2.0] - 2020-07-30
|
8
43
|
### Added
|
9
44
|
- Visit model
|
@@ -103,6 +138,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
103
138
|
### Added
|
104
139
|
- Initial Release
|
105
140
|
|
141
|
+
[1.5.1]: https://github.com/WeInfuse/redox/compare/v1.5.0...v1.5.1
|
142
|
+
[1.5.0]: https://github.com/WeInfuse/redox/compare/v1.4.0...v1.5.0
|
143
|
+
[1.4.0]: https://github.com/WeInfuse/redox/compare/v1.3.1...v1.4.0
|
144
|
+
[1.3.1]: https://github.com/WeInfuse/redox/compare/v1.3.0...v1.3.1
|
145
|
+
[1.3.0]: https://github.com/WeInfuse/redox/compare/v1.2.0...v1.3.0
|
106
146
|
[1.2.0]: https://github.com/WeInfuse/redox/compare/v1.1.1...v1.2.0
|
107
147
|
[1.1.1]: https://github.com/WeInfuse/redox/compare/v1.1.0...v1.1.1
|
108
148
|
[1.1.0]: https://github.com/WeInfuse/redox/compare/v1.0.2...v1.1.0
|
data/lib/redox.rb
CHANGED
@@ -6,15 +6,25 @@ require 'redox/connection'
|
|
6
6
|
require 'redox/authentication'
|
7
7
|
require 'redox/models/model'
|
8
8
|
require 'redox/models/meta'
|
9
|
+
require 'redox/models/ordering_provider'
|
9
10
|
require 'redox/models/patient'
|
11
|
+
require 'redox/models/provider'
|
10
12
|
require 'redox/models/visit'
|
13
|
+
require 'redox/models/transaction'
|
14
|
+
require 'redox/models/financial'
|
11
15
|
require 'redox/models/patient/demographics'
|
16
|
+
require 'redox/models/patient/contacts'
|
12
17
|
require 'redox/models/patient/identifier'
|
13
18
|
require 'redox/models/patient/insurance'
|
14
19
|
require 'redox/models/patient/p_c_p'
|
15
20
|
require 'redox/models/potential_matches'
|
21
|
+
require 'redox/models/scheduling'
|
22
|
+
require 'redox/request/request'
|
23
|
+
require 'redox/request/financial'
|
16
24
|
require 'redox/request/patient_admin'
|
17
25
|
require 'redox/request/patient_search'
|
26
|
+
require 'redox/request/provider'
|
27
|
+
require 'redox/request/scheduling'
|
18
28
|
|
19
29
|
module Redox
|
20
30
|
class Configuration
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Redox
|
2
|
+
module Models
|
3
|
+
class Financial < AbstractModel
|
4
|
+
property :Visit, required: false, from: :visit, default: Redox::Models::Visit.new
|
5
|
+
property :Patient, required: false, from: :patient, default: Redox::Models::Patient.new
|
6
|
+
property :Transactions, required: false, from: :transactions, default: []
|
7
|
+
|
8
|
+
alias_method :patient, :Patient
|
9
|
+
alias_method :visit, :Visit
|
10
|
+
alias_method :transactions, :Transactions
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/redox/models/model.rb
CHANGED
@@ -1,9 +1,19 @@
|
|
1
1
|
module Redox
|
2
2
|
module Models
|
3
|
-
|
3
|
+
def self.format_datetime(d)
|
4
|
+
if d.respond_to?(:strftime)
|
5
|
+
d.strftime(Redox::Models::Meta::TO_DATETIME_FORMAT)
|
6
|
+
else
|
7
|
+
d
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class AbstractModel < Hashie::Trash
|
4
12
|
include Hashie::Extensions::IgnoreUndeclared
|
5
13
|
include Hashie::Extensions::IndifferentAccess
|
6
14
|
|
15
|
+
HIGH_LEVEL_KEYS = %w[Meta Patient Visit PotentialMatches]
|
16
|
+
|
7
17
|
property :Meta, from: :meta, required: false
|
8
18
|
property :Patient, from: :patient, required: false
|
9
19
|
property :Visit, from: :visit, required: false
|
@@ -16,6 +26,70 @@ module Redox
|
|
16
26
|
alias_method :visit, :Visit
|
17
27
|
alias_method :meta, :Meta
|
18
28
|
|
29
|
+
def to_json(args = {})
|
30
|
+
return self.to_h.to_json
|
31
|
+
end
|
32
|
+
|
33
|
+
def insurances
|
34
|
+
(self.patient&.insurances || []) + (self.visit&.insurances || [])
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.from_response(response)
|
38
|
+
model = Model.new
|
39
|
+
model.response = response
|
40
|
+
|
41
|
+
HIGH_LEVEL_KEYS.each do |k|
|
42
|
+
begin
|
43
|
+
model.send("#{k}=", Module.const_get("Redox::Models::#{k}").new(response[k])) if response[k]
|
44
|
+
rescue
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
return model
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.from_response_inflected(response)
|
52
|
+
model = self.from_response(response)
|
53
|
+
|
54
|
+
if (model.response.ok?)
|
55
|
+
data = model.response.parsed_response
|
56
|
+
|
57
|
+
if data.respond_to?(:keys)
|
58
|
+
model_class = nil
|
59
|
+
|
60
|
+
if model.meta&.data_model
|
61
|
+
model_class = "Redox::Models::#{model.meta.data_model}"
|
62
|
+
|
63
|
+
begin
|
64
|
+
model_class = Object.const_get(model_class)
|
65
|
+
rescue NameError
|
66
|
+
model_class = nil
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
data.keys.each do |key|
|
71
|
+
next if HIGH_LEVEL_KEYS.include?(key.to_s)
|
72
|
+
|
73
|
+
helper_name = key.to_s.downcase.to_sym
|
74
|
+
|
75
|
+
if model_class.nil?
|
76
|
+
model.define_singleton_method(helper_name) { data[key] }
|
77
|
+
else
|
78
|
+
if data[key].is_a?(Array)
|
79
|
+
model.define_singleton_method(helper_name) { data[key].map {|obj| model_class.new(obj) } }
|
80
|
+
else
|
81
|
+
model.define_singleton_method(helper_name) { model_class.new(data[key]) }
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
return model
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
class Model < AbstractModel
|
19
93
|
def initialize(data = {})
|
20
94
|
if data.is_a?(Hash)
|
21
95
|
if data.include?(key)
|
@@ -32,32 +106,7 @@ module Redox
|
|
32
106
|
return { key => super.to_h }
|
33
107
|
end
|
34
108
|
|
35
|
-
def to_json
|
36
|
-
return self.to_h.to_json
|
37
|
-
end
|
38
|
-
|
39
|
-
def insurances
|
40
|
-
(self.patient&.insurances || []) + (self.visit&.insurances || [])
|
41
|
-
end
|
42
|
-
|
43
|
-
class << self
|
44
|
-
def from_response(response)
|
45
|
-
model = Model.new
|
46
|
-
model.response = response
|
47
|
-
|
48
|
-
%w[Meta Patient Visit PotentialMatches].each do |k|
|
49
|
-
begin
|
50
|
-
model.send("#{k}=", Module.const_get("Redox::Models::#{k}").new(response[k])) if response[k]
|
51
|
-
rescue
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
return model
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
109
|
private
|
60
|
-
|
61
110
|
def key
|
62
111
|
return self.class.to_s.split('::').last.to_s
|
63
112
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Redox
|
2
|
+
module Models
|
3
|
+
class OrderingProvider < AbstractModel
|
4
|
+
property :ID, required: false, from: :id
|
5
|
+
property :IDType, required: false, from: :id_type
|
6
|
+
property :FirstName, required: false, from: :first_name
|
7
|
+
property :LastName, required: false, from: :last_name
|
8
|
+
|
9
|
+
alias_method :first_name, :FirstName
|
10
|
+
alias_method :last_name, :LastName
|
11
|
+
alias_method :id, :ID
|
12
|
+
alias_method :id_type, :IDType
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/redox/models/patient.rb
CHANGED
@@ -4,10 +4,12 @@ module Redox
|
|
4
4
|
property :Identifiers, from: :identifiers, required: false, default: []
|
5
5
|
property :Insurances, from: :insurances, required: false, default: []
|
6
6
|
property :Demographics, from: :demographics, required: false
|
7
|
+
property :Contacts, from: :contacts, required: false, default: []
|
7
8
|
property :PCP, from: :primary_care_provider, required: false
|
8
9
|
|
9
10
|
alias_method :identifiers, :Identifiers
|
10
11
|
alias_method :insurances, :Insurances
|
12
|
+
alias_method :contacts, :Contacts
|
11
13
|
|
12
14
|
def demographics
|
13
15
|
self[:Demographics] = Demographics.new(self[:Demographics]) unless self[:Demographics].is_a?(Redox::Models::Demographics)
|
@@ -22,6 +24,10 @@ module Redox
|
|
22
24
|
self[:PCP] ||= PCP.new
|
23
25
|
end
|
24
26
|
|
27
|
+
def contacts
|
28
|
+
self[:Contacts] = self[:Contacts].map {|contact| contact.is_a?(Redox::Models::Contact) ? contact : Contact.new(contact)}
|
29
|
+
end
|
30
|
+
|
25
31
|
def add_identifier(type: , value: )
|
26
32
|
self[:Identifiers] << Identifier.new({'ID' => value, 'IDType' => type})
|
27
33
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Redox
|
2
|
+
module Models
|
3
|
+
class Contact < AbstractModel
|
4
|
+
property :FirstName, required: false, from: :first_name
|
5
|
+
property :MiddleName, required: false, from: :middle_name
|
6
|
+
property :LastName, required: false, from: :last_name
|
7
|
+
property :RelationToPatient, required: false
|
8
|
+
property :EmailAddresses, required: false, default: []
|
9
|
+
property :Address, required: false, default: {}
|
10
|
+
property :PhoneNumber, required: false, default: {}
|
11
|
+
property :Roles, required: false, default: []
|
12
|
+
|
13
|
+
alias_method :first_name, :FirstName
|
14
|
+
alias_method :middle_name, :MiddleName
|
15
|
+
alias_method :last_name, :LastName
|
16
|
+
alias_method :address, :Address
|
17
|
+
alias_method :phone_number, :PhoneNumber
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Redox
|
2
2
|
module Models
|
3
|
-
class Demographics <
|
3
|
+
class Demographics < AbstractModel
|
4
4
|
property :FirstName, required: false, from: :first_name
|
5
5
|
property :MiddleName, required: false, from: :middle_name
|
6
6
|
property :LastName, required: false, from: :last_name
|
@@ -9,7 +9,7 @@ module Redox
|
|
9
9
|
property :Sex, required: false, from: :sex
|
10
10
|
property :Race, required: false, from: :race
|
11
11
|
property :IsHispanic, required: false
|
12
|
-
property :MaritalStatus, required: false, from: :
|
12
|
+
property :MaritalStatus, required: false, from: :marital_status
|
13
13
|
property :IsDeceased, required: false
|
14
14
|
property :DeathDateTime, required: false
|
15
15
|
property :Language, required: false, from: :language
|
@@ -25,7 +25,7 @@ module Redox
|
|
25
25
|
alias_method :ssn, :SSN
|
26
26
|
alias_method :sex, :Sex
|
27
27
|
alias_method :race, :Race
|
28
|
-
alias_method :
|
28
|
+
alias_method :marital_status, :MaritalStatus
|
29
29
|
alias_method :language, :Language
|
30
30
|
alias_method :address, :Address
|
31
31
|
alias_method :phone_number, :PhoneNumber
|
@@ -1,13 +1,9 @@
|
|
1
1
|
module Redox
|
2
2
|
module Models
|
3
|
-
class PCP <
|
3
|
+
class PCP < OrderingProvider
|
4
4
|
property :NPI, from: :npi
|
5
|
-
property :FirstName, required: false, from: :first_name
|
6
|
-
property :LastName, required: false, from: :last_name
|
7
5
|
|
8
6
|
alias_method :npi, :NPI
|
9
|
-
alias_method :first_name, :FirstName
|
10
|
-
alias_method :last_name, :LastName
|
11
7
|
end
|
12
8
|
end
|
13
9
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Redox
|
2
|
+
module Models
|
3
|
+
class Provider < Model
|
4
|
+
property :Identifiers, from: :identifiers, required: false, default: []
|
5
|
+
property :Demographics, from: :demographics, required: false
|
6
|
+
|
7
|
+
alias_method :identifiers, :Identifiers
|
8
|
+
|
9
|
+
def demographics
|
10
|
+
self[:Demographics] = Demographics.new(self[:Demographics]) unless self[:Demographics].is_a?(Redox::Models::Demographics)
|
11
|
+
self[:Demographics] ||= Demographics.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_identifier(type: , value: )
|
15
|
+
self[:Identifiers] << Identifier.new({'ID' => value, 'IDType' => type})
|
16
|
+
|
17
|
+
return self
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Redox
|
2
|
+
module Models
|
3
|
+
class Scheduling < AbstractModel
|
4
|
+
property :Visit, required: false, from: :visit, default: Redox::Models::Visit.new
|
5
|
+
property :Patient, required: false, from: :patient, default: Redox::Models::Patient.new
|
6
|
+
property :AppointmentInfo, required: false, from: :appointment_info, default: []
|
7
|
+
|
8
|
+
alias_method :patient, :Patient
|
9
|
+
alias_method :visit, :Visit
|
10
|
+
alias_method :appointment_info, :AppointmentInfo
|
11
|
+
|
12
|
+
def add_appointment_info(code: nil, codeset: nil, description: nil, value: nil)
|
13
|
+
self[:AppointmentInfo] << {
|
14
|
+
Code: code,
|
15
|
+
Codeset: codeset,
|
16
|
+
Description: description,
|
17
|
+
Value: value
|
18
|
+
}
|
19
|
+
|
20
|
+
self
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module Redox
|
2
|
+
module Models
|
3
|
+
class Transaction < AbstractModel
|
4
|
+
property :Chargeable, required: false, from: :chargeable, default: {}
|
5
|
+
property :DateTimeOfService, required: false, from: :start
|
6
|
+
property :Department, required: false, from: :department, default: {}
|
7
|
+
property :Diagnoses, required: false, from: :diagnoses, default: []
|
8
|
+
property :EndDateTime, required: false, from: :end
|
9
|
+
property :Extensions, required: false, from: :extensions, default: {}
|
10
|
+
property :ID, required: false, from: :id
|
11
|
+
property :NDC, required: false, from: :ndc, default: {}
|
12
|
+
property :OrderID, required: false, from: :order_id
|
13
|
+
property :OrderingProviders, required: false, from: :ordering_providers, default: []
|
14
|
+
property :Performers, required: false, from: :performers, default: []
|
15
|
+
property :Procedure, required: false, from: :procedure, default: {}
|
16
|
+
property :Type, required: false, from: :type
|
17
|
+
|
18
|
+
alias_method :chargeable, :Chargeable
|
19
|
+
alias_method :start, :DateTimeOfService
|
20
|
+
alias_method :department, :Department
|
21
|
+
alias_method :diagnoses, :Diagnoses
|
22
|
+
alias_method :end, :EndDateTime
|
23
|
+
alias_method :extensions, :Extensions
|
24
|
+
alias_method :id, :ID
|
25
|
+
alias_method :ndc, :NDC
|
26
|
+
alias_method :order_id, :OrderID
|
27
|
+
alias_method :ordering_providers, :OrderingProviders
|
28
|
+
alias_method :performers, :Performers
|
29
|
+
alias_method :procedure, :Procedure
|
30
|
+
alias_method :type, :Type
|
31
|
+
|
32
|
+
def add_medication(ndc_code: nil, quantity: nil, magnitude: nil, unit: nil, description: nil)
|
33
|
+
self[:NDC] = { Code: ndc_code, Description: description }
|
34
|
+
self[:Extensions] = {
|
35
|
+
'ndc-quantity' => {
|
36
|
+
integer: quantity&.to_s
|
37
|
+
},
|
38
|
+
'ndc-units-measure' => {
|
39
|
+
coding: {
|
40
|
+
code: magnitude&.to_s,
|
41
|
+
display: unit
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
self
|
46
|
+
end
|
47
|
+
|
48
|
+
def add_ordering_provider(**kwargs)
|
49
|
+
self[:OrderingProviders] ||= []
|
50
|
+
self[:OrderingProviders] << OrderingProvider.new(kwargs)
|
51
|
+
self
|
52
|
+
end
|
53
|
+
|
54
|
+
def add_performer(**kwargs)
|
55
|
+
self[:Performers] ||= []
|
56
|
+
self[:Performers] << OrderingProvider.new(kwargs)
|
57
|
+
self
|
58
|
+
end
|
59
|
+
|
60
|
+
def to_h
|
61
|
+
result = super.to_h
|
62
|
+
|
63
|
+
%w[EndDateTime DateTimeOfService].each do |k|
|
64
|
+
result[k] = Redox::Models.format_datetime(result[k])
|
65
|
+
end
|
66
|
+
|
67
|
+
result
|
68
|
+
end
|
69
|
+
|
70
|
+
def as_json(args)
|
71
|
+
self.to_h
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
data/lib/redox/models/visit.rb
CHANGED
@@ -1,13 +1,54 @@
|
|
1
1
|
module Redox
|
2
2
|
module Models
|
3
3
|
class Visit < Model
|
4
|
+
DEFAULT_LOCATION = {
|
5
|
+
Department: nil,
|
6
|
+
Facility: nil
|
7
|
+
}
|
8
|
+
|
4
9
|
property :Insurances, from: :insurances, required: false, default: []
|
10
|
+
property :Location, from: :location, required: false, default: DEFAULT_LOCATION
|
11
|
+
property :VisitDateTime, from: :start, required: false
|
12
|
+
property :Duration, from: :duration, required: false
|
13
|
+
property :VisitNumber, from: :visit_number, required: false
|
14
|
+
property :AccountNumber, from: :account_number, required: false
|
5
15
|
|
6
16
|
alias_method :insurances, :Insurances
|
17
|
+
alias_method :start, :VisitDateTime
|
18
|
+
|
19
|
+
def department=(v)
|
20
|
+
self[:Location] ||= DEFAULT_LOCATION
|
21
|
+
self[:Location][:Department] = v
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
def facility=(v)
|
26
|
+
self[:Location] ||= DEFAULT_LOCATION
|
27
|
+
self[:Location][:Facility] = v
|
28
|
+
self
|
29
|
+
end
|
7
30
|
|
8
31
|
def insurances
|
9
32
|
self[:Insurances] = self[:Insurances].map {|ins| ins.is_a?(Redox::Models::Insurance) ? ins : Insurance.new(ins) }
|
10
33
|
end
|
34
|
+
|
35
|
+
def to_h
|
36
|
+
result = super.to_h
|
37
|
+
|
38
|
+
%w[VisitDateTime].each do |k|
|
39
|
+
result[key][k] = Redox::Models.format_datetime(result[key][k])
|
40
|
+
end
|
41
|
+
|
42
|
+
result
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_json(args = {})
|
46
|
+
self.to_h.to_json
|
47
|
+
end
|
48
|
+
|
49
|
+
def as_json(args = {})
|
50
|
+
self.to_h.dig('Visit')
|
51
|
+
end
|
11
52
|
end
|
12
53
|
end
|
13
54
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Redox
|
2
|
+
module Request
|
3
|
+
class Financial
|
4
|
+
TRANSACTION_META = Redox::Models::Meta.new(EventType: 'Transaction', DataModel: 'Financial')
|
5
|
+
|
6
|
+
def self.create(financial, meta: Redox::Models::Meta.new)
|
7
|
+
meta = TRANSACTION_META.merge(meta)
|
8
|
+
return Redox::Models::Model.from_response((RedoxClient.connection.request(body: Redox::Request.build_body(financial, meta))))
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -6,18 +6,12 @@ module Redox
|
|
6
6
|
|
7
7
|
def self.create(patient: , meta: Redox::Models::Meta.new)
|
8
8
|
meta = CREATE_META.merge(meta)
|
9
|
-
return Redox::Models::Model.from_response((RedoxClient.connection.request(body: Redox::Request
|
9
|
+
return Redox::Models::Model.from_response((RedoxClient.connection.request(body: Redox::Request.build_body(patient, meta))))
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.update(patient: , meta: Redox::Models::Meta.new)
|
13
13
|
meta = UPDATE_META.merge(meta)
|
14
|
-
return Redox::Models::Model.from_response((RedoxClient.connection.request(body: Redox::Request
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.build_body(params, meta)
|
18
|
-
meta = Redox::Models::Meta.new.merge(meta)
|
19
|
-
|
20
|
-
return meta.to_h.merge(params.to_h)
|
14
|
+
return Redox::Models::Model.from_response((RedoxClient.connection.request(body: Redox::Request.build_body(patient, meta))))
|
21
15
|
end
|
22
16
|
end
|
23
17
|
end
|
@@ -6,7 +6,7 @@ module Redox
|
|
6
6
|
|
7
7
|
def self.query(params, meta: Redox::Models::Meta.new)
|
8
8
|
meta = QUERY_META.merge(meta)
|
9
|
-
return Redox::Models::Model.from_response((RedoxClient.connection.request(endpoint: QUERY_ENDPOINT, body: Redox::Request
|
9
|
+
return Redox::Models::Model.from_response((RedoxClient.connection.request(endpoint: QUERY_ENDPOINT, body: Redox::Request.build_body(params, meta))))
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Redox
|
2
|
+
module Request
|
3
|
+
class Provider
|
4
|
+
QUERY_META = Redox::Models::Meta.new(EventType: 'ProviderQuery', DataModel: 'Provider')
|
5
|
+
|
6
|
+
def self.query(provider, meta: Redox::Models::Meta.new)
|
7
|
+
meta = QUERY_META.merge(meta)
|
8
|
+
return Redox::Models::Model.from_response_inflected((RedoxClient.connection.request(body: Redox::Request.build_body(provider, meta))))
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Redox
|
2
|
+
module Request
|
3
|
+
class Scheduling
|
4
|
+
CREATE_META = Redox::Models::Meta.new(EventType: 'New', DataModel: 'Scheduling')
|
5
|
+
CANCEL_META = Redox::Models::Meta.new(EventType: 'Cancel', DataModel: 'Scheduling')
|
6
|
+
RESCHEDULE_META = Redox::Models::Meta.new(EventType: 'Reschedule', DataModel: 'Scheduling')
|
7
|
+
MODIFICATION_META = Redox::Models::Meta.new(EventType: 'Modification', DataModel: 'Scheduling')
|
8
|
+
|
9
|
+
def self.create(model, meta: Redox::Models::Meta.new)
|
10
|
+
meta = CREATE_META.merge(meta)
|
11
|
+
return Redox::Models::Model.from_response((RedoxClient.connection.request(body: Redox::Request.build_body(model, meta))))
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.cancel(model, meta: Redox::Models::Meta.new)
|
15
|
+
meta = CANCEL_META.merge(meta)
|
16
|
+
return Redox::Models::Model.from_response((RedoxClient.connection.request(body: Redox::Request.build_body(model, meta))))
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.reschedule(model, meta: Redox::Models::Meta.new)
|
20
|
+
meta = RESCHEDULE_META.merge(meta)
|
21
|
+
return Redox::Models::Model.from_response((RedoxClient.connection.request(body: Redox::Request.build_body(model, meta))))
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.modification(model, meta: Redox::Models::Meta.new)
|
25
|
+
meta = MODIFICATION_META.merge(meta)
|
26
|
+
return Redox::Models::Model.from_response((RedoxClient.connection.request(body: Redox::Request.build_body(model, meta))))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/redox/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Clark
|
8
8
|
- Mike Crockett
|
9
9
|
- Mike Carr
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-12-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|
@@ -130,7 +130,7 @@ dependencies:
|
|
130
130
|
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0.9'
|
133
|
-
description:
|
133
|
+
description:
|
134
134
|
email:
|
135
135
|
- alexander.clark@weinfuse.com
|
136
136
|
- mike.crockett@weinfuse.com
|
@@ -147,18 +147,28 @@ files:
|
|
147
147
|
- lib/redox.rb
|
148
148
|
- lib/redox/authentication.rb
|
149
149
|
- lib/redox/connection.rb
|
150
|
+
- lib/redox/models/financial.rb
|
150
151
|
- lib/redox/models/meta.rb
|
151
152
|
- lib/redox/models/model.rb
|
153
|
+
- lib/redox/models/ordering_provider.rb
|
152
154
|
- lib/redox/models/patient.rb
|
155
|
+
- lib/redox/models/patient/contacts.rb
|
153
156
|
- lib/redox/models/patient/demographics.rb
|
154
157
|
- lib/redox/models/patient/identifier.rb
|
155
158
|
- lib/redox/models/patient/insurance.rb
|
156
159
|
- lib/redox/models/patient/p_c_p.rb
|
157
160
|
- lib/redox/models/potential_matches.rb
|
161
|
+
- lib/redox/models/provider.rb
|
162
|
+
- lib/redox/models/scheduling.rb
|
163
|
+
- lib/redox/models/transaction.rb
|
158
164
|
- lib/redox/models/visit.rb
|
159
165
|
- lib/redox/redox_exception.rb
|
166
|
+
- lib/redox/request/financial.rb
|
160
167
|
- lib/redox/request/patient_admin.rb
|
161
168
|
- lib/redox/request/patient_search.rb
|
169
|
+
- lib/redox/request/provider.rb
|
170
|
+
- lib/redox/request/request.rb
|
171
|
+
- lib/redox/request/scheduling.rb
|
162
172
|
- lib/redox/version.rb
|
163
173
|
- redox.gemspec
|
164
174
|
homepage: https://github.com/WeInfuse/redox
|
@@ -166,7 +176,7 @@ licenses:
|
|
166
176
|
- MIT
|
167
177
|
metadata:
|
168
178
|
allowed_push_host: https://rubygems.org
|
169
|
-
post_install_message:
|
179
|
+
post_install_message:
|
170
180
|
rdoc_options: []
|
171
181
|
require_paths:
|
172
182
|
- lib
|
@@ -181,9 +191,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
191
|
- !ruby/object:Gem::Version
|
182
192
|
version: '0'
|
183
193
|
requirements: []
|
184
|
-
rubyforge_project:
|
194
|
+
rubyforge_project:
|
185
195
|
rubygems_version: 2.7.6
|
186
|
-
signing_key:
|
196
|
+
signing_key:
|
187
197
|
specification_version: 4
|
188
198
|
summary: Ruby wrapper for the Redox Engine API
|
189
199
|
test_files: []
|