redox 1.0.0 → 1.2.0

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: 63503f81ebcb62da585b095cbe53721f14fd4924b6b7f292db34dc28a1fb58a0
4
- data.tar.gz: d79801d7d642ada1dd96952fb00882c858a06b6b3a165e9aa634624cd8580872
3
+ metadata.gz: 110c897be42bb1b29ecb7ad3fe0799e53e5b4aa933bc346be084133883e93715
4
+ data.tar.gz: 6235dfff929001d2666162d875708befb863b84f5122d3886d6cbaa6b9bfa017
5
5
  SHA512:
6
- metadata.gz: cc2504239a0515d8d951a7d0d181a260ca7719130fd0fffc40d309cf8938c46ebce2d1c402a1864e019d689836f5988857608d6e19c18326f7d00dcc180985a5
7
- data.tar.gz: cf26db2a8ee7d9379c01f2af44aa9b25c2b67a6d6b5fc8d09faa5d449dcfb89b6d8ef32e22cebb2f0dda1b68238f0982103a08e4d5d8accbb5635682f73532bd
6
+ metadata.gz: 5f19c7ba5371f732730e4746a9673da3db1758eb3778615cbd4c2ff77404c764bcd805abf346352156bb03b0bf9fe6d484ff99fb65bc4fa85a1ce9f10181407a
7
+ data.tar.gz: 1631c69cfc948ef85991ec8e091243bbc6b43ecc4a2b21c2828b99fc9be04e3dcecb3799a6ee4e3f3d2d459ad085c3917544d2e77ad8d06158434133877e17bf
@@ -4,7 +4,40 @@ 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.0.0] - Unreleased
7
+ ## [1.2.0] - 2020-07-30
8
+ ### Added
9
+ - Visit model
10
+ - Model#insurances helper for Patient.Insurances || Visit.Insurances
11
+
12
+ ## [1.1.1] - 2020-06-15
13
+ ### Changed
14
+ - Bugfix with patient param in update
15
+
16
+ ## [1.1.0] - 2020-06-15
17
+ ### Changed
18
+ - Moving to Requst classes instead of mixing in logic to models (kept backwards compatibility)
19
+ - Added potential matches to responses and implemented for patient search
20
+
21
+ =======
22
+ ### Added
23
+ - PotentialMatches class
24
+
25
+ ## [1.0.2] - 2019-06-04
26
+ ### Changed
27
+ - Added Extensions to all Redox models
28
+ - Fixed warnings in gemspec
29
+ - Fixed author emails in gemspec
30
+ - Removed packaging of bin and files starting with '.'
31
+ - Added helper file to translate Redox JSON to Hashie model.
32
+
33
+ ### Removed
34
+ - Unused response model.
35
+
36
+ ## [1.0.1] - 2019-05-02
37
+ ### Changed
38
+ - Check for high-level key as symbol
39
+
40
+ ## [1.0.0] - 2019-05-01
8
41
  ### Changed
9
42
  - How it works
10
43
 
@@ -70,7 +103,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
70
103
  ### Added
71
104
  - Initial Release
72
105
 
73
- [Unreleased]: https://github.com/WeInfuse/redox/compare/v0.1.6...HEAD
106
+ [1.2.0]: https://github.com/WeInfuse/redox/compare/v1.1.1...v1.2.0
107
+ [1.1.1]: https://github.com/WeInfuse/redox/compare/v1.1.0...v1.1.1
108
+ [1.1.0]: https://github.com/WeInfuse/redox/compare/v1.0.2...v1.1.0
109
+ [1.0.2]: https://github.com/WeInfuse/redox/compare/v1.0.1...v1.0.2
110
+ [1.0.1]: https://github.com/WeInfuse/redox/compare/v1.0.0...v1.0.1
111
+ [1.0.0]: https://github.com/WeInfuse/redox/compare/v0.1.6...v1.0.0
74
112
  [0.1.6]: https://github.com/WeInfuse/redox/compare/v0.1.5...v0.1.6
75
113
  [0.1.5]: https://github.com/WeInfuse/redox/compare/v0.1.4...v0.1.5
76
114
  [0.1.4]: https://github.com/WeInfuse/redox/compare/0.1.3...v0.1.4
@@ -7,10 +7,14 @@ 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'
10
11
  require 'redox/models/patient/demographics'
11
12
  require 'redox/models/patient/identifier'
12
13
  require 'redox/models/patient/insurance'
13
14
  require 'redox/models/patient/p_c_p'
15
+ require 'redox/models/potential_matches'
16
+ require 'redox/request/patient_admin'
17
+ require 'redox/request/patient_search'
14
18
 
15
19
  module Redox
16
20
  class Configuration
@@ -6,33 +6,46 @@ module Redox
6
6
 
7
7
  property :Meta, from: :meta, required: false
8
8
  property :Patient, from: :patient, required: false
9
+ property :Visit, from: :visit, required: false
10
+ property :PotentialMatches, from: :potential_matches, required: false
11
+ property :Extensions, from: :extensions, required: false
9
12
  property :response, required: false
10
13
 
14
+ alias_method :potential_matches, :PotentialMatches
11
15
  alias_method :patient, :Patient
16
+ alias_method :visit, :Visit
12
17
  alias_method :meta, :Meta
13
18
 
14
19
  def initialize(data = {})
15
- if (data.is_a?(Hash) && data.include?(key))
16
- data = data[key]
20
+ if data.is_a?(Hash)
21
+ if data.include?(key)
22
+ data = data[key]
23
+ elsif data.include?(key.to_sym)
24
+ data = data[key.to_sym]
25
+ end
17
26
  end
18
27
 
19
28
  super(data)
20
29
  end
21
30
 
22
31
  def to_h
23
- return {"#{key}" => super.to_h}
32
+ return { key => super.to_h }
24
33
  end
25
34
 
26
35
  def to_json
27
36
  return self.to_h.to_json
28
37
  end
29
38
 
39
+ def insurances
40
+ (self.patient&.insurances || []) + (self.visit&.insurances || [])
41
+ end
42
+
30
43
  class << self
31
44
  def from_response(response)
32
45
  model = Model.new
33
46
  model.response = response
34
47
 
35
- %w[Meta Patient].each do |k|
48
+ %w[Meta Patient Visit PotentialMatches].each do |k|
36
49
  begin
37
50
  model.send("#{k}=", Module.const_get("Redox::Models::#{k}").new(response[k])) if response[k]
38
51
  rescue
@@ -46,7 +59,7 @@ module Redox
46
59
  private
47
60
 
48
61
  def key
49
- return self.class.to_s.split('::').last
62
+ return self.class.to_s.split('::').last.to_s
50
63
  end
51
64
  end
52
65
  end
@@ -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
@@ -19,6 +14,10 @@ module Redox
19
14
  self[:Demographics] ||= Demographics.new
20
15
  end
21
16
 
17
+ def insurances
18
+ self[:Insurances] = self[:Insurances].map {|ins| ins.is_a?(Redox::Models::Insurance) ? ins : Insurance.new(ins) }
19
+ end
20
+
22
21
  def primary_care_provider
23
22
  self[:PCP] ||= PCP.new
24
23
  end
@@ -36,25 +35,16 @@ module Redox
36
35
  end
37
36
 
38
37
  def update(meta: Meta.new)
39
- meta = UPDATE_META.merge(meta)
40
- return Model.from_response((RedoxClient.connection.request(body: Patient.body(self, meta))))
38
+ Redox::Request::PatientAdmin.update(patient: self, meta: meta)
41
39
  end
42
40
 
43
41
  def create(meta: Meta.new)
44
- meta = CREATE_META.merge(meta)
45
- return Model.from_response((RedoxClient.connection.request(body: Patient.body(self, meta))))
42
+ Redox::Request::PatientAdmin.create(patient: self, meta: meta)
46
43
  end
47
44
 
48
45
  class << self
49
46
  def query(params, meta: Meta.new)
50
- meta = QUERY_META.merge(meta)
51
- return Model.from_response((RedoxClient.connection.request(endpoint: QUERY_ENDPOINT, body: Patient.body(params, meta))))
52
- end
53
-
54
- def body(params, meta)
55
- meta = Meta.new.merge(meta)
56
-
57
- return meta.to_h.merge(params.to_h)
47
+ return Redox::Request::PatientSearch.query(params, meta: meta)
58
48
  end
59
49
  end
60
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,13 @@
1
+ module Redox
2
+ module Models
3
+ class Visit < Model
4
+ property :Insurances, from: :insurances, required: false, default: []
5
+
6
+ alias_method :insurances, :Insurances
7
+
8
+ def insurances
9
+ self[:Insurances] = self[:Insurances].map {|ins| ins.is_a?(Redox::Models::Insurance) ? ins : Insurance.new(ins) }
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,24 @@
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::PatientAdmin.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::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)
21
+ end
22
+ end
23
+ end
24
+ 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::PatientAdmin.build_body(params, meta))))
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Redox
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.2.0'.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']
9
- spec.email = ['sasha.jackal@gmail.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'
@@ -20,16 +20,18 @@ Gem::Specification.new do |spec|
20
20
  end
21
21
 
22
22
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
23
- f.match(%r{^(test|spec|features)/})
23
+ f.match?(%r{^(test|spec|features|bin|helpers|)/}) || f.match?(%r{^(\.[[:alnum:]]+)})
24
24
  end
25
+
25
26
  spec.bindir = 'exe'
26
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
28
  spec.require_paths = ['lib']
29
+ spec.licenses = ['MIT']
28
30
 
29
- spec.add_dependency 'httparty'
30
- spec.add_dependency 'hashie'
31
- spec.add_development_dependency 'bundler'
32
- spec.add_development_dependency 'byebug'
31
+ spec.add_dependency 'httparty', '~> 0.18'
32
+ spec.add_dependency 'hashie', '~> 3.5'
33
+ spec.add_development_dependency 'bundler', '>=1', '<3'
34
+ spec.add_development_dependency 'byebug', '~> 11'
33
35
  spec.add_development_dependency 'minitest', '~> 5.0'
34
36
  spec.add_development_dependency 'rake', '~> 10.0'
35
37
  spec.add_development_dependency 'webmock', '~> 3.1'
metadata CHANGED
@@ -1,71 +1,79 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Clark
8
- autorequire:
8
+ - Mike Crockett
9
+ - Mike Carr
10
+ autorequire:
9
11
  bindir: exe
10
12
  cert_chain: []
11
- date: 2019-05-01 00:00:00.000000000 Z
13
+ date: 2020-07-30 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
16
  name: httparty
15
17
  requirement: !ruby/object:Gem::Requirement
16
18
  requirements:
17
- - - ">="
19
+ - - "~>"
18
20
  - !ruby/object:Gem::Version
19
- version: '0'
21
+ version: '0.18'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
23
25
  requirements:
24
- - - ">="
26
+ - - "~>"
25
27
  - !ruby/object:Gem::Version
26
- version: '0'
28
+ version: '0.18'
27
29
  - !ruby/object:Gem::Dependency
28
30
  name: hashie
29
31
  requirement: !ruby/object:Gem::Requirement
30
32
  requirements:
31
- - - ">="
33
+ - - "~>"
32
34
  - !ruby/object:Gem::Version
33
- version: '0'
35
+ version: '3.5'
34
36
  type: :runtime
35
37
  prerelease: false
36
38
  version_requirements: !ruby/object:Gem::Requirement
37
39
  requirements:
38
- - - ">="
40
+ - - "~>"
39
41
  - !ruby/object:Gem::Version
40
- version: '0'
42
+ version: '3.5'
41
43
  - !ruby/object:Gem::Dependency
42
44
  name: bundler
43
45
  requirement: !ruby/object:Gem::Requirement
44
46
  requirements:
45
47
  - - ">="
46
48
  - !ruby/object:Gem::Version
47
- version: '0'
49
+ version: '1'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '3'
48
53
  type: :development
49
54
  prerelease: false
50
55
  version_requirements: !ruby/object:Gem::Requirement
51
56
  requirements:
52
57
  - - ">="
53
58
  - !ruby/object:Gem::Version
54
- version: '0'
59
+ version: '1'
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '3'
55
63
  - !ruby/object:Gem::Dependency
56
64
  name: byebug
57
65
  requirement: !ruby/object:Gem::Requirement
58
66
  requirements:
59
- - - ">="
67
+ - - "~>"
60
68
  - !ruby/object:Gem::Version
61
- version: '0'
69
+ version: '11'
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
65
73
  requirements:
66
- - - ">="
74
+ - - "~>"
67
75
  - !ruby/object:Gem::Version
68
- version: '0'
76
+ version: '11'
69
77
  - !ruby/object:Gem::Dependency
70
78
  name: minitest
71
79
  requirement: !ruby/object:Gem::Requirement
@@ -122,23 +130,20 @@ dependencies:
122
130
  - - "~>"
123
131
  - !ruby/object:Gem::Version
124
132
  version: '0.9'
125
- description:
133
+ description:
126
134
  email:
127
- - sasha.jackal@gmail.com
135
+ - alexander.clark@weinfuse.com
136
+ - mike.crockett@weinfuse.com
137
+ - michael.carr@weinfuse.com
128
138
  executables: []
129
139
  extensions: []
130
140
  extra_rdoc_files: []
131
141
  files:
132
- - ".circleci/config.yml"
133
- - ".editorconfig"
134
- - ".gitignore"
135
142
  - CHANGELOG.md
136
143
  - CODE_OF_CONDUCT.md
137
144
  - Gemfile
138
145
  - README.md
139
146
  - Rakefile
140
- - bin/console
141
- - bin/setup
142
147
  - lib/redox.rb
143
148
  - lib/redox/authentication.rb
144
149
  - lib/redox/connection.rb
@@ -149,15 +154,19 @@ files:
149
154
  - lib/redox/models/patient/identifier.rb
150
155
  - lib/redox/models/patient/insurance.rb
151
156
  - lib/redox/models/patient/p_c_p.rb
157
+ - lib/redox/models/potential_matches.rb
158
+ - lib/redox/models/visit.rb
152
159
  - lib/redox/redox_exception.rb
153
- - lib/redox/response.rb
160
+ - lib/redox/request/patient_admin.rb
161
+ - lib/redox/request/patient_search.rb
154
162
  - lib/redox/version.rb
155
163
  - redox.gemspec
156
164
  homepage: https://github.com/WeInfuse/redox
157
- licenses: []
165
+ licenses:
166
+ - MIT
158
167
  metadata:
159
168
  allowed_push_host: https://rubygems.org
160
- post_install_message:
169
+ post_install_message:
161
170
  rdoc_options: []
162
171
  require_paths:
163
172
  - lib
@@ -172,9 +181,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
181
  - !ruby/object:Gem::Version
173
182
  version: '0'
174
183
  requirements: []
175
- rubyforge_project:
184
+ rubyforge_project:
176
185
  rubygems_version: 2.7.6
177
- signing_key:
186
+ signing_key:
178
187
  specification_version: 4
179
188
  summary: Ruby wrapper for the Redox Engine API
180
189
  test_files: []
@@ -1,23 +0,0 @@
1
- version: 2
2
- jobs:
3
- build:
4
- working_directory: ~/weinfuse_api
5
- docker:
6
- - image: circleci/ruby:2.4
7
- steps:
8
- - checkout
9
- - type: restore-cache
10
- key: redox_{{ checksum "Gemfile.lock" }}
11
- key: redox
12
- - run: bundle install --path vendor/bundle --jobs 20 --retry 5
13
- - type: cache-save
14
- key: redox_{{ checksum "Gemfile.lock" }}
15
- key: redox
16
- paths:
17
- - vendor/bundle
18
- - type: shell
19
- command: |
20
- bundle exec rake test
21
- - type: store_test_results
22
- path: /tmp/test-results
23
-
@@ -1,10 +0,0 @@
1
- root=true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 2
6
- end_of_line = lf
7
- charset = utf-8
8
- trim_trailing_whitespace = true
9
- insert_final_newline = true
10
-
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- /redox*.gem
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'json'
5
- require 'redox'
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require 'irb'
15
- IRB.start
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,14 +0,0 @@
1
- module Redox
2
- class Response
3
- attr_reader :model, :http_response
4
-
5
- def initialize(response, model_class = nil)
6
- @http_response = response
7
- @model = model_class.new(JSON.parse(response.body)) if !model_class.nil? && self.success?
8
- end
9
-
10
- def success?
11
- return @http_response.is_a?(Net::HTTPOK)
12
- end
13
- end
14
- end