ruby-hl7-extensions 0.0.61 → 0.0.62
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/VERSION.yml +1 -1
- data/lib/core_ext/message.rb +24 -36
- data/lib/core_ext/segments/evn.rb +24 -0
- data/lib/core_ext/segments/orc.rb +57 -1
- data/lib/core_ext/segments/pid.rb +17 -1
- data/lib/core_ext/segments/pv1.rb +18 -0
- data/lib/core_ext/segments/segments.rb +2 -1
- data/ruby-hl7-extensions.gemspec +2 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d77e1632b44216a110e2b93cd13fad7b38829c74
|
4
|
+
data.tar.gz: 2bea026073e31a0f858eb35f27b7d902b9aaafed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8059fd05b81b7978eb2f9974fb8b7403e3186cb74460acf2cbcbb382dd496bbff21141ea34c77801bd9144a644b944a8ec8ad0c828556d2fa46c6f2043b6db6e
|
7
|
+
data.tar.gz: 7bb8dd67488ab8211a0dafd0678cb57d9b105cc94a0a576522bebde5a9466fbe58d1bf39f5cdf2c658e557075ec8d9ea654158e1ba2f7f649ec49df6def12fe0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.62
|
data/VERSION.yml
CHANGED
data/lib/core_ext/message.rb
CHANGED
@@ -48,55 +48,23 @@ module Extensions
|
|
48
48
|
|
49
49
|
providers
|
50
50
|
end
|
51
|
+
|
52
|
+
def evn
|
53
|
+
@evn ||= segments_for(:EVN).first
|
54
|
+
end
|
51
55
|
|
52
56
|
def msh
|
53
57
|
@msh ||= segments_for(:MSH).first
|
54
58
|
end
|
55
59
|
|
56
|
-
def message_type
|
57
|
-
msh.value_for_field("8.1")
|
58
|
-
end
|
59
|
-
|
60
|
-
def event
|
61
|
-
msh.value_for_field("8.2")
|
62
|
-
end
|
63
|
-
|
64
|
-
def sending_application
|
65
|
-
msh.value_for_field("3.1")
|
66
|
-
end
|
67
|
-
|
68
60
|
def pid
|
69
61
|
@pid ||= segments_for(:PID).first
|
70
62
|
end
|
71
63
|
|
72
|
-
def patient_full_name
|
73
|
-
last_name = pid.value_for_field("5.1")
|
74
|
-
first_name = pid.value_for_field("5.2")
|
75
|
-
middle_initial_or_name = pid.value_for_field("5.3")
|
76
|
-
|
77
|
-
"#{last_name}, #{first_name}#{middle_initial_or_name.blank? ? "" : " #{middle_initial_or_name}"}"
|
78
|
-
end
|
79
|
-
|
80
|
-
def patient_dob
|
81
|
-
Date.parse(pid.patient_dob).strftime("%B %d, %Y") if pid.patient_dob
|
82
|
-
end
|
83
|
-
|
84
|
-
def patient_mrn
|
85
|
-
pid.value_for_field("3.1")
|
86
|
-
end
|
87
|
-
|
88
|
-
def patient_gender
|
89
|
-
pid.value_for_field("8")
|
90
|
-
end
|
91
|
-
|
92
64
|
def pv1
|
93
65
|
@pv1 ||= segments_for(:PV1).first
|
94
66
|
end
|
95
67
|
|
96
|
-
def account_number
|
97
|
-
pv1.value_for_field("19.1")
|
98
|
-
end
|
99
|
-
|
100
68
|
def obr_list
|
101
69
|
# segments_for(:OBR).to_enum(:each)
|
102
70
|
a = hash["message"]["content"]["OBR"]["array"].collect {|obr| ::HL7::Message::Segment.from_hash("OBR", obr)}
|
@@ -109,6 +77,26 @@ module Extensions
|
|
109
77
|
a.to_enum(:each)
|
110
78
|
end
|
111
79
|
|
80
|
+
def message_type
|
81
|
+
msh.value_for_field("8.1")
|
82
|
+
end
|
83
|
+
|
84
|
+
def event
|
85
|
+
msh.value_for_field("8.2")
|
86
|
+
end
|
87
|
+
|
88
|
+
def sending_application
|
89
|
+
msh.value_for_field("3.1")
|
90
|
+
end
|
91
|
+
|
92
|
+
def patient_mrn
|
93
|
+
pid.value_for_field("3.1")
|
94
|
+
end
|
95
|
+
|
96
|
+
def account_number
|
97
|
+
pv1.value_for_field("19.1")
|
98
|
+
end
|
99
|
+
|
112
100
|
def hash
|
113
101
|
to_hash
|
114
102
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Extensions
|
2
|
+
module HL7
|
3
|
+
module Segments
|
4
|
+
module EVN
|
5
|
+
|
6
|
+
def self.included base
|
7
|
+
base.send :include, InstanceMethods
|
8
|
+
base.extend ClassMethods
|
9
|
+
end
|
10
|
+
|
11
|
+
module InstanceMethods
|
12
|
+
def event_datetime
|
13
|
+
self.event_occurred || self.recorded_date
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
module ClassMethods
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
@@ -13,6 +13,10 @@ module Extensions
|
|
13
13
|
to_hash["orderingProvider"]
|
14
14
|
end
|
15
15
|
|
16
|
+
def order_control_text
|
17
|
+
OrderControl.t(self.order_control) rescue nil
|
18
|
+
end
|
19
|
+
|
16
20
|
def obr_list
|
17
21
|
a = to_hash["OBR"]["array"].collect {|obr| ::HL7::Message::Segment.from_hash("OBR", obr)}
|
18
22
|
a.to_enum(:each)
|
@@ -93,9 +97,61 @@ module Extensions
|
|
93
97
|
end
|
94
98
|
|
95
99
|
module ClassMethods
|
96
|
-
|
97
100
|
end
|
98
101
|
|
102
|
+
class OrderControl < EnumerateIt::Base
|
103
|
+
associate_values(NW: ['NW', 'New Order'],
|
104
|
+
OK: ['OK', 'Order/service accepted & OK'],
|
105
|
+
UA: ['UA', 'Unable to accept order/service'],
|
106
|
+
UA: ['UA', 'Unable to accept order/service'],
|
107
|
+
CA: ['CA', 'Canceled Order'],
|
108
|
+
OC: ['OC', 'Canceled Order'],
|
109
|
+
CR: ['CR', 'Canceled Order'],
|
110
|
+
UC: ['UC', 'Unable to cancel'],
|
111
|
+
DC: ['DC', 'Discontinue order/service request'],
|
112
|
+
OD: ['OD', 'Order/service discontinued'],
|
113
|
+
DR: ['DR', 'Discontinued as requested'],
|
114
|
+
UD: ['UD', 'Unable to discontinue'],
|
115
|
+
HD: ['HD', 'Hold order request'],
|
116
|
+
OH: ['OH', 'Order/service held'],
|
117
|
+
UH: ['UH', 'Unable to put on hold'],
|
118
|
+
HR: ['HR', 'On hold as requested'],
|
119
|
+
RL: ['RL', 'Release previous hold'],
|
120
|
+
OE: ['OE', 'Order/service released'],
|
121
|
+
OR: ['OR', 'Released as requested'],
|
122
|
+
UR: ['UR', 'Unable to release'],
|
123
|
+
RP: ['RP', 'Order/service replace request'],
|
124
|
+
RU: ['RU', 'Replaced unsolicited'],
|
125
|
+
RO: ['RO', 'Replacement order'],
|
126
|
+
RQ: ['RQ', 'Replaced as requested'],
|
127
|
+
UM: ['UM', 'Unable to replace'],
|
128
|
+
PA: ['PA', 'Parent order/service'],
|
129
|
+
CH: ['CH', 'Child order/service'],
|
130
|
+
XO: ['XO', 'Change Order'],
|
131
|
+
XX: ['XX', 'Change Order'],
|
132
|
+
UX: ['UX', 'Unable to change'],
|
133
|
+
XR: ['XR', 'Changed as requested'],
|
134
|
+
DE: ['DE', 'Data errors'],
|
135
|
+
RE: ['RE', 'Observations/Performed Service to follow'],
|
136
|
+
RR: ['RR', 'Request received'],
|
137
|
+
SR: ['SR', 'Response to send order/service status request'],
|
138
|
+
SS: ['SS', 'Send order/service status request'],
|
139
|
+
SC: ['SC', 'Status changed'],
|
140
|
+
SN: ['SN', 'Send order/service number'],
|
141
|
+
NA: ['NA', 'Number assigned'],
|
142
|
+
CN: ['CN', 'Combined result'],
|
143
|
+
RF: ['RF', 'Refill order/service request'],
|
144
|
+
AF: ['AF', 'Order/service refill request approval'],
|
145
|
+
DF: ['DF', 'Order/service refill request denied'],
|
146
|
+
FU: ['FU', 'Order/service refilled, unsolicited'],
|
147
|
+
OF: ['OF', 'Order/service refilled as requested'],
|
148
|
+
UF: ['UF', 'Unable to refill'],
|
149
|
+
LI: ['LI', 'Link order/service to patient care problem or goal'],
|
150
|
+
UN: ['UN', 'Unlink order/service from patient care problem or goal'],
|
151
|
+
OP: ['OP', 'Notification of order for outside dispense'],
|
152
|
+
PY: ['PY', 'Notification of replacement order for outside dispense'])
|
153
|
+
|
154
|
+
end
|
99
155
|
end
|
100
156
|
end
|
101
157
|
end
|
@@ -9,12 +9,28 @@ module Extensions
|
|
9
9
|
end
|
10
10
|
|
11
11
|
module InstanceMethods
|
12
|
+
def patient_full_name
|
13
|
+
last_name = self.value_for_field("5.1")
|
14
|
+
first_name = self.value_for_field("5.2")
|
15
|
+
middle_initial_or_name = self.value_for_field("5.3")
|
16
|
+
|
17
|
+
"#{last_name}, #{first_name}#{middle_initial_or_name.blank? ? "" : " #{middle_initial_or_name}"}" rescue "n/a"
|
18
|
+
end
|
19
|
+
|
20
|
+
def patient_initials
|
21
|
+
last_name = self.value_for_field("5.1")
|
22
|
+
first_name = self.value_for_field("5.2")
|
23
|
+
middle_initial_or_name = self.value_for_field("5.3")
|
24
|
+
|
25
|
+
"#{last_name[0]}, #{first_name[0]}" rescue "n/a"
|
26
|
+
end
|
27
|
+
|
12
28
|
def mrn
|
13
29
|
to_hash["internalId"]["id"]
|
14
30
|
end
|
15
31
|
|
16
32
|
def gender
|
17
|
-
|
33
|
+
self.value_for_field("8")
|
18
34
|
end
|
19
35
|
|
20
36
|
def to_hash
|
@@ -10,6 +10,24 @@ module Extensions
|
|
10
10
|
|
11
11
|
module InstanceMethods
|
12
12
|
|
13
|
+
def assigned_location_str
|
14
|
+
location = self.assigned_location.split(self.item_delim)
|
15
|
+
point_of_care = location[0] rescue nil
|
16
|
+
room = location[1] rescue nil
|
17
|
+
bed = location[2] rescue nil
|
18
|
+
|
19
|
+
"#{point_of_care}#{room.blank? ? "" : "-#{room}"}#{bed.blank? ? "" : "-#{bed}"}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def prior_location_str
|
23
|
+
location = self.prior_location.split(self.item_delim)
|
24
|
+
point_of_care = location[0] rescue nil
|
25
|
+
room = location[1] rescue nil
|
26
|
+
bed = location[2] rescue nil
|
27
|
+
|
28
|
+
"#{point_of_care}#{room.blank? ? "" : "-#{room}"}#{bed.blank? ? "" : "-#{bed}"}"
|
29
|
+
end
|
30
|
+
|
13
31
|
def account_number
|
14
32
|
to_hash["visit"]["id"]
|
15
33
|
end
|
@@ -6,8 +6,9 @@ require 'core_ext/segments/obx'
|
|
6
6
|
require 'core_ext/segments/nte'
|
7
7
|
require 'core_ext/segments/nk1'
|
8
8
|
require 'core_ext/segments/pv1'
|
9
|
+
require 'core_ext/segments/evn'
|
9
10
|
|
10
|
-
segments = ["MSH","PID","ORC","OBR","OBX","NTE","NK1", "PV1"]
|
11
|
+
segments = ["MSH","PID","ORC","OBR","OBX","NTE","NK1", "PV1", "EVN"]
|
11
12
|
segments.each do |segment_name|
|
12
13
|
|
13
14
|
eval("class HL7::Message::Segment::#{segment_name} < HL7::Message::Segment
|
data/ruby-hl7-extensions.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "ruby-hl7-extensions"
|
6
|
-
s.version = "0.0.
|
6
|
+
s.version = "0.0.62"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.extra_rdoc_files = ["LICENSE", "README.md"]
|
15
15
|
s.files = [".gitignore", "Gemfile", "Gemfile.lock", "LICENSE", "README.md", "Rakefile", "VERSION", "VERSION.yml", "lib/core_ext/segments/rol.rb",
|
16
16
|
"lib/core_ext/message.rb", "lib/core_ext/segment.rb",
|
17
|
-
"lib/core_ext/segments/msh.rb", "lib/core_ext/segments/nk1.rb", "lib/core_ext/segments/orc.rb", "lib/core_ext/segments/nte.rb", "lib/core_ext/segments/obr.rb", "lib/core_ext/segments/obx.rb", "lib/core_ext/segments/pid.rb", "lib/core_ext/segments/pv1.rb", "lib/core_ext/segments/segments.rb",
|
17
|
+
"lib/core_ext/segments/msh.rb", "lib/core_ext/segments/nk1.rb", "lib/core_ext/segments/orc.rb", "lib/core_ext/segments/evn.rb", "lib/core_ext/segments/nte.rb", "lib/core_ext/segments/obr.rb", "lib/core_ext/segments/obx.rb", "lib/core_ext/segments/pid.rb", "lib/core_ext/segments/pv1.rb", "lib/core_ext/segments/segments.rb",
|
18
18
|
"lib/ruby-hl7-extensions.rb", "ruby-hl7-extensions.gemspec"]
|
19
19
|
s.homepage = "http://github.com/nmlynl/ruby-hl7-extensions"
|
20
20
|
s.rdoc_options = ["--charset=UTF-8"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-hl7-extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.62
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Lega
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- VERSION.yml
|
57
57
|
- lib/core_ext/message.rb
|
58
58
|
- lib/core_ext/segment.rb
|
59
|
+
- lib/core_ext/segments/evn.rb
|
59
60
|
- lib/core_ext/segments/msh.rb
|
60
61
|
- lib/core_ext/segments/nk1.rb
|
61
62
|
- lib/core_ext/segments/nte.rb
|