ruby_astm 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruby_astm/astm_server.rb +2 -11
- data/lib/ruby_astm/usb_module.rb +28 -26
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80e32a89f60fc8e6323b9de22d2b1511d8c28d3eca13e819c2195f47bb9e1707
|
4
|
+
data.tar.gz: b394691adcb1355a3715fb7646d352c791357f5a7668b3183209b1f33087b335
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28abc36250ca2dfaf2e429cac95a89c26585c13823ede3ed17c892423249245b3f2298f2c0a2e81bf452036f4b4cd99c73e49d63f2dbc78a4180bd7fa7dde161
|
7
|
+
data.tar.gz: f1b7cde59e37731392f1ab47014e78290ea2c801a65c0e9de21e335f9d17c46a231f7f5ef785bef6cbcbb6fc3399d866caa6a71d163c648c27e10b2cd83a85f6
|
@@ -8,7 +8,7 @@ require "redis"
|
|
8
8
|
class AstmServer
|
9
9
|
|
10
10
|
include LabInterface
|
11
|
-
|
11
|
+
|
12
12
|
|
13
13
|
def self.log(message)
|
14
14
|
puts "" + message
|
@@ -53,16 +53,7 @@ class AstmServer
|
|
53
53
|
puts "RUNNING SERIAL ON #{serial_port} ------------ #{serial.to_s}"
|
54
54
|
self.ethernet_server = EventMachine::start_server self.server_ip, self.server_port, LabInterface
|
55
55
|
AstmServer.log("Running ETHERNET SERVER on #{server_port}")
|
56
|
-
|
57
|
-
self.usb_response_bytes = []
|
58
|
-
EM.add_periodic_timer(5) do
|
59
|
-
puts "running usb on #{usb_port}"
|
60
|
-
puts "sending machine data request #{request_results}"
|
61
|
-
usb.send_data(request_results)
|
62
|
-
end
|
63
|
-
usb.on_data do |data|
|
64
|
-
parse_usb_response(data)
|
65
|
-
end
|
56
|
+
|
66
57
|
}
|
67
58
|
end
|
68
59
|
|
data/lib/ruby_astm/usb_module.rb
CHANGED
@@ -38,32 +38,34 @@ module UsbModule
|
|
38
38
|
#puts self.usb_response_bytes.to_s
|
39
39
|
if interpret?
|
40
40
|
#puts "interpret"
|
41
|
-
self.usb_response_bytes[13..-4]
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
41
|
+
if kk = self.usb_response_bytes[13..-4]
|
42
|
+
kk.each_slice(32) do |patient_record|
|
43
|
+
bar_code = nil
|
44
|
+
bar_code = patient_record[11..23].pack('c*').gsub(/\./,'')
|
45
|
+
#puts "bar code: #{bar_code}"
|
46
|
+
unless bar_code.strip.blank?
|
47
|
+
esr = patient_record[26]
|
48
|
+
patient = Patient.new(:orders => [Order.new(:results => [Result.new(:value => esr, :name => "ESR", :report_name => "ESR")])])
|
49
|
+
patient = Patient.new({})
|
50
|
+
patient.patient_id = bar_code
|
51
|
+
patient.orders = []
|
52
|
+
order = Order.new({})
|
53
|
+
result = Result.new({})
|
54
|
+
result.value = esr.to_s
|
55
|
+
result.name = "ESR"
|
56
|
+
result.report_name = "ESR"
|
57
|
+
order.id = bar_code
|
58
|
+
order.results = []
|
59
|
+
order.results << result
|
60
|
+
patient.orders << order
|
61
|
+
#puts patient.orders.size
|
62
|
+
#puts patient.orders.first.results.size
|
63
|
+
#puts patient.orders.first.results.first.to_s
|
64
|
+
#puts "patient to json is:"
|
65
|
+
puts patient.to_json
|
66
|
+
$redis.lpush("patients",patient.to_json)
|
67
|
+
end
|
68
|
+
end
|
67
69
|
end
|
68
70
|
self.usb_response_bytes = []
|
69
71
|
else
|