ruby_astm 1.0.1 → 1.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc05e6b6b235e7df2ca1c58a743122e801c8c18b
4
- data.tar.gz: 2abc30cf1f6a90e3942bdd03a7b2dc1b9f7c846b
3
+ metadata.gz: 45a5db6505182ace88ffe6adb2c1b9595b432613
4
+ data.tar.gz: d111d2c14ba61ca507fc4f743e94d0578f4555f5
5
5
  SHA512:
6
- metadata.gz: 470f3f0bffa8cba632548f65a2f782a177e38bc4989880fd112a908ce98337dd940097e0f70ad0f6b79ce0d4711e5ab8f10dde25151e9a047f2dc101dfd2c325
7
- data.tar.gz: e3fec45152ad2716ec63efcfdcb1c7211c6db528a0cf1d0f3301d03484f0cf7f09766afe9f63f26aca8cb267ea4d6015cb3aee1d63678355bb6b71e4a8b954d3
6
+ metadata.gz: dfa51b7827945a702895e4c061697fc6b25862b918f2f4fdc098fc8e1a1513930eece5d39ff2c9a79d8c00a7bbc1ab3f28aa2f3df676d8fb071489ba3b3c0a36
7
+ data.tar.gz: b64b9600d4ed08846ff172fbe433b24886e2040f3802be08b961b06492d9512c2b29d47802a108ed4a7d1d2b066ebe317b3ba3cfc9120e9784c7bf0850dba8f1
@@ -101,6 +101,7 @@ class Google_Lab_Interface < Poller
101
101
  # method overriden from adapter.
102
102
  # data should be an array of objects.
103
103
  # see adapter for the recommended structure.
104
+ # @return[Boolean] true/false : depending on if there was an error or not.
104
105
  def update(data)
105
106
 
106
107
  orders = JSON.generate(data)
@@ -121,13 +122,15 @@ class Google_Lab_Interface < Poller
121
122
  if resp.error
122
123
  AstmServer.log("Error updating results to LIS, message follows")
123
124
  AstmServer.log("error: #{resp.error.message} : code: #{resp.error.code}")
124
- #puts "there was an error."
125
+ false
125
126
  else
126
127
  AstmServer.log("Updating results to LIS successfull")
128
+ true
127
129
  end
128
130
  rescue => e
129
131
  AstmServer.log("Error updating results to LIS, backtrace follows")
130
132
  AstmServer.log(e.backtrace.to_s)
133
+ false
131
134
  end
132
135
 
133
136
  end
@@ -230,8 +230,9 @@ class Poller
230
230
  end
231
231
 
232
232
  ## override to define how the data is updated.
233
+ ## expected to return Boolean value, depending on whether the update was successfull or not.
233
234
  def update(data)
234
-
235
+ true
235
236
  end
236
237
 
237
238
  ##@param[Array] data : array of objects.
@@ -333,8 +334,11 @@ class Poller
333
334
  while patients_to_process == true
334
335
  if patient_results = $redis.rpoplpush("patients","processing")
335
336
  patient_results = JSON.parse(patient_results)
336
- update(patient_results)
337
+ ## do this before the update, so that we don't go into an endless loop if the current update fails.
337
338
  patients_to_process = $redis.llen("patients") > 0
339
+ unless update(patient_results)
340
+ $redis.lpush("patients",JSON.generate(patient_results))
341
+ end
338
342
  else
339
343
  patients_to_process = false
340
344
  end
@@ -37,10 +37,13 @@ module LabInterface
37
37
  "L|1|N\r"
38
38
  end
39
39
 
40
+
40
41
  def checksum(input)
41
42
  strString = input
42
43
  checksum = strString.sum
44
+ #puts "checksum before to_s is: #{checksum}"
43
45
  b = checksum.to_s(16)
46
+ #puts "b is: #{b}"
44
47
  strCksm = b[-2..-1]
45
48
  if strCksm.length < 2
46
49
  for i in strString.length..1
@@ -11,7 +11,7 @@ class Result
11
11
  def initialize(args)
12
12
  if args[:line]
13
13
  line = args[:line]
14
- line.fields[2].scan(/\^+(?<name>[A-Za-z0-9\%\#-]+)\^?(?<dilution>\d+)?/) { |name,dilution|
14
+ line.fields[2].scan(/\^+(?<name>[A-Za-z0-9\%\#\-\_\?\/]+)\^?(?<dilution>\d+)?/) { |name,dilution|
15
15
  self.name = lookup_mapping(name)
16
16
  self.dilution = dilution
17
17
  }
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.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bhargav Raut