ruby_astm 1.1.1 → 1.1.2

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: f7633bfcc74d626e2135ceab715f3b91ce9d6a1093a3748829a2e589550c6d9e
4
- data.tar.gz: ced94d1d9124f265c519a49e9ce9325924d266abe16f6d63acf80c44990ab6b0
3
+ metadata.gz: ff47022f17e44e7b468663c714471a1cf0bd91835593bc166f6ca2b61a17ae85
4
+ data.tar.gz: a5d3ff3c77309b37de9982f1cefa607f6e0d5987084a561fcee8450c5a908294
5
5
  SHA512:
6
- metadata.gz: '056821d5b0b2c10929205a4d528dfced19bf978d1719ac26cf32fd2212c4cec25666576e25a1fed01761fb3faa871d69b7120b1a994ad022990c5399df9a9ede'
7
- data.tar.gz: 8d2fff46ffd8615662c856284301c03a07c0c776096e1f6c0c7c2a29a05c17a821b0d97bfce4e628a0c2e01aabb0bc2cd6bfaa145fbf589ca419118f0c179d3f
6
+ metadata.gz: 3372e998ddd5efc872128ea7648d8e8c87301f70414d03faece6348571190caf3641b1350d6eac52bdb213cd7a2cbc4b1f53fb50fed17a696a4cbd9b56aeeb6d
7
+ data.tar.gz: e228f0592560317f905d1d465c8e63790b67d184e4c1303ebb03772ac3d0c95e11002028df86b05c971389c1c32757961c1e9d8dcd7fb143879ba7a7c06af67d
@@ -46,10 +46,17 @@ class Header
46
46
  end
47
47
 
48
48
  def build_one_response
49
+ puts "building one response=========="
50
+ puts "queries are:"
51
+ puts self.queries.size.to_s
49
52
  responses = []
50
53
  self.queries.each do |query|
54
+ puts "doing query"
55
+ puts query.sample_ids
51
56
  header_response = "1H|\`^&||||||||||P|E 1394-97|#{Time.now.strftime("%Y%m%d%H%M%S")}\r"
52
57
  query.build_response.each do |qresponse|
58
+ puts "qresponse is:"
59
+ puts qresponse
53
60
  header_response += qresponse
54
61
  #responses << (header_response + qresponse)
55
62
  end
@@ -63,11 +63,11 @@ module LabInterface
63
63
 
64
64
  self.data_buffer ||= ''
65
65
 
66
- puts "incoming data bytes."
66
+ #puts "incoming data bytes."
67
67
 
68
68
  concat = ""
69
69
 
70
- puts data.bytes.to_a.to_s
70
+ #puts data.bytes.to_a.to_s
71
71
 
72
72
  data.bytes.to_a.each do |byte|
73
73
  x = [byte].pack('c*').force_encoding('UTF-8')
@@ -96,22 +96,23 @@ module LabInterface
96
96
 
97
97
  if data.bytes.to_a[-1] == 4
98
98
  #puts self.data_buffer
99
+ puts "GOT EOT --- PROCESSING BUFFER, AND CLEARING."
99
100
  process_text(self.data_buffer)
101
+ puts "queries are:"
102
+ if !self.headers.blank?
103
+ puts self.headers[-1].queries
104
+ end
100
105
  self.data_buffer = ''
101
106
  send_data(ENQ)
102
107
  elsif data.bytes.to_a[0] == 6
108
+ puts "got ack."
109
+ puts "building one response."
103
110
  header_responses = self.headers[-1].build_one_response
104
111
  header_responses.each_with_index {|response,key|
105
- #puts "response is:"
106
- #response.bytes.to_a.each do |b|
107
- # puts [b].pack('c*')
108
- #end
109
112
  message_checksum = checksum(response + terminator + ETX)
110
- #puts "Calculated checksum is: #{message_checksum}"
111
113
  final_resp = STX + response + terminator + ETX + message_checksum + "\r"
112
114
  final_resp_arr = final_resp.bytes.to_a
113
115
  final_resp_arr << 10
114
- #puts final_resp_arr.to_s
115
116
  if (self.headers[-1].response_sent == false)
116
117
  puts "sending the data as follows----------------------------------------------"
117
118
  puts "response sent is:"
@@ -132,8 +133,12 @@ module LabInterface
132
133
  if self.headers[-1].is_astm?
133
134
  send_data(ACK)
134
135
  elsif self.headers[-1].is_hl7?
136
+ puts "processing hl7"
137
+ process_text(self.data_buffer)
138
+ self.data_buffer = ''
135
139
  if self.headers.size > 0
136
140
  ## commit should return the jsonified thing, if possible.
141
+
137
142
  self.headers[-1].commit
138
143
  send_data(self.headers[-1].generate_ack_success_response)
139
144
  end
@@ -41,7 +41,7 @@ class Line
41
41
  end
42
42
 
43
43
  def detect_type
44
- puts "detecting line type: #{self.text}"
44
+ #puts "detecting line type: #{self.text}"
45
45
  line_type = self.fields[0]
46
46
  return unless line_type
47
47
  line_type.scan(/(?<ltype>[A-Z]+)/) { |ltype|
@@ -32,11 +32,14 @@ class Query
32
32
 
33
33
  one_response = ''
34
34
 
35
- self.sample_ids.each_with_index {|sid,key|
35
+ puts "sample ids are:"
36
+ puts self.sample_ids
36
37
 
38
+ self.sample_ids.each_with_index {|sid,key|
39
+ puts "doing sample id: #{sid}"
37
40
  ## tests are got from the requisitions hash.
38
41
  tests = get_tests(sid)
39
-
42
+ puts "tests are: #{tests}"
40
43
  ## default sequence number is 0 (THIS MAY LEAD TO PROBLEMS.)
41
44
  sequence_number = "#{key.to_s}"
42
45
 
@@ -51,7 +54,10 @@ class Query
51
54
 
52
55
  }
53
56
 
54
- return [one_response]
57
+ puts "responses are:"
58
+ puts responses.to_s
59
+
60
+ return responses
55
61
 
56
62
  end
57
63
 
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.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bhargav Raut