simple_hl7 0.2.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b86fbf729318a11892a84b45266a3b327a23ce2c
4
+ data.tar.gz: 446273020981a059aacbcb137e154d348db65f5a
5
+ SHA512:
6
+ metadata.gz: 3d7dde564de84aad240f7a02bdd7e68179a4b63782525d5ddee005b0e74b2377f03d976bd3a63c18d84a0ebae9fff1fa7bd4690b4ffdf69f6cf320942a33bad4
7
+ data.tar.gz: a32a050e3b24e5dea6e0b6ba3c3a201c859e78147e1eae9b0e9cdcdee350983d7635a6d860ca1865dec3d548501c81744b57edd123ecb80639224f05028e0250
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ cache:
3
+ bundler: true
4
+ rvm:
5
+ - "2.0.0"
6
+ script:
7
+ - bundle exec rspec spec/ -f documentation -c
8
+ branches:
9
+ only:
10
+ - master
11
+ notifications:
12
+ email:
13
+ - ops@alivecor.com
data/README.md CHANGED
@@ -115,8 +115,8 @@ msg.msh[9][2] = "A04"
115
115
  ```
116
116
 
117
117
  It is important to note that under the hood the the bracket syntax actually
118
- adds the value to the first subcomponent of the first componenet of the first
119
- repition in the specified field.
118
+ adds the value to the first subcomponent of the first component of the first
119
+ repetition in the specified field.
120
120
 
121
121
  This means that:
122
122
 
@@ -174,6 +174,18 @@ msg.pid[3] = "123456"
174
174
  msg.to_hl7
175
175
  => "MSH|^~\\&|\r\nPID|||123456"
176
176
  ```
177
+ ### Transmitting via TCP/IP
178
+
179
+ The Lower Layer Protocol (LLP) is the most common mechanism for sending unencrypted HL7 via TCP/IP over a local area network. In order to be complaint with this protocol you can use `to_llp` method which wraps the HL7 message with the appropriate header and trailer.
180
+
181
+ ```ruby
182
+ msg = SimpleHL7::Message.new
183
+ msg.msh[12] = '2.5'
184
+
185
+ socket = TCPSocket.open(ipaddr, port)
186
+ socket.write msg.to_llp
187
+ socket.close
188
+ ```
177
189
 
178
190
  ### Parsing
179
191
 
@@ -34,6 +34,14 @@ module SimpleHL7
34
34
  @segments.map {|s| s.to_hl7(separator_chars)}.join(@segment_separator)
35
35
  end
36
36
 
37
+ # Generate a LLP string from this message
38
+ # Commonly used for transmitting HL7 messages via TCP/IP
39
+ #
40
+ # @return [String] The generated LLP string
41
+ def to_llp
42
+ "\x0b#{to_hl7}\x1c\r"
43
+ end
44
+
37
45
  # Get an array representation of the HL7 message. This can be useful
38
46
  # to help debug problems.
39
47
  #
@@ -1,3 +1,3 @@
1
1
  module SimpleHL7
2
- VERSION = "0.2.0"
2
+ VERSION = "1.0.0"
3
3
  end
data/simple_hl7.gemspec CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../lib/simple_hl7/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Rome Portlock"]
6
- gem.email = ["rome@alivecor.com"]
6
+ gem.email = ["hportlock@gmail.com"]
7
7
  gem.description = %q{Parse and generate hl7 messages for interfacing with health care systems}
8
8
  gem.summary = %q{Parse and generate hl7 messages}
9
9
  gem.homepage = "https://github.com/alivecor/simple_hl7"
@@ -14,6 +14,7 @@ Gem::Specification.new do |gem|
14
14
  gem.name = "simple_hl7"
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = SimpleHL7::VERSION
17
+ gem.licenses = ['MIT']
17
18
 
18
19
  gem.add_development_dependency "pry", "~> 0.9"
19
20
  gem.add_development_dependency "rspec", "~> 2.14"
@@ -29,6 +29,24 @@ module SimpleHL7
29
29
  end
30
30
  end
31
31
 
32
+ describe "#to_llp" do
33
+ it "generates an llp message" do
34
+ msg = Message.new
35
+ msg.msh[6] = "accountid"
36
+ msg.pid[5] = "User"
37
+ msg.pid[5][2] = "Test"
38
+ msg.to_llp.should == "\x0bMSH|^~\\&||||accountid\rPID|||||User^Test\x1c\r"
39
+ end
40
+
41
+ it "generates a llp message with a non-default segment separator" do
42
+ msg = Message.new(segment_separator: "\r\n")
43
+ msg.msh[6] = "accountid"
44
+ msg.pid[5] = "User"
45
+ msg.pid[5][2] = "Test"
46
+ msg.to_llp.should == "\x0bMSH|^~\\&||||accountid\r\nPID|||||User^Test\x1c\r"
47
+ end
48
+ end
49
+
32
50
  describe "#add_segment" do
33
51
  it "adds segments properly" do
34
52
  msg = Message.new
metadata CHANGED
@@ -1,56 +1,52 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_hl7
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Rome Portlock
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-02-06 00:00:00.000000000 Z
11
+ date: 2016-02-14 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: pry
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0.9'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0.9'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
33
  version: '2.14'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
40
  version: '2.14'
46
41
  description: Parse and generate hl7 messages for interfacing with health care systems
47
42
  email:
48
- - rome@alivecor.com
43
+ - hportlock@gmail.com
49
44
  executables: []
50
45
  extensions: []
51
46
  extra_rdoc_files: []
52
47
  files:
53
- - .gitignore
48
+ - ".gitignore"
49
+ - ".travis.yml"
54
50
  - Gemfile
55
51
  - LICENSE
56
52
  - README.md
@@ -76,28 +72,28 @@ files:
76
72
  - spec/simple_hl7/segment_spec.rb
77
73
  - spec/simple_hl7/subcomponent_spec.rb
78
74
  homepage: https://github.com/alivecor/simple_hl7
79
- licenses: []
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
80
78
  post_install_message:
81
79
  rdoc_options: []
82
80
  require_paths:
83
81
  - lib
84
82
  required_ruby_version: !ruby/object:Gem::Requirement
85
- none: false
86
83
  requirements:
87
- - - ! '>='
84
+ - - ">="
88
85
  - !ruby/object:Gem::Version
89
86
  version: '0'
90
87
  required_rubygems_version: !ruby/object:Gem::Requirement
91
- none: false
92
88
  requirements:
93
- - - ! '>='
89
+ - - ">="
94
90
  - !ruby/object:Gem::Version
95
91
  version: '0'
96
92
  requirements: []
97
93
  rubyforge_project:
98
- rubygems_version: 1.8.24
94
+ rubygems_version: 2.4.5
99
95
  signing_key:
100
- specification_version: 3
96
+ specification_version: 4
101
97
  summary: Parse and generate hl7 messages
102
98
  test_files:
103
99
  - spec/simple_hl7/component_container_spec.rb