roqua-healthy 1.5.10 → 1.5.11

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
- SHA1:
3
- metadata.gz: fe41526687263d414b6fbb4a14e77d0538d14cfc
4
- data.tar.gz: d9222496cb31cd289ac4050f89a0bd77dea11d71
2
+ SHA256:
3
+ metadata.gz: a69d14d381de12c9ce4e1cbb04015bf71f2008de5f17bfa9704dab05f9d38791
4
+ data.tar.gz: 7c1943cc8598a5c13c66a017278503cb864511238389957c71dd9110580a4d43
5
5
  SHA512:
6
- metadata.gz: f408d157c74b9d00f250921b041e35faa9cfa116f931ec8e3d38127ab484565c195915fc583aa73d9a23f7d004719e9ce675d1993e026c06ab7ebc9d5739eb13
7
- data.tar.gz: b16066084c03e52ea5f81f857cf6c994c72164696eb36e853f9f52bbe1bac0b0ba5a3b47cab969c02be495a8b4bbc891917dd64247b353d72867e1c37968eae3
6
+ metadata.gz: d4ae997cb7c753cbffb28dfa7694598ddef996a8e780c9d8299fcf21a8a6d854440c5a3f6ced15e14d87d2e6c662506ce6df1290a102a1aaf04be7eed0dd689d
7
+ data.tar.gz: f8dfa8991ae1acf13bdcd5351dd4bcf50e5012aa8cbedd1ffdbf3fd6a788f43b65d24a5cb4d27d1fa0843e7857eac1ffd80b04d1553bb49ba62ad8a65c454d64
@@ -1,3 +1,7 @@
1
+ ### 1.6.11
2
+
3
+ * Support for PID.11 and PID.13 completely missing from an hl7 response.
4
+
1
5
  ### 1.5.10
2
6
 
3
7
  * Support for house number suffices in PID 11.2
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" }
@@ -58,7 +58,7 @@ module Roqua
58
58
  private
59
59
 
60
60
  def get_address_of_type(message, type)
61
- message.fetch('PID').fetch('PID.11').find do |record|
61
+ message.dig('PID', 'PID.11')&.find do |record|
62
62
  record.fetch('PID.11.7', :unknown_type_of_address_record) == type
63
63
  end
64
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,8 +19,8 @@ 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
 
@@ -2,6 +2,6 @@
2
2
  module Roqua
3
3
  module Healthy
4
4
  # healthy version
5
- VERSION = "1.5.10"
5
+ VERSION = "1.5.11"
6
6
  end
7
7
  end
@@ -37,7 +37,6 @@ Gem::Specification.new do |gem|
37
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,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>
@@ -215,6 +215,16 @@ describe 'Fetching A19 from XMcare' do
215
215
  expect(subject[:street]).to eq("Straatnaam 123ab")
216
216
  end
217
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
+
218
228
  describe 'a patient that does not exist' do
219
229
  before { load_fixture 'xmcare_patient_not_found', '12345678901' }
220
230
 
@@ -54,6 +54,11 @@ describe Roqua::Healthy::A19::AddressParser do
54
54
  parser = described_class.new(message)
55
55
  expect(parser.address_type).to be_nil
56
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
57
62
  end
58
63
 
59
64
  describe '#street' do
@@ -98,6 +103,11 @@ describe Roqua::Healthy::A19::AddressParser do
98
103
  parser = described_class.new(message)
99
104
  expect(parser.street).to eq("Homestreet 1ab")
100
105
  end
106
+
107
+ it 'handles missing PID' do
108
+ parser = described_class.new('PID' => {})
109
+ expect(parser.street).to be_nil
110
+ end
101
111
  end
102
112
 
103
113
  describe '#city' do
@@ -118,6 +128,11 @@ describe Roqua::Healthy::A19::AddressParser do
118
128
  parser = described_class.new(message)
119
129
  expect(parser.city).to be_nil
120
130
  end
131
+
132
+ it 'handles missing PID' do
133
+ parser = described_class.new('PID' => {})
134
+ expect(parser.city).to be_nil
135
+ end
121
136
  end
122
137
 
123
138
  describe '#zipcode' do
@@ -138,6 +153,10 @@ describe Roqua::Healthy::A19::AddressParser do
138
153
  parser = described_class.new(message)
139
154
  expect(parser.zipcode).to be_nil
140
155
  end
156
+ it 'handles missing PID' do
157
+ parser = described_class.new('PID' => {})
158
+ expect(parser.zipcode).to be_nil
159
+ end
141
160
  end
142
161
 
143
162
  describe '#country' do
@@ -158,6 +177,11 @@ describe Roqua::Healthy::A19::AddressParser do
158
177
  parser = described_class.new(message)
159
178
  expect(parser.country).to be_nil
160
179
  end
180
+
181
+ it 'handles missing PID' do
182
+ parser = described_class.new('PID' => {})
183
+ expect(parser.country).to be_nil
184
+ end
161
185
  end
162
186
  # rubocop:enable Metrics/MethodLength
163
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'},
@@ -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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roqua-healthy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.10
4
+ version: 1.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-06-24 00:00:00.000000000 Z
14
+ date: 2019-12-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -187,20 +187,6 @@ dependencies:
187
187
  - - "~>"
188
188
  - !ruby/object:Gem::Version
189
189
  version: '3.2'
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'
204
190
  - !ruby/object:Gem::Dependency
205
191
  name: guard
206
192
  requirement: !ruby/object:Gem::Requirement
@@ -358,6 +344,7 @@ files:
358
344
  - spec/fixtures/user_patient_with_maiden_name.xml
359
345
  - spec/fixtures/xmcare_house_number_addendum.xml
360
346
  - spec/fixtures/xmcare_impersonating_cdis.xml
347
+ - spec/fixtures/xmcare_missing_whole_pids.xml
361
348
  - spec/fixtures/xmcare_patient.xml
362
349
  - spec/fixtures/xmcare_patient_email_in_field_number_four.xml
363
350
  - spec/fixtures/xmcare_patient_not_found.xml
@@ -408,8 +395,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
408
395
  - !ruby/object:Gem::Version
409
396
  version: '0'
410
397
  requirements: []
411
- rubyforge_project:
412
- rubygems_version: 2.6.14.4
398
+ rubygems_version: 3.0.3
413
399
  signing_key:
414
400
  specification_version: 4
415
401
  summary: Arranges communication between Mirth and RoQua
@@ -435,6 +421,7 @@ test_files:
435
421
  - spec/fixtures/user_patient_with_maiden_name.xml
436
422
  - spec/fixtures/xmcare_house_number_addendum.xml
437
423
  - spec/fixtures/xmcare_impersonating_cdis.xml
424
+ - spec/fixtures/xmcare_missing_whole_pids.xml
438
425
  - spec/fixtures/xmcare_patient.xml
439
426
  - spec/fixtures/xmcare_patient_email_in_field_number_four.xml
440
427
  - spec/fixtures/xmcare_patient_not_found.xml