allscripts_api 0.6.0 → 0.7.0
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.
- checksums.yaml +4 -4
- data/.pryrc +3 -3
- data/Gemfile.lock +1 -1
- data/README.md +0 -1
- data/lib/allscripts_api.rb +3 -2
- data/lib/allscripts_api/client.rb +3 -1
- data/lib/allscripts_api/demographics.rb +3 -0
- data/lib/allscripts_api/demographics/demographics_methods.rb +64 -0
- data/lib/allscripts_api/documents/document.rb +1 -1
- data/lib/allscripts_api/documents/document_methods.rb +33 -0
- data/lib/allscripts_api/documents/document_sender.rb +3 -2
- data/lib/allscripts_api/named_magic_methods.rb +0 -119
- data/lib/allscripts_api/orders.rb +4 -0
- data/lib/allscripts_api/orders/order.rb +55 -0
- data/lib/allscripts_api/orders/ordering_methods.rb +44 -0
- data/lib/allscripts_api/patients.rb +3 -0
- data/lib/allscripts_api/patients/patient_methods.rb +67 -0
- data/lib/allscripts_api/version.rb +1 -1
- metadata +9 -4
- data/lib/allscripts_api/order.rb +0 -53
- data/lib/allscripts_api/ordering_methods.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae946e7adbf4299a037926c915fd33ff7bf57543
|
4
|
+
data.tar.gz: a2b9a11e36131641c5c338375a57d0decd12880c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24e68dfd0b893788d198956362c1f6c0f26bace7e3bcd18239f59e353595517c25ba09eaf774f48229c7257bc825f6b57abd03fdc53901da5745ef810f99e129
|
7
|
+
data.tar.gz: ca99389bd969d11db5bd789e7068dcce5e1a8e363ddf13909998cb7a3a2690ac079b63d114a0ccaca3881c2930f8796f82049726573e18f892221835a14d1613
|
data/.pryrc
CHANGED
@@ -27,16 +27,16 @@ def bc
|
|
27
27
|
client
|
28
28
|
end
|
29
29
|
|
30
|
-
def document_params
|
30
|
+
def document_params(pdf)
|
31
31
|
{
|
32
|
-
bytes_read:
|
32
|
+
bytes_read: pdf.bytes.length,
|
33
33
|
b_done_upload: false,
|
34
34
|
document_var: "",
|
35
35
|
patient_id: 19,
|
36
36
|
owner_code: "TW0001",
|
37
37
|
first_name: "Allison",
|
38
38
|
last_name: "Allscripts",
|
39
|
-
document_type: "
|
39
|
+
document_type: "gwn_otfm", #document_type_de.entrycode value GetDictionary
|
40
40
|
organization_name: "New World Health"
|
41
41
|
}
|
42
42
|
end
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
[](https://coveralls.io/github/Avhana/allscripts_api?branch=master)
|
4
4
|
[](https://travis-ci.org/Avhana/allscripts_api)
|
5
5
|
[](http://inch-ci.org/github/Avhana/allscripts_api)
|
6
|
-
[](https://gemnasium.com/github.com/Avhana/allscripts_api)
|
7
6
|
[](https://codeclimate.com/github/Avhana/allscripts_api/maintainability)
|
8
7
|
[](https://hakiri.io/github/Avhana/allscripts_api/master)
|
9
8
|
|
data/lib/allscripts_api.rb
CHANGED
@@ -5,8 +5,9 @@ require "allscripts_api/configuration"
|
|
5
5
|
require "allscripts_api/utilities/validator"
|
6
6
|
require "allscripts_api/magic_params"
|
7
7
|
require "allscripts_api/named_magic_methods"
|
8
|
-
require "allscripts_api/
|
9
|
-
require "allscripts_api/
|
8
|
+
require "allscripts_api/orders"
|
9
|
+
require "allscripts_api/patients"
|
10
|
+
require "allscripts_api/demographics"
|
10
11
|
require "allscripts_api/documents"
|
11
12
|
require "allscripts_api/client"
|
12
13
|
require "allscripts_api/version"
|
@@ -6,7 +6,9 @@ module AllscriptsApi
|
|
6
6
|
# Client serves as an entry point for making calls
|
7
7
|
class Client
|
8
8
|
include AllscriptsApi::NamedMagicMethods
|
9
|
-
include AllscriptsApi::OrderingMethods
|
9
|
+
include AllscriptsApi::Orders::OrderingMethods
|
10
|
+
include AllscriptsApi::Patients::PatientMethods
|
11
|
+
include AllscriptsApi::Demographics::DemographicsMethods
|
10
12
|
include AllscriptsApi::Documents::DocumentMethods
|
11
13
|
attr_reader :adapter, :unity_url, :app_name, :token
|
12
14
|
attr_writer :sso_token
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AllscriptsApi
|
4
|
+
module Demographics
|
5
|
+
# A collection convenience methods for ordering that map
|
6
|
+
# to Allscripts magic actions related to demographics calls.
|
7
|
+
# These methods are included in {AllscriptsApi::Client}
|
8
|
+
# and can be accessed from instances of that class.
|
9
|
+
module DemographicsMethods
|
10
|
+
# a wrapper around SearchPatients
|
11
|
+
#
|
12
|
+
# @param search_string [String] may be a name, birthdate
|
13
|
+
# partial address, or other PHI
|
14
|
+
# @return [Array<Hash>, Array, MagicError] a list of found patients,
|
15
|
+
# an empty array, or an error
|
16
|
+
def search_patients(search_string)
|
17
|
+
params =
|
18
|
+
MagicParams.format(
|
19
|
+
user_id: @allscripts_username,
|
20
|
+
parameter1: search_string
|
21
|
+
)
|
22
|
+
results = magic("SearchPatients", magic_params: params)
|
23
|
+
results["searchpatientsinfo"]
|
24
|
+
end
|
25
|
+
|
26
|
+
# gets patient's demographic info, insurance, guarantor, and PCP info
|
27
|
+
#
|
28
|
+
# @param patient_id [String] patient id
|
29
|
+
# @param patient_number [String] PM patient number
|
30
|
+
# @return [String, AllscriptsApi::MagicError] patient demographics
|
31
|
+
def get_patient(patient_id, patient_number = nil)
|
32
|
+
params =
|
33
|
+
MagicParams.format(
|
34
|
+
user_id: @allscripts_username,
|
35
|
+
patient_id: patient_id,
|
36
|
+
parameter1: patient_number
|
37
|
+
)
|
38
|
+
results = magic("GetPatient", magic_params: params)
|
39
|
+
results["getpatientinfo"]
|
40
|
+
end
|
41
|
+
|
42
|
+
# gets patient's demographic info, insurance, guarantor, and PCP info
|
43
|
+
# Note that this method is litely to return blank data sets
|
44
|
+
# for invalid IDs rather than raising an error
|
45
|
+
#
|
46
|
+
# @param patient_id [String] patient id
|
47
|
+
# @param mrn [String|nil] medical record number, if patient id is unknown
|
48
|
+
# @param order_id [String|nil] optionally used to get info for a secific
|
49
|
+
# patient order
|
50
|
+
# @return [String, AllscriptsApi::MagicError] patient demographics
|
51
|
+
def get_patient_full(patient_id, mrn = nil, order_id = nil)
|
52
|
+
params =
|
53
|
+
MagicParams.format(
|
54
|
+
user_id: @allscripts_username,
|
55
|
+
patient_id: patient_id,
|
56
|
+
parameter1: mrn,
|
57
|
+
parameter2: order_id
|
58
|
+
)
|
59
|
+
results = magic("GetPatientFull", magic_params: params)
|
60
|
+
results["getpatientfullinfo"]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -18,7 +18,7 @@ module AllscriptsApi
|
|
18
18
|
# @param command [String] i for insert, e for delete (entered in error), u for update
|
19
19
|
# @param params [Hash] any other params you may wish to pass to the api
|
20
20
|
# params may look like the following, all of which are required:
|
21
|
-
# @option params [String] :bytes_read number of bytes in the chunk (
|
21
|
+
# @option params [String] :bytes_read number of bytes in the chunk (pdf.bytes.length is nice for this if using one big chunk)
|
22
22
|
# @option params [String] :b_done_upload should be passed in as false,
|
23
23
|
# @option params [String] :document_var should be empty unless you are saving or updating
|
24
24
|
# @option params [String] :patient_id
|
@@ -29,6 +29,39 @@ module AllscriptsApi
|
|
29
29
|
results = magic("SaveDocumentImage", magic_params: params)
|
30
30
|
results["savedocumentimageinfo"]
|
31
31
|
end
|
32
|
+
|
33
|
+
# gets the CCDA documents for the specified patient and encounter
|
34
|
+
#
|
35
|
+
# @param patient_id [String] patient id
|
36
|
+
# @param encounter_id [String] encounter id from which to generate the CCDA
|
37
|
+
# @param org_id [String] specifies the organization, by default Unity
|
38
|
+
# uses the organization for the specified user
|
39
|
+
# @param app_group [String] defaults to "TouchWorks"
|
40
|
+
# @param referral_text [String] contents of ReferralText are appended
|
41
|
+
# @param site_id [String] site id
|
42
|
+
# @param document_type [String] document type defaults to CCDACCD,
|
43
|
+
# CCDACCD (Default) - Returns the Continuity of Care Document. This
|
44
|
+
# is the default behavior if nothing is passed in.
|
45
|
+
# CCDASOC - Returns the Summary of Care Document
|
46
|
+
# CCDACS - Returns the Clinical Summary Document (Visit Summary).
|
47
|
+
# @return [String, AllscriptsApi::MagicError] ccda for patient
|
48
|
+
def get_ccda(patient_id, encounter_id, org_id = nil,
|
49
|
+
app_group = nil, referral_text = nil,
|
50
|
+
site_id = nil, document_type = "CCDACCD")
|
51
|
+
params =
|
52
|
+
MagicParams.format(
|
53
|
+
user_id: @allscripts_username,
|
54
|
+
patient_id: patient_id,
|
55
|
+
parameter1: encounter_id,
|
56
|
+
parameter2: org_id,
|
57
|
+
parameter3: app_group,
|
58
|
+
parameter4: referral_text,
|
59
|
+
parameter5: site_id,
|
60
|
+
parameter6: document_type
|
61
|
+
)
|
62
|
+
results = magic("GetCCDA", magic_params: params)
|
63
|
+
results["getccdainfo"][0]["ccdaxml"]
|
64
|
+
end
|
32
65
|
end
|
33
66
|
end
|
34
67
|
end
|
@@ -5,6 +5,7 @@ module AllscriptsApi
|
|
5
5
|
# Wraps {AllscriptsApi::Documents::Document.build_xml} and
|
6
6
|
# {AllscriptsApi::Documents::DocumentMethods#save_document_image}
|
7
7
|
# to handle the 2 step document image saving process
|
8
|
+
# The DocumentSender is set up to send the document as one big chunk
|
8
9
|
class DocumentSender
|
9
10
|
# rubocop:disable LineLength
|
10
11
|
# The new method sets up eerything needed to run {#send_document}
|
@@ -12,7 +13,7 @@ module AllscriptsApi
|
|
12
13
|
# @example Usage Example
|
13
14
|
# document_params =
|
14
15
|
# {
|
15
|
-
# bytes_read:
|
16
|
+
# bytes_read: pdf.bytes.length,
|
16
17
|
# b_done_upload: false,
|
17
18
|
# document_var: "",
|
18
19
|
# patient_id: 19,
|
@@ -29,7 +30,7 @@ module AllscriptsApi
|
|
29
30
|
# @param document [String] the string contents of the pdf to be saved
|
30
31
|
# @param file_name [String] the name of the file to be saved, usually ending in .pdf
|
31
32
|
# @param params [Hash] a hash of params for use in saving a document
|
32
|
-
# @see {AllscriptsApi::
|
33
|
+
# @see {AllscriptsApi::Documents::DocumentSender} for details
|
33
34
|
# @return [AllscriptsApi::Documents::DocumentSender]
|
34
35
|
# rubocop:enable LineLength
|
35
36
|
def initialize(client, document, file_name, params)
|
@@ -6,22 +6,6 @@ module AllscriptsApi
|
|
6
6
|
# in `AllscriptsApi::Client` and can be accessed from
|
7
7
|
# instances of that class.
|
8
8
|
module NamedMagicMethods
|
9
|
-
# a wrapper around SearchPatients
|
10
|
-
#
|
11
|
-
# @param search_string [String] may be a name, birthdate
|
12
|
-
# partial address, or other PHI
|
13
|
-
# @return [Array<Hash>, Array, MagicError] a list of found patients,
|
14
|
-
# an empty array, or an error
|
15
|
-
def search_patients(search_string)
|
16
|
-
params =
|
17
|
-
MagicParams.format(
|
18
|
-
user_id: @allscripts_username,
|
19
|
-
parameter1: search_string
|
20
|
-
)
|
21
|
-
results = magic("SearchPatients", magic_params: params)
|
22
|
-
results["searchpatientsinfo"]
|
23
|
-
end
|
24
|
-
|
25
9
|
# a wrapper around GetProvider
|
26
10
|
#
|
27
11
|
# @param provider_id [String] optional Allscripts user id
|
@@ -37,109 +21,6 @@ module AllscriptsApi
|
|
37
21
|
results["getproviderinfo"]
|
38
22
|
end
|
39
23
|
|
40
|
-
# gets the CCDA documents for the specified patient and encounter
|
41
|
-
#
|
42
|
-
# @param patient_id [String] patient id
|
43
|
-
# @param encounter_id [String] encounter id from which to generate the CCDA
|
44
|
-
# @param org_id [String] specifies the organization, by default Unity
|
45
|
-
# uses the organization for the specified user
|
46
|
-
# @param app_group [String] defaults to "TouchWorks"
|
47
|
-
# @param referral_text [String] contents of ReferralText are appended
|
48
|
-
# @param site_id [String] site id
|
49
|
-
# @param document_type [String] document type defaults to CCDACCD,
|
50
|
-
# CCDACCD (Default) - Returns the Continuity of Care Document. This
|
51
|
-
# is the default behavior if nothing is passed in.
|
52
|
-
# CCDASOC - Returns the Summary of Care Document
|
53
|
-
# CCDACS - Returns the Clinical Summary Document (Visit Summary).
|
54
|
-
# @return [String, AllscriptsApi::MagicError] ccda for patient
|
55
|
-
def get_ccda(patient_id,
|
56
|
-
encounter_id,
|
57
|
-
org_id = nil,
|
58
|
-
app_group = nil,
|
59
|
-
referral_text = nil,
|
60
|
-
site_id = nil,
|
61
|
-
document_type = "CCDACCD")
|
62
|
-
params =
|
63
|
-
MagicParams.format(
|
64
|
-
user_id: @allscripts_username,
|
65
|
-
patient_id: patient_id,
|
66
|
-
parameter1: encounter_id,
|
67
|
-
parameter2: org_id,
|
68
|
-
parameter3: app_group,
|
69
|
-
parameter4: referral_text,
|
70
|
-
parameter5: site_id,
|
71
|
-
parameter6: document_type
|
72
|
-
)
|
73
|
-
results = magic("GetCCDA", magic_params: params)
|
74
|
-
results["getccdainfo"][0]["ccdaxml"]
|
75
|
-
end
|
76
|
-
|
77
|
-
# gets data elements of a patient's history
|
78
|
-
#
|
79
|
-
# @param patient_id [String] patient id
|
80
|
-
# @param section [String] section
|
81
|
-
# if no section is specified than all sections wt data are returned
|
82
|
-
# list multiple sections by using a pipe-delimited list ex. "Vitals|Alerts"
|
83
|
-
# @param encounter_id [String] internal identifier for the encounter
|
84
|
-
# the EncounterID can be acquired with GetEncounterList
|
85
|
-
# @param verbose [String] XMLDetail
|
86
|
-
# verbose column will be Y or blank, when Y is provided there will be a
|
87
|
-
# piece of XML data that is specific to that element of the patient's chart
|
88
|
-
# @return [String, AllscriptsApi::MagicError] clinical summary for patient
|
89
|
-
def get_clinical_summary(patient_id,
|
90
|
-
section = nil,
|
91
|
-
encounter_id = nil,
|
92
|
-
verbose = nil)
|
93
|
-
params =
|
94
|
-
MagicParams.format(
|
95
|
-
user_id: @allscripts_username,
|
96
|
-
patient_id: patient_id,
|
97
|
-
parameter1: section,
|
98
|
-
parameter2: encounter_id,
|
99
|
-
parameter3: verbose
|
100
|
-
)
|
101
|
-
results = magic("GetClinicalSummary", magic_params: params)
|
102
|
-
results["getclinicalsummaryinfo"]
|
103
|
-
end
|
104
|
-
|
105
|
-
# gets patient's demographic info, insurance, guarantor, and PCP info
|
106
|
-
#
|
107
|
-
# @param patient_id [String] patient id
|
108
|
-
# @param patient_number [String] PM patient number
|
109
|
-
# @return [String, AllscriptsApi::MagicError] patient demographics
|
110
|
-
def get_patient(patient_id,
|
111
|
-
patient_number = nil)
|
112
|
-
params =
|
113
|
-
MagicParams.format(
|
114
|
-
user_id: @allscripts_username,
|
115
|
-
patient_id: patient_id,
|
116
|
-
parameter1: patient_number
|
117
|
-
)
|
118
|
-
results = magic("GetPatient", magic_params: params)
|
119
|
-
results["getpatientinfo"]
|
120
|
-
end
|
121
|
-
|
122
|
-
# gets patient's demographic info, insurance, guarantor, and PCP info
|
123
|
-
# Note that this method is litely to return blank data sets
|
124
|
-
# for invalid IDs rather than raising an error
|
125
|
-
#
|
126
|
-
# @param patient_id [String] patient id
|
127
|
-
# @param mrn [String|nil] medical record number, if patient id is unknown
|
128
|
-
# @param order_id [String|nil] optionally used to get info for a secific
|
129
|
-
# patient order
|
130
|
-
# @return [String, AllscriptsApi::MagicError] patient demographics
|
131
|
-
def get_patient_full(patient_id, mrn = nil, order_id = nil)
|
132
|
-
params =
|
133
|
-
MagicParams.format(
|
134
|
-
user_id: @allscripts_username,
|
135
|
-
patient_id: patient_id,
|
136
|
-
parameter1: mrn,
|
137
|
-
parameter2: order_id
|
138
|
-
)
|
139
|
-
results = magic("GetPatientFull", magic_params: params)
|
140
|
-
results["getpatientfullinfo"]
|
141
|
-
end
|
142
|
-
|
143
24
|
# a wrapper around GetPatientProblems
|
144
25
|
#
|
145
26
|
# @param patient_id [String] patient id
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AllscriptsApi
|
4
|
+
module Orders
|
5
|
+
# A value object wrapped around a Nokogiri::XML::Builder DSL that builds
|
6
|
+
# properly formatted XML for {AllscriptsApi::OrderingMethods#save_order}
|
7
|
+
# @see https://www.rubydoc.info/github/sparklemotion/nokogiri/Nokogiri/XML/Builder
|
8
|
+
class Order
|
9
|
+
# Builder method for returning XML
|
10
|
+
#
|
11
|
+
# @param site_id [String] the id for the Allscripts install site
|
12
|
+
# @param emr_user_id [String] the provider's Allscripts id
|
13
|
+
# @param order_date [DateTime] a date for the order (Typically today)
|
14
|
+
# @param encounter_id [String|Nil] an encounter id, used when
|
15
|
+
# ordering to current encounter
|
16
|
+
# @return [String] xml formatted for
|
17
|
+
# {AllscriptsApi::OrderingMethods#save_order}
|
18
|
+
def self.build_xml(site_id, emr_user_id, order_date, encounter_id = "")
|
19
|
+
date = order_date.strftime("%d-%b-%Y")
|
20
|
+
builder = Nokogiri::XML::Builder.new
|
21
|
+
builder.saveorderxml do
|
22
|
+
# a value of 'Y' makes the order visible on the order list
|
23
|
+
builder.field("id" => "ordershowonorderlist", "value" => "Y")
|
24
|
+
builder.field("id" => "orderlocation", "value" => site_id)
|
25
|
+
builder.field("id" => "ordertobedone", "value" => date)
|
26
|
+
# default, not important, required
|
27
|
+
builder.field("id" => "orderpriority", "value" => "2")
|
28
|
+
builder.field("id" => "orderschedulefreetext", "value" => "")
|
29
|
+
builder.field("id" => "orderschedulerecurring", "value" => "")
|
30
|
+
builder.field("id" => "orderschedulerecurringperiod", "value" => "")
|
31
|
+
builder.field("id" => "orderschedulestarting", "value" => date)
|
32
|
+
builder.field("id" => "orderscheduleending", "value" => date)
|
33
|
+
builder.field("id" => "orderscheduleendingafter", "value" => "")
|
34
|
+
builder.field("id" => "orderperformingcomment", "value" => "")
|
35
|
+
builder.field("id" => "ordercommunicatedby", "value" => 11) # hard coded
|
36
|
+
builder.field("id" => "orderorderedby", "value" => emr_user_id)
|
37
|
+
builder.field("id" => "ordermanagedby", "value" => emr_user_id)
|
38
|
+
builder.field("id" => "ordersupervisedby", "value" => "")
|
39
|
+
builder.field("id" => "orderciteresult", "value" => "")
|
40
|
+
builder.field("id" => "orderannotation", "value" => "")
|
41
|
+
builder.field("id" => "orderstatus", "value" => "Active")
|
42
|
+
builder.field("id" => "orderstatusdate", "value" => date)
|
43
|
+
builder.field("id" => "orderdeferralinterval", "value" => 0)
|
44
|
+
builder.field("id" => "orderdeferralunit", "value" => "Days")
|
45
|
+
builder.field("id" => "orderstatusreason", "value" => "")
|
46
|
+
builder.field("id" => "encounter", "value" => encounter_id.to_s)
|
47
|
+
builder.orderlinkedproblems
|
48
|
+
builder.clinicalquestions
|
49
|
+
end
|
50
|
+
|
51
|
+
builder.to_xml
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AllscriptsApi
|
4
|
+
module Orders
|
5
|
+
# A collection convenience methods for ordering that map
|
6
|
+
# to Allscripts magic actions. Some of these methods
|
7
|
+
# wrap multiple actions. These methods are included
|
8
|
+
# in {AllscriptsApi::Client} and can be accessed from
|
9
|
+
# instances of that class.
|
10
|
+
module OrderingMethods
|
11
|
+
# a wrapper around SaveOrder, which save and order of the
|
12
|
+
# sepcified category, among: AdministeredMedication,
|
13
|
+
# Immunization, InstructionOrder, ProcedureOrder,
|
14
|
+
# Referral, SuppliesOrder.
|
15
|
+
#
|
16
|
+
# xml can be constructed with {AllscriptsApi::Order.build_xml}
|
17
|
+
#
|
18
|
+
# @param patient_id [String]
|
19
|
+
# @param xml [String] xml containing saveorderxml fields and values
|
20
|
+
# @param order_category [String] one of AdministeredMedication,
|
21
|
+
# Immunization, InstructionOrder, ProcedureOrder,
|
22
|
+
# Referral, SuppliesOrder.
|
23
|
+
# @param dictionary_id [String] id of the dictionary from SearchOrder TODO: look into how to doc this better
|
24
|
+
# @param problem_id [String|Nil] problem to associate with the order,
|
25
|
+
# may be passed in as part of the xml
|
26
|
+
# @param trans_id [String|Nil] the original OrderID,
|
27
|
+
# necessary when updating a past order
|
28
|
+
# @return [Hash|MagicError] order confirmation or error
|
29
|
+
def save_order(patient_id, xml, order_category, dictionary_id,
|
30
|
+
problem_id = nil, trans_id = nil)
|
31
|
+
params = MagicParams.format(
|
32
|
+
user_id: @allscripts_username,
|
33
|
+
patient_id: patient_id,
|
34
|
+
parameter1: xml,
|
35
|
+
parameter2: order_category,
|
36
|
+
parameter3: dictionary_id,
|
37
|
+
parameter4: problem_id,
|
38
|
+
parameter5: trans_id
|
39
|
+
)
|
40
|
+
magic("SaveOrder", magic_params: params)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AllscriptsApi
|
4
|
+
module Patients
|
5
|
+
# A collection convenience methods for ordering that map
|
6
|
+
# to Allscripts magic actions related to patients.
|
7
|
+
# These methods are included in {AllscriptsApi::Client}
|
8
|
+
# and can be accessed from instances of that class.
|
9
|
+
module PatientMethods
|
10
|
+
# gets data elements of a patient's history
|
11
|
+
#
|
12
|
+
# @param patient_id [String] patient id
|
13
|
+
# @param section [String] section
|
14
|
+
# if no section is specified than all sections wt data are returned
|
15
|
+
# list multiple sections by using a pipe-delimited list ex. "Vitals|Alerts"
|
16
|
+
# @param encounter_id [String] internal identifier for the encounter
|
17
|
+
# the EncounterID can be acquired with GetEncounterList
|
18
|
+
# @param verbose [String] XMLDetail
|
19
|
+
# verbose column will be Y or blank, when Y is provided there will be a
|
20
|
+
# piece of XML data that is specific to that element of the patient's chart
|
21
|
+
# @return [String, AllscriptsApi::MagicError] clinical summary for patient
|
22
|
+
def get_clinical_summary(patient_id,
|
23
|
+
section = nil,
|
24
|
+
encounter_id = nil,
|
25
|
+
verbose = nil)
|
26
|
+
params =
|
27
|
+
MagicParams.format(
|
28
|
+
user_id: @allscripts_username,
|
29
|
+
patient_id: patient_id,
|
30
|
+
parameter1: section,
|
31
|
+
parameter2: encounter_id,
|
32
|
+
parameter3: verbose
|
33
|
+
)
|
34
|
+
results = magic("GetClinicalSummary", magic_params: params)
|
35
|
+
results["getclinicalsummaryinfo"]
|
36
|
+
end
|
37
|
+
|
38
|
+
# Returns a list of Patient IDs whose information has been
|
39
|
+
# modified since a timestamp
|
40
|
+
#
|
41
|
+
# @param patient_id [String] patient id
|
42
|
+
# @param since [DateTime] DateTime indicating how far back to
|
43
|
+
# query for changed patients.
|
44
|
+
# @param clinical_data_only [String] Indicates whether to
|
45
|
+
# look at only changes in clinical data. Y or N
|
46
|
+
# @param verbose [String] Do you want to see the specific areas that have changed
|
47
|
+
# @param quick_scan [String] Set to Y to enable new change patient scanning functionality.
|
48
|
+
# @return [String, AllscriptsApi::MagicError] changed data for patient
|
49
|
+
def get_changed_patients(patient_id, since,
|
50
|
+
clinical_data_only = "Y",
|
51
|
+
verbose = "Y", quick_scan = "N")
|
52
|
+
params =
|
53
|
+
MagicParams.format(
|
54
|
+
user_id: @allscripts_username,
|
55
|
+
patient_id: patient_id,
|
56
|
+
parameter1: since.strftime("%m/%d/%Y"),
|
57
|
+
parameter2: clinical_data_only,
|
58
|
+
parameter3: verbose,
|
59
|
+
parameter4: quick_scan
|
60
|
+
)
|
61
|
+
|
62
|
+
results = magic("GetChangedPatients", magic_params: params)
|
63
|
+
results["getchangedpatientsinfo"]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allscripts_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chase
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -247,14 +247,19 @@ files:
|
|
247
247
|
- lib/allscripts_api.rb
|
248
248
|
- lib/allscripts_api/client.rb
|
249
249
|
- lib/allscripts_api/configuration.rb
|
250
|
+
- lib/allscripts_api/demographics.rb
|
251
|
+
- lib/allscripts_api/demographics/demographics_methods.rb
|
250
252
|
- lib/allscripts_api/documents.rb
|
251
253
|
- lib/allscripts_api/documents/document.rb
|
252
254
|
- lib/allscripts_api/documents/document_methods.rb
|
253
255
|
- lib/allscripts_api/documents/document_sender.rb
|
254
256
|
- lib/allscripts_api/magic_params.rb
|
255
257
|
- lib/allscripts_api/named_magic_methods.rb
|
256
|
-
- lib/allscripts_api/
|
257
|
-
- lib/allscripts_api/
|
258
|
+
- lib/allscripts_api/orders.rb
|
259
|
+
- lib/allscripts_api/orders/order.rb
|
260
|
+
- lib/allscripts_api/orders/ordering_methods.rb
|
261
|
+
- lib/allscripts_api/patients.rb
|
262
|
+
- lib/allscripts_api/patients/patient_methods.rb
|
258
263
|
- lib/allscripts_api/utilities/validator.rb
|
259
264
|
- lib/allscripts_api/version.rb
|
260
265
|
homepage: https://github.com/Avhana/allscripts_api
|
data/lib/allscripts_api/order.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module AllscriptsApi
|
4
|
-
# A value object wrapped around a Nokogiri::XML::Builder DSL that builds
|
5
|
-
# properly formatted XML for {AllscriptsApi::OrderingMethods#save_order}
|
6
|
-
# @see https://www.rubydoc.info/github/sparklemotion/nokogiri/Nokogiri/XML/Builder
|
7
|
-
class Order
|
8
|
-
# Builder method for returning XML
|
9
|
-
#
|
10
|
-
# @param site_id [String] the id for the Allscripts install site
|
11
|
-
# @param emr_user_id [String] the provider's Allscripts id
|
12
|
-
# @param order_date [DateTime] a date for the order (Typically today)
|
13
|
-
# @param encounter_id [String|Nil] an encounter id, used when
|
14
|
-
# ordering to current encounter
|
15
|
-
# @return [String] xml formatted for
|
16
|
-
# {AllscriptsApi::OrderingMethods#save_order}
|
17
|
-
def self.build_xml(site_id, emr_user_id, order_date, encounter_id = "")
|
18
|
-
date = order_date.strftime("%d-%b-%Y")
|
19
|
-
builder = Nokogiri::XML::Builder.new
|
20
|
-
builder.saveorderxml do
|
21
|
-
# a value of 'Y' makes the order visible on the order list
|
22
|
-
builder.field("id" => "ordershowonorderlist", "value" => "Y")
|
23
|
-
builder.field("id" => "orderlocation", "value" => site_id)
|
24
|
-
builder.field("id" => "ordertobedone", "value" => date)
|
25
|
-
# default, not important, required
|
26
|
-
builder.field("id" => "orderpriority", "value" => "2")
|
27
|
-
builder.field("id" => "orderschedulefreetext", "value" => "")
|
28
|
-
builder.field("id" => "orderschedulerecurring", "value" => "")
|
29
|
-
builder.field("id" => "orderschedulerecurringperiod", "value" => "")
|
30
|
-
builder.field("id" => "orderschedulestarting", "value" => date)
|
31
|
-
builder.field("id" => "orderscheduleending", "value" => date)
|
32
|
-
builder.field("id" => "orderscheduleendingafter", "value" => "")
|
33
|
-
builder.field("id" => "orderperformingcomment", "value" => "")
|
34
|
-
builder.field("id" => "ordercommunicatedby", "value" => 11) # hard coded
|
35
|
-
builder.field("id" => "orderorderedby", "value" => emr_user_id)
|
36
|
-
builder.field("id" => "ordermanagedby", "value" => emr_user_id)
|
37
|
-
builder.field("id" => "ordersupervisedby", "value" => "")
|
38
|
-
builder.field("id" => "orderciteresult", "value" => "")
|
39
|
-
builder.field("id" => "orderannotation", "value" => "")
|
40
|
-
builder.field("id" => "orderstatus", "value" => "Active")
|
41
|
-
builder.field("id" => "orderstatusdate", "value" => date)
|
42
|
-
builder.field("id" => "orderdeferralinterval", "value" => 0)
|
43
|
-
builder.field("id" => "orderdeferralunit", "value" => "Days")
|
44
|
-
builder.field("id" => "orderstatusreason", "value" => "")
|
45
|
-
builder.field("id" => "encounter", "value" => encounter_id.to_s)
|
46
|
-
builder.orderlinkedproblems
|
47
|
-
builder.clinicalquestions
|
48
|
-
end
|
49
|
-
|
50
|
-
builder.to_xml
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module AllscriptsApi
|
4
|
-
# A collection convenience methods for ordering that map
|
5
|
-
# to Allscripts magic actions. Some of these methods
|
6
|
-
# wrap multiple actions. These methods are included
|
7
|
-
# in {AllscriptsApi::Client} and can be accessed from
|
8
|
-
# instances of that class.
|
9
|
-
module OrderingMethods
|
10
|
-
# a wrapper around SaveOrder, which save and order of the
|
11
|
-
# sepcified category, among: AdministeredMedication,
|
12
|
-
# Immunization, InstructionOrder, ProcedureOrder,
|
13
|
-
# Referral, SuppliesOrder.
|
14
|
-
#
|
15
|
-
# xml can be constructed with {AllscriptsApi::Order.build_xml}
|
16
|
-
#
|
17
|
-
# @param patient_id [String]
|
18
|
-
# @param xml [String] xml containing saveorderxml fields and values
|
19
|
-
# @param order_category [String] one of AdministeredMedication,
|
20
|
-
# Immunization, InstructionOrder, ProcedureOrder,
|
21
|
-
# Referral, SuppliesOrder.
|
22
|
-
# @param dictionary_id [String] id of the dictionary from SearchOrder TODO: look into how to doc this better
|
23
|
-
# @param problem_id [String|Nil] problem to associate with the order,
|
24
|
-
# may be passed in as part of the xml
|
25
|
-
# @param trans_id [String|Nil] the original OrderID,
|
26
|
-
# necessary when updating a past order
|
27
|
-
# @return [Hash|MagicError] order confirmation or error
|
28
|
-
def save_order(patient_id, xml, order_category, dictionary_id,
|
29
|
-
problem_id = nil, trans_id = nil)
|
30
|
-
params = MagicParams.format(
|
31
|
-
user_id: @allscripts_username,
|
32
|
-
patient_id: patient_id,
|
33
|
-
parameter1: xml,
|
34
|
-
parameter2: order_category,
|
35
|
-
parameter3: dictionary_id,
|
36
|
-
parameter4: problem_id,
|
37
|
-
parameter5: trans_id
|
38
|
-
)
|
39
|
-
magic("SaveOrder", magic_params: params)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|