roqua-healthy 1.5.4 → 1.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.document +0 -0
  3. data/.gitlab-ci.yml +7 -3
  4. data/.rspec +0 -0
  5. data/.rubocop_todo.yml +0 -0
  6. data/.yardopts +0 -0
  7. data/Gemfile +1 -0
  8. data/Guardfile +0 -0
  9. data/LICENSE.txt +0 -0
  10. data/Rakefile +0 -0
  11. data/circle.yml +0 -0
  12. data/gemfiles/rails41.gemfile +0 -0
  13. data/gemfiles/rails42.gemfile +0 -0
  14. data/gemfiles/rails50.gemfile +0 -0
  15. data/lib/roqua/healthy/a19.rb +0 -0
  16. data/lib/roqua/healthy/a19/cdis_name_parser.rb +0 -0
  17. data/lib/roqua/healthy/a19/correct_patient_check.rb +0 -0
  18. data/lib/roqua/healthy/a19/impulse_name_parser.rb +0 -0
  19. data/lib/roqua/healthy/a19/name_parser.rb +0 -0
  20. data/lib/roqua/healthy/a19/phone_validator.rb +36 -0
  21. data/lib/roqua/healthy/a19/response_parser.rb +0 -0
  22. data/lib/roqua/healthy/a19/transformer.rb +4 -2
  23. data/lib/roqua/healthy/message_cleaner.rb +0 -0
  24. data/lib/roqua/healthy/version.rb +1 -1
  25. data/lib/roqua_healthy.rb +0 -0
  26. data/roqua-healthy.gemspec +1 -1
  27. data/spec/fixtures/cdis_gerda_geit.xml +0 -0
  28. data/spec/fixtures/cdis_jan_fictief.xml +0 -0
  29. data/spec/fixtures/cdis_missing_address.xml +0 -0
  30. data/spec/fixtures/cdis_piet_fictief.xml +0 -0
  31. data/spec/fixtures/comez_patient.xml +0 -0
  32. data/spec/fixtures/epic_no_gender.xml +0 -0
  33. data/spec/fixtures/epic_test_client.xml +4 -4
  34. data/spec/fixtures/ggzwnb_patient.xml +0 -0
  35. data/spec/fixtures/medoq_patient.xml +1 -1
  36. data/spec/fixtures/oru-requests/spsy1218j.hl7 +0 -0
  37. data/spec/fixtures/oru-requests/spsy1218o.hl7 +0 -0
  38. data/spec/fixtures/oru-requests/spsy1218o2.hl7 +0 -0
  39. data/spec/fixtures/oru-requests/spsy411o.hl7 +0 -0
  40. data/spec/fixtures/oru-requests/spsy411o2.hl7 +0 -0
  41. data/spec/fixtures/oru-requests/spsyl.hl7 +0 -0
  42. data/spec/fixtures/oru-responses/xmcare_nack.hl7 +0 -0
  43. data/spec/fixtures/user_patient.xml +0 -0
  44. data/spec/fixtures/user_patient_not_found.xml +0 -0
  45. data/spec/fixtures/user_patient_with_gsm_and_email.xml +0 -0
  46. data/spec/fixtures/user_patient_with_maiden_name.xml +0 -0
  47. data/spec/fixtures/xmcare_impersonating_cdis.xml +0 -0
  48. data/spec/fixtures/xmcare_patient.xml +0 -0
  49. data/spec/fixtures/xmcare_patient_email_in_field_number_four.xml +0 -0
  50. data/spec/fixtures/xmcare_patient_not_found.xml +0 -0
  51. data/spec/fixtures/xmcare_patient_with_maiden_name.xml +0 -0
  52. data/spec/fixtures/xmcare_patient_without_birthdate.xml +0 -0
  53. data/spec/fixtures/xmcare_phone_cell_in_prn.xml +0 -0
  54. data/spec/fixtures/xmcare_phone_cell_in_prn_orn.xml +0 -0
  55. data/spec/fixtures/xmcare_phone_home_in_prn.xml +0 -0
  56. data/spec/fixtures/xmcare_timeout_waiting_for_ack.xml +0 -0
  57. data/spec/fixtures/xmcare_unconventional_phone_cell_in_orn.xml +0 -0
  58. data/spec/fixtures/xmcare_unconventional_phone_cell_in_orn2.xml +0 -0
  59. data/spec/healthy_spec.rb +0 -0
  60. data/spec/integration/cdis_spec.rb +0 -0
  61. data/spec/integration/comez_spec.rb +0 -0
  62. data/spec/integration/epic_spec.rb +1 -1
  63. data/spec/integration/ggzwnb_spec.rb +0 -0
  64. data/spec/integration/medo_spec.rb +1 -1
  65. data/spec/integration/mirth_spec.rb +0 -0
  66. data/spec/integration/user_spec.rb +0 -0
  67. data/spec/integration/xmcare_spec.rb +0 -0
  68. data/spec/spec_helper.rb +0 -0
  69. data/spec/support/fixtures.rb +0 -0
  70. data/spec/unit/a19/address_parser_spec.rb +1 -0
  71. data/spec/unit/a19/correct_patient_check_spec.rb +0 -0
  72. data/spec/unit/a19/phone_validator_spec.rb +41 -0
  73. data/spec/unit/a19_spec.rb +0 -0
  74. data/spec/unit/message_cleaner_spec.rb +0 -0
  75. metadata +20 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb0dd22a8a5f693541a7ebfa39210bdfe3df8e19
4
- data.tar.gz: a06d6e42809e99705bb458d9912030b52083a26d
3
+ metadata.gz: 4e5499960a9c38757e49f6f943eba03deae4db03
4
+ data.tar.gz: 67d16e02512c7e3671d4c6e7cecf540b571b11b9
5
5
  SHA512:
6
- metadata.gz: 869a5c07c41a79f4b543dd31efed8ca198bfcdae0cdb2ef00679032460876d58f9dc00164e9a3b45366e8918d42481357396e2f24b28482e8c11fdcd701efdd9
7
- data.tar.gz: 3143b6944b2a2a12635d0fc6edd8d1b200284e3c868d38c2ab6f5c01b9926ffa08d6f7df4257f0843b12a84e7a1fda85f5925055e5e7ca094c07ccad1958ad93
6
+ metadata.gz: 0b5b506f6cb23b787eefd0bd517dd9c4ed856ed83ec4078d0b44681d565d7a845b23a794bd0c3c54713ceb2f77ae8ef94db919bcba777478c7e9d67354fb32b9
7
+ data.tar.gz: 1fd29af6071da287741fe6977e22069edad113f50d146afd786b35f8b7b19dae961f72586de10b3f68f041a1da6ffbb8f48f5df2086e390173f0d553ad74388c
data/.document CHANGED
File without changes
data/.gitlab-ci.yml CHANGED
@@ -1,8 +1,12 @@
1
- image: "roqua/roqua-build-images:ruby-2.3.3-phantomjs-2.1.1-bundler-gemnasium"
1
+ image: "registry.roqua.nl/roqua/roqua-build-images:ruby-2.3-rails-base-test"
2
+
3
+ cache:
4
+ paths:
5
+ - .gems
2
6
 
3
7
  before_script:
4
- - ruby -v
5
- - bundle-cache
8
+ - export BUNDLE_PATH=$CI_PROJECT_DIR/.gems
9
+ - bundle --jobs 2 --retry 3
6
10
  - gem install appraisal
7
11
  - bundle exec appraisal
8
12
 
data/.rspec CHANGED
File without changes
data/.rubocop_todo.yml CHANGED
File without changes
data/.yardopts CHANGED
File without changes
data/Gemfile CHANGED
@@ -7,3 +7,4 @@ gemspec
7
7
  # Normal development dependencies should go in the gemspec. People shouldn't
8
8
  # need to use bundler to develop on our gem.
9
9
  gem "codeclimate-test-reporter", "~> 1.0.0", group: :test, require: nil
10
+ gem 'roqua_styleguide', git: 'https://gitlab.roqua.nl/roqua/styleguide.git'
data/Guardfile CHANGED
File without changes
data/LICENSE.txt CHANGED
File without changes
data/Rakefile CHANGED
File without changes
data/circle.yml CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'phonelib'
4
+
5
+ module Roqua
6
+ module Healthy
7
+ module A19
8
+ module PhoneValidator
9
+ EU_COUNTRY_CODES = Set.new(
10
+ %w[AT BE BG CY CZ DE DK EE EL ES FI FR HR HU IE IT LT LU LV MT NL PL PT RO SE SI SK UK]
11
+ )
12
+
13
+ def self.phone_cell_number?(number)
14
+ stripped_number = strip_non_phone_number_characters(number)
15
+
16
+ phone_cell_number_in_european_country?(stripped_number) &&
17
+ contains_only_phone_number_characters?(stripped_number)
18
+ end
19
+
20
+ def self.phone_cell_number_in_european_country?(number)
21
+ phone = Phonelib.parse(number, 'NL')
22
+
23
+ phone.type == :mobile && EU_COUNTRY_CODES.include?(phone.country)
24
+ end
25
+
26
+ def self.contains_only_phone_number_characters?(number)
27
+ /^\+?\d+$/.match(number).present?
28
+ end
29
+
30
+ def self.strip_non_phone_number_characters(number)
31
+ number.gsub(/[-\s\.]/, '')
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
File without changes
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'roqua/healthy/a19/name_parser'
3
4
  require 'roqua/healthy/a19/cdis_name_parser'
4
5
  require 'roqua/healthy/a19/impulse_name_parser'
5
6
  require 'roqua/healthy/a19/address_parser'
7
+ require 'roqua/healthy/a19/phone_validator'
6
8
  require 'active_support/core_ext/hash'
7
9
 
8
10
  module Roqua
@@ -123,11 +125,11 @@ module Roqua
123
125
  # letters are not stripped since they may be part of a comment, which usually means the
124
126
  # phone number is not useable for the purpose of a client's cell phone number
125
127
  def strip_non_phone_number_characters(number)
126
- number.gsub(/[-\s\.]/, '')
128
+ Roqua::Healthy::A19::PhoneValidator.strip_non_phone_number_characters number
127
129
  end
128
130
 
129
131
  def phone_cell_number?(number)
130
- strip_non_phone_number_characters(number) =~ /\A(\+31|0|0031)6\d{8}\z/
132
+ Roqua::Healthy::A19::PhoneValidator.phone_cell_number? number
131
133
  end
132
134
 
133
135
  def name
File without changes
@@ -2,6 +2,6 @@
2
2
  module Roqua
3
3
  module Healthy
4
4
  # healthy version
5
- VERSION = "1.5.4"
5
+ VERSION = "1.5.5"
6
6
  end
7
7
  end
data/lib/roqua_healthy.rb CHANGED
File without changes
@@ -23,6 +23,7 @@ Gem::Specification.new do |gem|
23
23
  gem.add_dependency 'activesupport', '>= 3.2', '< 6'
24
24
  gem.add_dependency 'addressable', '~> 2.3'
25
25
  gem.add_dependency 'builder'
26
+ gem.add_dependency 'phonelib', '~> 0.6'
26
27
  gem.add_dependency 'rest-client', '>= 2.0.2'
27
28
  gem.add_dependency 'roqua-support', '~> 0.1.22'
28
29
 
@@ -41,7 +42,6 @@ Gem::Specification.new do |gem|
41
42
  gem.add_development_dependency 'guard-rspec', '~> 4.2.4'
42
43
  gem.add_development_dependency 'guard-rubocop', '~> 1.2.0'
43
44
  gem.add_development_dependency 'listen', '~> 2.1'
44
- gem.add_development_dependency 'rubocop', '~> 0.40'
45
45
  gem.add_development_dependency 'simplecov'
46
46
 
47
47
  # Documentation generation
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -164,20 +164,20 @@
164
164
  </PID.11>
165
165
  <PID.12/>
166
166
  <PID.13>
167
- <PID.13.1>06 67 89 54 31</PID.13.1>
167
+ <PID.13.1>06 12 34 56 78</PID.13.1>
168
168
  <PID.13.2>ORN</PID.13.2>
169
169
  <PID.13.3>PH</PID.13.3>
170
170
  <PID.13.4/>
171
171
  <PID.13.5>31</PID.13.5>
172
- <PID.13.6>0667895431</PID.13.6>
172
+ <PID.13.6>0612345678</PID.13.6>
173
173
  </PID.13>
174
174
  <PID.13>
175
- <PID.13.1>06 67 89 54 32</PID.13.1>
175
+ <PID.13.1>06 12 34 56 79</PID.13.1>
176
176
  <PID.13.2>PRN</PID.13.2>
177
177
  <PID.13.3>CP</PID.13.3>
178
178
  <PID.13.4/>
179
179
  <PID.13.5>31</PID.13.5>
180
- <PID.13.6>0667895432</PID.13.6>
180
+ <PID.13.6>0612345679</PID.13.6>
181
181
  </PID.13>
182
182
  <PID.14/>
183
183
  <PID.15/>
File without changes
@@ -88,7 +88,7 @@
88
88
  <PID.13.3>PH</PID.13.3>
89
89
  </PID.13>
90
90
  <PID.13>
91
- <PID.13.1>0698765432</PID.13.1>
91
+ <PID.13.1>0612345678</PID.13.1>
92
92
  <PID.13.2>ORN</PID.13.2>
93
93
  <PID.13.3>PH</PID.13.3>
94
94
  </PID.13>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/spec/healthy_spec.rb CHANGED
File without changes
File without changes
File without changes
@@ -23,7 +23,7 @@ describe 'Fetching A19 from EPIC' do
23
23
  it { expect(subject[:country]).to eq('NLD') }
24
24
  it { expect(subject[:birthdate]).to eq('19800101') }
25
25
  it { expect(subject[:gender]).to eq('M') }
26
- it { expect(subject[:phone_cell]).to eq('0667895432') }
26
+ it { expect(subject[:phone_cell]).to eq('0612345679') }
27
27
  end
28
28
 
29
29
  describe 'patient not found' do
File without changes
@@ -28,7 +28,7 @@ describe 'Fetching A19 from Medoq' do
28
28
  it { expect(subject[:country]).to eq('Nederland') }
29
29
  it { expect(subject[:birthdate]).to eq('19800525') }
30
30
  it { expect(subject[:gender]).to eq('M') }
31
- it { expect(subject[:phone_cell]).to eq('0698765432') }
31
+ it { expect(subject[:phone_cell]).to eq('0612345678') }
32
32
  end
33
33
 
34
34
  describe 'authentication failure' do
File without changes
File without changes
File without changes
data/spec/spec_helper.rb CHANGED
File without changes
File without changes
@@ -134,4 +134,5 @@ describe Roqua::Healthy::A19::AddressParser do
134
134
  expect(parser.country).to be_nil
135
135
  end
136
136
  end
137
+ # rubocop:enable Metrics/MethodLength
137
138
  end
File without changes
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Roqua::Healthy::A19::PhoneValidator do
6
+ subject { described_class }
7
+
8
+ describe '#phone_cell_number?' do
9
+ it 'detects a Dutch mobile number' do
10
+ expect(subject.phone_cell_number?('+31612345678')).to be_truthy
11
+ end
12
+
13
+ it 'rejects a phone number that consists of something other than numbers' do
14
+ expect(subject.phone_cell_number?('0612345678mdr')).to be_falsey
15
+ end
16
+
17
+ it 'detects a Dutch mobile number without a country code' do
18
+ expect(subject.phone_cell_number?('0612345678')).to be_truthy
19
+ end
20
+
21
+ it 'rejects a normal Dutch phone number' do
22
+ expect(subject.phone_cell_number?('+31592123456')).to be_falsey
23
+ end
24
+
25
+ it 'detects a mobile number from Austria' do
26
+ expect(subject.phone_cell_number?('+4365012345678')).to be_truthy
27
+ end
28
+
29
+ it 'rejects a normal phone number from Austria' do
30
+ expect(subject.phone_cell_number?('+431123456')).to be_falsey
31
+ end
32
+
33
+ it 'rejects a mobile number from China' do
34
+ expect(subject.phone_cell_number?('+8613312345678')).to be_falsey
35
+ end
36
+
37
+ it 'rejects a normal phone number from China' do
38
+ expect(subject.phone_cell_number?('+86312123456')).to be_falsey
39
+ end
40
+ end
41
+ end
File without changes
File without changes
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.4
4
+ version: 1.5.5
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: 2017-12-01 00:00:00.000000000 Z
14
+ date: 2018-03-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -61,6 +61,20 @@ dependencies:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
+ - !ruby/object:Gem::Dependency
65
+ name: phonelib
66
+ requirement: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - "~>"
69
+ - !ruby/object:Gem::Version
70
+ version: '0.6'
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '0.6'
64
78
  - !ruby/object:Gem::Dependency
65
79
  name: rest-client
66
80
  requirement: !ruby/object:Gem::Requirement
@@ -243,20 +257,6 @@ dependencies:
243
257
  - - "~>"
244
258
  - !ruby/object:Gem::Version
245
259
  version: '2.1'
246
- - !ruby/object:Gem::Dependency
247
- name: rubocop
248
- requirement: !ruby/object:Gem::Requirement
249
- requirements:
250
- - - "~>"
251
- - !ruby/object:Gem::Version
252
- version: '0.40'
253
- type: :development
254
- prerelease: false
255
- version_requirements: !ruby/object:Gem::Requirement
256
- requirements:
257
- - - "~>"
258
- - !ruby/object:Gem::Version
259
- version: '0.40'
260
260
  - !ruby/object:Gem::Dependency
261
261
  name: simplecov
262
262
  requirement: !ruby/object:Gem::Requirement
@@ -323,6 +323,7 @@ files:
323
323
  - lib/roqua/healthy/a19/fetcher.rb
324
324
  - lib/roqua/healthy/a19/impulse_name_parser.rb
325
325
  - lib/roqua/healthy/a19/name_parser.rb
326
+ - lib/roqua/healthy/a19/phone_validator.rb
326
327
  - lib/roqua/healthy/a19/response_parser.rb
327
328
  - lib/roqua/healthy/a19/response_validator.rb
328
329
  - lib/roqua/healthy/a19/transformer.rb
@@ -381,6 +382,7 @@ files:
381
382
  - spec/unit/a19/address_parser_spec.rb
382
383
  - spec/unit/a19/correct_patient_check_spec.rb
383
384
  - spec/unit/a19/fetcher_spec.rb
385
+ - spec/unit/a19/phone_validator_spec.rb
384
386
  - spec/unit/a19/response_validator_spec.rb
385
387
  - spec/unit/a19_spec.rb
386
388
  - spec/unit/client_spec.rb
@@ -406,7 +408,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
406
408
  version: '0'
407
409
  requirements: []
408
410
  rubyforge_project:
409
- rubygems_version: 2.5.1
411
+ rubygems_version: 2.5.2.2
410
412
  signing_key:
411
413
  specification_version: 4
412
414
  summary: Arranges communication between Mirth and RoQua
@@ -458,6 +460,7 @@ test_files:
458
460
  - spec/unit/a19/address_parser_spec.rb
459
461
  - spec/unit/a19/correct_patient_check_spec.rb
460
462
  - spec/unit/a19/fetcher_spec.rb
463
+ - spec/unit/a19/phone_validator_spec.rb
461
464
  - spec/unit/a19/response_validator_spec.rb
462
465
  - spec/unit/a19_spec.rb
463
466
  - spec/unit/client_spec.rb