ruby_astm 1.4.9 → 1.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6abc78dc8d0ed2abe9b877e3727155c0aacfe008b40f8e68678f8953c41b3230
4
- data.tar.gz: 2c477c41fb604d712da07752e0468bd6468a51ca0ca3e86c24985a99a5003b1d
3
+ metadata.gz: 7b1bfbc3f10eff39ea56aa70a6bac82d60068e2eb0e603f64ad15a6a11e7b2d4
4
+ data.tar.gz: 607c8eb219d2bb4d0ecb4d84de0d953372929e3d090af61c9337118418b6ae79
5
5
  SHA512:
6
- metadata.gz: c1c5b8d38e039fb84feee8ce501a5fc648ffe7fd79aa088f4018c4dd18c60d6611ba75deac6652b3d558778adf02f827aee3a716e4000e19b762b7459a943385
7
- data.tar.gz: 49e0c42b89413aabb1d40ca9a5b2e8ccdedd34ad3a3919a4de6de827f7b33237ab329d96d88679b00850be09f16b6f05be85d9059b4057bc863d431821d8ac40
6
+ metadata.gz: b47abdddba9c687086a2a286e68ae31d12ffa1e81bf835a2adc8892f9878dfdfc01ddb04d6c3577de3e4f11319569986d137073c8cdde957aa0002b1965185ff
7
+ data.tar.gz: 13852f514afad1f06679909ceb2c9eb0588477334cc818173e9f5cf5ee3703384f8ddd57bffb83f8fc06d32efdd679397ea237212c752622b2b6410043df17d6
@@ -9,6 +9,8 @@ module SiemensAbgElectrolyteModule
9
9
 
10
10
  SIEMENS_ELECTROLYTE_END = [10,10,10,10]
11
11
  ELECTROLYTE_START = [45, 45, 45, 32]
12
+ SIEMENS_ELEC_ABG_RESULTS_HASH = "SIEMENS_ELEC_ABG_RESULTS_HASH"
13
+
12
14
  attr_accessor :current_text_segment
13
15
 
14
16
  def get_po2
@@ -88,6 +90,19 @@ module SiemensAbgElectrolyteModule
88
90
  return nil
89
91
  end
90
92
 
93
+ ## @param[String] barcode : the barcode
94
+ ## @param[Result] result : result_object
95
+ def add_result?(barcode,result)
96
+ return true if $redis.hget(SIEMENS_ELEC_ABG_RESULTS_HASH,barcode).blank?
97
+ existing_results = JSON.parse($redis.hget(SIEMENS_ELEC_ABG_RESULTS_HASH,barcode))
98
+ if existing_results[result.name].blank?
99
+ return true
100
+ elsif existing_results[result.name] != result.value
101
+ return true
102
+ end
103
+ false
104
+ end
105
+
91
106
  ## we override the lab interface methods
92
107
  ## and we don't pollute the lab interface itself.
93
108
  ## as this is a custom analyzer.
@@ -133,7 +148,7 @@ module SiemensAbgElectrolyteModule
133
148
  r.value = sodium
134
149
  r.units = "mmol/L"
135
150
  r.timestamp = Time.now.to_i
136
- o.results["SNATRIUM"] = r
151
+ o.results["SNATRIUM"] = r if add_result?(patient_id,r)
137
152
  end
138
153
 
139
154
  if potassium = get_k
@@ -143,7 +158,7 @@ module SiemensAbgElectrolyteModule
143
158
  r.value = potassium
144
159
  r.units = "mmol/L"
145
160
  r.timestamp = Time.now.to_i
146
- o.results["SPOTASSIUM"] = r
161
+ o.results["SPOTASSIUM"] = r if add_result?(patient_id,r)
147
162
  end
148
163
 
149
164
  if chloride = get_cl
@@ -153,7 +168,7 @@ module SiemensAbgElectrolyteModule
153
168
  r.value = chloride
154
169
  r.units = "mmol/L"
155
170
  r.timestamp = Time.now.to_i
156
- o.results["SCHLORIDE"] = r
171
+ o.results["SCHLORIDE"] = r if add_result?(patient_id,r)
157
172
  end
158
173
 
159
174
  if ph = get_ph
@@ -163,7 +178,7 @@ module SiemensAbgElectrolyteModule
163
178
  r.value = ph
164
179
  r.units = "mmol/L"
165
180
  r.timestamp = Time.now.to_i
166
- o.results["pH"] = r
181
+ o.results["pH"] = r if add_result?(patient_id,r)
167
182
  end
168
183
 
169
184
  if po2 = get_po2
@@ -173,7 +188,7 @@ module SiemensAbgElectrolyteModule
173
188
  r.value = po2
174
189
  r.units = "mmHg"
175
190
  r.timestamp = Time.now.to_i
176
- o.results["po2"] = r
191
+ o.results["po2"] = r if add_result?(patient_id,r)
177
192
  end
178
193
 
179
194
  if pco2 = get_pco2
@@ -183,18 +198,20 @@ module SiemensAbgElectrolyteModule
183
198
  r.value = pco2
184
199
  r.units = "mmHg"
185
200
  r.timestamp = Time.now.to_i
186
- o.results["pco2"] = r
201
+ o.results["pco2"] = r if add_result?(patient_id,r)
187
202
  end
188
203
 
189
- p.orders << o
190
- self.headers[-1].patients << p
204
+ unless o.results.blank?
205
+ p.orders << o
206
+ self.headers[-1].patients << p
207
+ end
208
+
191
209
  end
192
210
  end
193
211
 
194
212
  if self.headers.size > 0
195
213
  self.headers[-1].commit
196
214
  clear
197
- #send_data(self.headers[-1].generate_ack_success_response)
198
215
  end
199
216
 
200
217
  end
@@ -248,9 +248,9 @@ module LabInterface
248
248
 
249
249
  concat = pre_process_bytes(byte_arr,concat)
250
250
 
251
- puts "concat is:"
251
+ #puts "concat is:"
252
252
 
253
- puts concat.to_s
253
+ #puts concat.to_s
254
254
 
255
255
  self.data_buffer << concat
256
256
 
@@ -266,8 +266,8 @@ module LabInterface
266
266
  if data.bytes.to_a[-1] == 4
267
267
  puts "GOT EOT --- PROCESSING BUFFER, AND CLEARING."
268
268
  process_text(self.data_buffer)
269
- root_path = File.dirname __dir__
270
- puts "root path #{root_path}"
269
+ #root_path = File.dirname __dir__
270
+ #puts "root path #{root_path}"
271
271
  #IO.write((File.join root_path,'../test','resources','stago.txt'),self.test_data_bytes.to_s)
272
272
  puts self.test_data_bytes.flatten.to_s
273
273
  self.data_buffer = ''
@@ -355,7 +355,7 @@ module LabInterface
355
355
  puts "text is:"
356
356
  puts text
357
357
  text.split("\n").each do |l|
358
- puts "doing line:#{l}"
358
+ #puts "doing line:#{l}"
359
359
  line = Line.new({:text => l})
360
360
  process_type(line)
361
361
  end
@@ -385,18 +385,18 @@ module LabInterface
385
385
  self.headers[-1].patients[-1].orders << hl7_order
386
386
  end
387
387
  when "Header"
388
- puts "got header"
388
+ #puts "got header"
389
389
  header = Header.new({:line => line})
390
390
  self.headers ||= []
391
391
  self.headers << header
392
392
  when "Query"
393
- puts "got query"
393
+ #puts "got query"
394
394
  query = Query.new({:line => line})
395
395
  unless self.headers.blank?
396
396
  self.headers[-1].queries << query
397
397
  end
398
398
  when "Patient"
399
- puts "got patient."
399
+ #puts "got patient."
400
400
  patient = Patient.new({:line => line})
401
401
  unless self.headers.blank?
402
402
  self.headers[-1].patients << patient
@@ -409,10 +409,10 @@ module LabInterface
409
409
  end
410
410
  end
411
411
  when "Result"
412
- puts "GOT RESULT------------------>"
413
- puts "line is :#{line}"
412
+ #puts "GOT RESULT------------------>"
413
+ #puts "line is :#{line}"
414
414
  result = Result.new({:line => line})
415
- puts "made new result"
415
+ #puts "made new result"
416
416
  unless self.headers.blank?
417
417
  unless self.headers[-1].patients.blank?
418
418
  unless self.headers[-1].patients[-1].orders[-1].blank?
@@ -423,7 +423,7 @@ module LabInterface
423
423
  when "Terminator"
424
424
  ## it didn't terminate so there was no commit being called.
425
425
  unless self.headers.blank?
426
- puts "got terminator."
426
+ #puts "got terminator."
427
427
  self.headers[-1].commit
428
428
  end
429
429
  end
@@ -113,7 +113,7 @@ class Result
113
113
 
114
114
  ## here will call mappings and check the result correlation
115
115
  def initialize(args={})
116
- puts "called initialize result"
116
+ #puts "called initialize result"
117
117
  set_name(args)
118
118
  set_flags(args)
119
119
  set_value(args)
@@ -83,7 +83,7 @@ module UsbModule
83
83
  patient.orders << order
84
84
  if add_result?(bar_code,result.value)
85
85
  #puts patient.to_json
86
- $redis.lpush("test_patients",patient.to_json)
86
+ $redis.lpush("patients",patient.to_json)
87
87
  $redis.hset(ESR_RESULTS_HASH,bar_code,result.value.to_i)
88
88
  end
89
89
  end
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.9
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bhargav Raut