roqua-healthy 1.5.7 → 1.5.12

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: 188f815aa06bc9810fe1218d215bc2d8b0444945a4665c1bb35546bcc8e800b8
4
- data.tar.gz: 8665aacab360207c3bf22037910a4fc58544aebed4f9f5e63b24fb997f7fddbe
3
+ metadata.gz: e402c30237a4c3eeeb578cb4c2a594eba83b6374ce8634259b5bac1c9cf1270b
4
+ data.tar.gz: 344a609880ddf08da1cf0d60dc9e70a1ef2d312a3de887aa11bd71680b5a49bb
5
5
  SHA512:
6
- metadata.gz: f2a6638530dec574f3be0fcd81e534f73d2654af4f5be160d5c933474e8f6db45d49911cd043ad27aabecc8d7ecb42ca1a80d78415c0644e51d19a998510dfe1
7
- data.tar.gz: f74860226be11358e36f2d69acfddf1f7cc20efa5ad439f4e5694c934c477c24ab89b9964442f60ec8fd1efa28a8586ae07a584c0080b31e2c0b91af0037db75
6
+ metadata.gz: 67ad548fab99cf59055a425891d0645afbd22598e4a6ce490f6adc26324289ec3c3c038f777b106c02e3746cdc26dcc8f92547c4661f2da71f7d3ac94932b41c
7
+ data.tar.gz: 42c200b696af931d3666a9aa9e0bddfe0983a3f6180c771dae7cbc4f5983fbd3133bf1dc7dc0539e53b4be2bc58bd70fc2afb76dfc1e4ca594d0e4c03ee9ee44
@@ -1,10 +1,11 @@
1
- image: "registry.roqua.nl/roqua/roqua-build-images:ruby-2.3-rails-base-test"
1
+ image: "registry.roqua.nl/roqua/docker-base-images:ruby-2.5"
2
2
 
3
3
  cache:
4
4
  paths:
5
5
  - .gems
6
6
 
7
7
  before_script:
8
+ - gem uninstall bundler
8
9
  - export BUNDLE_PATH=$CI_PROJECT_DIR/.gems
9
10
  - bundle --jobs 2 --retry 3
10
11
  - gem install appraisal
@@ -13,10 +14,27 @@ before_script:
13
14
  rubocop:
14
15
  script:
15
16
  - bundle exec rubocop -D
16
-
17
- rspec:
17
+
18
+ rails41:
18
19
  script:
19
20
  - bundle exec appraisal rails41 bundle exec rspec
21
+
22
+ rails42:
23
+ script:
20
24
  - bundle exec appraisal rails42 bundle exec rspec
25
+
26
+ rails50:
27
+ script:
21
28
  - bundle exec appraisal rails50 bundle exec rspec
22
29
 
30
+ rails51:
31
+ script:
32
+ - bundle exec appraisal rails51 bundle exec rspec
33
+
34
+ rails52:
35
+ script:
36
+ - bundle exec appraisal rails52 bundle exec rspec
37
+
38
+ rails60:
39
+ script:
40
+ - bundle exec appraisal rails60 bundle exec rspec
@@ -31,3 +31,6 @@ Naming/FileName:
31
31
  Exclude:
32
32
  - Appraisals
33
33
 
34
+ # No, I don't want to call my exceptions 'e' instead of 'exception' or 'error'.
35
+ Naming/RescuedExceptionsVariableName:
36
+ Enabled: false
@@ -20,3 +20,6 @@ Metrics/BlockLength:
20
20
  # URISchemes: http, https
21
21
  Metrics/LineLength:
22
22
  Max: 200
23
+
24
+ Layout/EmptyLineAfterGuardClause:
25
+ Enabled: false
data/Appraisals CHANGED
@@ -11,3 +11,15 @@ end
11
11
  appraise "rails50" do
12
12
  gem "activesupport", "5.0"
13
13
  end
14
+
15
+ appraise "rails51" do
16
+ gem "activesupport", "5.1"
17
+ end
18
+
19
+ appraise "rails52" do
20
+ gem "activesupport", "5.2"
21
+ end
22
+
23
+ appraise "rails60" do
24
+ gem "activesupport", "6.0"
25
+ end
@@ -1,3 +1,23 @@
1
+ ### 1.5.12
2
+
3
+ * ActiveSupport 6.0 support
4
+
5
+ ### 1.5.11
6
+
7
+ * Support for PID.11 and PID.13 completely missing from an hl7 response.
8
+
9
+ ### 1.5.10
10
+
11
+ * Support for house number suffices in PID 11.2
12
+
13
+ ### 1.5.9
14
+
15
+ * Ruby 2.5 support
16
+
17
+ ### 1.5.8
18
+
19
+ * Add NoRouteToHostException in case Healthy cannot route to hl7 message server.
20
+
1
21
  ### 1.5.7
2
22
 
3
23
  * Add deceased attribute (boolean)
data/Guardfile CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- guard 'rspec', cmd: 'bundle exec rspec -f Fuubar' do
2
+ guard 'rspec', cmd: 'bundle exec rspec' do
3
3
  watch(%r{^spec/.+_spec\.rb$})
4
4
  watch(%r{^lib/healthy/(.+)\.rb$}) { |m| ["spec/unit/#{m[1]}_spec.rb", "spec/integration"] }
5
5
  watch('spec/spec_helper.rb') { "spec" }
@@ -2,7 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "codeclimate-test-reporter", "~> 1.0.0", :group => :test, :require => nil
5
+ gem "codeclimate-test-reporter", "~> 1.0.0", group: :test, require: nil
6
+ gem "roqua_styleguide", git: "https://gitlab.roqua.nl/roqua/styleguide.git"
6
7
  gem "activesupport", "4.1"
7
8
 
8
- gemspec :path => "../"
9
+ gemspec path: "../"
@@ -2,7 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "codeclimate-test-reporter", "~> 1.0.0", :group => :test, :require => nil
5
+ gem "codeclimate-test-reporter", "~> 1.0.0", group: :test, require: nil
6
+ gem "roqua_styleguide", git: "https://gitlab.roqua.nl/roqua/styleguide.git"
6
7
  gem "activesupport", "4.2"
7
8
 
8
- gemspec :path => "../"
9
+ gemspec path: "../"
@@ -2,7 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "codeclimate-test-reporter", "~> 1.0.0", :group => :test, :require => nil
5
+ gem "codeclimate-test-reporter", "~> 1.0.0", group: :test, require: nil
6
+ gem "roqua_styleguide", git: "https://gitlab.roqua.nl/roqua/styleguide.git"
6
7
  gem "activesupport", "5.0"
7
8
 
8
- gemspec :path => "../"
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "codeclimate-test-reporter", "~> 1.0.0", group: :test, require: nil
6
+ gem "roqua_styleguide", git: "https://gitlab.roqua.nl/roqua/styleguide.git"
7
+ gem "activesupport", "5.1"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "codeclimate-test-reporter", "~> 1.0.0", group: :test, require: nil
6
+ gem "roqua_styleguide", git: "https://gitlab.roqua.nl/roqua/styleguide.git"
7
+ gem "activesupport", "5.2"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "codeclimate-test-reporter", "~> 1.0.0", group: :test, require: nil
6
+ gem "roqua_styleguide", git: "https://gitlab.roqua.nl/roqua/styleguide.git"
7
+ gem "activesupport", "6.0"
8
+
9
+ gemspec path: "../"
@@ -16,7 +16,15 @@ module Roqua
16
16
 
17
17
  def street
18
18
  return nil if record.blank? || record.fetch('PID.11.1').blank?
19
- record.fetch('PID.11.1').fetch('PID.11.1.1')
19
+
20
+ street = record.fetch('PID.11.1').fetch('PID.11.1.1')
21
+ suffix = record.fetch('PID.11.2', nil)
22
+
23
+ if suffix.present? && !street.end_with?(suffix)
24
+ street + suffix
25
+ else
26
+ street
27
+ end
20
28
  end
21
29
 
22
30
  def city
@@ -50,7 +58,7 @@ module Roqua
50
58
  private
51
59
 
52
60
  def get_address_of_type(message, type)
53
- message.fetch('PID').fetch('PID.11').find do |record|
61
+ message.dig('PID', 'PID.11')&.find do |record|
54
62
  record.fetch('PID.11.7', :unknown_type_of_address_record) == type
55
63
  end
56
64
  end
@@ -11,7 +11,7 @@ module Roqua
11
11
 
12
12
  # this is a heuristic to pick likely dutch cell phone numbers from hl7 messages
13
13
  def to_s
14
- pid13 = message.fetch('PID').fetch('PID.13')
14
+ pid13 = message.dig('PID', 'PID.13') || []
15
15
 
16
16
  # prefer PRN (Primary Residence Number) that contains a cell phone number
17
17
  phone_cell_record = pid13.find do |record|
@@ -19,33 +19,33 @@ module Roqua
19
19
  raise ::Roqua::Healthy::PatientNotFound unless message['PID'].present?
20
20
  message['PID']['PID.3'] = [message.fetch('PID').fetch('PID.3')].flatten.compact
21
21
  message['PID']['PID.5'] = [message.fetch('PID').fetch('PID.5')].flatten.compact
22
- message['PID']['PID.11'] = [message.fetch('PID').fetch('PID.11')].flatten.compact
23
- message['PID']['PID.13'] = [message.fetch('PID').fetch('PID.13')].flatten.compact
22
+ message['PID']['PID.11'] = [message.dig('PID', 'PID.11')].flatten.compact
23
+ message['PID']['PID.13'] = [message.dig('PID', 'PID.13')].flatten.compact
24
24
  @message = MessageCleaner.new(message).message
25
25
  end
26
26
 
27
27
  # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
28
28
  def to_patient
29
29
  {
30
- status: status,
31
- source: source,
32
- identities: identities,
33
- firstname: name.firstname,
34
- initials: name.initials,
35
- lastname: name.lastname,
30
+ status: status,
31
+ source: source,
32
+ identities: identities,
33
+ firstname: name.firstname,
34
+ initials: name.initials,
35
+ lastname: name.lastname,
36
36
  display_name: name.display_name,
37
- nickname: name.nickname,
38
- email: email,
37
+ nickname: name.nickname,
38
+ email: email,
39
39
  address_type: address.address_type,
40
- street: address.street,
41
- city: address.city,
42
- zipcode: address.zipcode,
43
- country: address.country,
44
- birthdate: birthdate,
45
- gender: gender,
46
- phone_cell: phone_cell,
47
- medoq_data: medoq_data,
48
- deceased: deceased
40
+ street: address.street,
41
+ city: address.city,
42
+ zipcode: address.zipcode,
43
+ country: address.country,
44
+ birthdate: birthdate,
45
+ gender: gender,
46
+ phone_cell: phone_cell,
47
+ medoq_data: medoq_data,
48
+ deceased: deceased
49
49
  }
50
50
  end
51
51
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
@@ -9,6 +9,7 @@ module Roqua
9
9
  class Timeout < ConnectionError; end
10
10
  class HostUnreachable < ConnectionError; end
11
11
  class ConnectionRefused < ConnectionError; end
12
+ class NoRouteToHost < ConnectionError; end
12
13
 
13
14
  class UnknownFailure < Error; end
14
15
  class PatientIdNotInRemote < Error; end
@@ -46,6 +47,8 @@ module Roqua
46
47
  ::Roqua::Healthy::ConnectionRefused,
47
48
  'ERROR: ConnectException: Connection refused' =>
48
49
  ::Roqua::Healthy::ConnectionRefused,
50
+ 'ERROR: NoRouteToHostException: No route to host' =>
51
+ ::Roqua::Healthy::NoRouteToHost,
49
52
  "ERROR: NACK sent from receiver. (Rejected)" =>
50
53
  ::Roqua::Healthy::NACK,
51
54
  "ERROR: NACK sent from receiver. (Error)" => # ie. Patient not found
@@ -22,7 +22,6 @@ module Roqua
22
22
  headers: {content_type: 'text/xml'},
23
23
  timeout: timeout.to_i
24
24
  ) do |response, _request, _result|
25
-
26
25
  xml_response = Hash.from_xml(response.body)
27
26
 
28
27
  if response.code == 200 && xml_response['oru']['status'] == 'ACK'
@@ -2,6 +2,6 @@
2
2
  module Roqua
3
3
  module Healthy
4
4
  # healthy version
5
- VERSION = "1.5.7"
5
+ VERSION = "1.5.12"
6
6
  end
7
7
  end
@@ -20,24 +20,23 @@ Gem::Specification.new do |gem|
20
20
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
21
21
  gem.require_paths = ['lib']
22
22
 
23
- gem.add_dependency 'activesupport', '>= 3.2', '< 6'
23
+ gem.add_dependency 'activesupport', '>= 3.2', '< 6.1'
24
24
  gem.add_dependency 'addressable', '~> 2.3'
25
25
  gem.add_dependency 'builder'
26
26
  gem.add_dependency 'phonelib', '~> 0.6'
27
27
  gem.add_dependency 'rest-client', '>= 2.0.2'
28
- gem.add_dependency 'roqua-support', '~> 0.1.22'
28
+ gem.add_dependency 'roqua-support', '~> 0.3.0'
29
29
 
30
30
  gem.add_development_dependency 'appraisal'
31
- gem.add_development_dependency 'bundler', '~> 1.0'
31
+ gem.add_development_dependency 'bundler'
32
32
  gem.add_development_dependency 'rake', '~> 10.0'
33
33
  gem.add_development_dependency 'rspec', '~> 3.3.0'
34
34
  gem.add_development_dependency 'yard', '~> 0.8'
35
35
 
36
36
  # Required for the tests
37
- gem.add_development_dependency 'webmock', '~> 1.13'
37
+ gem.add_development_dependency 'webmock', '~> 3.2'
38
38
 
39
39
  # Workflow and tools
40
- gem.add_development_dependency 'fuubar'
41
40
  gem.add_development_dependency 'guard', '~> 2.1'
42
41
  gem.add_development_dependency 'guard-rspec', '~> 4.2.4'
43
42
  gem.add_development_dependency 'guard-rubocop', '~> 1.2.0'
@@ -0,0 +1,335 @@
1
+ <HL7Message>
2
+ <MSH>
3
+ <MSH.1>|</MSH.1>
4
+ <MSH.2>^~\&amp;</MSH.2>
5
+ <MSH.3>
6
+ <MSH.3.1>XMCARE</MSH.3.1>
7
+ </MSH.3>
8
+ <MSH.4>
9
+ <MSH.4.1>ZIS</MSH.4.1>
10
+ </MSH.4>
11
+ <MSH.5>
12
+ <MSH.5.1>ROQUA</MSH.5.1>
13
+ </MSH.5>
14
+ <MSH.6>
15
+ <MSH.6.1>RGOC</MSH.6.1>
16
+ </MSH.6>
17
+ <MSH.7>
18
+ <MSH.7.1>20190620121912</MSH.7.1>
19
+ </MSH.7>
20
+ <MSH.8/>
21
+ <MSH.9>
22
+ <MSH.9.1>ADR</MSH.9.1>
23
+ <MSH.9.2>A19</MSH.9.2>
24
+ <MSH.9.3>ADR_A19</MSH.9.3>
25
+ </MSH.9>
26
+ <MSH.10>
27
+ <MSH.10.1>10883208</MSH.10.1>
28
+ </MSH.10>
29
+ <MSH.11>
30
+ <MSH.11.1>P</MSH.11.1>
31
+ </MSH.11>
32
+ <MSH.12>
33
+ <MSH.12.1>2.4</MSH.12.1>
34
+ </MSH.12>
35
+ <MSH.13/>
36
+ <MSH.14/>
37
+ <MSH.15>
38
+ <MSH.15.1>NE</MSH.15.1>
39
+ </MSH.15>
40
+ <MSH.16>
41
+ <MSH.16.1>NE</MSH.16.1>
42
+ </MSH.16>
43
+ </MSH>
44
+ <MSA>
45
+ <MSA.1>
46
+ <MSA.1.1>CA</MSA.1.1>
47
+ </MSA.1>
48
+ <MSA.2>
49
+ <MSA.2.1>20190620121912766</MSA.2.1>
50
+ </MSA.2>
51
+ </MSA>
52
+ <QRD>
53
+ <QRD.1>
54
+ <QRD.1.1>20190620121912</QRD.1.1>
55
+ </QRD.1>
56
+ <QRD.2>
57
+ <QRD.2.1>R</QRD.2.1>
58
+ </QRD.2>
59
+ <QRD.3>
60
+ <QRD.3.1>I</QRD.3.1>
61
+ </QRD.3>
62
+ <QRD.4>
63
+ <QRD.4.1>766</QRD.4.1>
64
+ </QRD.4>
65
+ <QRD.5/>
66
+ <QRD.6/>
67
+ <QRD.7>
68
+ <QRD.7.1>1</QRD.7.1>
69
+ <QRD.7.2>RD</QRD.7.2>
70
+ </QRD.7>
71
+ <QRD.8>
72
+ <QRD.8.1>1234567890</QRD.8.1>
73
+ </QRD.8>
74
+ <QRD.9>
75
+ <QRD.9.1>DEM</QRD.9.1>
76
+ </QRD.9>
77
+ </QRD>
78
+ <PID>
79
+ <PID.1>
80
+ <PID.1.1>1</PID.1.1>
81
+ </PID.1>
82
+ <PID.2/>
83
+ <PID.3>
84
+ <PID.3.1>1234567890</PID.3.1>
85
+ <PID.3.2/>
86
+ <PID.3.3/>
87
+ <PID.3.4>XMCARE</PID.3.4>
88
+ <PID.3.5>PI</PID.3.5>
89
+ </PID.3>
90
+ <PID.3>
91
+ <PID.3.1>999991234</PID.3.1>
92
+ <PID.3.2/>
93
+ <PID.3.3/>
94
+ <PID.3.4>NLMINBIZA</PID.3.4>
95
+ <PID.3.5>NNNLD</PID.3.5>
96
+ <PID.3.6/>
97
+ <PID.3.7>20190123</PID.3.7>
98
+ </PID.3>
99
+ <PID.3>
100
+ <PID.3.1>""</PID.3.1>
101
+ <PID.3.2/>
102
+ <PID.3.3/>
103
+ <PID.3.4/>
104
+ <PID.3.5>IBAN</PID.3.5>
105
+ </PID.3>
106
+ <PID.3>
107
+ <PID.3.1>""</PID.3.1>
108
+ <PID.3.2/>
109
+ <PID.3.3/>
110
+ <PID.3.4>GIRO</PID.3.4>
111
+ <PID.3.5>BA</PID.3.5>
112
+ </PID.3>
113
+ <PID.3>
114
+ <PID.3.1>""</PID.3.1>
115
+ <PID.3.2/>
116
+ <PID.3.3/>
117
+ <PID.3.4>BANK</PID.3.4>
118
+ <PID.3.5>BA</PID.3.5>
119
+ </PID.3>
120
+ <PID.4/>
121
+ <PID.5>
122
+ <PID.5.1>
123
+ <PID.5.1.1>Anton</PID.5.1.1>
124
+ <PID.5.1.2>""</PID.5.1.2>
125
+ <PID.5.1.3>Anton</PID.5.1.3>
126
+ <PID.5.1.4>""</PID.5.1.4>
127
+ <PID.5.1.5>""</PID.5.1.5>
128
+ </PID.5.1>
129
+ <PID.5.2>B</PID.5.2>
130
+ <PID.5.3>C</PID.5.3>
131
+ <PID.5.4/>
132
+ <PID.5.5/>
133
+ <PID.5.6/>
134
+ <PID.5.7>L</PID.5.7>
135
+ </PID.5>
136
+ <PID.5>
137
+ <PID.5.1>Anton</PID.5.1>
138
+ <PID.5.2/>
139
+ <PID.5.3/>
140
+ <PID.5.4/>
141
+ <PID.5.5/>
142
+ <PID.5.6/>
143
+ <PID.5.7>D</PID.5.7>
144
+ </PID.5>
145
+ <PID.5>
146
+ <PID.5.1/>
147
+ <PID.5.2>Tirol</PID.5.2>
148
+ <PID.5.3/>
149
+ <PID.5.4/>
150
+ <PID.5.5/>
151
+ <PID.5.6/>
152
+ <PID.5.7>N</PID.5.7>
153
+ </PID.5>
154
+ <PID.6/>
155
+ <PID.7>
156
+ <PID.7.1>19991212</PID.7.1>
157
+ </PID.7>
158
+ <PID.8>
159
+ <PID.8.1>M</PID.8.1>
160
+ </PID.8>
161
+ <PID.9/>
162
+ <PID.10/>
163
+ <PID.11/>
164
+ <PID.11>
165
+ <PID.11.1>
166
+ <PID.11.1.1>Straatnaam 123</PID.11.1.1>
167
+ <PID.11.1.2>Straatnaam</PID.11.1.2>
168
+ <PID.11.1.3>123</PID.11.1.3>
169
+ </PID.11.1>
170
+ <PID.11.2>ab</PID.11.2>
171
+ <PID.11.3>DEURNE</PID.11.3>
172
+ <PID.11.4/>
173
+ <PID.11.5>1234AB</PID.11.5>
174
+ <PID.11.6>NL</PID.11.6>
175
+ <PID.11.7>H</PID.11.7>
176
+ </PID.11>
177
+ <PID.11>
178
+ <PID.11.1>
179
+ <PID.11.1.1/>
180
+ <PID.11.1.2>""</PID.11.1.2>
181
+ <PID.11.1.3>""</PID.11.1.3>
182
+ </PID.11.1>
183
+ <PID.11.2>""</PID.11.2>
184
+ <PID.11.3>'S-GRAVENHAGE</PID.11.3>
185
+ <PID.11.4/>
186
+ <PID.11.5>""</PID.11.5>
187
+ <PID.11.6>NL</PID.11.6>
188
+ <PID.11.7>N</PID.11.7>
189
+ </PID.11>
190
+ <PID.11>
191
+ <PID.11.1>
192
+ <PID.11.1.1/>
193
+ <PID.11.1.2>""</PID.11.1.2>
194
+ <PID.11.1.3>""</PID.11.1.3>
195
+ </PID.11.1>
196
+ <PID.11.2>""</PID.11.2>
197
+ <PID.11.3>""</PID.11.3>
198
+ <PID.11.4/>
199
+ <PID.11.5>""</PID.11.5>
200
+ <PID.11.6>""</PID.11.6>
201
+ <PID.11.7>C</PID.11.7>
202
+ </PID.11>
203
+ <PID.12/>
204
+ <PID.13>
205
+ <PID.13.1>0123-444444</PID.13.1>
206
+ <PID.13.2>PRN</PID.13.2>
207
+ <PID.13.3>PH</PID.13.3>
208
+ </PID.13>
209
+ <PID.13>
210
+ <PID.13.1>0031612345678</PID.13.1>
211
+ <PID.13.2>ORN</PID.13.2>
212
+ <PID.13.3>PH</PID.13.3>
213
+ </PID.13>
214
+ <PID.13>
215
+ <PID.13.1>""</PID.13.1>
216
+ <PID.13.2>ORN</PID.13.2>
217
+ <PID.13.3>FX</PID.13.3>
218
+ </PID.13>
219
+ <PID.13>
220
+ <PID.13.1/>
221
+ <PID.13.2>NET</PID.13.2>
222
+ <PID.13.3>Internet</PID.13.3>
223
+ <PID.13.4>voornaam+test@example.org</PID.13.4>
224
+ </PID.13>
225
+ <PID.14/>
226
+ <PID.15/>
227
+ <PID.16/>
228
+ <PID.17/>
229
+ <PID.18/>
230
+ <PID.19/>
231
+ <PID.20/>
232
+ <PID.21/>
233
+ <PID.22/>
234
+ <PID.23/>
235
+ <PID.24/>
236
+ <PID.25/>
237
+ <PID.26>
238
+ <PID.26.1>""</PID.26.1>
239
+ </PID.26>
240
+ <PID.27/>
241
+ <PID.28/>
242
+ <PID.29>
243
+ <PID.29.1>""</PID.29.1>
244
+ </PID.29>
245
+ <PID.30>
246
+ <PID.30.1>N</PID.30.1>
247
+ </PID.30>
248
+ <PID.31>
249
+ <PID.31.1>N</PID.31.1>
250
+ </PID.31>
251
+ </PID>
252
+ <ROL>
253
+ <ROL.1/>
254
+ <ROL.2>
255
+ <ROL.2.1>UP</ROL.2.1>
256
+ </ROL.2>
257
+ <ROL.3>
258
+ <ROL.3.1>PP</ROL.3.1>
259
+ </ROL.3>
260
+ <ROL.4>
261
+ <ROL.4.1>BENU-DEUR</ROL.4.1>
262
+ <ROL.4.2>
263
+ <ROL.4.2.1/>
264
+ <ROL.4.2.2/>
265
+ <ROL.4.2.3>Benu Apotheek</ROL.4.2.3>
266
+ </ROL.4.2>
267
+ <ROL.4.3/>
268
+ <ROL.4.4/>
269
+ <ROL.4.5/>
270
+ <ROL.4.6/>
271
+ <ROL.4.7/>
272
+ <ROL.4.8>P</ROL.4.8>
273
+ <ROL.4.9>LOCAL</ROL.4.9>
274
+ </ROL.4>
275
+ <ROL.4>
276
+ <ROL.4.1>01239000</ROL.4.1>
277
+ <ROL.4.2/>
278
+ <ROL.4.3/>
279
+ <ROL.4.4/>
280
+ <ROL.4.5/>
281
+ <ROL.4.6/>
282
+ <ROL.4.7/>
283
+ <ROL.4.8>02</ROL.4.8>
284
+ <ROL.4.9>VEKTIS</ROL.4.9>
285
+ </ROL.4>
286
+ <ROL.5/>
287
+ <ROL.6/>
288
+ <ROL.7/>
289
+ <ROL.8/>
290
+ <ROL.9>
291
+ <ROL.9.1>02</ROL.9.1>
292
+ <ROL.9.2/>
293
+ <ROL.9.3>VEKTIS</ROL.9.3>
294
+ </ROL.9>
295
+ </ROL>
296
+ <ROL>
297
+ <ROL.1/>
298
+ <ROL.2>
299
+ <ROL.2.1>UP</ROL.2.1>
300
+ </ROL.2>
301
+ <ROL.3>
302
+ <ROL.3.1>PP</ROL.3.1>
303
+ </ROL.3>
304
+ <ROL.4>
305
+ <ROL.4.1>OPEN-DEUR</ROL.4.1>
306
+ <ROL.4.2>
307
+ <ROL.4.2.1/>
308
+ <ROL.4.2.2>de</ROL.4.2.2>
309
+ <ROL.4.2.3>Open</ROL.4.2.3>
310
+ </ROL.4.2>
311
+ <ROL.4.3>M</ROL.4.3>
312
+ <ROL.4.4>P</ROL.4.4>
313
+ <ROL.4.5/>
314
+ <ROL.4.6/>
315
+ <ROL.4.7/>
316
+ <ROL.4.8>H</ROL.4.8>
317
+ <ROL.4.9>LOCAL</ROL.4.9>
318
+ </ROL.4>
319
+ <ROL.5/>
320
+ <ROL.6/>
321
+ <ROL.7/>
322
+ <ROL.8/>
323
+ <ROL.9>
324
+ <ROL.9.1>01</ROL.9.1>
325
+ <ROL.9.2/>
326
+ <ROL.9.3>VEKTIS</ROL.9.3>
327
+ </ROL.9>
328
+ </ROL>
329
+ <PV1>
330
+ <PV1.1/>
331
+ <PV1.2>
332
+ <PV1.2.1>O</PV1.2.1>
333
+ </PV1.2>
334
+ </PV1>
335
+ </HL7Message>
@@ -0,0 +1,162 @@
1
+ <?xml version="1.0"?>
2
+ <HL7Message>
3
+ <MSH>
4
+ <MSH.1>|</MSH.1>
5
+ <MSH.2>^~\&amp;</MSH.2>
6
+ <MSH.3>
7
+ <MSH.3.1>XMCARE</MSH.3.1>
8
+ </MSH.3>
9
+ <MSH.4>
10
+ <MSH.4.1>ZIS</MSH.4.1>
11
+ </MSH.4>
12
+ <MSH.5>
13
+ <MSH.5.1>ROQUA</MSH.5.1>
14
+ </MSH.5>
15
+ <MSH.6>
16
+ <MSH.6.1>RGOC</MSH.6.1>
17
+ </MSH.6>
18
+ <MSH.7>
19
+ <MSH.7.1>20130924132007</MSH.7.1>
20
+ </MSH.7>
21
+ <MSH.8/>
22
+ <MSH.9>
23
+ <MSH.9.1>ADR</MSH.9.1>
24
+ <MSH.9.2>A19</MSH.9.2>
25
+ <MSH.9.3>ADR_A19</MSH.9.3>
26
+ </MSH.9>
27
+ <MSH.10>
28
+ <MSH.10.1>23099201</MSH.10.1>
29
+ </MSH.10>
30
+ <MSH.11>
31
+ <MSH.11.1>P</MSH.11.1>
32
+ </MSH.11>
33
+ <MSH.12>
34
+ <MSH.12.1>2.4</MSH.12.1>
35
+ </MSH.12>
36
+ <MSH.13/>
37
+ <MSH.14/>
38
+ <MSH.15>
39
+ <MSH.15.1>NE</MSH.15.1>
40
+ </MSH.15>
41
+ <MSH.16>
42
+ <MSH.16.1>NE</MSH.16.1>
43
+ </MSH.16>
44
+ </MSH>
45
+ <MSA>
46
+ <MSA.1>
47
+ <MSA.1.1>CA</MSA.1.1>
48
+ </MSA.1>
49
+ <MSA.2>
50
+ <MSA.2.1>2013092413200823</MSA.2.1>
51
+ </MSA.2>
52
+ </MSA>
53
+ <QRD>
54
+ <QRD.1>
55
+ <QRD.1.1>20130924132008</QRD.1.1>
56
+ </QRD.1>
57
+ <QRD.2>
58
+ <QRD.2.1>R</QRD.2.1>
59
+ </QRD.2>
60
+ <QRD.3>
61
+ <QRD.3.1>I</QRD.3.1>
62
+ </QRD.3>
63
+ <QRD.4>
64
+ <QRD.4.1>23</QRD.4.1>
65
+ </QRD.4>
66
+ <QRD.5/>
67
+ <QRD.6/>
68
+ <QRD.7>
69
+ <QRD.7.1>1</QRD.7.1>
70
+ <QRD.7.2>RD</QRD.7.2>
71
+ </QRD.7>
72
+ <QRD.8>
73
+ <QRD.8.1>12345678901</QRD.8.1>
74
+ </QRD.8>
75
+ <QRD.9>
76
+ <QRD.9.1>DEM</QRD.9.1>
77
+ </QRD.9>
78
+ </QRD>
79
+ <PID>
80
+ <PID.1>
81
+ <PID.1.1>1</PID.1.1>
82
+ </PID.1>
83
+ <PID.2/>
84
+ <PID.3>
85
+ <PID.3.1>12345678901</PID.3.1>
86
+ <PID.3.2/>
87
+ <PID.3.3/>
88
+ <PID.3.4>XMCARE</PID.3.4>
89
+ <PID.3.5>PI</PID.3.5>
90
+ </PID.3>
91
+ <PID.3>
92
+ <PID.3.1>123456789</PID.3.1>
93
+ <PID.3.2/>
94
+ <PID.3.3/>
95
+ <PID.3.4>NLMINBIZA</PID.3.4>
96
+ <PID.3.5>NNNLD</PID.3.5>
97
+ <PID.3.6/>
98
+ <PID.3.7>20120820</PID.3.7>
99
+ </PID.3>
100
+ <PID.3>
101
+ <PID.3.1>""</PID.3.1>
102
+ <PID.3.2/>
103
+ <PID.3.3/>
104
+ <PID.3.4/>
105
+ <PID.3.5>IBAN</PID.3.5>
106
+ </PID.3>
107
+ <PID.3>
108
+ <PID.3.1>""</PID.3.1>
109
+ <PID.3.2/>
110
+ <PID.3.3/>
111
+ <PID.3.4>GIRO</PID.3.4>
112
+ <PID.3.5>BA</PID.3.5>
113
+ </PID.3>
114
+ <PID.3>
115
+ <PID.3.1>""</PID.3.1>
116
+ <PID.3.2/>
117
+ <PID.3.3/>
118
+ <PID.3.4>BANK</PID.3.4>
119
+ <PID.3.5>BA</PID.3.5>
120
+ </PID.3>
121
+ <PID.4/>
122
+ <PID.5>
123
+ <PID.5.1>
124
+ <PID.5.1.1>Achternaam</PID.5.1.1>
125
+ <PID.5.1.2>""</PID.5.1.2>
126
+ <PID.5.1.3>Achternaam</PID.5.1.3>
127
+ <PID.5.1.4>""</PID.5.1.4>
128
+ <PID.5.1.5>""</PID.5.1.5>
129
+ </PID.5.1>
130
+ <PID.5.2>A</PID.5.2>
131
+ <PID.5.3>B</PID.5.3>
132
+ <PID.5.4/>
133
+ <PID.5.5/>
134
+ <PID.5.6/>
135
+ <PID.5.7>L</PID.5.7>
136
+ </PID.5>
137
+ <PID.5>
138
+ <PID.5.1>Achternaam</PID.5.1>
139
+ <PID.5.2/>
140
+ <PID.5.3/>
141
+ <PID.5.4/>
142
+ <PID.5.5/>
143
+ <PID.5.6/>
144
+ <PID.5.7>D</PID.5.7>
145
+ </PID.5>
146
+ <PID.5>
147
+ <PID.5.1/>
148
+ <PID.5.2>Babette</PID.5.2>
149
+ <PID.5.3/>
150
+ <PID.5.4/>
151
+ <PID.5.5/>
152
+ <PID.5.6/>
153
+ <PID.5.7>N</PID.5.7>
154
+ </PID.5>
155
+ <PID.7>
156
+ <PID.7.1>17070415</PID.7.1>
157
+ </PID.7>
158
+ <PID.8>
159
+ <PID.8.1>F</PID.8.1>
160
+ </PID.8>
161
+ </PID>
162
+ </HL7Message>
@@ -207,6 +207,24 @@ describe 'Fetching A19 from XMcare' do
207
207
  end
208
208
  end
209
209
 
210
+ describe 'a patient with an address suffix' do
211
+ before { load_fixture 'xmcare_house_number_addendum', '1234567890' }
212
+ subject { Roqua::Healthy::A19.fetch("1234567890") }
213
+
214
+ it 'returns the street with suffix appended' do
215
+ expect(subject[:street]).to eq("Straatnaam 123ab")
216
+ end
217
+ end
218
+
219
+ describe 'a patient with no PID.11 (address) or PID.13 (phone) at all' do
220
+ before { load_fixture 'xmcare_missing_whole_pids', '12345678901' }
221
+ subject { Roqua::Healthy::A19.fetch("12345678901") }
222
+
223
+ it 'loads the rest' do
224
+ expect(subject[:firstname]).to eq("Babette")
225
+ end
226
+ end
227
+
210
228
  describe 'a patient that does not exist' do
211
229
  before { load_fixture 'xmcare_patient_not_found', '12345678901' }
212
230
 
@@ -8,6 +8,7 @@ describe Roqua::Healthy::A19::AddressParser do
8
8
  if types.include?('M')
9
9
  addresses << {'PID.11.7' => 'M',
10
10
  'PID.11.1' => {'PID.11.1.1' => 'Mailstreet 1'},
11
+ 'PID.11.2' => '',
11
12
  'PID.11.3' => 'Mailcity',
12
13
  'PID.11.5' => 'Mailzipcode',
13
14
  'PID.11.6' => 'Mailcountry'}
@@ -53,6 +54,11 @@ describe Roqua::Healthy::A19::AddressParser do
53
54
  parser = described_class.new(message)
54
55
  expect(parser.address_type).to be_nil
55
56
  end
57
+
58
+ it 'handles missing PID' do
59
+ parser = described_class.new('PID' => {})
60
+ expect(parser.address_type).to be_nil
61
+ end
56
62
  end
57
63
 
58
64
  describe '#street' do
@@ -73,6 +79,35 @@ describe Roqua::Healthy::A19::AddressParser do
73
79
  parser = described_class.new(message)
74
80
  expect(parser.street).to be_nil
75
81
  end
82
+
83
+ it 'appends house number suffix' do
84
+ addresses = [{'PID.11.7' => 'M',
85
+ 'PID.11.1' => {'PID.11.1.1' => 'Homestreet 1'},
86
+ 'PID.11.2' => "ab",
87
+ 'PID.11.3' => 'Homecity',
88
+ 'PID.11.5' => 'Homezipcode',
89
+ 'PID.11.6' => 'Homecountry'}]
90
+ message = {'PID' => {'PID.11' => addresses}}
91
+ parser = described_class.new(message)
92
+ expect(parser.street).to eq("Homestreet 1ab")
93
+ end
94
+
95
+ it 'does not append house number suffix if full field already ends in it' do
96
+ addresses = [{'PID.11.7' => 'M',
97
+ 'PID.11.1' => {'PID.11.1.1' => 'Homestreet 1ab'},
98
+ 'PID.11.2' => "ab",
99
+ 'PID.11.3' => 'Homecity',
100
+ 'PID.11.5' => 'Homezipcode',
101
+ 'PID.11.6' => 'Homecountry'}]
102
+ message = {'PID' => {'PID.11' => addresses}}
103
+ parser = described_class.new(message)
104
+ expect(parser.street).to eq("Homestreet 1ab")
105
+ end
106
+
107
+ it 'handles missing PID' do
108
+ parser = described_class.new('PID' => {})
109
+ expect(parser.street).to be_nil
110
+ end
76
111
  end
77
112
 
78
113
  describe '#city' do
@@ -93,6 +128,11 @@ describe Roqua::Healthy::A19::AddressParser do
93
128
  parser = described_class.new(message)
94
129
  expect(parser.city).to be_nil
95
130
  end
131
+
132
+ it 'handles missing PID' do
133
+ parser = described_class.new('PID' => {})
134
+ expect(parser.city).to be_nil
135
+ end
96
136
  end
97
137
 
98
138
  describe '#zipcode' do
@@ -113,6 +153,10 @@ describe Roqua::Healthy::A19::AddressParser do
113
153
  parser = described_class.new(message)
114
154
  expect(parser.zipcode).to be_nil
115
155
  end
156
+ it 'handles missing PID' do
157
+ parser = described_class.new('PID' => {})
158
+ expect(parser.zipcode).to be_nil
159
+ end
116
160
  end
117
161
 
118
162
  describe '#country' do
@@ -133,6 +177,11 @@ describe Roqua::Healthy::A19::AddressParser do
133
177
  parser = described_class.new(message)
134
178
  expect(parser.country).to be_nil
135
179
  end
180
+
181
+ it 'handles missing PID' do
182
+ parser = described_class.new('PID' => {})
183
+ expect(parser.country).to be_nil
184
+ end
136
185
  end
137
186
  # rubocop:enable Metrics/MethodLength
138
187
  end
@@ -31,6 +31,13 @@ RSpec.describe Roqua::Healthy::A19::PhoneParser do
31
31
  it { should be_nil }
32
32
  end
33
33
 
34
+ describe 'no phone number field at all' do
35
+ let(:message) do
36
+ {'PID' => {}}
37
+ end
38
+ it { should be_nil }
39
+ end
40
+
34
41
  describe 'mobile type in PRN is preferred over other mobile numbers' do
35
42
  let(:message) do
36
43
  {'PID' => {'PID.13' => [{'PID.13.1' => '0612345678', 'PID.13.2' => 'CP'},
@@ -31,17 +31,23 @@ describe Roqua::Healthy::A19::ResponseValidator do
31
31
  end
32
32
 
33
33
  context "Unable to connect to destination\tConnectException\tConnection refused" do
34
- it 'raises ::Roqua::Healthy::Timeout' do
34
+ it 'raises ::Roqua::Healthy::ConnectionRefused' do
35
35
  expect { subject.validate }.to raise_error(::Roqua::Healthy::ConnectionRefused)
36
36
  end
37
37
  end
38
38
 
39
39
  context 'ERROR: ConnectException: Connection refused' do
40
- it 'raises ::Roqua::Healthy::Timeout' do
40
+ it 'raises ::Roqua::Healthy::ConnectionRefused' do
41
41
  expect { subject.validate }.to raise_error(::Roqua::Healthy::ConnectionRefused)
42
42
  end
43
43
  end
44
44
 
45
+ context 'ERROR: NoRouteToHostException: No route to host' do
46
+ it 'raises ::Roqua::Healthy::NoRouteToHost' do
47
+ expect { subject.validate }.to raise_error(::Roqua::Healthy::NoRouteToHost)
48
+ end
49
+ end
50
+
45
51
  context "ERROR: NACK sent from receiver. (Rejected)" do
46
52
  it 'raises ::Roqua::Healthy::NACK' do
47
53
  expect { subject.validate }.to raise_error(::Roqua::Healthy::NACK)
@@ -10,7 +10,7 @@ RSpec.describe Roqua::Healthy::Oru::Client do
10
10
  'hash%3E%0A++%3Coru+type%3D%22symbol%22%3Edata%3C%2Foru%3E%0A%3C%2Fhash%3E%0A',
11
11
  headers: {
12
12
  'Accept' => '*/*',
13
- 'Accept-Encoding' => 'gzip, deflate',
13
+ 'Accept-Encoding' => /gzip.*?deflate.*/,
14
14
  'Content-Length' => '140',
15
15
  'Content-Type' => 'text/xml'
16
16
  }
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roqua-healthy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.7
4
+ version: 1.5.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  - Jorn van de Beek
9
9
  - Samuel Esposito
10
10
  - Henk van der Veen
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-05-24 00:00:00.000000000 Z
14
+ date: 2020-07-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '3.2'
23
23
  - - "<"
24
24
  - !ruby/object:Gem::Version
25
- version: '6'
25
+ version: '6.1'
26
26
  type: :runtime
27
27
  prerelease: false
28
28
  version_requirements: !ruby/object:Gem::Requirement
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '3.2'
33
33
  - - "<"
34
34
  - !ruby/object:Gem::Version
35
- version: '6'
35
+ version: '6.1'
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: addressable
38
38
  requirement: !ruby/object:Gem::Requirement
@@ -95,14 +95,14 @@ dependencies:
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: 0.1.22
98
+ version: 0.3.0
99
99
  type: :runtime
100
100
  prerelease: false
101
101
  version_requirements: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - "~>"
104
104
  - !ruby/object:Gem::Version
105
- version: 0.1.22
105
+ version: 0.3.0
106
106
  - !ruby/object:Gem::Dependency
107
107
  name: appraisal
108
108
  requirement: !ruby/object:Gem::Requirement
@@ -121,16 +121,16 @@ dependencies:
121
121
  name: bundler
122
122
  requirement: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - "~>"
124
+ - - ">="
125
125
  - !ruby/object:Gem::Version
126
- version: '1.0'
126
+ version: '0'
127
127
  type: :development
128
128
  prerelease: false
129
129
  version_requirements: !ruby/object:Gem::Requirement
130
130
  requirements:
131
- - - "~>"
131
+ - - ">="
132
132
  - !ruby/object:Gem::Version
133
- version: '1.0'
133
+ version: '0'
134
134
  - !ruby/object:Gem::Dependency
135
135
  name: rake
136
136
  requirement: !ruby/object:Gem::Requirement
@@ -179,28 +179,14 @@ dependencies:
179
179
  requirements:
180
180
  - - "~>"
181
181
  - !ruby/object:Gem::Version
182
- version: '1.13'
182
+ version: '3.2'
183
183
  type: :development
184
184
  prerelease: false
185
185
  version_requirements: !ruby/object:Gem::Requirement
186
186
  requirements:
187
187
  - - "~>"
188
188
  - !ruby/object:Gem::Version
189
- version: '1.13'
190
- - !ruby/object:Gem::Dependency
191
- name: fuubar
192
- requirement: !ruby/object:Gem::Requirement
193
- requirements:
194
- - - ">="
195
- - !ruby/object:Gem::Version
196
- version: '0'
197
- type: :development
198
- prerelease: false
199
- version_requirements: !ruby/object:Gem::Requirement
200
- requirements:
201
- - - ">="
202
- - !ruby/object:Gem::Version
203
- version: '0'
189
+ version: '3.2'
204
190
  - !ruby/object:Gem::Dependency
205
191
  name: guard
206
192
  requirement: !ruby/object:Gem::Requirement
@@ -314,6 +300,9 @@ files:
314
300
  - gemfiles/rails41.gemfile
315
301
  - gemfiles/rails42.gemfile
316
302
  - gemfiles/rails50.gemfile
303
+ - gemfiles/rails51.gemfile
304
+ - gemfiles/rails52.gemfile
305
+ - gemfiles/rails60.gemfile
317
306
  - lib/roqua/errors.rb
318
307
  - lib/roqua/healthy.rb
319
308
  - lib/roqua/healthy/a19.rb
@@ -356,7 +345,9 @@ files:
356
345
  - spec/fixtures/user_patient_not_found.xml
357
346
  - spec/fixtures/user_patient_with_gsm_and_email.xml
358
347
  - spec/fixtures/user_patient_with_maiden_name.xml
348
+ - spec/fixtures/xmcare_house_number_addendum.xml
359
349
  - spec/fixtures/xmcare_impersonating_cdis.xml
350
+ - spec/fixtures/xmcare_missing_whole_pids.xml
360
351
  - spec/fixtures/xmcare_patient.xml
361
352
  - spec/fixtures/xmcare_patient_email_in_field_number_four.xml
362
353
  - spec/fixtures/xmcare_patient_not_found.xml
@@ -392,7 +383,7 @@ homepage: https://github.com/roqua/healthy
392
383
  licenses:
393
384
  - MIT
394
385
  metadata: {}
395
- post_install_message:
386
+ post_install_message:
396
387
  rdoc_options: []
397
388
  require_paths:
398
389
  - lib
@@ -407,9 +398,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
407
398
  - !ruby/object:Gem::Version
408
399
  version: '0'
409
400
  requirements: []
410
- rubyforge_project:
411
- rubygems_version: 2.7.6
412
- signing_key:
401
+ rubyforge_project:
402
+ rubygems_version: 2.7.6.2
403
+ signing_key:
413
404
  specification_version: 4
414
405
  summary: Arranges communication between Mirth and RoQua
415
406
  test_files:
@@ -432,7 +423,9 @@ test_files:
432
423
  - spec/fixtures/user_patient_not_found.xml
433
424
  - spec/fixtures/user_patient_with_gsm_and_email.xml
434
425
  - spec/fixtures/user_patient_with_maiden_name.xml
426
+ - spec/fixtures/xmcare_house_number_addendum.xml
435
427
  - spec/fixtures/xmcare_impersonating_cdis.xml
428
+ - spec/fixtures/xmcare_missing_whole_pids.xml
436
429
  - spec/fixtures/xmcare_patient.xml
437
430
  - spec/fixtures/xmcare_patient_email_in_field_number_four.xml
438
431
  - spec/fixtures/xmcare_patient_not_found.xml