ruby_astm 1.4.1 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/mappings.json +199 -79
- data/lib/publisher/adapter.rb +0 -0
- data/lib/publisher/google_lab_interface.rb +2 -2
- data/lib/publisher/pf_lab_interface.rb +484 -0
- data/lib/publisher/poller.rb +12 -3
- data/lib/publisher/real_time_db.rb +76 -0
- data/lib/ruby_astm.rb +21 -17
- data/lib/ruby_astm/HL7/hl7_header.rb +0 -0
- data/lib/ruby_astm/HL7/hl7_observation.rb +0 -0
- data/lib/ruby_astm/HL7/hl7_order.rb +0 -0
- data/lib/ruby_astm/HL7/hl7_patient.rb +0 -0
- data/lib/ruby_astm/astm_server.rb +1 -0
- data/lib/ruby_astm/custom/siemens_abg_electrolyte_server.rb +315 -0
- data/lib/ruby_astm/frame.rb +0 -0
- data/lib/ruby_astm/header.rb +2 -4
- data/lib/ruby_astm/lab_interface.rb +113 -25
- data/lib/ruby_astm/line.rb +0 -0
- data/lib/ruby_astm/order.rb +1 -1
- data/lib/ruby_astm/patient.rb +1 -1
- data/lib/ruby_astm/query.rb +0 -0
- data/lib/ruby_astm/result.rb +1 -1
- data/lib/ruby_astm/usb_module.rb +0 -0
- metadata +35 -4
data/lib/ruby_astm/frame.rb
CHANGED
File without changes
|
data/lib/ruby_astm/header.rb
CHANGED
@@ -18,15 +18,13 @@ class Header
|
|
18
18
|
self.protocol = "ASTM"
|
19
19
|
end
|
20
20
|
|
21
|
-
def initialize(args)
|
21
|
+
def initialize(args={})
|
22
22
|
self.patients = []
|
23
23
|
self.queries = []
|
24
24
|
self.response_sent = false
|
25
25
|
if line = args[:line]
|
26
26
|
set_machine_name(args)
|
27
27
|
set_protocol(args)
|
28
|
-
else
|
29
|
-
super
|
30
28
|
end
|
31
29
|
end
|
32
30
|
|
@@ -98,7 +96,7 @@ class Header
|
|
98
96
|
responses
|
99
97
|
end
|
100
98
|
|
101
|
-
def to_json
|
99
|
+
def to_json(args={})
|
102
100
|
hash = {}
|
103
101
|
self.instance_variables.each do |x|
|
104
102
|
hash[x] = self.instance_variable_get x
|
@@ -9,33 +9,35 @@ module LabInterface
|
|
9
9
|
CR = "\x13"
|
10
10
|
ETX = "\x03"
|
11
11
|
EOT = "\x04"
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
12
|
+
|
13
|
+
|
14
|
+
attr_accessor :ethernet_connections
|
15
|
+
attr_accessor :serial_connections
|
16
|
+
|
17
|
+
attr_accessor :ethernet_server
|
18
|
+
attr_accessor :server_ip
|
19
|
+
attr_accessor :server_port
|
20
|
+
attr_accessor :serial_port
|
21
|
+
attr_accessor :serial_baud
|
22
|
+
attr_accessor :serial_parity
|
23
|
+
attr_accessor :usb_port
|
24
|
+
attr_accessor :usb_baud
|
25
|
+
attr_accessor :usb_parity
|
26
|
+
attr_accessor :mid_frame_end_detected
|
27
27
|
|
28
28
|
## gather bytes to store for us to test.
|
29
|
-
|
29
|
+
attr_accessor :test_data_bytes
|
30
30
|
|
31
|
+
## just an array of byte arrays, cleared on calling process text
|
32
|
+
attr_accessor :data_bytes
|
31
33
|
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
|
35
|
+
attr_accessor :headers
|
36
|
+
attr_accessor :mapping
|
37
|
+
attr_accessor :respond_to_queries
|
36
38
|
|
37
39
|
## buffer of incoming data.
|
38
|
-
|
40
|
+
attr_accessor :data_buffer
|
39
41
|
|
40
42
|
|
41
43
|
## returns the root directory of the gem.
|
@@ -166,6 +168,83 @@ module LabInterface
|
|
166
168
|
|
167
169
|
concat
|
168
170
|
|
171
|
+
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
def write_bytes_to_file(bytes)
|
176
|
+
|
177
|
+
end
|
178
|
+
|
179
|
+
## @param[Array] :
|
180
|
+
## [[bytes],[bytes]....]
|
181
|
+
def process_electrolytes(data_bytes)
|
182
|
+
#puts "came to process electrolytes_plain_text"
|
183
|
+
byte_arr = data_bytes.flatten
|
184
|
+
#puts "the end part of the arr is"
|
185
|
+
return if byte_arr[-4..-1] != SIEMENS_ELECTROLYTE_END
|
186
|
+
self.data_bytes = []
|
187
|
+
concat = ""
|
188
|
+
byte_arr.each do |byte|
|
189
|
+
x = [byte].pack('c*').force_encoding('UTF-8')
|
190
|
+
if x == "\r"
|
191
|
+
concat+="\n"
|
192
|
+
elsif x == "\n"
|
193
|
+
#puts "new line found --- "
|
194
|
+
concat+=x
|
195
|
+
#puts "last thing in concat."
|
196
|
+
#puts concat[-1].to_s
|
197
|
+
else
|
198
|
+
concat+=x
|
199
|
+
end
|
200
|
+
end
|
201
|
+
## nwo write concat to file
|
202
|
+
## File.open("electrolytes_plain_text.txt", 'a+') { |file| file.write(concat) }
|
203
|
+
## Header
|
204
|
+
## Patient
|
205
|
+
## Order
|
206
|
+
## Result
|
207
|
+
## Terminator
|
208
|
+
|
209
|
+
## GET PO2
|
210
|
+
concat.scan(/pCO2\s+(?<pco>(\d+)(\.\d)*)(\^|v)?\s+mmHg/) do |k|
|
211
|
+
n = Regexp.last_match
|
212
|
+
puts n[:pco].to_s
|
213
|
+
end
|
214
|
+
|
215
|
+
## GET PCO2
|
216
|
+
concat.scan(/pO2\s+(?<po>(\d+)(\.\d)*)(\^|v)?\s+mmHg/) do |k|
|
217
|
+
n = Regexp.last_match
|
218
|
+
puts n[:po].to_s
|
219
|
+
end
|
220
|
+
|
221
|
+
## GET PH
|
222
|
+
|
223
|
+
## GET NA+
|
224
|
+
|
225
|
+
## GET K+
|
226
|
+
|
227
|
+
## GET CL-
|
228
|
+
|
229
|
+
## GET PATIENT_ID
|
230
|
+
|
231
|
+
## GET DATE AND TIME
|
232
|
+
|
233
|
+
start_measure = false
|
234
|
+
|
235
|
+
concat.split(/\n/).each do |line|
|
236
|
+
if line =~ /348\-D718/
|
237
|
+
header = Header.new({:line => line})
|
238
|
+
self.headers ||= []
|
239
|
+
self.headers << header
|
240
|
+
elsif line =~ /\-{32}/
|
241
|
+
elsif line =~ /Patient\s+ID/
|
242
|
+
elsif line =~ /Measured/
|
243
|
+
elsif line =~ /outside ref/
|
244
|
+
else
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
169
248
|
end
|
170
249
|
|
171
250
|
def receive_data(data)
|
@@ -182,13 +261,18 @@ module LabInterface
|
|
182
261
|
|
183
262
|
|
184
263
|
byte_arr = data.bytes.to_a
|
264
|
+
|
185
265
|
self.test_data_bytes ||= []
|
266
|
+
|
267
|
+
self.data_bytes ||= []
|
268
|
+
|
186
269
|
self.test_data_bytes.push(byte_arr)
|
270
|
+
|
271
|
+
self.data_bytes.push(byte_arr)
|
272
|
+
|
187
273
|
|
188
274
|
concat = pre_process_bytes(byte_arr,concat)
|
189
|
-
|
190
|
-
|
191
|
-
|
275
|
+
|
192
276
|
puts "concat is:"
|
193
277
|
|
194
278
|
puts concat.to_s
|
@@ -197,8 +281,12 @@ module LabInterface
|
|
197
281
|
|
198
282
|
## if the last byte is EOT, then call process text.
|
199
283
|
## inside that split by line and process one at a time.
|
200
|
-
##process_text(concat)
|
201
|
-
|
284
|
+
##process_text(concat)
|
285
|
+
#puts "data bytes -1: #{self.data_bytes[-1]}"
|
286
|
+
#puts "data bytes 0: #{self.data_bytes[0]}"
|
287
|
+
#if self.data_bytes[0] == ELECTROLYTE_START
|
288
|
+
#self.process_electrolytes(self.data_bytes)
|
289
|
+
#end
|
202
290
|
|
203
291
|
if data.bytes.to_a[-1] == 4
|
204
292
|
puts "GOT EOT --- PROCESSING BUFFER, AND CLEARING."
|
data/lib/ruby_astm/line.rb
CHANGED
File without changes
|
data/lib/ruby_astm/order.rb
CHANGED
data/lib/ruby_astm/patient.rb
CHANGED
data/lib/ruby_astm/query.rb
CHANGED
File without changes
|
data/lib/ruby_astm/result.rb
CHANGED
data/lib/ruby_astm/usb_module.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_astm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bhargav Raut
|
@@ -40,6 +40,20 @@ dependencies:
|
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activesupport
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 5.2.3
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 5.2.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
@@ -53,7 +67,7 @@ dependencies:
|
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: redis
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - ">="
|
@@ -67,7 +81,7 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: typhoeus
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ">="
|
@@ -108,6 +122,20 @@ dependencies:
|
|
108
122
|
- - '='
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: 3.5.2
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rest-firebase
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
111
139
|
description: This gem provides a server that can handle communication from medical
|
112
140
|
instruments that send/receive information on the ASTM protocol.
|
113
141
|
email: bhargav.r.raut@gmail.com
|
@@ -118,13 +146,16 @@ files:
|
|
118
146
|
- lib/mappings.json
|
119
147
|
- lib/publisher/adapter.rb
|
120
148
|
- lib/publisher/google_lab_interface.rb
|
149
|
+
- lib/publisher/pf_lab_interface.rb
|
121
150
|
- lib/publisher/poller.rb
|
151
|
+
- lib/publisher/real_time_db.rb
|
122
152
|
- lib/ruby_astm.rb
|
123
153
|
- lib/ruby_astm/HL7/hl7_header.rb
|
124
154
|
- lib/ruby_astm/HL7/hl7_observation.rb
|
125
155
|
- lib/ruby_astm/HL7/hl7_order.rb
|
126
156
|
- lib/ruby_astm/HL7/hl7_patient.rb
|
127
157
|
- lib/ruby_astm/astm_server.rb
|
158
|
+
- lib/ruby_astm/custom/siemens_abg_electrolyte_server.rb
|
128
159
|
- lib/ruby_astm/frame.rb
|
129
160
|
- lib/ruby_astm/header.rb
|
130
161
|
- lib/ruby_astm/lab_interface.rb
|
@@ -154,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
185
|
version: '0'
|
155
186
|
requirements: []
|
156
187
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.
|
188
|
+
rubygems_version: 2.6.14.4
|
158
189
|
signing_key:
|
159
190
|
specification_version: 4
|
160
191
|
summary: A Ruby gem to interface with Medical instruments that work on the ASTM protocol
|