athena_health 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/athena_health.rb +3 -0
- data/lib/athena_health/connection.rb +3 -1
- data/lib/athena_health/endpoints/departments.rb +12 -2
- data/lib/athena_health/endpoints/patients.rb +45 -5
- data/lib/athena_health/endpoints/practices.rb +12 -2
- data/lib/athena_health/event.rb +8 -0
- data/lib/athena_health/patient_problem.rb +9 -0
- data/lib/athena_health/patient_problem_collection.rb +6 -0
- data/lib/athena_health/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09b761c82a6c988c162456d1482d75ef2260d967
|
4
|
+
data.tar.gz: 1dfbea79cd481005442e4c89515fc615e28b2c91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01e173821a99b9938ee1bacf4d3f2499ba3340d047e75f5339a2af43f6ba54cf01554a158bd07976a5731bdb317bff5b7078453fa9b7dfd083ca854be6a42742
|
7
|
+
data.tar.gz: 55f7252abced9c1e3183d63b2d8ffea38baa2d8a91e20a59417380232d740352099e3a7e2c644431324f8a1616e33e10608394fbcd0ca61cd54391fa30194ef1
|
data/lib/athena_health.rb
CHANGED
@@ -17,6 +17,9 @@ require 'athena_health/department_collection'
|
|
17
17
|
require 'athena_health/balance'
|
18
18
|
require 'athena_health/patient'
|
19
19
|
require 'athena_health/patient_collection'
|
20
|
+
require 'athena_health/event'
|
21
|
+
require 'athena_health/patient_problem'
|
22
|
+
require 'athena_health/patient_problem_collection'
|
20
23
|
|
21
24
|
module AthenaHealth
|
22
25
|
end
|
@@ -37,7 +37,9 @@ module AthenaHealth
|
|
37
37
|
call(endpoint: endpoint, method: method, second_call: true)
|
38
38
|
end
|
39
39
|
|
40
|
-
|
40
|
+
unless [200, 400].include? response.response_code
|
41
|
+
AthenaHealth::Error.new(code: response.response_code).render
|
42
|
+
end
|
41
43
|
|
42
44
|
JSON.parse(response.response_body)
|
43
45
|
end
|
@@ -2,12 +2,22 @@ module AthenaHealth
|
|
2
2
|
module Endpoints
|
3
3
|
module Departments
|
4
4
|
def all_departments(practice_id:, params: {})
|
5
|
-
response = @api.call(
|
5
|
+
response = @api.call(
|
6
|
+
endpoint: "#{practice_id}/departments",
|
7
|
+
method: :get,
|
8
|
+
params: params
|
9
|
+
)
|
10
|
+
|
6
11
|
DepartmentCollection.new(response)
|
7
12
|
end
|
8
13
|
|
9
14
|
def find_department(practice_id:, department_id:, params: {})
|
10
|
-
response = @api.call(
|
15
|
+
response = @api.call(
|
16
|
+
endpoint: "#{practice_id}/departments/#{department_id}",
|
17
|
+
method: :get,
|
18
|
+
params: params
|
19
|
+
)
|
20
|
+
|
11
21
|
Department.new(response.first)
|
12
22
|
end
|
13
23
|
end
|
@@ -2,25 +2,65 @@ module AthenaHealth
|
|
2
2
|
module Endpoints
|
3
3
|
module Patients
|
4
4
|
def all_patients(practice_id:, department_id:, params: {})
|
5
|
-
response = @api.call(
|
5
|
+
response = @api.call(
|
6
|
+
endpoint: "#{practice_id}/patients",
|
7
|
+
method: :get,
|
8
|
+
params: params.merge!(departmentid: department_id)
|
9
|
+
)
|
10
|
+
|
6
11
|
PatientCollection.new(response)
|
7
12
|
end
|
8
13
|
|
9
14
|
def find_patient(practice_id:, patient_id:, params: {})
|
10
|
-
response = @api.call(
|
15
|
+
response = @api.call(
|
16
|
+
endpoint: "#{practice_id}/patients/#{patient_id}",
|
17
|
+
method: :get,
|
18
|
+
params: params
|
19
|
+
)
|
20
|
+
|
11
21
|
Patient.new(response.first)
|
12
22
|
end
|
13
23
|
|
14
24
|
def create_patient(practice_id:, department_id:, params: {})
|
15
|
-
@api.call(
|
25
|
+
@api.call(
|
26
|
+
endpoint: "#{practice_id}/patients",
|
27
|
+
method: :post,
|
28
|
+
body: params.merge!(departmentid: department_id)
|
29
|
+
)
|
16
30
|
end
|
17
31
|
|
18
32
|
def update_patient(practice_id:, patient_id:, params: {})
|
19
|
-
@api.call(
|
33
|
+
@api.call(
|
34
|
+
endpoint: "#{practice_id}/patients/#{patient_id}",
|
35
|
+
method: :put,
|
36
|
+
params: params
|
37
|
+
)
|
20
38
|
end
|
21
39
|
|
22
40
|
def delete_patient(practice_id:, patient_id:)
|
23
|
-
@api.call(
|
41
|
+
@api.call(
|
42
|
+
endpoint: "#{practice_id}/patients/#{patient_id}",
|
43
|
+
method: :put,
|
44
|
+
params: { status: 'deleted' }
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_patient_problem(practice_id:, department_id:, patient_id:, snomed_code:, params: {})
|
49
|
+
@api.call(
|
50
|
+
endpoint: "#{practice_id}/chart/#{patient_id}/problems",
|
51
|
+
method: :post,
|
52
|
+
body: params.merge!(departmentid: department_id, snomedcode: snomed_code)
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
def find_patient_problems(practice_id:, department_id:, patient_id:)
|
57
|
+
response = @api.call(
|
58
|
+
endpoint: "#{practice_id}/chart/#{patient_id}/problems",
|
59
|
+
method: :get,
|
60
|
+
params: { departmentid: department_id }
|
61
|
+
)
|
62
|
+
|
63
|
+
PatientProblemCollection.new(response)
|
24
64
|
end
|
25
65
|
end
|
26
66
|
end
|
@@ -2,12 +2,22 @@ module AthenaHealth
|
|
2
2
|
module Endpoints
|
3
3
|
module Practices
|
4
4
|
def all_practices(params: {})
|
5
|
-
response = @api.call(
|
5
|
+
response = @api.call(
|
6
|
+
endpoint: '1/practiceinfo',
|
7
|
+
method: :get,
|
8
|
+
params: params
|
9
|
+
)
|
10
|
+
|
6
11
|
PracticeCollection.new(response)
|
7
12
|
end
|
8
13
|
|
9
14
|
def find_practice(practice_id:, params: {})
|
10
|
-
response = @api.call(
|
15
|
+
response = @api.call(
|
16
|
+
endpoint: "#{practice_id}/practiceinfo",
|
17
|
+
method: :get,
|
18
|
+
params: params
|
19
|
+
)
|
20
|
+
|
11
21
|
PracticeCollection.new(response).practices.first
|
12
22
|
end
|
13
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: athena_health
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mateusz Urbański
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -136,8 +136,11 @@ files:
|
|
136
136
|
- lib/athena_health/endpoints/patients.rb
|
137
137
|
- lib/athena_health/endpoints/practices.rb
|
138
138
|
- lib/athena_health/error.rb
|
139
|
+
- lib/athena_health/event.rb
|
139
140
|
- lib/athena_health/patient.rb
|
140
141
|
- lib/athena_health/patient_collection.rb
|
142
|
+
- lib/athena_health/patient_problem.rb
|
143
|
+
- lib/athena_health/patient_problem_collection.rb
|
141
144
|
- lib/athena_health/practice.rb
|
142
145
|
- lib/athena_health/practice_collection.rb
|
143
146
|
- lib/athena_health/version.rb
|