lis 0.1.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -21,3 +21,4 @@ pkg
21
21
  doc
22
22
 
23
23
  ## PROJECT::SPECIFIC
24
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
data/Rakefile CHANGED
@@ -1,23 +1,9 @@
1
- require 'rubygems'
2
- require 'rake'
1
+ $LOAD_PATH.unshift './lib'
3
2
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "lis"
8
- gem.summary = %Q{LIS interface to Siemens Immulite 2000XPi or other similar analyzers}
9
- gem.description = %Q{}
10
- gem.email = "mail@levinalex.net"
11
- gem.homepage = "http://github.com/levinalex/lis"
12
- gem.authors = ["Levin Alexander"]
13
- gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
- gem.add_development_dependency "yard", ">= 0"
15
- gem.add_development_dependency "cucumber", ">= 0"
16
- end
17
- Jeweler::GemcutterTasks.new
18
- rescue LoadError
19
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
- end
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ require 'lis'
21
7
 
22
8
  require 'rake/testtask'
23
9
  Rake::TestTask.new(:test) do |test|
@@ -26,39 +12,8 @@ Rake::TestTask.new(:test) do |test|
26
12
  test.verbose = true
27
13
  end
28
14
 
29
- begin
30
- require 'rcov/rcovtask'
31
- Rcov::RcovTask.new do |test|
32
- test.libs << 'test'
33
- test.pattern = 'test/**/test_*.rb'
34
- test.verbose = true
35
- end
36
- rescue LoadError
37
- task :rcov do
38
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
39
- end
40
- end
41
-
42
- task :test => :check_dependencies
15
+ require 'cucumber/rake/task'
16
+ Cucumber::Rake::Task.new(:features)
43
17
 
44
- begin
45
- require 'cucumber/rake/task'
46
- Cucumber::Rake::Task.new(:features)
18
+ task :default => [:test, :features]
47
19
 
48
- task :features => :check_dependencies
49
- rescue LoadError
50
- task :features do
51
- abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
52
- end
53
- end
54
-
55
- task :default => :test
56
-
57
- begin
58
- require 'yard'
59
- YARD::Rake::YardocTask.new
60
- rescue LoadError
61
- task :yardoc do
62
- abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
63
- end
64
- end
@@ -0,0 +1,6 @@
1
+ module LIS::Message
2
+ class Comment < Base
3
+ type_id "C"
4
+ has_field 3, :message
5
+ end
6
+ end
@@ -1,7 +1,7 @@
1
1
  module LIS::Message
2
2
  class Header < Base
3
3
  type_id "H"
4
- has_field 2, :delimiter_definition, :default => "^&"
4
+ has_field 2, :delimiter_definition, :default => "\\^&"
5
5
  has_field 4, :access_password
6
6
  has_field 5, :sender_name
7
7
  has_field 6, :sender_address
@@ -15,7 +15,8 @@ module LIS::Message
15
15
  def initialize(sequence_number, patient_id, last_name = "", first_name = "")
16
16
  self.sequence_number = sequence_number
17
17
  self.practice_assigned_patient_id = patient_id
18
- self.name = [last_name, first_name].join("^")
18
+ self.patient_id = patient_id
19
+ self.name = [last_name.force_encoding("UTF-8"), first_name.force_encoding("UTF-8")].join("^")
19
20
  end
20
21
 
21
22
  end
data/lib/lis/messages.rb CHANGED
@@ -5,7 +5,7 @@ module LIS::Message
5
5
  CONVERSION_WRITER = {
6
6
  :string => lambda { |s| s },
7
7
  :int => lambda { |s| s.to_i },
8
- :timestamp => lambda { |s| DateTime.strptime(s, "%Y%m%d%H%M%S") }
8
+ :timestamp => lambda { |s| DateTime.strptime(s, "%Y%m%d%H%M%S") rescue nil }
9
9
  }
10
10
 
11
11
  def field_count(val = nil)
data/lib/lis.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  $:.unshift File.dirname(__FILE__)
2
2
 
3
3
  module LIS
4
+ VERSION = "0.2.1"
4
5
  end
5
6
 
6
7
  require 'lis/io_listener.rb'
@@ -12,3 +13,4 @@ require 'lis/packetized_protocol.rb'
12
13
  require 'lis/application_protocol.rb'
13
14
  require 'lis/worklist_manager_interface.rb'
14
15
  require 'lis/interface_server.rb'
16
+
data/lis.gemspec CHANGED
@@ -1,97 +1,28 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require 'lis'
5
4
 
6
5
  Gem::Specification.new do |s|
7
6
  s.name = %q{lis}
8
- s.version = "0.1.0"
7
+ s.version = LIS::VERSION
9
8
 
10
9
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
10
  s.authors = ["Levin Alexander"]
12
- s.date = %q{2010-02-14}
13
- s.default_executable = %q{lis2http}
14
11
  s.description = %q{}
15
12
  s.email = %q{mail@levinalex.net}
16
- s.executables = ["lis2http"]
17
- s.extra_rdoc_files = [
18
- "LICENSE",
19
- "README.markdown"
20
- ]
21
- s.files = [
22
- ".document",
23
- ".gitignore",
24
- ".yardopts",
25
- "LICENSE",
26
- "README.markdown",
27
- "Rakefile",
28
- "VERSION",
29
- "bin/lis2http",
30
- "features/communication basics.feature",
31
- "features/lis.feature",
32
- "features/step_definitions/lis_steps.rb",
33
- "features/support/env.rb",
34
- "lib/lis.rb",
35
- "lib/lis/application_protocol.rb",
36
- "lib/lis/commands/application.rb",
37
- "lib/lis/interface_server.rb",
38
- "lib/lis/io_listener.rb",
39
- "lib/lis/messages.rb",
40
- "lib/lis/messages/header.rb",
41
- "lib/lis/messages/order.rb",
42
- "lib/lis/messages/patient.rb",
43
- "lib/lis/messages/query.rb",
44
- "lib/lis/messages/result.rb",
45
- "lib/lis/messages/terminator.rb",
46
- "lib/lis/packetized_protocol.rb",
47
- "lib/lis/worklist_manager_interface.rb",
48
- "lis.gemspec",
49
- "test/helper.rb",
50
- "test/lib/mock_server.rb",
51
- "test/messages/test_header.rb",
52
- "test/messages/test_order.rb",
53
- "test/messages/test_patients.rb",
54
- "test/messages/test_terminator.rb",
55
- "test/test_application_protocol.rb",
56
- "test/test_io_listener.rb",
57
- "test/test_messages.rb",
58
- "test/test_packetized_protocol.rb"
59
- ]
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+
60
18
  s.homepage = %q{http://github.com/levinalex/lis}
61
19
  s.rdoc_options = ["--charset=UTF-8"]
62
20
  s.require_paths = ["lib"]
63
- s.rubygems_version = %q{1.3.5}
64
21
  s.summary = %q{LIS interface to Siemens Immulite 2000XPi or other similar analyzers}
65
- s.test_files = [
66
- "test/helper.rb",
67
- "test/lib/mock_server.rb",
68
- "test/messages/test_header.rb",
69
- "test/messages/test_order.rb",
70
- "test/messages/test_patients.rb",
71
- "test/messages/test_terminator.rb",
72
- "test/test_application_protocol.rb",
73
- "test/test_io_listener.rb",
74
- "test/test_messages.rb",
75
- "test/test_packetized_protocol.rb"
76
- ]
77
-
78
- if s.respond_to? :specification_version then
79
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
80
- s.specification_version = 3
81
22
 
82
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
83
- s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
84
- s.add_development_dependency(%q<yard>, [">= 0"])
85
- s.add_development_dependency(%q<cucumber>, [">= 0"])
86
- else
87
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
88
- s.add_dependency(%q<yard>, [">= 0"])
89
- s.add_dependency(%q<cucumber>, [">= 0"])
90
- end
91
- else
92
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
93
- s.add_dependency(%q<yard>, [">= 0"])
94
- s.add_dependency(%q<cucumber>, [">= 0"])
95
- end
23
+ s.add_development_dependency("shoulda", ["~> 2.11.3"])
24
+ s.add_development_dependency("mocha", ["~> 0.9.12"])
25
+ s.add_development_dependency("yard", ["~> 0.7.1"])
26
+ s.add_development_dependency("cucumber", ["~> 0.10.3"])
96
27
  end
97
28
 
@@ -8,12 +8,12 @@ class TestHeaderMessages < Test::Unit::TestCase
8
8
 
9
9
  should "have sane defaults" do
10
10
  @message = LIS::Message::Header.new()
11
- assert_equal "H|\^&|||SenderID||||8N1|ReceiverID||P|1|20100215172832", @message.to_message
11
+ assert_equal "H|\\^&|||SenderID||||8N1|ReceiverID||P|1|20100215172832", @message.to_message
12
12
  end
13
13
 
14
14
  should "have overridable sender and receiver IDs" do
15
15
  @message = LIS::Message::Header.new("SEND", "RECV", "PASSWORD")
16
- assert_equal "H|\^&||PASSWORD|SEND||||8N1|RECV||P|1|20100215172832", @message.to_message
16
+ assert_equal "H|\\^&||PASSWORD|SEND||||8N1|RECV||P|1|20100215172832", @message.to_message
17
17
  end
18
18
  end
19
19
  end
@@ -4,7 +4,7 @@ class TestPatientMessages < Test::Unit::TestCase
4
4
  context "order message" do
5
5
  should "have sane defaults" do
6
6
  @message = LIS::Message::Patient.new(1, 101, "Riker", "Al")
7
- assert_equal "P|1|101|||Riker^Al||||||||", @message.to_message
7
+ assert_equal "P|1|101||101|Riker^Al||||||||", @message.to_message
8
8
  end
9
9
  end
10
10
  end
@@ -22,6 +22,17 @@ class TestMessages < Test::Unit::TestCase
22
22
  end
23
23
  end
24
24
 
25
+ context "parsing a comment message" do
26
+ setup do
27
+ @str = "C|1|BAD_QC|"
28
+ @message = LIS::Message::Base.from_string(@str)
29
+ end
30
+
31
+ should "create a comment message" do
32
+ assert_equal LIS::Message::Comment, @message.class
33
+ end
34
+ end
35
+
25
36
  context "parsing a result message" do
26
37
  setup do
27
38
  @str = "R|1|^^^TSH|0.902|mIU/L|0.400\\0.004^4.00\\75.0|N|N|R|||20100115105636|20100115120641|B0135"
@@ -52,6 +63,11 @@ class TestMessages < Test::Unit::TestCase
52
63
  should "return message itself on #to_message" do
53
64
  assert_equal @str, @message.to_message
54
65
  end
66
+
67
+ should "parse empty result messages without error" do
68
+ @message = LIS::Message::Base.from_string("R|1|^^^||||||X|||||LIAISON")
69
+ assert_equal LIS::Message::Result, @message.class
70
+ end
55
71
  end
56
72
 
57
73
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 1
9
+ version: 0.2.1
5
10
  platform: ruby
6
11
  authors:
7
12
  - Levin Alexander
@@ -9,52 +14,82 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-14 00:00:00 +01:00
13
- default_executable: lis2http
17
+ date: 2011-05-30 00:00:00 +02:00
18
+ default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
- name: thoughtbot-shoulda
21
+ name: shoulda
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 2
30
+ - 11
31
+ - 3
32
+ version: 2.11.3
17
33
  type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: mocha
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
20
40
  requirements:
21
- - - ">="
41
+ - - ~>
22
42
  - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
43
+ segments:
44
+ - 0
45
+ - 9
46
+ - 12
47
+ version: 0.9.12
48
+ type: :development
49
+ version_requirements: *id002
25
50
  - !ruby/object:Gem::Dependency
26
51
  name: yard
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
30
55
  requirements:
31
- - - ">="
56
+ - - ~>
32
57
  - !ruby/object:Gem::Version
33
- version: "0"
34
- version:
58
+ segments:
59
+ - 0
60
+ - 7
61
+ - 1
62
+ version: 0.7.1
63
+ type: :development
64
+ version_requirements: *id003
35
65
  - !ruby/object:Gem::Dependency
36
66
  name: cucumber
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
40
70
  requirements:
41
- - - ">="
71
+ - - ~>
42
72
  - !ruby/object:Gem::Version
43
- version: "0"
44
- version:
73
+ segments:
74
+ - 0
75
+ - 10
76
+ - 3
77
+ version: 0.10.3
78
+ type: :development
79
+ version_requirements: *id004
45
80
  description: ""
46
81
  email: mail@levinalex.net
47
82
  executables:
48
83
  - lis2http
49
84
  extensions: []
50
85
 
51
- extra_rdoc_files:
52
- - LICENSE
53
- - README.markdown
86
+ extra_rdoc_files: []
87
+
54
88
  files:
55
89
  - .document
56
90
  - .gitignore
57
91
  - .yardopts
92
+ - Gemfile
58
93
  - LICENSE
59
94
  - README.markdown
60
95
  - Rakefile
@@ -70,6 +105,7 @@ files:
70
105
  - lib/lis/interface_server.rb
71
106
  - lib/lis/io_listener.rb
72
107
  - lib/lis/messages.rb
108
+ - lib/lis/messages/comment.rb
73
109
  - lib/lis/messages/header.rb
74
110
  - lib/lis/messages/order.rb
75
111
  - lib/lis/messages/patient.rb
@@ -99,25 +135,33 @@ rdoc_options:
99
135
  require_paths:
100
136
  - lib
101
137
  required_ruby_version: !ruby/object:Gem::Requirement
138
+ none: false
102
139
  requirements:
103
140
  - - ">="
104
141
  - !ruby/object:Gem::Version
142
+ segments:
143
+ - 0
105
144
  version: "0"
106
- version:
107
145
  required_rubygems_version: !ruby/object:Gem::Requirement
146
+ none: false
108
147
  requirements:
109
148
  - - ">="
110
149
  - !ruby/object:Gem::Version
150
+ segments:
151
+ - 0
111
152
  version: "0"
112
- version:
113
153
  requirements: []
114
154
 
115
155
  rubyforge_project:
116
- rubygems_version: 1.3.5
156
+ rubygems_version: 1.3.7
117
157
  signing_key:
118
158
  specification_version: 3
119
159
  summary: LIS interface to Siemens Immulite 2000XPi or other similar analyzers
120
160
  test_files:
161
+ - features/communication basics.feature
162
+ - features/lis.feature
163
+ - features/step_definitions/lis_steps.rb
164
+ - features/support/env.rb
121
165
  - test/helper.rb
122
166
  - test/lib/mock_server.rb
123
167
  - test/messages/test_header.rb