roqua-healthy 1.5.9 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.document +0 -0
- data/.gitlab-ci.yml +11 -5
- data/.rspec +0 -0
- data/.rubocop.yml +7 -1
- data/.yardopts +0 -0
- data/Appraisals +7 -6
- data/ChangeLog.md +18 -0
- data/Guardfile +1 -1
- data/LICENSE.txt +0 -0
- data/Rakefile +0 -0
- data/circle.yml +0 -0
- data/gemfiles/rails52.gemfile +10 -0
- data/gemfiles/rails60.gemfile +9 -0
- data/gemfiles/rails61.gemfile +9 -0
- data/lib/roqua/healthy/a19.rb +0 -0
- data/lib/roqua/healthy/a19/address_parser.rb +10 -2
- data/lib/roqua/healthy/a19/correct_patient_check.rb +0 -0
- data/lib/roqua/healthy/a19/fetcher.rb +1 -2
- data/lib/roqua/healthy/a19/impulse_name_parser.rb +0 -0
- data/lib/roqua/healthy/a19/name_parser.rb +0 -0
- data/lib/roqua/healthy/a19/phone_parser.rb +18 -11
- data/lib/roqua/healthy/a19/phone_validator.rb +1 -1
- data/lib/roqua/healthy/a19/response_parser.rb +0 -0
- data/lib/roqua/healthy/a19/response_validator.rb +11 -13
- data/lib/roqua/healthy/a19/transformer.rb +19 -19
- data/lib/roqua/healthy/message_cleaner.rb +0 -0
- data/lib/roqua/healthy/oru/client.rb +0 -1
- data/lib/roqua/healthy/version.rb +1 -1
- data/lib/roqua_healthy.rb +0 -0
- data/roqua-healthy.gemspec +5 -6
- data/spec/fixtures/comez_patient.xml +0 -0
- data/spec/fixtures/ggzwnb_patient.xml +0 -0
- data/spec/fixtures/oru-requests/spsy1218j.hl7 +0 -0
- data/spec/fixtures/oru-requests/spsy1218o.hl7 +0 -0
- data/spec/fixtures/oru-requests/spsy1218o2.hl7 +0 -0
- data/spec/fixtures/oru-requests/spsy411o.hl7 +0 -0
- data/spec/fixtures/oru-requests/spsy411o2.hl7 +0 -0
- data/spec/fixtures/oru-requests/spsyl.hl7 +0 -0
- data/spec/fixtures/oru-responses/xmcare_nack.hl7 +0 -0
- data/spec/fixtures/user_patient.xml +0 -0
- data/spec/fixtures/user_patient_not_found.xml +0 -0
- data/spec/fixtures/user_patient_with_gsm_and_email.xml +0 -0
- data/spec/fixtures/user_patient_with_maiden_name.xml +0 -0
- data/spec/fixtures/xmcare_house_number_addendum.xml +335 -0
- data/spec/fixtures/xmcare_missing_whole_pids.xml +162 -0
- data/spec/fixtures/xmcare_patient.xml +0 -0
- data/spec/fixtures/xmcare_patient_email_in_field_number_four.xml +0 -0
- data/spec/fixtures/xmcare_patient_not_found.xml +0 -0
- data/spec/fixtures/xmcare_patient_with_maiden_name.xml +0 -0
- data/spec/fixtures/xmcare_patient_without_birthdate.xml +0 -0
- data/spec/fixtures/xmcare_phone_cell_in_prn.xml +0 -0
- data/spec/fixtures/xmcare_phone_cell_in_prn_orn.xml +0 -0
- data/spec/fixtures/xmcare_phone_home_in_prn.xml +0 -0
- data/spec/fixtures/xmcare_timeout_waiting_for_ack.xml +0 -0
- data/spec/fixtures/xmcare_unconventional_phone_cell_in_orn.xml +0 -0
- data/spec/fixtures/xmcare_unconventional_phone_cell_in_orn2.xml +0 -0
- data/spec/healthy_spec.rb +0 -0
- data/spec/integration/xmcare_spec.rb +18 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/support/fixtures.rb +0 -0
- data/spec/unit/a19/address_parser_spec.rb +49 -0
- data/spec/unit/a19/correct_patient_check_spec.rb +0 -0
- data/spec/unit/a19/phone_parser_spec.rb +7 -0
- data/spec/unit/a19_spec.rb +0 -0
- data/spec/unit/message_cleaner_spec.rb +0 -0
- data/spec/unit/oru/client_spec.rb +2 -2
- metadata +31 -36
- data/gemfiles/rails41.gemfile +0 -8
- data/gemfiles/rails42.gemfile +0 -8
- data/gemfiles/rails50.gemfile +0 -8
- data/lib/roqua/errors.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 676e3d78e93d705fbf01f1e7eb726ca8c250b64fb7e226262b8bebd9d4ca540d
|
4
|
+
data.tar.gz: 5a5eac93225350b7446eaf8c3c22f29d53d3673437488fe04e4c8d8b9ccc25ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b54a9724e9035399b542b8d034cde91808a32938293c1da699dc1ab9d5ba626bc5a56bc0afc047fc1989b12e307e728562abc87d1d04147691791327f99a01b
|
7
|
+
data.tar.gz: d992da02d82847037d5881ead65ee81281ccc1a1eb111f44b5f68600f26c6af31e31f0b5acf2304fba34bf48db98dfe8bf44f9dd90188bbcb972a955ad4509c0
|
data/.document
CHANGED
File without changes
|
data/.gitlab-ci.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
image: "registry.roqua.nl/roqua/docker-base-images:ruby-2.
|
1
|
+
image: "registry.roqua.nl/roqua/docker-base-images:ruby-2.7-builder"
|
2
2
|
|
3
3
|
cache:
|
4
4
|
paths:
|
@@ -15,8 +15,14 @@ rubocop:
|
|
15
15
|
script:
|
16
16
|
- bundle exec rubocop -D
|
17
17
|
|
18
|
-
|
18
|
+
rails52:
|
19
19
|
script:
|
20
|
-
- bundle exec appraisal
|
21
|
-
|
22
|
-
|
20
|
+
- bundle exec appraisal rails52 bundle exec rspec
|
21
|
+
|
22
|
+
rails60:
|
23
|
+
script:
|
24
|
+
- bundle exec appraisal rails60 bundle exec rspec
|
25
|
+
|
26
|
+
rails61:
|
27
|
+
script:
|
28
|
+
- bundle exec appraisal rails61 bundle exec rspec
|
data/.rspec
CHANGED
File without changes
|
data/.rubocop.yml
CHANGED
@@ -4,7 +4,7 @@ AllCops:
|
|
4
4
|
Exclude:
|
5
5
|
- vendor/**/*
|
6
6
|
- gemfiles/*
|
7
|
-
TargetRubyVersion: 2.
|
7
|
+
TargetRubyVersion: 2.6
|
8
8
|
|
9
9
|
Documentation:
|
10
10
|
Enabled: false
|
@@ -27,7 +27,13 @@ SignalException:
|
|
27
27
|
Layout/EmptyLineAfterMagicComment:
|
28
28
|
Enabled: False
|
29
29
|
|
30
|
+
Layout/EmptyLineBetweenDefs:
|
31
|
+
AllowAdjacentOneLineDefs: true
|
32
|
+
|
30
33
|
Naming/FileName:
|
31
34
|
Exclude:
|
32
35
|
- Appraisals
|
33
36
|
|
37
|
+
# No, I don't want to call my exceptions 'e' instead of 'exception' or 'error'.
|
38
|
+
Naming/RescuedExceptionsVariableName:
|
39
|
+
Enabled: false
|
data/.yardopts
CHANGED
File without changes
|
data/Appraisals
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
appraise "
|
4
|
-
gem "activesupport", "
|
3
|
+
appraise "rails52" do
|
4
|
+
gem "activesupport", "5.2"
|
5
|
+
gem "roqua-support", "~> 0.3.0"
|
5
6
|
end
|
6
7
|
|
7
|
-
appraise "
|
8
|
-
gem "activesupport", "
|
8
|
+
appraise "rails60" do
|
9
|
+
gem "activesupport", "6.0"
|
9
10
|
end
|
10
11
|
|
11
|
-
appraise "
|
12
|
-
gem "activesupport", "
|
12
|
+
appraise "rails61" do
|
13
|
+
gem "activesupport", "6.1"
|
13
14
|
end
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
### 1.6.0
|
2
|
+
|
3
|
+
* ActiveSupport 6.1 support
|
4
|
+
* Removed ActiveSupport 4.1, 4.2, 5.0 and 5.1
|
5
|
+
* Add roqua_support 0.4 support.
|
6
|
+
|
7
|
+
### 1.5.12
|
8
|
+
|
9
|
+
* ActiveSupport 6.0 support
|
10
|
+
|
11
|
+
### 1.5.11
|
12
|
+
|
13
|
+
* Support for PID.11 and PID.13 completely missing from an hl7 response.
|
14
|
+
|
15
|
+
### 1.5.10
|
16
|
+
|
17
|
+
* Support for house number suffices in PID 11.2
|
18
|
+
|
1
19
|
### 1.5.9
|
2
20
|
|
3
21
|
* Ruby 2.5 support
|
data/Guardfile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
guard 'rspec', cmd: 'bundle exec rspec
|
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" }
|
data/LICENSE.txt
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/circle.yml
CHANGED
File without changes
|
@@ -0,0 +1,10 @@
|
|
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
|
+
gem "roqua-support", "~> 0.3.0"
|
9
|
+
|
10
|
+
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: "../"
|
@@ -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.1"
|
8
|
+
|
9
|
+
gemspec path: "../"
|
data/lib/roqua/healthy/a19.rb
CHANGED
File without changes
|
@@ -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
|
-
|
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.
|
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
|
File without changes
|
File without changes
|
File without changes
|
@@ -11,26 +11,33 @@ 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')
|
15
|
-
|
16
14
|
# prefer PRN (Primary Residence Number) that contains a cell phone number
|
17
|
-
phone_cell_record = pid13.find do |record|
|
18
|
-
phone_cell_number?(record.fetch('PID.13.1', '') || '') &&
|
19
|
-
record.fetch('PID.13.2', :unknown_type_of_phone_record) == 'PRN'
|
20
|
-
end
|
21
|
-
|
22
15
|
# otherwise choose the first occuring cell phone number
|
23
|
-
phone_cell_record ||= pid13.find do |record|
|
24
|
-
phone_cell_number?(record.fetch('PID.13.1', '') || '')
|
25
|
-
end
|
26
|
-
|
27
16
|
# any number for which phone_cell_number? returns false is ignored
|
17
|
+
phone_cell_record = first_matching_prn_record || first_matching_record
|
28
18
|
|
29
19
|
strip_non_phone_number_characters(phone_cell_record.fetch('PID.13.1')) if phone_cell_record.present?
|
30
20
|
end
|
31
21
|
|
32
22
|
private
|
33
23
|
|
24
|
+
def pid13
|
25
|
+
@pid13 ||= message.dig('PID', 'PID.13') || []
|
26
|
+
end
|
27
|
+
|
28
|
+
def first_matching_prn_record
|
29
|
+
pid13.find do |record|
|
30
|
+
phone_cell_number?(record.fetch('PID.13.1', '') || '') &&
|
31
|
+
record.fetch('PID.13.2', :unknown_type_of_phone_record) == 'PRN'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def first_matching_record
|
36
|
+
pid13.find do |record|
|
37
|
+
phone_cell_number?(record.fetch('PID.13.1', '') || '')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
34
41
|
def strip_non_phone_number_characters(number)
|
35
42
|
Roqua::Healthy::A19::PhoneValidator.strip_non_phone_number_characters number
|
36
43
|
end
|
File without changes
|
@@ -7,9 +7,7 @@ module Roqua
|
|
7
7
|
class ResponseValidator
|
8
8
|
require 'roqua/healthy/errors'
|
9
9
|
|
10
|
-
attr_reader :response_code
|
11
|
-
attr_reader :parser
|
12
|
-
attr_reader :patient_id
|
10
|
+
attr_reader :parser, :patient_id, :response_code
|
13
11
|
|
14
12
|
def initialize(response_code, parser, patient_id)
|
15
13
|
@response_code = response_code
|
@@ -20,41 +18,41 @@ module Roqua
|
|
20
18
|
def validate
|
21
19
|
case response_code
|
22
20
|
when '200'
|
23
|
-
|
21
|
+
validate200
|
24
22
|
when '401', '403'
|
25
|
-
|
23
|
+
validate403
|
26
24
|
when '404'
|
27
|
-
|
25
|
+
validate404
|
28
26
|
when '500'
|
29
|
-
|
27
|
+
validate500
|
30
28
|
else
|
31
29
|
raise ::Roqua::Healthy::UnknownFailure, "Unexpected HTTP response code #{response_code}."
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
35
|
-
|
33
|
+
private
|
34
|
+
|
35
|
+
def validate200
|
36
36
|
parsed_message = parser.fetch("HL7Message")
|
37
37
|
ensure_patient_found(parsed_message)
|
38
38
|
ensure_correct_patient(parsed_message)
|
39
39
|
true
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
42
|
+
def validate403
|
43
43
|
raise ::Roqua::Healthy::AuthenticationFailure
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
46
|
+
def validate404
|
47
47
|
raise ::Roqua::Healthy::PatientNotFound
|
48
48
|
end
|
49
49
|
|
50
|
-
def
|
50
|
+
def validate500
|
51
51
|
error = parser.fetch('failure')['error']
|
52
52
|
raise ::Roqua::Healthy::ERRORS[error], error if ::Roqua::Healthy::ERRORS[error]
|
53
53
|
raise ::Roqua::Healthy::UnknownFailure, error
|
54
54
|
end
|
55
55
|
|
56
|
-
private
|
57
|
-
|
58
56
|
def ensure_patient_found(parsed_message)
|
59
57
|
raise ::Roqua::Healthy::PatientNotFound if parsed_message.key?("ERR") && parsed_message.fetch("ERR").fetch("ERR.1").fetch("ERR.1.4").fetch("ERR.1.4.2") =~ /Patient \(@\) niet gevonden\(.*\)/
|
60
58
|
raise ::Roqua::Healthy::PatientNotFound if parsed_message.key?("QAK") && parsed_message.fetch("QAK").fetch("QAK.2").fetch("QAK.2.1") == "NF"
|
@@ -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.
|
23
|
-
message['PID']['PID.13'] = [message.
|
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:
|
31
|
-
source:
|
32
|
-
identities:
|
33
|
-
firstname:
|
34
|
-
initials:
|
35
|
-
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:
|
38
|
-
email:
|
37
|
+
nickname: name.nickname,
|
38
|
+
email: email,
|
39
39
|
address_type: address.address_type,
|
40
|
-
street:
|
41
|
-
city:
|
42
|
-
zipcode:
|
43
|
-
country:
|
44
|
-
birthdate:
|
45
|
-
gender:
|
46
|
-
phone_cell:
|
47
|
-
medoq_data:
|
48
|
-
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
|
File without changes
|
data/lib/roqua_healthy.rb
CHANGED
File without changes
|
data/roqua-healthy.gemspec
CHANGED
@@ -13,19 +13,19 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.email = "support@roqua.nl"
|
14
14
|
gem.homepage = "https://github.com/roqua/healthy"
|
15
15
|
|
16
|
-
gem.required_ruby_version = '
|
16
|
+
gem.required_ruby_version = '>= 2.6'
|
17
17
|
|
18
18
|
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
19
19
|
gem.executables = [] # executables in bin/ are helpers for use during development
|
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', '>=
|
23
|
+
gem.add_dependency 'activesupport', '>= 5.1', '< 6.2'
|
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', '
|
28
|
+
gem.add_dependency 'roqua-support', '>= 0.3.0', '< 0.5.0'
|
29
29
|
|
30
30
|
gem.add_development_dependency 'appraisal'
|
31
31
|
gem.add_development_dependency 'bundler'
|
@@ -37,10 +37,9 @@ 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
|
-
gem.add_development_dependency 'guard-rspec', '~> 4.2
|
43
|
-
gem.add_development_dependency 'guard-rubocop', '~> 1.2
|
41
|
+
gem.add_development_dependency 'guard-rspec', '~> 4.2'
|
42
|
+
gem.add_development_dependency 'guard-rubocop', '~> 1.2'
|
44
43
|
gem.add_development_dependency 'listen', '~> 2.1'
|
45
44
|
gem.add_development_dependency 'simplecov'
|
46
45
|
|