ehr_proxy-clients 0.1.8

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.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +5 -0
  5. data/CONTRIBUTING.md +44 -0
  6. data/Gemfile +26 -0
  7. data/Gemfile.lock +129 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +45 -0
  10. data/Rakefile +6 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/ehr_proxy-clients.gemspec +34 -0
  14. data/lib/ehr_proxy-clients.rb +13 -0
  15. data/lib/ehr_proxy/clients.rb +40 -0
  16. data/lib/ehr_proxy/clients/chiron/client.rb +25 -0
  17. data/lib/ehr_proxy/clients/kareo_ehr/client.rb +227 -0
  18. data/lib/ehr_proxy/clients/version.rb +5 -0
  19. data/lib/ehr_proxy/errors.rb +5 -0
  20. data/lib/ehr_proxy/errors/.keep +0 -0
  21. data/lib/ehr_proxy/errors/chiron_practice_not_found_error.rb +7 -0
  22. data/lib/ehr_proxy/errors/error.rb +5 -0
  23. data/lib/ehr_proxy/errors/record_invalid_error.rb +7 -0
  24. data/lib/ehr_proxy/errors/record_not_found_error.rb +7 -0
  25. data/lib/ehr_proxy/mappers.rb +3 -0
  26. data/lib/ehr_proxy/mappers/.keep +0 -0
  27. data/lib/ehr_proxy/mappers/chiron/create_kareo_ehr_integration_response_mapper.rb +23 -0
  28. data/lib/ehr_proxy/mappers/chiron/create_practice_response_mapper.rb +23 -0
  29. data/lib/ehr_proxy/mappers/kareo_ehr/case_mapper.rb +19 -0
  30. data/lib/ehr_proxy/mappers/kareo_ehr/get_appointments_response_mapper.rb +21 -0
  31. data/lib/ehr_proxy/mappers/kareo_ehr/get_patient_response_mapper.rb +23 -0
  32. data/lib/ehr_proxy/mappers/kareo_ehr/get_patients_response_mapper.rb +23 -0
  33. data/lib/ehr_proxy/mappers/kareo_ehr/get_practices_response_mapper.rb +23 -0
  34. data/lib/ehr_proxy/mappers/kareo_ehr/get_providers_response_mapper.rb +23 -0
  35. data/lib/ehr_proxy/mappers/kareo_ehr/patient_mapper.rb +27 -0
  36. data/lib/ehr_proxy/models.rb +5 -0
  37. data/lib/ehr_proxy/models/chiron/kareo_ehr_integration.rb +9 -0
  38. data/lib/ehr_proxy/models/chiron/model.rb +15 -0
  39. data/lib/ehr_proxy/models/chiron/practice.rb +8 -0
  40. data/lib/ehr_proxy/models/chiron/types.rb +11 -0
  41. data/lib/ehr_proxy/requests.rb +7 -0
  42. data/lib/ehr_proxy/requests/base_request.rb +51 -0
  43. data/lib/ehr_proxy/requests/chiron/base_request.rb +12 -0
  44. data/lib/ehr_proxy/requests/chiron/create_kareo_ehr_integration_request.rb +35 -0
  45. data/lib/ehr_proxy/requests/chiron/create_practice_request.rb +30 -0
  46. data/lib/ehr_proxy/requests/kareo_ehr/base_request.rb +12 -0
  47. data/lib/ehr_proxy/requests/kareo_ehr/get_appointments_request.rb +48 -0
  48. data/lib/ehr_proxy/requests/kareo_ehr/get_patient_request.rb +28 -0
  49. data/lib/ehr_proxy/requests/kareo_ehr/get_patients_request.rb +27 -0
  50. data/lib/ehr_proxy/requests/kareo_ehr/get_practices_request.rb +42 -0
  51. data/lib/ehr_proxy/requests/kareo_ehr/get_providers_request.rb +42 -0
  52. metadata +178 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c22ec18dd2ea8a01b6d2c95ff023d9886ca96989
4
+ data.tar.gz: 3b498c7639a12582c65a12497f099f20410f2d01
5
+ SHA512:
6
+ metadata.gz: e2f1668ce808abcebe0bab56957c180cb7e4c552a092695375a9fb77b39dd6d355f533dfe45d79fff928ee8cd1c8a29c74bdb76be08ab03eb3d820b936da853b
7
+ data.tar.gz: 68f4b05c294e0f9f654d94fbb5d2429a83dff149c17d9b22f8f1537a38419044bfc9a1e6ad45dcf84f2ac1c9560c773cb6a378d02fd0a5358ad893ae025ecc3a
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.16.0
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,44 @@
1
+ # Contributing
2
+
3
+ Bug reports and pull requests are welcome on GitHub at https://github.com/chiron-health/ehr_proxy-clients.
4
+
5
+ ## Testing your changes locally
6
+
7
+ Run `bundle exec rake install` to:
8
+ * Run the test suite
9
+ * Build the gem
10
+ * Install into your local gemset
11
+
12
+ Or you may want to reference your changes from another project:
13
+ * Add `gem "ehr_proxy-clients", path: 'YOUR-SOURCE-DIRECTORY/ehr_proxy-clients'` to your other project's `Gemfile`
14
+ * Run `bundle`
15
+ * Execution will now use the source files in `YOUR-SOURCE-DIRECTORY/ehr_proxy-clients`
16
+ * Changes are included automatically (by definition)
17
+
18
+ ## Managing Prviate Gem
19
+
20
+ The `ehr_proxy-clients` is a privately distributed gem. To release the private gem:
21
+
22
+ ### Configure access to the private gem server
23
+
24
+ Add Gemfury as a remote:
25
+ ```
26
+ git remote add fury https://chironhealth@git.fury.io/chironhealthplatform/ehr_proxy-clients.git
27
+ ```
28
+
29
+ > Note: The first time you release you will be prompted for credentials. These are located in [Lastpass](https://www.lastpass.com/).
30
+
31
+ ### Bumping the version
32
+
33
+ Bump version minor / major with `gem bump --version <minor|major>`. Patch bumps are the default.
34
+
35
+ Please don't include version bumps in your patches. Maintainers will handle this.
36
+
37
+ ### Releasing
38
+
39
+ Run `bundle exec gem release` to:
40
+
41
+ * Run the full test suite
42
+ * Build the gem
43
+ * Tag this sha as a github release
44
+ * Push the build to our private gem server: `git push fury master`
data/Gemfile ADDED
@@ -0,0 +1,26 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # runtime dependencies in ehr_proxy-clients.gemspec
6
+ gemspec
7
+
8
+ source 'https://dpgxG53dPHuR3YDr-sNt@gem.fury.io/chironhealthplatform' do
9
+ gem 'kareo_ehr-models', '~> 1.0.0'
10
+ end
11
+
12
+ # dependencies not needed during CI
13
+ group :optional do
14
+ gem 'byebug', '>= 0', platforms: [:ruby_20, :ruby_21, :ruby_22, :ruby_23]
15
+ gem 'pry', '>= 0', platforms: :ruby
16
+ gem 'gem-release', '~> 2.0.0.dev'
17
+ end
18
+
19
+ group :development, :test do
20
+ gem 'factory_bot', '~> 4.8.2'
21
+ gem 'rake', '~> 10.0'
22
+ gem 'rspec', '~> 3.6.0'
23
+ gem 'vcr', '~> 3.0.3'
24
+ gem 'yard', '~> 0.9.9'
25
+ gem 'webmock', '~> 2.1'
26
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,129 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ehr_proxy-clients (0.1.8)
5
+ activesupport (>= 4.0.0)
6
+ dry-struct (~> 0.3.1)
7
+ jwt (~> 1.2.0)
8
+ kareo_ehr-models (~> 1.0.0)
9
+ rest-client (~> 2.0.0)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ remote: https://dpgxG53dPHuR3YDr-sNt@gem.fury.io/chironhealthplatform/
14
+ specs:
15
+ activesupport (5.1.5)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (~> 0.7)
18
+ minitest (~> 5.1)
19
+ tzinfo (~> 1.1)
20
+ addressable (2.5.2)
21
+ public_suffix (>= 2.0.2, < 4.0)
22
+ byebug (9.1.0)
23
+ coderay (1.1.2)
24
+ concurrent-ruby (1.0.5)
25
+ crack (0.4.3)
26
+ safe_yaml (~> 1.0.0)
27
+ diff-lcs (1.3)
28
+ domain_name (0.5.20170404)
29
+ unf (>= 0.0.5, < 1.0.0)
30
+ dry-configurable (0.7.0)
31
+ concurrent-ruby (~> 1.0)
32
+ dry-container (0.6.0)
33
+ concurrent-ruby (~> 1.0)
34
+ dry-configurable (~> 0.1, >= 0.1.3)
35
+ dry-core (0.4.2)
36
+ concurrent-ruby (~> 1.0)
37
+ dry-equalizer (0.2.0)
38
+ dry-logic (0.4.2)
39
+ dry-container (~> 0.2, >= 0.2.6)
40
+ dry-core (~> 0.2)
41
+ dry-equalizer (~> 0.2)
42
+ dry-struct (0.3.1)
43
+ dry-configurable (~> 0.1)
44
+ dry-core (~> 0.3)
45
+ dry-equalizer (~> 0.2)
46
+ dry-types (~> 0.9, >= 0.9.0)
47
+ ice_nine (~> 0.11)
48
+ dry-types (0.12.2)
49
+ concurrent-ruby (~> 1.0)
50
+ dry-configurable (~> 0.1)
51
+ dry-container (~> 0.3)
52
+ dry-core (~> 0.2, >= 0.2.1)
53
+ dry-equalizer (~> 0.2)
54
+ dry-logic (~> 0.4, >= 0.4.2)
55
+ inflecto (~> 0.0.0, >= 0.0.2)
56
+ factory_bot (4.8.2)
57
+ activesupport (>= 3.0.0)
58
+ gem-release (2.0.0.dev.5)
59
+ hashdiff (0.3.7)
60
+ http-cookie (1.0.3)
61
+ domain_name (~> 0.5)
62
+ i18n (0.9.5)
63
+ concurrent-ruby (~> 1.0)
64
+ ice_nine (0.11.2)
65
+ inflecto (0.0.2)
66
+ jwt (1.2.1)
67
+ kareo_ehr-models (1.0.0)
68
+ dry-struct (~> 0.3.1)
69
+ method_source (0.9.0)
70
+ mime-types (3.1)
71
+ mime-types-data (~> 3.2015)
72
+ mime-types-data (3.2016.0521)
73
+ minitest (5.11.3)
74
+ netrc (0.11.0)
75
+ pry (0.11.3)
76
+ coderay (~> 1.1.0)
77
+ method_source (~> 0.9.0)
78
+ public_suffix (3.0.2)
79
+ rake (10.5.0)
80
+ rest-client (2.0.2)
81
+ http-cookie (>= 1.0.2, < 2.0)
82
+ mime-types (>= 1.16, < 4.0)
83
+ netrc (~> 0.8)
84
+ rspec (3.6.0)
85
+ rspec-core (~> 3.6.0)
86
+ rspec-expectations (~> 3.6.0)
87
+ rspec-mocks (~> 3.6.0)
88
+ rspec-core (3.6.0)
89
+ rspec-support (~> 3.6.0)
90
+ rspec-expectations (3.6.0)
91
+ diff-lcs (>= 1.2.0, < 2.0)
92
+ rspec-support (~> 3.6.0)
93
+ rspec-mocks (3.6.0)
94
+ diff-lcs (>= 1.2.0, < 2.0)
95
+ rspec-support (~> 3.6.0)
96
+ rspec-support (3.6.0)
97
+ safe_yaml (1.0.4)
98
+ thread_safe (0.3.6)
99
+ tzinfo (1.2.5)
100
+ thread_safe (~> 0.1)
101
+ unf (0.1.4)
102
+ unf_ext
103
+ unf_ext (0.0.7.5)
104
+ vcr (3.0.3)
105
+ webmock (2.3.2)
106
+ addressable (>= 2.3.6)
107
+ crack (>= 0.3.2)
108
+ hashdiff
109
+ yard (0.9.12)
110
+
111
+ PLATFORMS
112
+ ruby
113
+
114
+ DEPENDENCIES
115
+ bundler (~> 1.15)
116
+ byebug
117
+ ehr_proxy-clients!
118
+ factory_bot (~> 4.8.2)
119
+ gem-release (~> 2.0.0.dev)
120
+ kareo_ehr-models (~> 1.0.0)!
121
+ pry
122
+ rake (~> 10.0)
123
+ rspec (~> 3.6.0)
124
+ vcr (~> 3.0.3)
125
+ webmock (~> 2.1)
126
+ yard (~> 0.9.9)
127
+
128
+ BUNDLED WITH
129
+ 1.16.0
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Pierce
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # EhrProxy::Clients
2
+
3
+ Welcome to the `ehr_proxy-clients` gem! This is a privately distributed gem written by Chiron Health. The gem provides a ruby wrapper for working with the Chiron Health EHR Proxy API.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ source 'https://dpgxG53dPHuR3YDr-sNt@gem.fury.io/chironhealthplatform' do
11
+ gem 'ehr_proxy-clients'
12
+ end
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install ehr_proxy-clients --source https://dpgxG53dPHuR3YDr-sNt@gem.fury.io/chironhealthplatform/
22
+
23
+ ## Getting Started
24
+
25
+ ```ruby
26
+ irb(main):001:0> require 'ehr_proxy-clients'
27
+ => true
28
+ irb(main):002:0> client = EhrProxy::KareoEhr::Client.new(provider_uuid: '086cc24c-be80-4495-8143-b5e7b7cd76fa')
29
+ => #<EhrProxy::KareoEhr::Client:0x007faf5c478340 @provider_uuid="086cc24c-be80-4495-8143-b5e7b7cd76fa">
30
+ irb(main):003:0> client.get_appointments
31
+ => [#<KareoEhr::Appointment id="173GMG" all_day=false appointment_reason1=nil appointment_reason10=nil appointment_reason2=nil appointment_reason3=nil appointment_reason4=nil appointment_reason5=nil appointment_reason6=nil appointment_reason7=nil appointment_reason8=nil appointment_reason9=nil authorization_end_date=nil authorization_id=nil authorization_insurance_plan=nil authorization_number=nil authorization_start_date=nil confirmation_status="Scheduled" created_date=#<DateTime: 2014-03-09T20:37:16+00:00 ((2456726j,74236s,0n),+0s,2299161j)> end_date="12/23/2017 9:00:00 PM" last_modified_date=#<DateTime: 2014-03-09T20:38:20+00:00 ((2456726j,74300s,0n),+0s,2299161j)> notes=nil patient_case_id=nil patient_case_name=nil patient_case_payer_scenario=nil patient_full_name=nil patient_id=nil practice_id=9 practice_name="Family Health Medical Center" recurring=true resource_name1="Winthorp Xavier" resource_name10=nil resource_name2="Benjamin Grimmley" resource_name3="Marium Bukhari" resource_name4="Pepperdine Potts" resource_name5="Roderick Richards" resource_name6="Tasha Romanoff" resource_name7="Jonathan Storm" resource_name8="Selena Strom" resource_name9="Victor Vondriska" service_location_name="Family Health Medical Center" start_date="12/23/2017 8:00:00 PM" type="Other">]
32
+ ```
33
+ ## Development
34
+
35
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
36
+
37
+ To install this gem onto your local machine, run `bundle exec rake install`.
38
+
39
+ ## Contributing
40
+
41
+ Read how to contribute [here](CONTRIBUTING.md).
42
+
43
+ ## License
44
+
45
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'ehr_proxy-clients'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require 'pry'
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,34 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require 'ehr_proxy/clients/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'ehr_proxy-clients'
8
+ spec.version = EhrProxy::Clients::VERSION
9
+ spec.authors = ['Pierce Harmon']
10
+ spec.email = ['pierceh.dev@gmail.com']
11
+
12
+ spec.summary = ''
13
+ spec.description = ''
14
+ spec.homepage = 'https://github.com/chiron-health/ehr_proxy-clients'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_runtime_dependency 'activesupport', '>= 4.0.0'
26
+ spec.add_runtime_dependency 'dry-struct', '~> 0.3.1'
27
+ spec.add_runtime_dependency 'jwt', '~> 1.2.0'
28
+ spec.add_runtime_dependency 'kareo_ehr-models', '~> 1.0.0'
29
+ spec.add_runtime_dependency 'rest-client', '~> 2.0.0'
30
+
31
+ # Don't add more development dependencies here.
32
+ # They go in groups within the Gemfile.
33
+ spec.add_development_dependency 'bundler', '~> 1.15'
34
+ end
@@ -0,0 +1,13 @@
1
+ module EhrProxy
2
+ require 'active_support/core_ext/hash/indifferent_access'
3
+ require 'active_support/core_ext/hash/keys'
4
+
5
+ require 'kareo_ehr/models'
6
+
7
+ require_relative 'ehr_proxy/clients/version'
8
+ require_relative 'ehr_proxy/clients'
9
+ require_relative 'ehr_proxy/errors'
10
+ require_relative 'ehr_proxy/models'
11
+ require_relative 'ehr_proxy/mappers'
12
+ require_relative 'ehr_proxy/requests'
13
+ end
@@ -0,0 +1,40 @@
1
+ Dir.glob("#{__dir__}/clients/**/*.rb").each do |file|
2
+ require file
3
+ end
4
+
5
+ module EhrProxy
6
+ module Clients
7
+ # ENVS = [:local, :dev, :stage, :prod].freeze # TODO: Implement dev and prod
8
+ ENVS = [:local, :stage, :prod].freeze
9
+
10
+ # Configuration for EhrProxy::Clients, use like:
11
+ #
12
+ # EhrProxy::Clients.configure do |config|
13
+ # config.access_key = "foobar"
14
+ # config.env = :local
15
+ # end
16
+ def self.configure
17
+ yield self
18
+ end
19
+
20
+ def self.access_key=(val)
21
+ @access_key = val
22
+ end
23
+
24
+ def self.access_key
25
+ raise ArgumentError.new('missing access_key') unless defined? @access_key
26
+
27
+ @access_key
28
+ end
29
+
30
+ def self.env=(val)
31
+ raise ArgumentError.new('Value for env is not a valid option.') unless ENVS.include?(val)
32
+
33
+ @env = val
34
+ end
35
+
36
+ def self.env
37
+ @env || :local
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,25 @@
1
+ module EhrProxy
2
+ module Chiron
3
+ class Client
4
+ def create_practice(params)
5
+ request = CreatePracticeRequest.new(params)
6
+
7
+ response = request.call
8
+
9
+ CreatePracticeResponseMapper.new(
10
+ response
11
+ ).practice
12
+ end
13
+
14
+ def create_kareo_ehr_integration(practice_uuid, params)
15
+ request = CreateKareoEhrIntegrationRequest.new(practice_uuid, params)
16
+
17
+ response = request.call
18
+
19
+ CreateKareoEhrIntegrationResponseMapper.new(
20
+ response
21
+ ).kareo_ehr_integration
22
+ end
23
+ end
24
+ end
25
+ end