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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e495bbce6cc215d7c08b9747276962a59e1f43bddb206b3383d709962472d140
4
- data.tar.gz: 1b076d1c574bafae7b91fa976505cf0d23ec41cf9cc00eda5f3c899ecbc0da4f
3
+ metadata.gz: 80e32a89f60fc8e6323b9de22d2b1511d8c28d3eca13e819c2195f47bb9e1707
4
+ data.tar.gz: b394691adcb1355a3715fb7646d352c791357f5a7668b3183209b1f33087b335
5
5
  SHA512:
6
- metadata.gz: 8dd76d5568de871b42efbb96c3f79d82c70d43933184bc442906e965fd18fb571a024e210bf7e2952617c959efcf47027c00f284813069e276d409387b7d2415
7
- data.tar.gz: 42e1a222ebbd3e6a215d7de88164155b833565a1c418266a5735c4026352dc29f3bfbf99c127fc861ad04ccb56813b5f9f5a43489e13291da42ae83b37777c38
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
- include UsbModule
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
- usb = EventMachine.open_serial(usb_port,usb_baud,usb_parity)
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
 
@@ -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].each_slice(32) do |patient_record|
42
- bar_code = nil
43
- bar_code = patient_record[11..23].pack('c*').gsub(/\./,'')
44
- #puts "bar code: #{bar_code}"
45
- unless bar_code.strip.blank?
46
- esr = patient_record[26]
47
- patient = Patient.new(:orders => [Order.new(:results => [Result.new(:value => esr, :name => "ESR", :report_name => "ESR")])])
48
- patient = Patient.new({})
49
- patient.patient_id = bar_code
50
- patient.orders = []
51
- order = Order.new({})
52
- result = Result.new({})
53
- result.value = esr.to_s
54
- result.name = "ESR"
55
- result.report_name = "ESR"
56
- order.id = bar_code
57
- order.results = []
58
- order.results << result
59
- patient.orders << order
60
- #puts patient.orders.size
61
- #puts patient.orders.first.results.size
62
- #puts patient.orders.first.results.first.to_s
63
- #puts "patient to json is:"
64
- puts patient.to_json
65
- $redis.lpush("patients",patient.to_json)
66
- end
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
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.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bhargav Raut