roqua-healthy 1.1.9 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 964fbac85a2be76b1cef6c67dbbc3709263bd075
4
- data.tar.gz: 7ca7069b1a9f82c4bb8f219f2626c37373facc44
3
+ metadata.gz: 535dbe075acc71ad6cfb216f74c0459d30076680
4
+ data.tar.gz: d0ca4037f6610614aa35350fc9f7e3ac80f83c4e
5
5
  SHA512:
6
- metadata.gz: 5c90e5bcc6533683c1c3ebcd9b8b2b7c114bd45c077b673c02c80c7f4fcebe4895b311ca0b26c0a187af7de195dced3a5d6001d356de26df086ba814d33a019e
7
- data.tar.gz: bcc1ab265d2aae32b9f3f391864c3fb53f0a51cc611b1b832bba5eef038e266e125a5bac1dcface2328327fe26e6976ca11de639ad20cb1f6ccc5c6121642d75
6
+ metadata.gz: 768b8effbda52101455902040e0ba9357778ab73070bf36626ce6f2addf1311dba1c5cf175c104bd894d09fb13cad530fff4602aca8f0b31d4c7e7b37f7295a4
7
+ data.tar.gz: 7559755407e7e2ba44079dd4e89e2b0f8bc2243fcf6d5b7eee88ca5cb9b4297728f8cc0cbe87957c63d7ed631a9862b6b8475e5663c80eb49918935802e6af19
data/ChangeLog.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 1.2.0
2
+
3
+ * Added support for MEDOQ hl7 a19 identities encoded in JSON
4
+
1
5
  ### 1.1.9
2
6
 
3
7
  * Handle upgraded mirth error messages
@@ -10,9 +10,9 @@ module Roqua
10
10
  end
11
11
 
12
12
  def check
13
- record[:identities].any? { |i| i[:ident] == patient_id }
13
+ record[:identities].try(:any?) { |i| i[:ident] == patient_id }
14
14
  end
15
15
  end
16
16
  end
17
17
  end
18
- end
18
+ end
@@ -2,6 +2,7 @@ require 'roqua/healthy/a19/name_parser'
2
2
  require 'roqua/healthy/a19/cdis_name_parser'
3
3
  require 'roqua/healthy/a19/impulse_name_parser'
4
4
  require 'roqua/healthy/a19/address_parser'
5
+ require 'active_support/core_ext/hash'
5
6
 
6
7
  module Roqua
7
8
  module Healthy
@@ -35,7 +36,8 @@ module Roqua
35
36
  country: address.country,
36
37
  birthdate: birthdate,
37
38
  gender: gender,
38
- phone_cell: phone_cell
39
+ phone_cell: phone_cell,
40
+ medoq_data: medoq_data
39
41
  }
40
42
  end
41
43
 
@@ -48,12 +50,30 @@ module Roqua
48
50
  end
49
51
 
50
52
  def identities
51
- message.fetch('PID').fetch('PID.3').map do |identity|
53
+ @identities ||= message.fetch('PID').fetch('PID.3').map do |identity|
52
54
  next if identity.fetch('PID.3.1').blank?
53
- {ident: identity.fetch('PID.3.1'), authority: identity.fetch('PID.3.5')}
55
+ authority = identity.fetch('PID.3.5')
56
+ # medoq sends all its (possibly identifying) metadata in 1 json encoded identity
57
+ # non medoq hl7 clients could fake being medoq, so do not add any trusted behavior
58
+ # to medoq identities beyond what a regular hl7 field would enable
59
+ if authority == 'MEDOQ'
60
+ parsed_medoq_data = JSON.parse(identity.fetch('PID.3.1')).with_indifferent_access
61
+ {ident: parsed_medoq_data[:epd_id],
62
+ research_number: parsed_medoq_data[:research_number],
63
+ metadata: parsed_medoq_data[:metadata],
64
+ authority: authority}
65
+ else
66
+ {ident: identity.fetch('PID.3.1'), authority: authority}
67
+ end
54
68
  end.compact
55
69
  end
56
70
 
71
+ def medoq_data
72
+ identities.find do |identity|
73
+ identity[:authority] == 'MEDOQ'
74
+ end || {}
75
+ end
76
+
57
77
  def birthdate
58
78
  birthdate_details = message.fetch('PID').fetch('PID.7')
59
79
  birthdate_details.fetch('PID.7.1') if birthdate_details
@@ -1,6 +1,6 @@
1
1
  module Roqua
2
2
  module Healthy
3
3
  # healthy version
4
- VERSION = "1.1.9"
4
+ VERSION = "1.2.0"
5
5
  end
6
6
  end
data/lib/roqua-healthy.rb CHANGED
@@ -1 +1 @@
1
- require 'roqua/healthy'
1
+ require 'roqua/healthy'
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
8
8
  gem.summary = %q{Arranges communication between Mirth and RoQua}
9
9
  gem.description = %q{Receives queries from RoQua, sends them to Mirth, and translates Mirth's responses back into Rubyland.}
10
10
  gem.license = "MIT"
11
- gem.authors = ["Marten Veldthuis"]
12
- gem.email = "marten@roqua.nl"
11
+ gem.authors = ["Marten Veldthuis", "Jorn van de Beek"]
12
+ gem.email = "support@roqua.nl"
13
13
  gem.homepage = "https://github.com/roqua/healthy"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
@@ -4,7 +4,7 @@
4
4
  <MSH.1>|</MSH.1>
5
5
  <MSH.2>^~\&amp;</MSH.2>
6
6
  <MSH.3>
7
- <MSH.3.1>MEDO</MSH.3.1>
7
+ <MSH.3.1>MEDOQ</MSH.3.1>
8
8
  </MSH.3>
9
9
  <MSH.4>
10
10
  <MSH.4.1>RGOC</MSH.4.1>
@@ -46,12 +46,9 @@
46
46
  </PID.1>
47
47
  <PID.3 type="array">
48
48
  <PID.3>
49
- <PID.3.1>md-cdae5d100d8e0131d2623c075478eb56</PID.3.1>
50
- <PID.3.5>epd</PID.3.5>
51
- </PID.3>
52
- <PID.3>
53
- <PID.3.1>research-id-123</PID.3.1>
54
- <PID.3.5>medo-research-number</PID.3.5>
49
+ <PID.3.1>{"research_number":"research-id-123",
50
+ "epd_id":"md-cdae5d100d8e0131d2623c075478eb56", "metadata":{"test":"12"}}</PID.3.1>
51
+ <PID.3.5>MEDOQ</PID.3.5>
55
52
  </PID.3>
56
53
  </PID.3>
57
54
  <PID.5 type="array">
@@ -1,16 +1,18 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  # rubocop:disable Blocks,BlockAlignment
4
- describe 'Fetching A19 from Medo' do
4
+ describe 'Fetching A19 from Medoq' do
5
5
  describe 'a patient' do
6
- before { load_fixture 'medo_patient', 'md-cdae5d100d8e0131d2623c075478eb56' }
6
+ before { load_fixture 'medoq_patient', 'md-cdae5d100d8e0131d2623c075478eb56' }
7
7
  subject { Roqua::Healthy::A19.fetch("md-cdae5d100d8e0131d2623c075478eb56") }
8
8
 
9
9
  it { expect(subject[:status]).to eq('SUCCESS') }
10
10
  it { expect(subject[:error]).to be_nil }
11
11
  it { expect(subject[:source]).to eq('RGOC') }
12
- it { expect(subject[:identities]).to eq([{ident: 'md-cdae5d100d8e0131d2623c075478eb56', authority: 'epd'},
13
- {ident: 'research-id-123', authority: 'medo-research-number'}]) }
12
+ it { expect(subject[:identities]).to eq([{ident: "md-cdae5d100d8e0131d2623c075478eb56",
13
+ research_number: "research-id-123",
14
+ metadata: {"test" => "12"},
15
+ authority: 'MEDOQ'}]) }
14
16
  it { expect(subject[:firstname]).to eq('Jan') }
15
17
  it { expect(subject[:initials]).to eq('J.') }
16
18
  it { expect(subject[:lastname]).to eq('Fictief') }
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roqua-healthy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.9
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
+ - Jorn van de Beek
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-10-07 00:00:00.000000000 Z
12
+ date: 2016-03-22 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: activesupport
@@ -228,7 +229,7 @@ dependencies:
228
229
  version: '1.2'
229
230
  description: Receives queries from RoQua, sends them to Mirth, and translates Mirth's
230
231
  responses back into Rubyland.
231
- email: marten@roqua.nl
232
+ email: support@roqua.nl
232
233
  executables: []
233
234
  extensions: []
234
235
  extra_rdoc_files: []
@@ -270,7 +271,7 @@ files:
270
271
  - spec/fixtures/cdis_missing_address.xml
271
272
  - spec/fixtures/cdis_piet_fictief.xml
272
273
  - spec/fixtures/comez_patient.xml
273
- - spec/fixtures/medo_patient.xml
274
+ - spec/fixtures/medoq_patient.xml
274
275
  - spec/fixtures/oru-requests/spsy1218j.hl7
275
276
  - spec/fixtures/oru-requests/spsy1218o.hl7
276
277
  - spec/fixtures/oru-requests/spsy1218o2.hl7
@@ -334,7 +335,7 @@ test_files:
334
335
  - spec/fixtures/cdis_missing_address.xml
335
336
  - spec/fixtures/cdis_piet_fictief.xml
336
337
  - spec/fixtures/comez_patient.xml
337
- - spec/fixtures/medo_patient.xml
338
+ - spec/fixtures/medoq_patient.xml
338
339
  - spec/fixtures/oru-requests/spsy1218j.hl7
339
340
  - spec/fixtures/oru-requests/spsy1218o.hl7
340
341
  - spec/fixtures/oru-requests/spsy1218o2.hl7