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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ee9010e37827822d73699a86a4676ebe8492fd5
4
- data.tar.gz: 1644e9bdfad763562230dc2a75e84804e01af564
3
+ metadata.gz: 09b761c82a6c988c162456d1482d75ef2260d967
4
+ data.tar.gz: 1dfbea79cd481005442e4c89515fc615e28b2c91
5
5
  SHA512:
6
- metadata.gz: 5f73e8dee3a7bdd769541d3cac218b84742b4ca4f6502d3b118659a416ee015a57d883c0b4fee22db6761d700974213c027c5dc5046a8b4f54994fd991544977
7
- data.tar.gz: fa8bd8b705025dcbb7814b3293521ad8cb8a38d5541752a9f8ff635fefe00aafdc078e480ebf4478179b0e3694cccbb3bebffef36548a0e9bd0443302714a867
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
- AthenaHealth::Error.new(code: response.response_code).render unless [200, 400].include? response.response_code
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(endpoint: "#{practice_id}/departments", method: :get, params: params)
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(endpoint: "#{practice_id}/departments/#{department_id}", method: :get, params: params)
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(endpoint: "#{practice_id}/patients", method: :get, params: params.merge!(departmentid: department_id))
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(endpoint: "#{practice_id}/patients/#{patient_id}", method: :get, params: params)
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(endpoint: "#{practice_id}/patients", method: :post, body: params.merge!(departmentid: department_id))
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(endpoint: "#{practice_id}/patients/#{patient_id}", method: :put, params: params)
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(endpoint: "#{practice_id}/patients/#{patient_id}", method: :put, params: { status: 'deleted' })
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(endpoint: '1/practiceinfo', method: :get, params: params)
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(endpoint: "#{practice_id}/practiceinfo", method: :get, params: params)
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
@@ -0,0 +1,8 @@
1
+ module AthenaHealth
2
+ class Event < BaseModel
3
+ attribute :source, String
4
+ attribute :eventtype, String
5
+ attribute :startdate, String
6
+ attribute :diagnoses, Array
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ module AthenaHealth
2
+ class PatientProblem < BaseModel
3
+ attribute :problemid, Integer
4
+ attribute :events, Array[Event]
5
+ attribute :codeset, String
6
+ attribute :name, String
7
+ attribute :code, Integer
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ module AthenaHealth
2
+ class PatientProblemCollection < BaseCollection
3
+ attribute :lastupdated, String
4
+ attribute :problems, Array[PatientProblem]
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module AthenaHealth
2
- VERSION = '0.6.0'.freeze
2
+ VERSION = '0.7.0'.freeze
3
3
  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.6.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-18 00:00:00.000000000 Z
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