athena_health 2.0.2 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +4 -0
- data/README.md +1 -1
- data/athena_health.gemspec +5 -4
- data/lib/athena_health/auth_token.rb +69 -0
- data/lib/athena_health/base_collection.rb +2 -3
- data/lib/athena_health/base_model.rb +44 -0
- data/lib/athena_health/client.rb +21 -4
- data/lib/athena_health/connection.rb +8 -36
- data/lib/athena_health/endpoints/configurations.rb +31 -3
- data/lib/athena_health/endpoints/encounters.rb +73 -2
- data/lib/athena_health/endpoints/patients.rb +27 -13
- data/lib/athena_health/gender_identity_field_collection.rb +5 -0
- data/lib/athena_health/{claim → models/claim}/claim.rb +4 -3
- data/lib/athena_health/{claim → models/claim}/claim_collection.rb +0 -0
- data/lib/athena_health/{claim → models/claim}/diagnosis.rb +0 -0
- data/lib/athena_health/{claim → models/claim}/payer.rb +0 -0
- data/lib/athena_health/{claim → models/claim}/procedure.rb +0 -0
- data/lib/athena_health/models/screening_questionnaire/meta_question.rb +12 -0
- data/lib/athena_health/models/screening_questionnaire/question.rb +15 -0
- data/lib/athena_health/models/screening_questionnaire/screening_questionnaire.rb +43 -0
- data/lib/athena_health/models/screening_questionnaire/screening_questionnaire_collection.rb +11 -0
- data/lib/athena_health/models/screening_questionnaire/screening_questionnaire_template_collection.rb +11 -0
- data/lib/athena_health/models/screening_questionnaire/section.rb +11 -0
- data/lib/athena_health/provider.rb +1 -0
- data/lib/athena_health/version.rb +1 -1
- data/lib/athena_health.rb +6 -2
- metadata +46 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c005b70b9fe653d511911dc8ae73886f54db577d45dfe1af197cd72f9a1f876
|
4
|
+
data.tar.gz: '0838c4499ddca040998cda0f095dcb6c2300273f84894ed49e5de6540f4cb5cb'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1da9ff931d0d983769fbb3447d552759ce75c8a905aa47bc3f213fc1bd81fa4cb80bb9536fa79e497ea48625fa97661e8d2cf62a474085ac51fdabb85a31afa6
|
7
|
+
data.tar.gz: 71637c8888c4ef43ca42798db02b6cd2cf54595fae51564eebbcf2129d3ba0a3828c479ad5d0f89089d8f822868a93a5cb2a3b9e09303aca5c59b705373c44f4
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
# AthenaHealth
|
5
5
|
|
6
|
-
Ruby wrapper for [Athenahealth API](https://
|
6
|
+
Ruby wrapper for [Athenahealth API](https://docs.athenahealth.com/api/).
|
7
7
|
|
8
8
|
## Updating from gem version 1 (Mashery API) to gem version 2 (https://developer.api.athena.io/ API)
|
9
9
|
|
data/athena_health.gemspec
CHANGED
@@ -1,13 +1,12 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'athena_health/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = 'athena_health'
|
8
7
|
spec.version = AthenaHealth::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = ['mateuszurbanski@yahoo.pl']
|
8
|
+
spec.authors = ['Mateusz Urbański', 'Ben Jones']
|
9
|
+
spec.email = ['mateuszurbanski@yahoo.pl', 'ben@benjones.io']
|
11
10
|
|
12
11
|
spec.summary = 'Ruby wrapper for Athenahealth API.'
|
13
12
|
spec.description = 'Ruby wrapper for Athenahealth API. See https://developer.athenahealth.com/io-docs for more details.'
|
@@ -25,4 +24,6 @@ Gem::Specification.new do |spec|
|
|
25
24
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
25
|
spec.add_development_dependency 'rspec', '~> 3.2'
|
27
26
|
spec.add_development_dependency 'vcr', '~> 3.0'
|
27
|
+
spec.add_development_dependency 'timecop', '~> 0.9.6'
|
28
|
+
spec.add_development_dependency 'rubocop', '~> 1.42'
|
28
29
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module AthenaHealth
|
4
|
+
class AuthToken
|
5
|
+
def initialize(client_id:, secret:, base_url:, api_version:, auth_token_hash: nil)
|
6
|
+
@base_url = base_url
|
7
|
+
@api_version = api_version
|
8
|
+
@client_id = client_id
|
9
|
+
@secret = secret
|
10
|
+
reset!
|
11
|
+
parse_auth_token_hash!(auth_token_hash) unless auth_token_hash.nil?
|
12
|
+
end
|
13
|
+
|
14
|
+
def auth_header
|
15
|
+
{ 'Authorization' => "Bearer #{token}" }
|
16
|
+
end
|
17
|
+
|
18
|
+
def reset!
|
19
|
+
@access_token = nil
|
20
|
+
@expires_at = nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def serialized_token
|
24
|
+
{
|
25
|
+
'access_token' => token,
|
26
|
+
'expires_at' => @expires_at.to_i
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def token
|
33
|
+
fetch_token! unless valid?
|
34
|
+
@access_token
|
35
|
+
end
|
36
|
+
|
37
|
+
def valid?
|
38
|
+
!@access_token.nil? &&
|
39
|
+
!@expires_at.nil? &&
|
40
|
+
@expires_at > Time.now
|
41
|
+
end
|
42
|
+
|
43
|
+
def parse_auth_token_hash!(auth_token_hash)
|
44
|
+
# make sure it has the right parts
|
45
|
+
return unless auth_token_hash['access_token'].instance_of? String
|
46
|
+
return unless auth_token_hash['expires_at'].instance_of? Integer
|
47
|
+
|
48
|
+
@access_token = auth_token_hash['access_token']
|
49
|
+
@expires_at = Time.at(auth_token_hash['expires_at'])
|
50
|
+
end
|
51
|
+
|
52
|
+
def fetch_token!
|
53
|
+
reset!
|
54
|
+
initiated_at = Time.now
|
55
|
+
response = Typhoeus.post(
|
56
|
+
"#{@base_url}/oauth2/#{@api_version}/token",
|
57
|
+
userpwd: "#{@client_id}:#{@secret}",
|
58
|
+
body: {
|
59
|
+
grant_type: 'client_credentials',
|
60
|
+
scope: 'athena/service/Athenanet.MDP.*'
|
61
|
+
}
|
62
|
+
)
|
63
|
+
token_hash = JSON.parse(response.response_body)
|
64
|
+
expires_in = token_hash['expires_in'].to_i
|
65
|
+
@access_token = token_hash['access_token']
|
66
|
+
@expires_at = initiated_at + expires_in
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -1,5 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module AthenaHealth
|
4
|
+
# all parsed models should inherit from here
|
2
5
|
class BaseModel
|
3
6
|
include Virtus.model
|
7
|
+
|
8
|
+
def self.model_attribute(field_name:, klass:, array: false)
|
9
|
+
define_method(field_name.to_sym) do
|
10
|
+
instance_variable_get("@#{field_name}")
|
11
|
+
end
|
12
|
+
|
13
|
+
instance_variable_set(:@internal_detail_fields, (@internal_detail_fields || []) + [{
|
14
|
+
field_name: field_name,
|
15
|
+
field_klass: klass,
|
16
|
+
array: array
|
17
|
+
}])
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(args)
|
21
|
+
super(args)
|
22
|
+
parse_sub_objects(args)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def parse_sub_objects(args)
|
28
|
+
return if self.class.instance_variable_get(:@internal_detail_fields).nil?
|
29
|
+
|
30
|
+
self.class.instance_variable_get(:@internal_detail_fields).each do |internal_detail_field|
|
31
|
+
value = sub_object_value(internal_detail_field, args)
|
32
|
+
|
33
|
+
next if value.nil?
|
34
|
+
|
35
|
+
instance_variable_set("@#{internal_detail_field[:field_name]}", value)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def sub_object_value(internal_detail_field, args)
|
40
|
+
val = args[internal_detail_field[:field_name]]
|
41
|
+
return nil if val.nil?
|
42
|
+
return internal_detail_field[:field_klass].new(val) unless internal_detail_field[:array] == true
|
43
|
+
|
44
|
+
val.map do |x|
|
45
|
+
internal_detail_field[:field_klass].new(x)
|
46
|
+
end
|
47
|
+
end
|
4
48
|
end
|
5
49
|
end
|
data/lib/athena_health/client.rb
CHANGED
@@ -1,14 +1,27 @@
|
|
1
1
|
module AthenaHealth
|
2
2
|
class Client
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
PRODUCTION_BASE_URL = 'https://api.platform.athenahealth.com'.freeze
|
4
|
+
PREVIEW_BASE_URL = 'https://api.preview.platform.athenahealth.com'.freeze
|
5
|
+
API_VERSION = 'v1'.freeze
|
6
|
+
|
7
|
+
def initialize(client_id:, secret:, production: false, auth_token_hash: nil)
|
8
|
+
base_url = Client.base_url(production: production)
|
9
|
+
@token = AthenaHealth::AuthToken.new(
|
6
10
|
client_id: client_id,
|
7
11
|
secret: secret,
|
8
|
-
|
12
|
+
auth_token_hash: auth_token_hash,
|
13
|
+
base_url: base_url,
|
14
|
+
api_version: API_VERSION
|
15
|
+
)
|
16
|
+
@api = AthenaHealth::Connection.new(
|
17
|
+
base_url: base_url, api_version: API_VERSION, token: @token
|
9
18
|
)
|
10
19
|
end
|
11
20
|
|
21
|
+
def serialized_token
|
22
|
+
@token.serialized_token
|
23
|
+
end
|
24
|
+
|
12
25
|
include Endpoints::Practices
|
13
26
|
include Endpoints::Departments
|
14
27
|
include Endpoints::Patients
|
@@ -20,5 +33,9 @@ module AthenaHealth
|
|
20
33
|
include Endpoints::Subscriptions
|
21
34
|
include Endpoints::Claims
|
22
35
|
include Endpoints::CustomFields
|
36
|
+
|
37
|
+
def self.base_url(production:)
|
38
|
+
production ? PRODUCTION_BASE_URL : PREVIEW_BASE_URL
|
39
|
+
end
|
23
40
|
end
|
24
41
|
end
|
@@ -2,43 +2,23 @@ require 'json'
|
|
2
2
|
|
3
3
|
module AthenaHealth
|
4
4
|
class Connection
|
5
|
-
|
6
|
-
PREVIEW_BASE_URL = 'https://api.preview.platform.athenahealth.com'.freeze
|
7
|
-
API_VERSION = 'v1'.freeze
|
8
|
-
|
9
|
-
def initialize(client_id:, secret:, token: nil, production: )
|
10
|
-
@client_id = client_id
|
11
|
-
@secret = secret
|
5
|
+
def initialize(base_url:, api_version:, token:)
|
12
6
|
@token = token
|
13
|
-
@
|
14
|
-
|
15
|
-
|
16
|
-
def authenticate
|
17
|
-
response = Typhoeus.post(
|
18
|
-
"#{base_url}/oauth2/#{API_VERSION}/token",
|
19
|
-
userpwd: "#{@client_id}:#{@secret}",
|
20
|
-
body: {
|
21
|
-
grant_type: 'client_credentials',
|
22
|
-
scope: 'athena/service/Athenanet.MDP.*'
|
23
|
-
}
|
24
|
-
).response_body
|
25
|
-
|
26
|
-
@token = JSON.parse(response)['access_token']
|
7
|
+
@api_version = api_version
|
8
|
+
@base_url = base_url
|
27
9
|
end
|
28
10
|
|
29
11
|
def call(endpoint:, method:, params: {}, body: {}, second_call: false)
|
30
|
-
authenticate if @token.nil?
|
31
|
-
|
32
12
|
response = Typhoeus::Request.new(
|
33
|
-
"#{base_url}/#{
|
13
|
+
"#{@base_url}/#{@api_version}/#{endpoint}",
|
34
14
|
method: method,
|
35
|
-
headers:
|
15
|
+
headers: @token.auth_header,
|
36
16
|
params: params,
|
37
17
|
body: body
|
38
18
|
).run
|
39
19
|
|
40
20
|
if response.response_code == 401 && !second_call
|
41
|
-
|
21
|
+
@token.reset!
|
42
22
|
return call(endpoint: endpoint, method: method, second_call: true, body: body, params: params)
|
43
23
|
end
|
44
24
|
|
@@ -48,13 +28,9 @@ module AthenaHealth
|
|
48
28
|
|
49
29
|
body = response.response_body
|
50
30
|
|
51
|
-
if [400, 409].include? response.response_code
|
52
|
-
fail AthenaHealth::ValidationError.new(json_response(body))
|
53
|
-
end
|
31
|
+
raise AthenaHealth::ValidationError, json_response(body) if [400, 409].include? response.response_code
|
54
32
|
|
55
|
-
if response.response_code != 200
|
56
|
-
AthenaHealth::Error.new(code: response.response_code).render
|
57
|
-
end
|
33
|
+
AthenaHealth::Error.new(code: response.response_code).render if response.response_code != 200
|
58
34
|
|
59
35
|
json_response(body)
|
60
36
|
end
|
@@ -64,9 +40,5 @@ module AthenaHealth
|
|
64
40
|
def json_response(body)
|
65
41
|
JSON.parse(body)
|
66
42
|
end
|
67
|
-
|
68
|
-
def base_url
|
69
|
-
@base_url ||= @production ? PRODUCTION_BASE_URL : PREVIEW_BASE_URL
|
70
|
-
end
|
71
43
|
end
|
72
44
|
end
|
@@ -8,7 +8,7 @@ module AthenaHealth
|
|
8
8
|
params: params.merge!(departmentid: department_id, ordertype: order_type)
|
9
9
|
)
|
10
10
|
|
11
|
-
response.map {|facility| AthenaHealth::Facility.new(facility) }
|
11
|
+
response.map { |facility| AthenaHealth::Facility.new(facility) }
|
12
12
|
end
|
13
13
|
|
14
14
|
def all_medications(practice_id:, search_value:)
|
@@ -18,7 +18,7 @@ module AthenaHealth
|
|
18
18
|
params: { searchvalue: search_value }
|
19
19
|
)
|
20
20
|
|
21
|
-
response.map {|medication| AthenaHealth::Medication.new(medication) }
|
21
|
+
response.map { |medication| AthenaHealth::Medication.new(medication) }
|
22
22
|
end
|
23
23
|
|
24
24
|
def all_allergies(practice_id:, search_value:)
|
@@ -28,7 +28,7 @@ module AthenaHealth
|
|
28
28
|
params: { searchvalue: search_value }
|
29
29
|
)
|
30
30
|
|
31
|
-
response.map {|allergy| AthenaHealth::Allergy.new(allergy) }
|
31
|
+
response.map { |allergy| AthenaHealth::Allergy.new(allergy) }
|
32
32
|
end
|
33
33
|
|
34
34
|
def all_insurances(practice_id:, plan_name:, member_id:, state:, params: {})
|
@@ -54,6 +54,34 @@ module AthenaHealth
|
|
54
54
|
|
55
55
|
response.map { |ordertype| AthenaHealth::OrderType.new(ordertype) }
|
56
56
|
end
|
57
|
+
|
58
|
+
def all_gender_identities(practice_id:, show2015edcehrtvalues: nil, limit: nil, offset: nil)
|
59
|
+
params = {
|
60
|
+
show2015edcehrtvalues: show2015edcehrtvalues, limit: limit, offset: offset
|
61
|
+
}.reject { |_k, v| v.nil? }
|
62
|
+
|
63
|
+
GenderIdentityFieldCollection.new(
|
64
|
+
@api.call(
|
65
|
+
endpoint: "#{practice_id}/configuration/patients/genderidentity",
|
66
|
+
method: :get,
|
67
|
+
params: params
|
68
|
+
)
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
72
|
+
def available_screening_questionaires(practice_id:, limit: nil, offset: nil)
|
73
|
+
params = {
|
74
|
+
limit: limit, offset: offset
|
75
|
+
}.reject { |_k, v| v.nil? }
|
76
|
+
|
77
|
+
AthenaHealth::ScreeningQuestionaire::ScreeningQuestionaireTemplateCollection.new(
|
78
|
+
@api.call(
|
79
|
+
endpoint: "#{practice_id}/chart/questionnairescreeners",
|
80
|
+
method: :get,
|
81
|
+
params: params
|
82
|
+
)
|
83
|
+
)
|
84
|
+
end
|
57
85
|
end
|
58
86
|
end
|
59
87
|
end
|
@@ -16,7 +16,7 @@ module AthenaHealth
|
|
16
16
|
method: :get
|
17
17
|
)
|
18
18
|
orders_collection = []
|
19
|
-
response.each {|x| orders_collection << OrderCollection.new(x)}
|
19
|
+
response.each { |x| orders_collection << OrderCollection.new(x) }
|
20
20
|
|
21
21
|
orders_collection
|
22
22
|
end
|
@@ -32,7 +32,7 @@ module AthenaHealth
|
|
32
32
|
|
33
33
|
def encounter_summary(practice_id:, encounter_id:)
|
34
34
|
response = @api.call(
|
35
|
-
endpoint:
|
35
|
+
endpoint: "#{practice_id}/chart/encounters/#{encounter_id}/summary",
|
36
36
|
method: :get
|
37
37
|
)
|
38
38
|
EncounterSummary.new(response)
|
@@ -61,6 +61,77 @@ module AthenaHealth
|
|
61
61
|
body: body
|
62
62
|
)
|
63
63
|
end
|
64
|
+
|
65
|
+
def encounter_screening_questionnaires(practice_id:, encounter_id:, limit: nil, offset: nil)
|
66
|
+
params = {
|
67
|
+
limit: limit, offset: offset
|
68
|
+
}.reject { |_k, value| value.nil? }
|
69
|
+
|
70
|
+
response = @api.call(
|
71
|
+
endpoint: "#{practice_id}/chart/encounter/#{encounter_id}/questionnairescreeners",
|
72
|
+
params: params,
|
73
|
+
method: :get
|
74
|
+
)
|
75
|
+
|
76
|
+
ScreeningQuestionaire::ScreeningQuestionaireCollection.new(response)
|
77
|
+
end
|
78
|
+
|
79
|
+
def activate_screening_questionnaire(practice_id:, encounter_id:, template_id:)
|
80
|
+
@api.call(
|
81
|
+
endpoint: "#{practice_id}/chart/encounter/#{encounter_id}/questionnairescreeners",
|
82
|
+
body: {
|
83
|
+
templateid: template_id
|
84
|
+
},
|
85
|
+
method: :post
|
86
|
+
)
|
87
|
+
end
|
88
|
+
|
89
|
+
def update_screening_questionnaire_score_only(
|
90
|
+
practice_id:,
|
91
|
+
encounter_id:,
|
92
|
+
questionnaire_id:,
|
93
|
+
score:,
|
94
|
+
document_ids:,
|
95
|
+
note: nil
|
96
|
+
)
|
97
|
+
|
98
|
+
body = {
|
99
|
+
questionnaireid: questionnaire_id,
|
100
|
+
documentids: document_ids,
|
101
|
+
score: score, note: note
|
102
|
+
}.reject { |_k, value| value.nil? }
|
103
|
+
|
104
|
+
@api.call(
|
105
|
+
endpoint: "#{practice_id}/chart/encounter/#{encounter_id}/questionnairescreeners/scoreonly",
|
106
|
+
body: body,
|
107
|
+
method: :put
|
108
|
+
)
|
109
|
+
end
|
110
|
+
|
111
|
+
def update_screening_questionnaire(
|
112
|
+
practice_id:,
|
113
|
+
encounter_id:,
|
114
|
+
questionnaire_id:,
|
115
|
+
questions:,
|
116
|
+
score:,
|
117
|
+
document_ids:,
|
118
|
+
guidelines: nil,
|
119
|
+
state: nil,
|
120
|
+
note: nil
|
121
|
+
)
|
122
|
+
|
123
|
+
body = {
|
124
|
+
questionnaireid: questionnaire_id,
|
125
|
+
documentids: document_ids, guidelines: guidelines,
|
126
|
+
state: state, questions: questions, score: score, note: note
|
127
|
+
}.reject { |_k, value| value.nil? }
|
128
|
+
|
129
|
+
@api.call(
|
130
|
+
endpoint: "#{practice_id}/chart/encounter/#{encounter_id}/questionnairescreeners",
|
131
|
+
body: body,
|
132
|
+
method: :put
|
133
|
+
)
|
134
|
+
end
|
64
135
|
end
|
65
136
|
end
|
66
137
|
end
|
@@ -28,7 +28,7 @@ module AthenaHealth
|
|
28
28
|
params: params.merge!(firstname: first_name, lastname: last_name, dob: date_of_birth)
|
29
29
|
)
|
30
30
|
|
31
|
-
response.map{ |patient| Patient.new(patient) }
|
31
|
+
response.map { |patient| Patient.new(patient) }
|
32
32
|
end
|
33
33
|
|
34
34
|
def create_patient(practice_id:, department_id:, params: {})
|
@@ -141,13 +141,13 @@ module AthenaHealth
|
|
141
141
|
end
|
142
142
|
|
143
143
|
def patient_appointments(practice_id:, patient_id:, params: {})
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
144
|
+
response = @api.call(
|
145
|
+
endpoint: "#{practice_id}/patients/#{patient_id}/appointments",
|
146
|
+
method: :get,
|
147
|
+
params: params
|
148
|
+
)
|
149
149
|
|
150
|
-
|
150
|
+
AppointmentCollection.new(response)
|
151
151
|
end
|
152
152
|
|
153
153
|
def patient_documents(practice_id:, department_id:, patient_id:, params: {})
|
@@ -168,6 +168,20 @@ module AthenaHealth
|
|
168
168
|
)
|
169
169
|
end
|
170
170
|
|
171
|
+
def create_patient_encounter_document(practice_id:, department_id:, patient_id:, document_subclass:,
|
172
|
+
attachment_contents: nil, encounter_id: nil, params: {})
|
173
|
+
body = params.merge({
|
174
|
+
departmentid: department_id.to_s, documentsubclass: document_subclass,
|
175
|
+
attachmentcontents: attachment_contents, encounterid: encounter_id
|
176
|
+
}.reject { |_k, v| v.nil? })
|
177
|
+
|
178
|
+
@api.call(
|
179
|
+
endpoint: "#{practice_id}/patients/#{patient_id}/documents/encounterdocument",
|
180
|
+
method: :post,
|
181
|
+
body: body
|
182
|
+
)['encounterdocumentid']
|
183
|
+
end
|
184
|
+
|
171
185
|
def patient_default_pharmacy(practice_id:, department_id:, patient_id:)
|
172
186
|
response = @api.call(
|
173
187
|
endpoint: "#{practice_id}/chart/#{patient_id}/pharmacies/default",
|
@@ -229,7 +243,7 @@ module AthenaHealth
|
|
229
243
|
params: { departmentid: department_id }
|
230
244
|
)
|
231
245
|
|
232
|
-
response.map {|template| AthenaHealth::Template.new(template) }
|
246
|
+
response.map { |template| AthenaHealth::Template.new(template) }
|
233
247
|
end
|
234
248
|
|
235
249
|
def set_patient_social_history_templates(practice_id:, department_id:, patient_id:, template_ids: [])
|
@@ -280,9 +294,9 @@ module AthenaHealth
|
|
280
294
|
|
281
295
|
def update_patient_medications(practice_id:, department_id:, patient_id:, params: {})
|
282
296
|
response = @api.call(
|
283
|
-
|
284
|
-
|
285
|
-
|
297
|
+
endpoint: "#{practice_id}/chart/#{patient_id}/medications",
|
298
|
+
method: :put,
|
299
|
+
body: params.merge!(departmentid: department_id)
|
286
300
|
)
|
287
301
|
end
|
288
302
|
|
@@ -339,9 +353,9 @@ module AthenaHealth
|
|
339
353
|
|
340
354
|
def update_patient_insurance_card_image(practice_id:, patient_id:, insurance_id:, image:, params: {})
|
341
355
|
@api.call(
|
342
|
-
endpoint: "#{practice_id}/patients/#{patient_id}/insurances/#{insurance_id}/image",
|
356
|
+
endpoint: "#{practice_id}/patients/#{patient_id}/insurances/#{insurance_id}/image",
|
343
357
|
method: :put,
|
344
|
-
body: {image: image}
|
358
|
+
body: { image: image }
|
345
359
|
)
|
346
360
|
end
|
347
361
|
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
require_relative 'diagnosis'
|
4
|
+
require_relative 'payer'
|
5
|
+
require_relative 'procedure'
|
6
|
+
require_relative 'claim_collection'
|
6
7
|
module AthenaHealth
|
7
8
|
module Claim
|
8
9
|
class Claim < BaseModel
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AthenaHealth
|
4
|
+
module ScreeningQuestionaire
|
5
|
+
# Any meta questions related to a questionnaire.
|
6
|
+
# E.g., should this be considered generally as positive or negative?
|
7
|
+
class MetaQuestion < BaseModel
|
8
|
+
attribute :answertext, String
|
9
|
+
attribute :questiontext, String
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AthenaHealth
|
4
|
+
module ScreeningQuestionaire
|
5
|
+
# A specfic question in a screening questionaire
|
6
|
+
class Question < BaseModel
|
7
|
+
attribute :answer, String
|
8
|
+
attribute :hidden, String
|
9
|
+
attribute :key, String
|
10
|
+
attribute :possibleanswers, Array[String]
|
11
|
+
attribute :question, String
|
12
|
+
attribute :questionid, Integer
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'question'
|
4
|
+
require_relative 'meta_question'
|
5
|
+
require_relative 'section'
|
6
|
+
|
7
|
+
module AthenaHealth
|
8
|
+
module ScreeningQuestionaire
|
9
|
+
# The reason the patient declined
|
10
|
+
class DeclinedReason < BaseModel
|
11
|
+
attribute :declinedreasontext, String
|
12
|
+
end
|
13
|
+
|
14
|
+
# A Screening Questionnaire Available in the platform
|
15
|
+
class ScreeningQuestionaireTemplate < BaseModel
|
16
|
+
attribute :templateid, Integer
|
17
|
+
attribute :templatetype, String
|
18
|
+
attribute :name, String
|
19
|
+
end
|
20
|
+
|
21
|
+
# Screening Questionnaires are used to assess risk for or severity of disorders or
|
22
|
+
# conditions such as autism and depression. These questionnaires result in a score,
|
23
|
+
# and often include guidelines and proposed treatment actions. Screeners can be structured
|
24
|
+
# or score-only. The Screening Questionnaires Reference are configured in the system.
|
25
|
+
# The user will be able to retrieve the list of screening questionnaires for a specific
|
26
|
+
# encounter. Screeners can be structured or score-only.
|
27
|
+
class ScreeningQuestionaire < ScreeningQuestionaireTemplate
|
28
|
+
model_attribute(field_name: 'declinedreason', klass: DeclinedReason)
|
29
|
+
attribute :documentids, Array[String]
|
30
|
+
attribute :guidelines, String
|
31
|
+
attribute :maximumscore, Integer
|
32
|
+
model_attribute(field_name: 'metaquestions', klass: MetaQuestion, array: true)
|
33
|
+
|
34
|
+
attribute :note, String
|
35
|
+
attribute :questionnaireid, Integer
|
36
|
+
attribute :score, Integer
|
37
|
+
attribute :scoredby, String
|
38
|
+
attribute :scoreddate, String
|
39
|
+
attribute :scoringstatus, String
|
40
|
+
model_attribute(field_name: 'sections', klass: Section, array: true)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'screening_questionnaire'
|
4
|
+
module AthenaHealth
|
5
|
+
module ScreeningQuestionaire
|
6
|
+
# a collection of screening questionaires
|
7
|
+
class ScreeningQuestionaireCollection < BaseModel
|
8
|
+
model_attribute(field_name: 'questionnairescreeners', klass: ScreeningQuestionaire, array: true)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/athena_health/models/screening_questionnaire/screening_questionnaire_template_collection.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'screening_questionnaire'
|
4
|
+
module AthenaHealth
|
5
|
+
module ScreeningQuestionaire
|
6
|
+
# a collection of screening questionaire templates
|
7
|
+
class ScreeningQuestionaireTemplateCollection < BaseCollection
|
8
|
+
model_attribute(field_name: 'questionnairescreeners', klass: ScreeningQuestionaireTemplate, array: true)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AthenaHealth
|
4
|
+
module ScreeningQuestionaire
|
5
|
+
# The section of a screening questionaire
|
6
|
+
class Section < BaseModel
|
7
|
+
attribute :headertext, String
|
8
|
+
model_attribute(field_name: 'questionlist', klass: Question, array: true)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/athena_health.rb
CHANGED
@@ -3,6 +3,7 @@ require 'virtus'
|
|
3
3
|
|
4
4
|
require 'athena_health/version'
|
5
5
|
require 'athena_health/connection'
|
6
|
+
require 'athena_health/auth_token'
|
6
7
|
require 'athena_health/error'
|
7
8
|
require 'athena_health/endpoints/practices'
|
8
9
|
require 'athena_health/endpoints/departments'
|
@@ -37,6 +38,7 @@ require 'athena_health/appointment_type_collection'
|
|
37
38
|
require 'athena_health/appointment'
|
38
39
|
require 'athena_health/appointment_waitlist'
|
39
40
|
require 'athena_health/appointment_collection'
|
41
|
+
require 'athena_health/gender_identity_field_collection'
|
40
42
|
require 'athena_health/insurance_package'
|
41
43
|
require 'athena_health/insurance_package_collection'
|
42
44
|
require 'athena_health/patient_appointment_reason'
|
@@ -79,8 +81,10 @@ require 'athena_health/user_medication_sig'
|
|
79
81
|
require 'athena_health/user_medication'
|
80
82
|
require 'athena_health/user_medication_collection'
|
81
83
|
require 'athena_health/subscription'
|
82
|
-
|
83
|
-
require 'athena_health/claim/
|
84
|
+
|
85
|
+
require 'athena_health/models/claim/claim'
|
86
|
+
require 'athena_health/models/screening_questionnaire/screening_questionnaire_collection'
|
87
|
+
require 'athena_health/models/screening_questionnaire/screening_questionnaire_template_collection'
|
84
88
|
|
85
89
|
module AthenaHealth
|
86
90
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: athena_health
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mateusz Urbański
|
8
|
+
- Ben Jones
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date: 2023-
|
12
|
+
date: 2023-02-02 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: typhoeus
|
@@ -94,10 +95,39 @@ dependencies:
|
|
94
95
|
- - "~>"
|
95
96
|
- !ruby/object:Gem::Version
|
96
97
|
version: '3.0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: timecop
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 0.9.6
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 0.9.6
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: rubocop
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '1.42'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '1.42'
|
97
126
|
description: Ruby wrapper for Athenahealth API. See https://developer.athenahealth.com/io-docs
|
98
127
|
for more details.
|
99
128
|
email:
|
100
129
|
- mateuszurbanski@yahoo.pl
|
130
|
+
- ben@benjones.io
|
101
131
|
executables: []
|
102
132
|
extensions: []
|
103
133
|
extra_rdoc_files: []
|
@@ -105,6 +135,7 @@ files:
|
|
105
135
|
- ".github/workflows/ci.yml"
|
106
136
|
- ".gitignore"
|
107
137
|
- ".rspec"
|
138
|
+
- ".rubocop.yml"
|
108
139
|
- ".ruby-version"
|
109
140
|
- ".travis.yml"
|
110
141
|
- Gemfile
|
@@ -123,14 +154,10 @@ files:
|
|
123
154
|
- lib/athena_health/appointment_type.rb
|
124
155
|
- lib/athena_health/appointment_type_collection.rb
|
125
156
|
- lib/athena_health/appointment_waitlist.rb
|
157
|
+
- lib/athena_health/auth_token.rb
|
126
158
|
- lib/athena_health/balance.rb
|
127
159
|
- lib/athena_health/base_collection.rb
|
128
160
|
- lib/athena_health/base_model.rb
|
129
|
-
- lib/athena_health/claim/claim.rb
|
130
|
-
- lib/athena_health/claim/claim_collection.rb
|
131
|
-
- lib/athena_health/claim/diagnosis.rb
|
132
|
-
- lib/athena_health/claim/payer.rb
|
133
|
-
- lib/athena_health/claim/procedure.rb
|
134
161
|
- lib/athena_health/client.rb
|
135
162
|
- lib/athena_health/connection.rb
|
136
163
|
- lib/athena_health/custom_field.rb
|
@@ -156,6 +183,7 @@ files:
|
|
156
183
|
- lib/athena_health/error.rb
|
157
184
|
- lib/athena_health/event.rb
|
158
185
|
- lib/athena_health/facility.rb
|
186
|
+
- lib/athena_health/gender_identity_field_collection.rb
|
159
187
|
- lib/athena_health/insurance.rb
|
160
188
|
- lib/athena_health/insurance_collection.rb
|
161
189
|
- lib/athena_health/insurance_package.rb
|
@@ -164,6 +192,17 @@ files:
|
|
164
192
|
- lib/athena_health/lab_result_collection.rb
|
165
193
|
- lib/athena_health/laboratory.rb
|
166
194
|
- lib/athena_health/medication.rb
|
195
|
+
- lib/athena_health/models/claim/claim.rb
|
196
|
+
- lib/athena_health/models/claim/claim_collection.rb
|
197
|
+
- lib/athena_health/models/claim/diagnosis.rb
|
198
|
+
- lib/athena_health/models/claim/payer.rb
|
199
|
+
- lib/athena_health/models/claim/procedure.rb
|
200
|
+
- lib/athena_health/models/screening_questionnaire/meta_question.rb
|
201
|
+
- lib/athena_health/models/screening_questionnaire/question.rb
|
202
|
+
- lib/athena_health/models/screening_questionnaire/screening_questionnaire.rb
|
203
|
+
- lib/athena_health/models/screening_questionnaire/screening_questionnaire_collection.rb
|
204
|
+
- lib/athena_health/models/screening_questionnaire/screening_questionnaire_template_collection.rb
|
205
|
+
- lib/athena_health/models/screening_questionnaire/section.rb
|
167
206
|
- lib/athena_health/note.rb
|
168
207
|
- lib/athena_health/note_collection.rb
|
169
208
|
- lib/athena_health/order.rb
|