lis 0.4.7 → 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
data/bin/lis CHANGED
@@ -21,7 +21,6 @@ Main {
21
21
  cast :uri
22
22
  end
23
23
 
24
-
25
24
  def run
26
25
  $VERBOSE = true if params[:verbose].given?
27
26
  portname = params[:port].value
@@ -36,8 +35,10 @@ Main {
36
35
  warn "http: #{uri.to_s}"
37
36
 
38
37
  LIS::InterfaceServer.listen(port, uri).run!
39
-
40
-
38
+ rescue Exception => e
39
+ fatal { e.message }
40
+ e.backtrace.each do |l| warn l end
41
+ raise
41
42
  end
42
43
  end
43
44
 
@@ -60,12 +60,12 @@ end
60
60
 
61
61
  Then /^LIS should have sent test orders to client:$/ do |text|
62
62
  @data = @client.read_all
63
- @data.force_encoding("utf-8") if @data.respond_to?(:force_encoding)
64
- @packets = @data.split("\002").select { |s| s =~ /^\d[A-Z]/ }
63
+ @data.force_encoding("ASCII-8BIT") if @data.respond_to?(:force_encoding)
64
+ @packets = @data.split("\002").select { |s| s =~ /^\d[A-Z]/n }
65
65
  @packets.zip(text.split(/\n/)) do |actual, expected|
66
66
  @called = true
67
- rx = Regexp.new("^" + Regexp.escape(expected.strip))
68
- assert_match(rx, actual.gsub(/\r\003.*$/, "").strip)
67
+ rx = Regexp.new("^" + Regexp.escape(expected.strip.force_encoding('ASCII-8BIT')), Regexp::NOENCODING)
68
+ assert_match(rx, actual.gsub(/\r\003.*$/n, "").strip)
69
69
  end
70
70
  assert_equal(true, @called)
71
71
  end
@@ -54,13 +54,7 @@ class LIS::HTTPInterface
54
54
  "raw" => result.raw_data
55
55
  }
56
56
 
57
- # FIXME: WTF: should not just catch everything
58
- begin
59
- res = HTTP.post(uri(device_name, barcode, order.universal_test_id), :body => data.to_json)
60
- rescue Exception => e
61
- puts "EXCEPTION"
62
- p e
63
- end
57
+ HTTP.post(uri(device_name, barcode, order.universal_test_id), :body => data.to_json)
64
58
  end
65
59
 
66
60
 
@@ -90,11 +90,6 @@ module LIS::Transfer
90
90
  end
91
91
  end
92
92
 
93
- def write(type, message=nil)
94
- warn "[S] #{message}" if type == :message and $VERBOSE
95
- super
96
- end
97
-
98
93
  # @yield data
99
94
  def sending_session(data)
100
95
  # don't send anything if there are no pending requests
@@ -32,7 +32,7 @@ module LIS::Transfer
32
32
  # | `------------------ message
33
33
  # `---------------------- frame number
34
34
  )
35
- /xm
35
+ /xmn
36
36
 
37
37
  def initialize(*args)
38
38
  super(*args)
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module LIS
4
- VERSION = "0.4.7"
4
+ VERSION = "0.4.8"
5
5
  end
6
6
 
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_dependency "httparty"
25
25
  s.add_dependency "rake"
26
26
  s.add_dependency "main"
27
+ s.add_dependency "json"
27
28
 
28
29
  s.add_development_dependency("shoulda", ">= 3.1.0")
29
30
  s.add_development_dependency("mocha", ">= 0.12.0")
@@ -74,7 +74,7 @@ class TestPacketizedProtocol < Test::Unit::TestCase
74
74
  end
75
75
 
76
76
  should "propagate only packet data" do
77
- @str = "\0023L|1\r\0033C\r\n"
77
+ @str = "\0023L|1\r\0033C\r\n".force_encoding("ASCII-8BIT")
78
78
  @protocol.receive("\005")
79
79
  @protocol.receive(@str)
80
80
  @protocol.receive("\004")
@@ -1,10 +1,12 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'helper'
2
4
 
3
5
  class TestMessages < Test::Unit::TestCase
4
6
 
5
7
  context "parsing an order message" do
6
8
  setup do
7
- @str = "O|1|8780||^^^ATA|R|||||||||||||||||||B0135"
9
+ @str = "O|1|8780||^^^ATA|R|||||||||||||||||||B0135".force_encoding("ASCII-8BIT")
8
10
  @message = LIS::Message::Base.from_string(@str)
9
11
  end
10
12
 
@@ -24,7 +26,7 @@ class TestMessages < Test::Unit::TestCase
24
26
 
25
27
  context "parsing a comment message" do
26
28
  setup do
27
- @str = "C|1|BAD_QC|"
29
+ @str = "C|1|BAD_QC|".force_encoding("ASCII-8BIT")
28
30
  @message = LIS::Message::Base.from_string(@str)
29
31
  end
30
32
 
@@ -33,9 +35,26 @@ class TestMessages < Test::Unit::TestCase
33
35
  end
34
36
  end
35
37
 
38
+ context "parsing a patient message" do
39
+ setup do
40
+ @str = "P|1|123||123|Müller^Ulrich Peter||||||||".force_encoding("ASCII-8BIT")
41
+ @message = LIS::Message::Base.from_string(@str)
42
+ end
43
+
44
+ should "have correct type" do
45
+ assert_equal LIS::Message::Patient, @message.class
46
+ assert_equal "P", @message.type_id
47
+ end
48
+
49
+ should "have correct name" do
50
+ assert_equal "Müller^Ulrich Peter".force_encoding("ASCII-8BIT"), @message.name # FIXME, this should be utf8
51
+ end
52
+
53
+ end
54
+
36
55
  context "parsing a result message" do
37
56
  setup do
38
- @str = "R|1|^^^TSH|0.902|mIU/L|0.400\\0.004^4.00\\75.0|N|N|R|||20100115105636|20100115120641|B0135"
57
+ @str = "R|1|^^^TSH|0.902|mIU/L|0.400\\0.004^4.00\\75.0|N|N|R|||20100115105636|20100115120641|B0135".force_encoding("ASCII-8BIT")
39
58
  @message = LIS::Message::Base.from_string(@str)
40
59
  end
41
60
 
@@ -65,7 +84,7 @@ class TestMessages < Test::Unit::TestCase
65
84
  end
66
85
 
67
86
  should "parse empty result messages without error" do
68
- @message = LIS::Message::Base.from_string("R|1|^^^||||||X|||||LIAISON")
87
+ @message = LIS::Message::Base.from_string("R|1|^^^||||||X|||||LIAISON".force_encoding("ASCII-8BIT"))
69
88
  assert_equal LIS::Message::Result, @message.class
70
89
  end
71
90
  end
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Levin Alexander
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-03-09 00:00:00.000000000 Z
12
+ date: 2013-04-22 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: packet_io
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ! '>='
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ! '>='
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: httparty
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ! '>='
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ! '>='
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rake
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ! '>='
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ! '>='
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: main
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ! '>='
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,23 @@ dependencies:
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: json
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
65
90
  requirements:
66
91
  - - ! '>='
67
92
  - !ruby/object:Gem::Version
@@ -69,6 +94,7 @@ dependencies:
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: shoulda
71
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
72
98
  requirements:
73
99
  - - ! '>='
74
100
  - !ruby/object:Gem::Version
@@ -76,6 +102,7 @@ dependencies:
76
102
  type: :development
77
103
  prerelease: false
78
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
79
106
  requirements:
80
107
  - - ! '>='
81
108
  - !ruby/object:Gem::Version
@@ -83,6 +110,7 @@ dependencies:
83
110
  - !ruby/object:Gem::Dependency
84
111
  name: mocha
85
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
86
114
  requirements:
87
115
  - - ! '>='
88
116
  - !ruby/object:Gem::Version
@@ -90,6 +118,7 @@ dependencies:
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
93
122
  requirements:
94
123
  - - ! '>='
95
124
  - !ruby/object:Gem::Version
@@ -97,6 +126,7 @@ dependencies:
97
126
  - !ruby/object:Gem::Dependency
98
127
  name: yard
99
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
100
130
  requirements:
101
131
  - - ! '>='
102
132
  - !ruby/object:Gem::Version
@@ -104,6 +134,7 @@ dependencies:
104
134
  type: :development
105
135
  prerelease: false
106
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
107
138
  requirements:
108
139
  - - ! '>='
109
140
  - !ruby/object:Gem::Version
@@ -111,6 +142,7 @@ dependencies:
111
142
  - !ruby/object:Gem::Dependency
112
143
  name: cucumber
113
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
114
146
  requirements:
115
147
  - - ! '>='
116
148
  - !ruby/object:Gem::Version
@@ -118,6 +150,7 @@ dependencies:
118
150
  type: :development
119
151
  prerelease: false
120
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
121
154
  requirements:
122
155
  - - ! '>='
123
156
  - !ruby/object:Gem::Version
@@ -125,6 +158,7 @@ dependencies:
125
158
  - !ruby/object:Gem::Dependency
126
159
  name: webmock
127
160
  requirement: !ruby/object:Gem::Requirement
161
+ none: false
128
162
  requirements:
129
163
  - - ! '>='
130
164
  - !ruby/object:Gem::Version
@@ -132,6 +166,7 @@ dependencies:
132
166
  type: :development
133
167
  prerelease: false
134
168
  version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
135
170
  requirements:
136
171
  - - ! '>='
137
172
  - !ruby/object:Gem::Version
@@ -139,6 +174,7 @@ dependencies:
139
174
  - !ruby/object:Gem::Dependency
140
175
  name: aruba
141
176
  requirement: !ruby/object:Gem::Requirement
177
+ none: false
142
178
  requirements:
143
179
  - - ! '>='
144
180
  - !ruby/object:Gem::Version
@@ -146,6 +182,7 @@ dependencies:
146
182
  type: :development
147
183
  prerelease: false
148
184
  version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
149
186
  requirements:
150
187
  - - ! '>='
151
188
  - !ruby/object:Gem::Version
@@ -201,27 +238,28 @@ files:
201
238
  - vendor/lis.service
202
239
  homepage: http://github.com/levinalex/lis
203
240
  licenses: []
204
- metadata: {}
205
241
  post_install_message:
206
242
  rdoc_options:
207
243
  - --charset=UTF-8
208
244
  require_paths:
209
245
  - lib
210
246
  required_ruby_version: !ruby/object:Gem::Requirement
247
+ none: false
211
248
  requirements:
212
249
  - - ! '>='
213
250
  - !ruby/object:Gem::Version
214
251
  version: '0'
215
252
  required_rubygems_version: !ruby/object:Gem::Requirement
253
+ none: false
216
254
  requirements:
217
255
  - - ! '>='
218
256
  - !ruby/object:Gem::Version
219
257
  version: '0'
220
258
  requirements: []
221
259
  rubyforge_project:
222
- rubygems_version: 2.0.1
260
+ rubygems_version: 1.8.23
223
261
  signing_key:
224
- specification_version: 4
262
+ specification_version: 3
225
263
  summary: LIS interface to Siemens Immulite 2000XPi or other similar analyzers
226
264
  test_files:
227
265
  - features/communication basics.feature
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YzJkNjFkOTYxYWNlY2RiMzhkOGI5OThiOGMyYmQxZDFhNmFhNTBjZA==
5
- data.tar.gz: !binary |-
6
- OGQxMjljYWQ1ZmE4MzAzZTIyYjczOWYxNjFjNTVjZGI4ZGZmZWViNw==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZTZlM2E4ZTcwMTE4M2EwMTY3ZjZkZDg5OWI4NTQwNDRjNGRiMGZkYTY1YTYz
10
- MGMyZWU3MzQ3ZDU3MWJlMjkwMWI4M2FmMDY2MDZhYTEzMmYzMDJkZTU3OWIz
11
- MmYwOGEzMTk1NDFjZTE2OTJkOTI5Y2VjM2Q3MDQxMjA4NDQyMjI=
12
- data.tar.gz: !binary |-
13
- NTQ5MTQxMjgwN2E2N2M2NjczM2FhMGY0MTljNjA2Mjc3ODViMDFhODAxZWIx
14
- MmNiYjM1MDA3N2NlOTBkMWU4NTAxOGM5NjUzOTZkM2IyNTY3NjM0Y2QxMTAz
15
- N2QxYzY0NTNmOGZjNGVjYjg1MTZmNTMwNzFkYjc1NWUxMzZhMTI=