roqua-healthy 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,10 +5,13 @@ describe 'Fetching A19 from Comez' do
5
5
  before { load_fixture 'comez_patient', '0000123456' }
6
6
  subject { Roqua::Healthy::A19.fetch("0000123456") }
7
7
 
8
- it { expect(subject[:status]).to eq('SUCCESS') }
9
- it { expect(subject[:error]).to be_nil }
10
- it { expect(subject[:source]).to eq('CS') }
11
- it { expect(subject[:identities]).to eq([{ident: '0000123456', authority: 'PI'}, {ident: '123456789', authority: 'NNNLD'}]) }
8
+ it { expect(subject[:status]).to eq('SUCCESS') }
9
+ it { expect(subject[:error]).to be_nil }
10
+ it { expect(subject[:source]).to eq('CS') }
11
+ it do
12
+ expect(subject[:identities]).to eq([{ident: '0000123456', authority: 'PI'},
13
+ {ident: '123456789', authority: 'NNNLD'}])
14
+ end
12
15
  it { expect(subject[:firstname]).to eq('Voornaam') }
13
16
  it { expect(subject[:initials]).to eq('A') }
14
17
  it { expect(subject[:lastname]).to eq('Achternaam') }
@@ -23,4 +26,4 @@ describe 'Fetching A19 from Comez' do
23
26
  it { expect(subject[:gender]).to eq('F') }
24
27
  it { expect(subject[:phone_cell]).to eq('0612345678mdr') }
25
28
  end
26
- end
29
+ end
@@ -1,18 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
- # rubocop:disable Blocks,BlockAlignment
4
3
  describe 'Fetching A19 from Medoq' do
5
4
  describe 'a patient' do
6
5
  before { load_fixture 'medoq_patient', 'md-cdae5d100d8e0131d2623c075478eb56' }
7
6
  subject { Roqua::Healthy::A19.fetch("md-cdae5d100d8e0131d2623c075478eb56") }
8
7
 
9
- it { expect(subject[:status]).to eq('SUCCESS') }
10
- it { expect(subject[:error]).to be_nil }
11
- it { expect(subject[:source]).to eq('RGOC') }
12
- it { expect(subject[:identities]).to eq([{ident: "md-cdae5d100d8e0131d2623c075478eb56",
13
- research_number: "research-id-123",
14
- metadata: {"test" => "12"},
15
- authority: 'MEDOQ'}]) }
8
+ it { expect(subject[:status]).to eq('SUCCESS') }
9
+ it { expect(subject[:error]).to be_nil }
10
+ it { expect(subject[:source]).to eq('RGOC') }
11
+ it do
12
+ expect(subject[:identities]).to eq([{ident: "md-cdae5d100d8e0131d2623c075478eb56",
13
+ research_number: "research-id-123",
14
+ metadata: {"test" => "12"},
15
+ authority: 'MEDOQ'}])
16
+ end
16
17
  it { expect(subject[:firstname]).to eq('Jan') }
17
18
  it { expect(subject[:initials]).to eq('J.') }
18
19
  it { expect(subject[:lastname]).to eq('Fictief') }
@@ -14,4 +14,4 @@ describe 'Accounting for Mirth bugs' do
14
14
  expect { Roqua::Healthy::A19.fetch("12345678") }.to raise_error(Roqua::Healthy::MirthErrors::WrongPatient)
15
15
  end
16
16
  end
17
- end
17
+ end
@@ -5,10 +5,13 @@ describe 'Fetching A19 from XMcare' do
5
5
  before { load_fixture 'xmcare_patient', '12345678901' }
6
6
  subject { Roqua::Healthy::A19.fetch("12345678901") }
7
7
 
8
- it { expect(subject[:status]).to eq('SUCCESS') }
9
- it { expect(subject[:error]).to be_nil }
10
- it { expect(subject[:source]).to eq('ZIS') }
11
- it { expect(subject[:identities]).to eq([{ident: '12345678901', authority: 'PI'}, {ident: '123456789', authority: 'NNNLD'}]) }
8
+ it { expect(subject[:status]).to eq('SUCCESS') }
9
+ it { expect(subject[:error]).to be_nil }
10
+ it { expect(subject[:source]).to eq('ZIS') }
11
+ it do
12
+ expect(subject[:identities]).to eq([{ident: '12345678901', authority: 'PI'},
13
+ {ident: '123456789', authority: 'NNNLD'}])
14
+ end
12
15
  it { expect(subject[:firstname]).to eq('Babette') }
13
16
  it { expect(subject[:initials]).to eq('A B') }
14
17
  it { expect(subject[:lastname]).to eq('Achternaam') }
@@ -28,10 +31,13 @@ describe 'Fetching A19 from XMcare' do
28
31
  before { load_fixture 'xmcare_patient_with_maiden_name', '12345678901' }
29
32
  subject { Roqua::Healthy::A19.fetch("12345678901") }
30
33
 
31
- it { expect(subject[:status]).to eq('SUCCESS') }
32
- it { expect(subject[:error]).to be_nil }
33
- it { expect(subject[:source]).to eq('ZIS') }
34
- it { expect(subject[:identities]).to eq([{ident: '12345678901', authority: 'PI'}, {ident: '123456789', authority: 'NNNLD'}]) }
34
+ it { expect(subject[:status]).to eq('SUCCESS') }
35
+ it { expect(subject[:error]).to be_nil }
36
+ it { expect(subject[:source]).to eq('ZIS') }
37
+ it do
38
+ expect(subject[:identities]).to eq([{ident: '12345678901', authority: 'PI'},
39
+ {ident: '123456789', authority: 'NNNLD'}])
40
+ end
35
41
  it { expect(subject[:firstname]).to eq('Babette') }
36
42
  it { expect(subject[:initials]).to eq('A B') }
37
43
  it { expect(subject[:lastname]).to eq('Achternaam') }
@@ -51,10 +57,13 @@ describe 'Fetching A19 from XMcare' do
51
57
  before { load_fixture 'xmcare_patient_without_birthdate', '12345678901' }
52
58
  subject { Roqua::Healthy::A19.fetch("12345678901") }
53
59
 
54
- it { expect(subject[:status]).to eq('SUCCESS') }
55
- it { expect(subject[:error]).to be_nil }
56
- it { expect(subject[:source]).to eq('ZIS') }
57
- it { expect(subject[:identities]).to eq([{ident: '12345678901', authority: 'PI'}, {ident: '123456789', authority: 'NNNLD'}]) }
60
+ it { expect(subject[:status]).to eq('SUCCESS') }
61
+ it { expect(subject[:error]).to be_nil }
62
+ it { expect(subject[:source]).to eq('ZIS') }
63
+ it do
64
+ expect(subject[:identities]).to eq([{ident: '12345678901', authority: 'PI'},
65
+ {ident: '123456789', authority: 'NNNLD'}])
66
+ end
58
67
  it { expect(subject[:firstname]).to eq('Babette') }
59
68
  it { expect(subject[:initials]).to eq('A B') }
60
69
  it { expect(subject[:lastname]).to eq('Achternaam') }
@@ -74,10 +83,13 @@ describe 'Fetching A19 from XMcare' do
74
83
  before { load_fixture 'xmcare_patient_email_in_field_number_four', '12345678901' }
75
84
  subject { Roqua::Healthy::A19.fetch("12345678901") }
76
85
 
77
- it { expect(subject[:status]).to eq('SUCCESS') }
78
- it { expect(subject[:error]).to be_nil }
79
- it { expect(subject[:source]).to eq('ZIS') }
80
- it { expect(subject[:identities]).to eq([{ident: '12345678901', authority: 'PI'}, {ident: '123456789', authority: 'NNNLD'}]) }
86
+ it { expect(subject[:status]).to eq('SUCCESS') }
87
+ it { expect(subject[:error]).to be_nil }
88
+ it { expect(subject[:source]).to eq('ZIS') }
89
+ it do
90
+ expect(subject[:identities]).to eq([{ident: '12345678901', authority: 'PI'},
91
+ {ident: '123456789', authority: 'NNNLD'}])
92
+ end
81
93
  it { expect(subject[:firstname]).to eq('Babette') }
82
94
  it { expect(subject[:initials]).to eq('A B') }
83
95
  it { expect(subject[:lastname]).to eq('Achternaam') }
@@ -91,17 +103,19 @@ describe 'Fetching A19 from XMcare' do
91
103
  it { expect(subject[:birthdate]).to eq('17070415') }
92
104
  it { expect(subject[:gender]).to eq('F') }
93
105
  it { expect(subject[:phone_cell]).to eq('06 12 34 56 78') }
94
-
95
106
  end
96
107
 
97
108
  describe 'a patient from an xmcare instance impersonating cdis' do
98
109
  before { load_fixture 'xmcare_impersonating_cdis', '12345678901' }
99
110
  subject { Roqua::Healthy::A19.fetch("12345678901") }
100
111
 
101
- it { expect(subject[:status]).to eq('SUCCESS') }
102
- it { expect(subject[:error]).to be_nil }
103
- it { expect(subject[:source]).to eq('UMCG') }
104
- it { expect(subject[:identities]).to eq([{ident: '12345678901', authority: 'PI'}, {ident: '123456789', authority: 'NNNLD'}]) }
112
+ it { expect(subject[:status]).to eq('SUCCESS') }
113
+ it { expect(subject[:error]).to be_nil }
114
+ it { expect(subject[:source]).to eq('UMCG') }
115
+ it do
116
+ expect(subject[:identities]).to eq([{ident: '12345678901', authority: 'PI'},
117
+ {ident: '123456789', authority: 'NNNLD'}])
118
+ end
105
119
  it { expect(subject[:firstname]).to eq('A') }
106
120
  it { expect(subject[:initials]).to eq('B C') }
107
121
  it { expect(subject[:lastname]).to eq('Achternaam') }
@@ -117,6 +131,50 @@ describe 'Fetching A19 from XMcare' do
117
131
  it { expect(subject[:phone_cell]).to eq('06-12345678') }
118
132
  end
119
133
 
134
+ describe 'a patient with a 06 cell phone number only in the primary residence number field' do
135
+ before { load_fixture 'xmcare_phone_cell_in_prn', '88888888888' }
136
+ subject { Roqua::Healthy::A19.fetch("88888888888") }
137
+
138
+ it { expect(subject[:status]).to eq('SUCCESS') }
139
+ it { expect(subject[:error]).to be_nil }
140
+ it { expect(subject[:source]).to eq('XMCARE') }
141
+ it do
142
+ expect(subject[:identities]).to eq([{ident: '88888888888', authority: 'PI'},
143
+ {ident: '222222222', authority: 'NNNLD'}])
144
+ end
145
+ it { expect(subject[:firstname]).to eq('Voorname') }
146
+ it { expect(subject[:initials]).to eq('V') }
147
+ it { expect(subject[:lastname]).to eq('Achternom') }
148
+ it { expect(subject[:display_name]).to eq('Achternom') }
149
+ it { expect(subject[:email]).to eq('support@roqua.nl') }
150
+ it { expect(subject[:address_type]).to eq('H') }
151
+ it { expect(subject[:street]).to eq('Straat 8') }
152
+ it { expect(subject[:city]).to eq('GRONINGEN') }
153
+ it { expect(subject[:zipcode]).to eq('9711CR') }
154
+ it { expect(subject[:country]).to eq('NED') }
155
+ it { expect(subject[:birthdate]).to eq('19900101') }
156
+ it { expect(subject[:gender]).to eq('F') }
157
+ it { expect(subject[:phone_cell]).to eq('0612345678') }
158
+ end
159
+
160
+ describe 'a patient with a 06 cell phone number in the both residence number fields' do
161
+ before { load_fixture 'xmcare_phone_cell_in_prn_orn', '88888888888' }
162
+ subject { Roqua::Healthy::A19.fetch("88888888888") }
163
+
164
+ it 'prefers the orn cell phone number over the prn' do
165
+ expect(subject[:phone_cell]).to eq('0612345678')
166
+ end
167
+ end
168
+
169
+ describe 'a patient with an unconventional cell phone number in the other residence number field' do
170
+ before { load_fixture 'xmcare_unconventional_phone_cell_in_orn', '88888888888' }
171
+ subject { Roqua::Healthy::A19.fetch("88888888888") }
172
+
173
+ it 'returns the orn number' do
174
+ expect(subject[:phone_cell]).to eq('+31612345678')
175
+ end
176
+ end
177
+
120
178
  describe 'a patient that does not exist' do
121
179
  before { load_fixture 'xmcare_patient_not_found', '12345678901' }
122
180
 
@@ -124,4 +182,4 @@ describe 'Fetching A19 from XMcare' do
124
182
  expect { Roqua::Healthy::A19.fetch("12345678901") }.to raise_error(Roqua::Healthy::PatientNotFound)
125
183
  end
126
184
  end
127
- end
185
+ end
data/spec/spec_helper.rb CHANGED
@@ -26,4 +26,4 @@ RSpec.configure do |config|
26
26
  puts "", "Log file: ", LOG_FILE.read
27
27
  end
28
28
  end
29
- end
29
+ end
@@ -11,4 +11,4 @@ def load_fixture(name, patient_id = '123')
11
11
  fixture_filename = File.expand_path(File.join(__FILE__, "../../fixtures", "#{name}.xml"))
12
12
  response = File.read(fixture_filename)
13
13
  stub_mirth_response(response, 200, patient_id)
14
- end
14
+ end
@@ -7,20 +7,17 @@ describe Roqua::Healthy::A19::AddressParser do
7
7
  'PID.11.1' => {'PID.11.1.1' => 'Mailstreet 1'},
8
8
  'PID.11.3' => 'Mailcity',
9
9
  'PID.11.5' => 'Mailzipcode',
10
- 'PID.11.6' => 'Mailcountry'
11
- } if types.include?('M')
10
+ 'PID.11.6' => 'Mailcountry'} if types.include?('M')
12
11
  addresses << {'PID.11.7' => 'H',
13
12
  'PID.11.1' => {'PID.11.1.1' => 'Homestreet 1'},
14
13
  'PID.11.3' => 'Homecity',
15
14
  'PID.11.5' => 'Homezipcode',
16
- 'PID.11.6' => 'Homecountry'
17
- } if types.include?('H')
15
+ 'PID.11.6' => 'Homecountry'} if types.include?('H')
18
16
  addresses << {'PID.11.7' => '?',
19
17
  'PID.11.1' => {'PID.11.1.1' => '????street 1'},
20
18
  'PID.11.3' => '????city',
21
19
  'PID.11.5' => '????zipcode',
22
- 'PID.11.6' => '????country'
23
- } if types.include?('?')
20
+ 'PID.11.6' => '????country'} if types.include?('?')
24
21
  {'PID' => {'PID.11' => addresses}}
25
22
  end
26
23
 
@@ -129,4 +126,4 @@ describe Roqua::Healthy::A19::AddressParser do
129
126
  expect(parser.country).to be_nil
130
127
  end
131
128
  end
132
- end
129
+ end
@@ -19,4 +19,4 @@ module Roqua
19
19
  end
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -13,7 +13,5 @@ describe Roqua::Healthy::Client do
13
13
  it 'defaults to system wide config' do
14
14
  expect(subject.a19_endpoint).to eq Roqua::Healthy.a19_endpoint
15
15
  end
16
-
17
16
  end
18
-
19
17
  end
@@ -44,4 +44,4 @@ describe Roqua::Healthy::MessageCleaner do
44
44
  expect(cleaner.clean_string('""')).to eq('')
45
45
  end
46
46
  end
47
- end
47
+ end
metadata CHANGED
@@ -1,15 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roqua-healthy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  - Jorn van de Beek
9
+ - Samuel Esposito
10
+ - Henk van der Veen
9
11
  autorequire:
10
12
  bindir: bin
11
13
  cert_chain: []
12
- date: 2016-03-22 00:00:00.000000000 Z
14
+ date: 2016-06-24 00:00:00.000000000 Z
13
15
  dependencies:
14
16
  - !ruby/object:Gem::Dependency
15
17
  name: activesupport
@@ -177,28 +179,28 @@ dependencies:
177
179
  requirements:
178
180
  - - "~>"
179
181
  - !ruby/object:Gem::Version
180
- version: 1.0.1
182
+ version: 1.2.0
181
183
  type: :development
182
184
  prerelease: false
183
185
  version_requirements: !ruby/object:Gem::Requirement
184
186
  requirements:
185
187
  - - "~>"
186
188
  - !ruby/object:Gem::Version
187
- version: 1.0.1
189
+ version: 1.2.0
188
190
  - !ruby/object:Gem::Dependency
189
191
  name: rubocop
190
192
  requirement: !ruby/object:Gem::Requirement
191
193
  requirements:
192
- - - '='
194
+ - - "~>"
193
195
  - !ruby/object:Gem::Version
194
- version: 0.17.0
196
+ version: '0.40'
195
197
  type: :development
196
198
  prerelease: false
197
199
  version_requirements: !ruby/object:Gem::Requirement
198
200
  requirements:
199
- - - '='
201
+ - - "~>"
200
202
  - !ruby/object:Gem::Version
201
- version: 0.17.0
203
+ version: '0.40'
202
204
  - !ruby/object:Gem::Dependency
203
205
  name: fuubar
204
206
  requirement: !ruby/object:Gem::Requirement
@@ -238,6 +240,7 @@ files:
238
240
  - ".gitignore"
239
241
  - ".rspec"
240
242
  - ".rubocop.yml"
243
+ - ".rubocop_todo.yml"
241
244
  - ".yardopts"
242
245
  - ChangeLog.md
243
246
  - Gemfile
@@ -249,6 +252,7 @@ files:
249
252
  - bin/get_old_mirth_processing_result
250
253
  - bin/get_xml_for_patient
251
254
  - bin/parse_local_xml
255
+ - circle.yml
252
256
  - lib/roqua-healthy.rb
253
257
  - lib/roqua/healthy.rb
254
258
  - lib/roqua/healthy/a19.rb
@@ -289,7 +293,10 @@ files:
289
293
  - spec/fixtures/xmcare_patient_not_found.xml
290
294
  - spec/fixtures/xmcare_patient_with_maiden_name.xml
291
295
  - spec/fixtures/xmcare_patient_without_birthdate.xml
296
+ - spec/fixtures/xmcare_phone_cell_in_prn.xml
297
+ - spec/fixtures/xmcare_phone_cell_in_prn_orn.xml
292
298
  - spec/fixtures/xmcare_timeout_waiting_for_ack.xml
299
+ - spec/fixtures/xmcare_unconventional_phone_cell_in_orn.xml
293
300
  - spec/healthy_spec.rb
294
301
  - spec/integration/cdis_spec.rb
295
302
  - spec/integration/comez_spec.rb
@@ -325,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
325
332
  version: '0'
326
333
  requirements: []
327
334
  rubyforge_project:
328
- rubygems_version: 2.2.2
335
+ rubygems_version: 2.4.8
329
336
  signing_key:
330
337
  specification_version: 4
331
338
  summary: Arranges communication between Mirth and RoQua
@@ -353,7 +360,10 @@ test_files:
353
360
  - spec/fixtures/xmcare_patient_not_found.xml
354
361
  - spec/fixtures/xmcare_patient_with_maiden_name.xml
355
362
  - spec/fixtures/xmcare_patient_without_birthdate.xml
363
+ - spec/fixtures/xmcare_phone_cell_in_prn.xml
364
+ - spec/fixtures/xmcare_phone_cell_in_prn_orn.xml
356
365
  - spec/fixtures/xmcare_timeout_waiting_for_ack.xml
366
+ - spec/fixtures/xmcare_unconventional_phone_cell_in_orn.xml
357
367
  - spec/healthy_spec.rb
358
368
  - spec/integration/cdis_spec.rb
359
369
  - spec/integration/comez_spec.rb