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 +4 -4
- data/lib/ruby_astm/header.rb +7 -0
- data/lib/ruby_astm/lab_interface.rb +13 -8
- data/lib/ruby_astm/line.rb +1 -1
- data/lib/ruby_astm/query.rb +9 -3
- 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: ff47022f17e44e7b468663c714471a1cf0bd91835593bc166f6ca2b61a17ae85
|
4
|
+
data.tar.gz: a5d3ff3c77309b37de9982f1cefa607f6e0d5987084a561fcee8450c5a908294
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3372e998ddd5efc872128ea7648d8e8c87301f70414d03faece6348571190caf3641b1350d6eac52bdb213cd7a2cbc4b1f53fb50fed17a696a4cbd9b56aeeb6d
|
7
|
+
data.tar.gz: e228f0592560317f905d1d465c8e63790b67d184e4c1303ebb03772ac3d0c95e11002028df86b05c971389c1c32757961c1e9d8dcd7fb143879ba7a7c06af67d
|
data/lib/ruby_astm/header.rb
CHANGED
@@ -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
|
data/lib/ruby_astm/line.rb
CHANGED
data/lib/ruby_astm/query.rb
CHANGED
@@ -32,11 +32,14 @@ class Query
|
|
32
32
|
|
33
33
|
one_response = ''
|
34
34
|
|
35
|
-
|
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
|
-
|
57
|
+
puts "responses are:"
|
58
|
+
puts responses.to_s
|
59
|
+
|
60
|
+
return responses
|
55
61
|
|
56
62
|
end
|
57
63
|
|