redox 1.2.0 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 110c897be42bb1b29ecb7ad3fe0799e53e5b4aa933bc346be084133883e93715
4
- data.tar.gz: 6235dfff929001d2666162d875708befb863b84f5122d3886d6cbaa6b9bfa017
3
+ metadata.gz: 0666bbb5152f4d34f3966dad512c2b1c6bb62cd661235516ad2a123eca63e653
4
+ data.tar.gz: ec535077633c70fa241a3ee5a8af81812791e53e36f72dfcfcb87900b96a9fe5
5
5
  SHA512:
6
- metadata.gz: 5f19c7ba5371f732730e4746a9673da3db1758eb3778615cbd4c2ff77404c764bcd805abf346352156bb03b0bf9fe6d484ff99fb65bc4fa85a1ce9f10181407a
7
- data.tar.gz: 1631c69cfc948ef85991ec8e091243bbc6b43ecc4a2b21c2828b99fc9be04e3dcecb3799a6ee4e3f3d2d459ad085c3917544d2e77ad8d06158434133877e17bf
6
+ metadata.gz: 844d30e49f7d57e5ca0dd7acc91d3bbc0aac672213e7016de5f5f52cac6e77e1123f1cb94613c5521d90c2f0a7445e0174af223c1e5b93c092386f6be5d2f9d6
7
+ data.tar.gz: 1d09377d50c8729f7e3698bd2de877b3b4c081a8ec21a3b9997e0da6dbc9c5bab7f58fb6cb1da273e062443b41168bdb7178c872c8beeda77e24f8239cd7636f
@@ -4,6 +4,11 @@ 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.3.0] - 2020-09-17
8
+ ### Added
9
+ - Transaction model
10
+ - Financial#create
11
+
7
12
  ## [1.2.0] - 2020-07-30
8
13
  ### Added
9
14
  - Visit model
@@ -103,6 +108,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
103
108
  ### Added
104
109
  - Initial Release
105
110
 
111
+ [1.3.0]: https://github.com/WeInfuse/redox/compare/v1.2.0...v1.3.0
106
112
  [1.2.0]: https://github.com/WeInfuse/redox/compare/v1.1.1...v1.2.0
107
113
  [1.1.1]: https://github.com/WeInfuse/redox/compare/v1.1.0...v1.1.1
108
114
  [1.1.0]: https://github.com/WeInfuse/redox/compare/v1.0.2...v1.1.0
@@ -8,11 +8,15 @@ require 'redox/models/model'
8
8
  require 'redox/models/meta'
9
9
  require 'redox/models/patient'
10
10
  require 'redox/models/visit'
11
+ require 'redox/models/transaction'
12
+ require 'redox/models/financial'
11
13
  require 'redox/models/patient/demographics'
12
14
  require 'redox/models/patient/identifier'
13
15
  require 'redox/models/patient/insurance'
14
16
  require 'redox/models/patient/p_c_p'
15
17
  require 'redox/models/potential_matches'
18
+ require 'redox/request/request'
19
+ require 'redox/request/financial'
16
20
  require 'redox/request/patient_admin'
17
21
  require 'redox/request/patient_search'
18
22
 
@@ -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,5 +1,13 @@
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
@@ -32,7 +40,7 @@ module Redox
32
40
  return { key => super.to_h }
33
41
  end
34
42
 
35
- def to_json
43
+ def to_json(args = {})
36
44
  return self.to_h.to_json
37
45
  end
38
46
 
@@ -0,0 +1,62 @@
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_json(args = nil)
52
+ d = self.dup
53
+
54
+ [:EndDateTime, :DateTimeOfService].each do |k|
55
+ d[k] = Redox::Models.format_datetime(d[k])
56
+ end
57
+
58
+ d.to_h.to_json
59
+ end
60
+ end
61
+ end
62
+ end
@@ -1,13 +1,41 @@
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 :VisitNumber, from: :visit_number, required: false
13
+ property :AccountNumber, from: :account_number, required: false
5
14
 
6
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
7
29
 
8
30
  def insurances
9
31
  self[:Insurances] = self[:Insurances].map {|ins| ins.is_a?(Redox::Models::Insurance) ? ins : Insurance.new(ins) }
10
32
  end
33
+
34
+ def to_json(args = nil)
35
+ d = self.dup
36
+ d[:VisitDateTime] = Redox::Models.format_datetime(d[:VisitDateTime])
37
+ d.to_h.to_json
38
+ end
11
39
  end
12
40
  end
13
41
  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::PatientAdmin.build_body(patient, meta))))
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::PatientAdmin.build_body(patient, meta))))
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::PatientAdmin.build_body(params, meta))))
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,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.2.0'.freeze
2
+ VERSION = '1.3.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Clark
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2020-07-30 00:00:00.000000000 Z
13
+ date: 2020-09-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
@@ -147,6 +147,7 @@ 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
152
153
  - lib/redox/models/patient.rb
@@ -155,10 +156,13 @@ files:
155
156
  - lib/redox/models/patient/insurance.rb
156
157
  - lib/redox/models/patient/p_c_p.rb
157
158
  - lib/redox/models/potential_matches.rb
159
+ - lib/redox/models/transaction.rb
158
160
  - lib/redox/models/visit.rb
159
161
  - lib/redox/redox_exception.rb
162
+ - lib/redox/request/financial.rb
160
163
  - lib/redox/request/patient_admin.rb
161
164
  - lib/redox/request/patient_search.rb
165
+ - lib/redox/request/request.rb
162
166
  - lib/redox/version.rb
163
167
  - redox.gemspec
164
168
  homepage: https://github.com/WeInfuse/redox