redox 1.0.2 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 723ef1a6761a8bc29b184b6ce436cab1efd9bc397bc51b7907fa8692421ba8ba
4
- data.tar.gz: e45806f7bd77025ee3d060ee4c4663aa462cc0b2554042b33110f1df76f85b27
3
+ metadata.gz: 740cc0762bcf54c65c0767f1e6254aa304a193b493babdd5993859866911a7c2
4
+ data.tar.gz: df1e7871ffde6efcd565255ea17ad05a5940fa951879e30db4e152c9c78679ae
5
5
  SHA512:
6
- metadata.gz: ea1863fe78f915a3ae082963dbd56dbb2501759e2f2a0ab99b622b7925febe209f33a212a700c0a48415b1464b46715941d8f95869c6811fc0cb1fddceb7ddb2
7
- data.tar.gz: d4ed45942181735d43c458193a5cc39890d222f07168cbeec593531b0b7647c3c222686f1f738c4d80b5d091f3aa4c6a1df16186d22662bec6e951f650dca092
6
+ metadata.gz: f49cff5f2b525ff29499104f008ca393d1676d8a0963fad72154f8a8bfd0cd807fafc9017606d7d3d45c4ed81e8598d06843096b731699f972ed3143e147ad37
7
+ data.tar.gz: 3dd1d039480dc5573df999aa9f74f44e6a63acef237dc8257e4bdc22f073033d75b7be6b1d9617e26dcbac22e8f6d199f5d995e019bd73e3c866cde98c9acd62
@@ -4,11 +4,35 @@ 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.x.x] - UNRELEASED
7
+ ## [1.3.1] - 2020-10-02
8
+ ### Added
9
+ - Transaction#as\_json
10
+ - Visit#as\_json
11
+
12
+ ## [1.3.0] - 2020-09-17
13
+ ### Added
14
+ - Transaction model
15
+ - Financial#create
16
+
17
+ ## [1.2.0] - 2020-07-30
18
+ ### Added
19
+ - Visit model
20
+ - Model#insurances helper for Patient.Insurances || Visit.Insurances
21
+
22
+ ## [1.1.1] - 2020-06-15
8
23
  ### Changed
9
- - None
24
+ - Bugfix with patient param in update
25
+
26
+ ## [1.1.0] - 2020-06-15
27
+ ### Changed
28
+ - Moving to Requst classes instead of mixing in logic to models (kept backwards compatibility)
29
+ - Added potential matches to responses and implemented for patient search
30
+
31
+ =======
32
+ ### Added
33
+ - PotentialMatches class
10
34
 
11
- ## [1.0.2] - UNRELEASED
35
+ ## [1.0.2] - 2019-06-04
12
36
  ### Changed
13
37
  - Added Extensions to all Redox models
14
38
  - Fixed warnings in gemspec
@@ -89,7 +113,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
89
113
  ### Added
90
114
  - Initial Release
91
115
 
92
- [Unreleased]: https://github.com/WeInfuse/redox/compare/v1.0.2...HEAD
116
+ [1.3.1]: https://github.com/WeInfuse/redox/compare/v1.3.0...v1.3.1
117
+ [1.3.0]: https://github.com/WeInfuse/redox/compare/v1.2.0...v1.3.0
118
+ [1.2.0]: https://github.com/WeInfuse/redox/compare/v1.1.1...v1.2.0
119
+ [1.1.1]: https://github.com/WeInfuse/redox/compare/v1.1.0...v1.1.1
120
+ [1.1.0]: https://github.com/WeInfuse/redox/compare/v1.0.2...v1.1.0
93
121
  [1.0.2]: https://github.com/WeInfuse/redox/compare/v1.0.1...v1.0.2
94
122
  [1.0.1]: https://github.com/WeInfuse/redox/compare/v1.0.0...v1.0.1
95
123
  [1.0.0]: https://github.com/WeInfuse/redox/compare/v0.1.6...v1.0.0
@@ -7,10 +7,18 @@ require 'redox/authentication'
7
7
  require 'redox/models/model'
8
8
  require 'redox/models/meta'
9
9
  require 'redox/models/patient'
10
+ require 'redox/models/visit'
11
+ require 'redox/models/transaction'
12
+ require 'redox/models/financial'
10
13
  require 'redox/models/patient/demographics'
11
14
  require 'redox/models/patient/identifier'
12
15
  require 'redox/models/patient/insurance'
13
16
  require 'redox/models/patient/p_c_p'
17
+ require 'redox/models/potential_matches'
18
+ require 'redox/request/request'
19
+ require 'redox/request/financial'
20
+ require 'redox/request/patient_admin'
21
+ require 'redox/request/patient_search'
14
22
 
15
23
  module Redox
16
24
  class Configuration
@@ -0,0 +1,16 @@
1
+ module Redox
2
+ module Models
3
+ class Financial < Hashie::Trash
4
+ include Hashie::Extensions::IgnoreUndeclared
5
+ include Hashie::Extensions::IndifferentAccess
6
+
7
+ property :Visit, required: false, from: :visit, default: Redox::Models::Visit.new
8
+ property :Patient, required: false, from: :patient, default: Redox::Models::Patient.new
9
+ property :Transactions, required: false, from: :transactions, default: []
10
+
11
+ alias_method :patient, :Patient
12
+ alias_method :visit, :Visit
13
+ alias_method :transactions, :Transactions
14
+ end
15
+ end
16
+ end
@@ -1,15 +1,27 @@
1
1
  module Redox
2
2
  module Models
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
+
3
11
  class Model < Hashie::Trash
4
12
  include Hashie::Extensions::IgnoreUndeclared
5
13
  include Hashie::Extensions::IndifferentAccess
6
14
 
7
15
  property :Meta, from: :meta, required: false
8
16
  property :Patient, from: :patient, required: false
17
+ property :Visit, from: :visit, required: false
18
+ property :PotentialMatches, from: :potential_matches, required: false
9
19
  property :Extensions, from: :extensions, required: false
10
20
  property :response, required: false
11
21
 
22
+ alias_method :potential_matches, :PotentialMatches
12
23
  alias_method :patient, :Patient
24
+ alias_method :visit, :Visit
13
25
  alias_method :meta, :Meta
14
26
 
15
27
  def initialize(data = {})
@@ -28,16 +40,20 @@ module Redox
28
40
  return { key => super.to_h }
29
41
  end
30
42
 
31
- def to_json
43
+ def to_json(args = {})
32
44
  return self.to_h.to_json
33
45
  end
34
46
 
47
+ def insurances
48
+ (self.patient&.insurances || []) + (self.visit&.insurances || [])
49
+ end
50
+
35
51
  class << self
36
52
  def from_response(response)
37
53
  model = Model.new
38
54
  model.response = response
39
55
 
40
- %w[Meta Patient].each do |k|
56
+ %w[Meta Patient Visit PotentialMatches].each do |k|
41
57
  begin
42
58
  model.send("#{k}=", Module.const_get("Redox::Models::#{k}").new(response[k])) if response[k]
43
59
  rescue
@@ -1,11 +1,6 @@
1
1
  module Redox
2
2
  module Models
3
3
  class Patient < Model
4
- QUERY_ENDPOINT = '/query'.freeze
5
- QUERY_META = Meta.new(EventType: 'Query', DataModel: 'PatientSearch')
6
- CREATE_META = Meta.new(EventType: 'NewPatient', DataModel: 'PatientAdmin')
7
- UPDATE_META = Meta.new(EventType: 'PatientUpdate', DataModel: 'PatientAdmin')
8
-
9
4
  property :Identifiers, from: :identifiers, required: false, default: []
10
5
  property :Insurances, from: :insurances, required: false, default: []
11
6
  property :Demographics, from: :demographics, required: false
@@ -40,25 +35,16 @@ module Redox
40
35
  end
41
36
 
42
37
  def update(meta: Meta.new)
43
- meta = UPDATE_META.merge(meta)
44
- return Model.from_response((RedoxClient.connection.request(body: Patient.body(self, meta))))
38
+ Redox::Request::PatientAdmin.update(patient: self, meta: meta)
45
39
  end
46
40
 
47
41
  def create(meta: Meta.new)
48
- meta = CREATE_META.merge(meta)
49
- return Model.from_response((RedoxClient.connection.request(body: Patient.body(self, meta))))
42
+ Redox::Request::PatientAdmin.create(patient: self, meta: meta)
50
43
  end
51
44
 
52
45
  class << self
53
46
  def query(params, meta: Meta.new)
54
- meta = QUERY_META.merge(meta)
55
- return Model.from_response((RedoxClient.connection.request(endpoint: QUERY_ENDPOINT, body: Patient.body(params, meta))))
56
- end
57
-
58
- def body(params, meta)
59
- meta = Meta.new.merge(meta)
60
-
61
- return meta.to_h.merge(params.to_h)
47
+ return Redox::Request::PatientSearch.query(params, meta: meta)
62
48
  end
63
49
  end
64
50
  end
@@ -0,0 +1,13 @@
1
+ module Redox
2
+ module Models
3
+ class PotentialMatches < Array
4
+ def initialize(data = [])
5
+ if false == data.nil?
6
+ super(data.map {|patient| Redox::Models::Patient.new(patient) })
7
+ else
8
+ super([])
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,66 @@
1
+ module Redox
2
+ module Models
3
+ class Transaction < Hashie::Trash
4
+ include Hashie::Extensions::IgnoreUndeclared
5
+ include Hashie::Extensions::IndifferentAccess
6
+
7
+ property :Chargeable, required: false, from: :chargeable, default: {}
8
+ property :DateTimeOfService, required: false, from: :start
9
+ property :Department, required: false, from: :department, default: {}
10
+ property :Diagnoses, required: false, from: :diagnoses, default: []
11
+ property :EndDateTime, required: false, from: :end
12
+ property :Extensions, required: false, from: :extensions, default: {}
13
+ property :ID, required: false, from: :id
14
+ property :NDC, required: false, from: :ndc, default: {}
15
+ property :OrderID, required: false, from: :order_id
16
+ property :OrderingProviders, required: false, from: :ordering_providers, default: []
17
+ property :Performers, required: false, from: :performers, default: []
18
+ property :Procedure, required: false, from: :procedure, default: {}
19
+ property :Type, required: false, from: :type
20
+
21
+ alias_method :chargeable, :Chargeable
22
+ alias_method :start, :DateTimeOfService
23
+ alias_method :department, :Department
24
+ alias_method :diagnoses, :Diagnoses
25
+ alias_method :end, :EndDateTime
26
+ alias_method :extensions, :Extensions
27
+ alias_method :id, :ID
28
+ alias_method :ndc, :NDC
29
+ alias_method :order_id, :OrderID
30
+ alias_method :ordering_providers, :OrderingProviders
31
+ alias_method :performers, :Performers
32
+ alias_method :procedure, :Procedure
33
+ alias_method :type, :Type
34
+
35
+ def add_medication(ndc_code: nil, quantity: nil, magnitude: nil, unit: nil, description: nil)
36
+ self[:NDC] = { Code: ndc_code, Description: description }
37
+ self[:Extensions] = {
38
+ 'ndc-quantity' => {
39
+ integer: quantity&.to_s
40
+ },
41
+ 'ndc-units-measure' => {
42
+ coding: {
43
+ code: magnitude&.to_s,
44
+ display: unit
45
+ }
46
+ }
47
+ }
48
+ self
49
+ end
50
+
51
+ def to_h
52
+ result = super.to_h
53
+
54
+ %w[EndDateTime DateTimeOfService].each do |k|
55
+ result[k] = Redox::Models.format_datetime(result[k])
56
+ end
57
+
58
+ result
59
+ end
60
+
61
+ def as_json(args)
62
+ self.to_h
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,53 @@
1
+ module Redox
2
+ module Models
3
+ class Visit < Model
4
+ DEFAULT_LOCATION = {
5
+ Department: nil,
6
+ Facility: nil
7
+ }
8
+
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 :VisitNumber, from: :visit_number, required: false
13
+ property :AccountNumber, from: :account_number, required: false
14
+
15
+ alias_method :insurances, :Insurances
16
+ alias_method :start, :VisitDateTime
17
+
18
+ def department=(v)
19
+ self[:Location] ||= DEFAULT_LOCATION
20
+ self[:Location][:Department] = v
21
+ self
22
+ end
23
+
24
+ def facility=(v)
25
+ self[:Location] ||= DEFAULT_LOCATION
26
+ self[:Location][:Facility] = v
27
+ self
28
+ end
29
+
30
+ def insurances
31
+ self[:Insurances] = self[:Insurances].map {|ins| ins.is_a?(Redox::Models::Insurance) ? ins : Insurance.new(ins) }
32
+ end
33
+
34
+ def to_h
35
+ result = super.to_h
36
+
37
+ %w[VisitDateTime].each do |k|
38
+ result[key][k] = Redox::Models.format_datetime(result[key][k])
39
+ end
40
+
41
+ result
42
+ end
43
+
44
+ def to_json(args = {})
45
+ self.to_h.to_json
46
+ end
47
+
48
+ def as_json(args = {})
49
+ self.to_h.dig('Visit')
50
+ end
51
+ end
52
+ end
53
+ 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
@@ -0,0 +1,18 @@
1
+ module Redox
2
+ module Request
3
+ class PatientAdmin
4
+ CREATE_META = Redox::Models::Meta.new(EventType: 'NewPatient', DataModel: 'PatientAdmin')
5
+ UPDATE_META = Redox::Models::Meta.new(EventType: 'PatientUpdate', DataModel: 'PatientAdmin')
6
+
7
+ def self.create(patient: , meta: Redox::Models::Meta.new)
8
+ meta = CREATE_META.merge(meta)
9
+ return Redox::Models::Model.from_response((RedoxClient.connection.request(body: Redox::Request.build_body(patient, meta))))
10
+ end
11
+
12
+ def self.update(patient: , meta: Redox::Models::Meta.new)
13
+ meta = UPDATE_META.merge(meta)
14
+ return Redox::Models::Model.from_response((RedoxClient.connection.request(body: Redox::Request.build_body(patient, meta))))
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ module Redox
2
+ module Request
3
+ class PatientSearch
4
+ QUERY_ENDPOINT = '/query'.freeze
5
+ QUERY_META = Redox::Models::Meta.new(EventType: 'Query', DataModel: 'PatientSearch')
6
+
7
+ def self.query(params, meta: Redox::Models::Meta.new)
8
+ meta = QUERY_META.merge(meta)
9
+ return Redox::Models::Model.from_response((RedoxClient.connection.request(endpoint: QUERY_ENDPOINT, body: Redox::Request.build_body(params, meta))))
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ module Redox
2
+ module Request
3
+ def self.build_body(params, meta)
4
+ meta = Redox::Models::Meta.new.merge(meta)
5
+
6
+ return meta.to_h.merge(params.to_h)
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Redox
2
- VERSION = '1.0.2'.freeze
2
+ VERSION = '1.3.1'.freeze
3
3
  end
@@ -5,8 +5,8 @@ require 'redox/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'redox'
7
7
  spec.version = Redox::VERSION
8
- spec.authors = ['Alexander Clark', 'Mike Crockett']
9
- spec.email = ['alexander.clark@weinfuse.com', 'mike.crockett@weinfuse.com']
8
+ spec.authors = ['Alexander Clark', 'Mike Crockett', 'Mike Carr']
9
+ spec.email = ['alexander.clark@weinfuse.com', 'mike.crockett@weinfuse.com', 'michael.carr@weinfuse.com']
10
10
 
11
11
  spec.summary = 'Ruby wrapper for the Redox Engine API'
12
12
  spec.homepage = 'https://github.com/WeInfuse/redox'
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ['lib']
29
29
  spec.licenses = ['MIT']
30
30
 
31
- spec.add_dependency 'httparty', '~> 0.17'
31
+ spec.add_dependency 'httparty', '~> 0.18'
32
32
  spec.add_dependency 'hashie', '~> 3.5'
33
33
  spec.add_development_dependency 'bundler', '>=1', '<3'
34
34
  spec.add_development_dependency 'byebug', '~> 11'
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Clark
8
8
  - Mike Crockett
9
- autorequire:
9
+ - Mike Carr
10
+ autorequire:
10
11
  bindir: exe
11
12
  cert_chain: []
12
- date: 2019-06-04 00:00:00.000000000 Z
13
+ date: 2020-10-02 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: httparty
@@ -17,14 +18,14 @@ dependencies:
17
18
  requirements:
18
19
  - - "~>"
19
20
  - !ruby/object:Gem::Version
20
- version: '0.17'
21
+ version: '0.18'
21
22
  type: :runtime
22
23
  prerelease: false
23
24
  version_requirements: !ruby/object:Gem::Requirement
24
25
  requirements:
25
26
  - - "~>"
26
27
  - !ruby/object:Gem::Version
27
- version: '0.17'
28
+ version: '0.18'
28
29
  - !ruby/object:Gem::Dependency
29
30
  name: hashie
30
31
  requirement: !ruby/object:Gem::Requirement
@@ -129,10 +130,11 @@ dependencies:
129
130
  - - "~>"
130
131
  - !ruby/object:Gem::Version
131
132
  version: '0.9'
132
- description:
133
+ description:
133
134
  email:
134
135
  - alexander.clark@weinfuse.com
135
136
  - mike.crockett@weinfuse.com
137
+ - michael.carr@weinfuse.com
136
138
  executables: []
137
139
  extensions: []
138
140
  extra_rdoc_files: []
@@ -145,6 +147,7 @@ files:
145
147
  - lib/redox.rb
146
148
  - lib/redox/authentication.rb
147
149
  - lib/redox/connection.rb
150
+ - lib/redox/models/financial.rb
148
151
  - lib/redox/models/meta.rb
149
152
  - lib/redox/models/model.rb
150
153
  - lib/redox/models/patient.rb
@@ -152,7 +155,14 @@ files:
152
155
  - lib/redox/models/patient/identifier.rb
153
156
  - lib/redox/models/patient/insurance.rb
154
157
  - lib/redox/models/patient/p_c_p.rb
158
+ - lib/redox/models/potential_matches.rb
159
+ - lib/redox/models/transaction.rb
160
+ - lib/redox/models/visit.rb
155
161
  - lib/redox/redox_exception.rb
162
+ - lib/redox/request/financial.rb
163
+ - lib/redox/request/patient_admin.rb
164
+ - lib/redox/request/patient_search.rb
165
+ - lib/redox/request/request.rb
156
166
  - lib/redox/version.rb
157
167
  - redox.gemspec
158
168
  homepage: https://github.com/WeInfuse/redox
@@ -160,7 +170,7 @@ licenses:
160
170
  - MIT
161
171
  metadata:
162
172
  allowed_push_host: https://rubygems.org
163
- post_install_message:
173
+ post_install_message:
164
174
  rdoc_options: []
165
175
  require_paths:
166
176
  - lib
@@ -175,9 +185,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
185
  - !ruby/object:Gem::Version
176
186
  version: '0'
177
187
  requirements: []
178
- rubyforge_project:
188
+ rubyforge_project:
179
189
  rubygems_version: 2.7.6
180
- signing_key:
190
+ signing_key:
181
191
  specification_version: 4
182
192
  summary: Ruby wrapper for the Redox Engine API
183
193
  test_files: []