athena_health 2.0.3 → 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 +1 -0
- data/.rubocop.yml +4 -0
- data/README.md +1 -1
- data/lib/athena_health/base_collection.rb +2 -3
- data/lib/athena_health/base_model.rb +44 -0
- data/lib/athena_health/endpoints/configurations.rb +14 -0
- data/lib/athena_health/endpoints/encounters.rb +73 -2
- data/lib/athena_health/endpoints/patients.rb +27 -13
- 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/version.rb +1 -1
- data/lib/athena_health.rb +4 -2
- metadata +14 -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
|
|
@@ -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
|
@@ -68,6 +68,20 @@ module AthenaHealth
|
|
68
68
|
)
|
69
69
|
)
|
70
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
|
71
85
|
end
|
72
86
|
end
|
73
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
@@ -81,8 +81,10 @@ require 'athena_health/user_medication_sig'
|
|
81
81
|
require 'athena_health/user_medication'
|
82
82
|
require 'athena_health/user_medication_collection'
|
83
83
|
require 'athena_health/subscription'
|
84
|
-
|
85
|
-
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'
|
86
88
|
|
87
89
|
module AthenaHealth
|
88
90
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: typhoeus
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- ".github/workflows/ci.yml"
|
136
136
|
- ".gitignore"
|
137
137
|
- ".rspec"
|
138
|
+
- ".rubocop.yml"
|
138
139
|
- ".ruby-version"
|
139
140
|
- ".travis.yml"
|
140
141
|
- Gemfile
|
@@ -157,11 +158,6 @@ files:
|
|
157
158
|
- lib/athena_health/balance.rb
|
158
159
|
- lib/athena_health/base_collection.rb
|
159
160
|
- lib/athena_health/base_model.rb
|
160
|
-
- lib/athena_health/claim/claim.rb
|
161
|
-
- lib/athena_health/claim/claim_collection.rb
|
162
|
-
- lib/athena_health/claim/diagnosis.rb
|
163
|
-
- lib/athena_health/claim/payer.rb
|
164
|
-
- lib/athena_health/claim/procedure.rb
|
165
161
|
- lib/athena_health/client.rb
|
166
162
|
- lib/athena_health/connection.rb
|
167
163
|
- lib/athena_health/custom_field.rb
|
@@ -196,6 +192,17 @@ files:
|
|
196
192
|
- lib/athena_health/lab_result_collection.rb
|
197
193
|
- lib/athena_health/laboratory.rb
|
198
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
|
199
206
|
- lib/athena_health/note.rb
|
200
207
|
- lib/athena_health/note_collection.rb
|
201
208
|
- lib/athena_health/order.rb
|