roqua-healthy 1.1.4 → 1.1.5

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
2
  SHA1:
3
- metadata.gz: 07b9615104913124d488adcfe8dcd8fc2b7d8a39
4
- data.tar.gz: e28bb319e0a7cb541000cc3426abc14f62c1f5cf
3
+ metadata.gz: 3592ec2e660920a456d96a84c0592a2e06feb6a6
4
+ data.tar.gz: 314df1d2cc8921c18b68e30b19f29d09047273b3
5
5
  SHA512:
6
- metadata.gz: 2c9c06247100c245101a39333e520f52d64e0be29ad1302c5fe263f7c6851107ccf9256abb07282e9ccb314cec7c2f3e16247122ef890fc35b58843ab9c5bc85
7
- data.tar.gz: 2b7deda3ee98b10f332c19a0379232c76e46a7ebd2f55994cfe76453270d259302eddd6a2d3287d1f3b87a939867ee04bd7af2e3f4a7382bf88abc4ed8889158
6
+ metadata.gz: 389a5a8552e049f2cbec4028ca093928625eea1eb8f56740a0b50db01767e5e8658d0a85b8d8d22621e7729a49aab21b146701028d905622878f7a4e1462a070
7
+ data.tar.gz: edd69073fd2923ea17007687dd81b0c4cbb0c30200a3dea2fb4d9d57fc7ba05521a8e3478067d600304e6a2bf5b9dbe1f60166b00c07de7a79bf670d5348044c
data/ChangeLog.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 1.1.5
2
+
3
+ * Added support for QAK segments that signal that a patient record was not found
4
+
1
5
  ### 1.1.4
2
6
 
3
7
  * Better handling for 403 and 404 responses.
@@ -30,9 +30,9 @@ module Roqua
30
30
  end
31
31
 
32
32
  def validate_200
33
- failure = parser.fetch("HL7Message")
34
- raise ::Roqua::Healthy::PatientNotFound if failure.key?("ERR") && failure.fetch("ERR").fetch("ERR.1").fetch("ERR.1.4").fetch("ERR.1.4.2") =~ /Patient \(@\) niet gevonden\(.*\)/
35
- raise ::Roqua::Healthy::MirthErrors::WrongPatient if failure.key?('QRD') && failure.fetch("QRD").fetch("QRD.8").fetch("QRD.8.1") != patient_id
33
+ parsed_message = parser.fetch("HL7Message")
34
+ ensure_patient_found(parsed_message)
35
+ ensure_correct_patient(parsed_message)
36
36
  true
37
37
  end
38
38
 
@@ -51,6 +51,17 @@ module Roqua
51
51
  raise ::Roqua::Healthy::ConnectionRefused, failure["error"] if failure["error"] == "Unable to connect to destination\tConnectException\tConnection refused"
52
52
  raise ::Roqua::Healthy::UnknownFailure, failure["error"]
53
53
  end
54
+
55
+ private
56
+
57
+ def ensure_patient_found(parsed_message)
58
+ 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\(.*\)/
59
+ raise ::Roqua::Healthy::PatientNotFound if parsed_message.key?("QAK") && parsed_message.fetch("QAK").fetch("QAK.2").fetch("QAK.2.1") == "NF"
60
+ end
61
+
62
+ def ensure_correct_patient(parsed_message)
63
+ raise ::Roqua::Healthy::MirthErrors::WrongPatient if parsed_message.key?('QRD') && parsed_message.fetch("QRD").fetch("QRD.8").fetch("QRD.8.1") != patient_id
64
+ end
54
65
  end
55
66
  end
56
67
  end
@@ -1,6 +1,6 @@
1
1
  module Roqua
2
2
  module Healthy
3
3
  # healthy version
4
- VERSION = "1.1.4"
4
+ VERSION = "1.1.5"
5
5
  end
6
- end
6
+ end
@@ -0,0 +1,131 @@
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>USER</MSH.3.1>
8
+ </MSH.3>
9
+ <MSH.4>
10
+ <MSH.4.1>IMPULSE</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>201405081100</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>
26
+ <MSH.10>
27
+ <MSH.10.1>00000000000003589431</MSH.10.1>
28
+ </MSH.10>
29
+ <MSH.11>
30
+ <MSH.11.1>P</MSH.11.1>
31
+ </MSH.11>
32
+ <MSH.12>
33
+ <MSH.12.1>2.4</MSH.12.1>
34
+ </MSH.12>
35
+ <MSH.13/>
36
+ <MSH.14/>
37
+ <MSH.15>
38
+ <MSH.15.1>NE</MSH.15.1>
39
+ </MSH.15>
40
+ <MSH.16>
41
+ <MSH.16.1>NE</MSH.16.1>
42
+ </MSH.16>
43
+ <MSH.17>
44
+ <MSH.17.1>NLD</MSH.17.1>
45
+ </MSH.17>
46
+ <MSH.18>
47
+ <MSH.18.1>UNICODE</MSH.18.1>
48
+ </MSH.18>
49
+ <MSH.19/>
50
+ <MSH.20/>
51
+ <MSH.21/>
52
+ <MSH.22/>
53
+ </MSH>
54
+ <MSA>
55
+ <MSA.1>
56
+ <MSA.1.1>CA</MSA.1.1>
57
+ </MSA.1>
58
+ <MSA.2>
59
+ <MSA.2.1>a00dd41161</MSA.2.1>
60
+ </MSA.2>
61
+ <MSA.3/>
62
+ <MSA.4/>
63
+ <MSA.5/>
64
+ <MSA.6/>
65
+ <MSA.7/>
66
+ </MSA>
67
+ <QAK>
68
+ <QAK.1/>
69
+ <QAK.2>
70
+ <QAK.2.1>NF</QAK.2.1>
71
+ </QAK.2>
72
+ <QAK.3/>
73
+ <QAK.4/>
74
+ <QAK.5/>
75
+ <QAK.6/>
76
+ <QAK.7/>
77
+ </QAK>
78
+ <QRD>
79
+ <QRD.1>
80
+ <QRD.1.1>201405080000</QRD.1.1>
81
+ </QRD.1>
82
+ <QRD.2>
83
+ <QRD.2.1>R</QRD.2.1>
84
+ </QRD.2>
85
+ <QRD.3>
86
+ <QRD.3.1>I</QRD.3.1>
87
+ </QRD.3>
88
+ <QRD.4>
89
+ <QRD.4.1>a00dd41161</QRD.4.1>
90
+ </QRD.4>
91
+ <QRD.5/>
92
+ <QRD.6/>
93
+ <QRD.7>
94
+ <QRD.7.1>1</QRD.7.1>
95
+ <QRD.7.2>RD</QRD.7.2>
96
+ </QRD.7>
97
+ <QRD.8>
98
+ <QRD.8.1>123456</QRD.8.1>
99
+ <QRD.8.2>
100
+ <QRD.8.2.1/>
101
+ <QRD.8.2.2/>
102
+ <QRD.8.2.3/>
103
+ <QRD.8.2.4/>
104
+ <QRD.8.2.5/>
105
+ </QRD.8.2>
106
+ <QRD.8.3/>
107
+ <QRD.8.4/>
108
+ <QRD.8.5/>
109
+ <QRD.8.6/>
110
+ <QRD.8.7/>
111
+ <QRD.8.8/>
112
+ <QRD.8.9/>
113
+ <QRD.8.10/>
114
+ <QRD.8.11/>
115
+ <QRD.8.12/>
116
+ <QRD.8.13/>
117
+ <QRD.8.14/>
118
+ <QRD.8.15/>
119
+ <QRD.8.16/>
120
+ <QRD.8.17/>
121
+ <QRD.8.18/>
122
+ </QRD.8>
123
+ <QRD.9>
124
+ <QRD.9.1>DEM</QRD.9.1>
125
+ </QRD.9>
126
+ <QRD.10/>
127
+ <QRD.11/>
128
+ <QRD.12/>
129
+ <QRD.13/>
130
+ </QRD>
131
+ </HL7Message>
@@ -69,4 +69,12 @@ describe 'Fetching A19 from USER' do
69
69
  it { expect(subject[:gender]).to eq('M') }
70
70
  it { expect(subject[:phone_cell]).to eq('0611223344') }
71
71
  end
72
- end
72
+
73
+ describe 'a patient that does not exist' do
74
+ before { load_fixture 'user_patient_not_found', '123456' }
75
+
76
+ it 'raises PatientNotFound' do
77
+ expect { Roqua::Healthy::A19.fetch("123456") }.to raise_error(Roqua::Healthy::PatientNotFound)
78
+ end
79
+ end
80
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roqua-healthy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-01 00:00:00.000000000 Z
11
+ date: 2014-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -278,6 +278,7 @@ files:
278
278
  - spec/fixtures/oru-requests/spsyl.hl7
279
279
  - spec/fixtures/oru-responses/xmcare_nack.hl7
280
280
  - spec/fixtures/user_patient.xml
281
+ - spec/fixtures/user_patient_not_found.xml
281
282
  - spec/fixtures/user_patient_with_gsm_and_email.xml
282
283
  - spec/fixtures/user_patient_with_maiden_name.xml
283
284
  - spec/fixtures/xmcare_impersonating_cdis.xml
@@ -341,6 +342,7 @@ test_files:
341
342
  - spec/fixtures/oru-requests/spsyl.hl7
342
343
  - spec/fixtures/oru-responses/xmcare_nack.hl7
343
344
  - spec/fixtures/user_patient.xml
345
+ - spec/fixtures/user_patient_not_found.xml
344
346
  - spec/fixtures/user_patient_with_gsm_and_email.xml
345
347
  - spec/fixtures/user_patient_with_maiden_name.xml
346
348
  - spec/fixtures/xmcare_impersonating_cdis.xml