yahl7 0.3.0 → 0.4.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 +4 -4
- data/.github/dependabot.yml +7 -0
- data/CHANGELOG.md +45 -0
- data/lib/yahl7/v2/data_type/tq.rb +32 -0
- data/lib/yahl7/v2/error/invalid_format_error.rb +2 -0
- data/lib/yahl7/v2/field_parser.rb +4 -7
- data/lib/yahl7/v2/message/adt.rb +2 -0
- data/lib/yahl7/v2/message/oru.rb +1 -0
- data/lib/yahl7/v2/message.rb +6 -0
- data/lib/yahl7/v2/segment/al1.rb +1 -0
- data/lib/yahl7/v2/segment/dg1.rb +1 -0
- data/lib/yahl7/v2/segment/evn.rb +2 -0
- data/lib/yahl7/v2/segment/in1.rb +1 -0
- data/lib/yahl7/v2/segment/msh.rb +21 -20
- data/lib/yahl7/v2/segment/nte.rb +1 -0
- data/lib/yahl7/v2/segment/obr.rb +2 -1
- data/lib/yahl7/v2/segment/obx.rb +1 -0
- data/lib/yahl7/v2/segment/orc.rb +2 -1
- data/lib/yahl7/v2/segment/pd1.rb +1 -0
- data/lib/yahl7/v2/segment/pid.rb +1 -0
- data/lib/yahl7/v2/segment/pv1.rb +1 -0
- data/lib/yahl7/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ead354fddaf6834942e7a7e23d46a965adf5f318cb730278844fefb728ad0a16
|
4
|
+
data.tar.gz: c6d4c697c4d32e1128401d37024d6518a57b798cb6400b73c4ec730fbf0085f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ff7e6dbfdc8b2a2c31c0025da6753c77a6b4c3dd400f57fd31010c6dca0439ecd17c3ad6e2c74140b3d16b970d9273f46d10efaa3c35204ef2b40b98765da71
|
7
|
+
data.tar.gz: f2c9a7572f48cfbc898ba902f3c0415b68a4d3509deb54b855856815bad69e6e33b3c3d41ec0b92d8d36f977d6429177d3ce6f16d3a970ff49e164dc0c4064ff
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,51 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [0.4.0] - 2021-09-01
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- HL7 data types:
|
13
|
+
- `TQ` for timing and quantity
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
|
17
|
+
- Mapped the following fields to the `TQ` data type:
|
18
|
+
- `OBR.27`
|
19
|
+
- `ORC.7`
|
20
|
+
|
21
|
+
## [0.3.3] - 2021-09-01
|
22
|
+
|
23
|
+
This version comes with a few bugfixes
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
|
27
|
+
- The mapping order of MSH fields was incorrect.
|
28
|
+
- When `YAHL7::V2::FieldParser` was given a `nil` value, the program could
|
29
|
+
crash. This condition should now be resolved.
|
30
|
+
|
31
|
+
## [0.3.2] - 2021-09-01
|
32
|
+
|
33
|
+
0.3.1 introduced a bug that is fixed in this release.
|
34
|
+
|
35
|
+
### Fixed
|
36
|
+
|
37
|
+
- A bug in 0.3.1. We should have returned `YAHL7::V2::Message` but `nil` was
|
38
|
+
returned instead, resulting in an inconsistent API. This release fixed that
|
39
|
+
behavior and makes the API consistent again.
|
40
|
+
|
41
|
+
## [0.3.1] - 2021-09-01
|
42
|
+
|
43
|
+
This release fixes a bug under certain circumstances. More details are listed
|
44
|
+
below.
|
45
|
+
|
46
|
+
### Fixed
|
47
|
+
|
48
|
+
- A bug that could be encountered where messages that do not contain a message
|
49
|
+
type field caused a crash. This crash should now be fixed. When calling
|
50
|
+
`YAHL7::V2::Message.message_type` on a message body that does not contain the
|
51
|
+
type field, `nil` should now be returned rather than crashing.
|
52
|
+
|
8
53
|
## [0.3.0] - 2021-08-31
|
9
54
|
|
10
55
|
The most significant part of this release is the addition of HL7 data types,
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
require_relative 'ts'
|
6
|
+
|
7
|
+
module YAHL7
|
8
|
+
module V2
|
9
|
+
class DataType
|
10
|
+
# This is the HL7 data type for a timing and quantity.
|
11
|
+
class TQ < YAHL7::V2::DataType
|
12
|
+
include YAHL7::V2::AliasPersonName
|
13
|
+
include YAHL7::V2::AliasFieldNames
|
14
|
+
|
15
|
+
define_field_names({
|
16
|
+
quantity: 0,
|
17
|
+
interval: 1,
|
18
|
+
duration: 2,
|
19
|
+
start_datetime: { index: 3, class: YAHL7::V2::DataType::TS },
|
20
|
+
end_datetime: { index: 4, class: YAHL7::V2::DataType::TS },
|
21
|
+
priority: 5,
|
22
|
+
condition: 6,
|
23
|
+
text: 7,
|
24
|
+
conjunction: 8,
|
25
|
+
order_sequencing: 9,
|
26
|
+
occurrence_duration: 10,
|
27
|
+
total_occurrences: 11
|
28
|
+
})
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -19,13 +19,8 @@ module YAHL7
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def split_fields(body)
|
22
|
-
|
23
|
-
|
24
|
-
if fields.is_a?(String)
|
25
|
-
split_components(fields)
|
26
|
-
else
|
27
|
-
fields.map { |f| split_components(f) }
|
28
|
-
end
|
22
|
+
parts = split_body(body, parse_options.field_sep)
|
23
|
+
parts.is_a?(Array) ? parts.map { |f| split_components(f) } : split_components(parts)
|
29
24
|
end
|
30
25
|
|
31
26
|
def split_components(body)
|
@@ -43,6 +38,8 @@ module YAHL7
|
|
43
38
|
end
|
44
39
|
|
45
40
|
def split_body(body, separator)
|
41
|
+
return '' if body.nil?
|
42
|
+
|
46
43
|
got = body.split(separator)
|
47
44
|
got.count < 2 ? body : got
|
48
45
|
end
|
data/lib/yahl7/v2/message/adt.rb
CHANGED
data/lib/yahl7/v2/message/oru.rb
CHANGED
data/lib/yahl7/v2/message.rb
CHANGED
@@ -45,9 +45,15 @@ module YAHL7
|
|
45
45
|
# information, as this method simply finds the type code and then hands it
|
46
46
|
# off to `get_message_class` to find the class to use.
|
47
47
|
def self.message_type(body, parse_options = nil)
|
48
|
+
return self if body.length < 8
|
49
|
+
|
48
50
|
parse_options ||= ParseOptions.from_body(body)
|
49
51
|
head = body.split(parse_options.segment_sep)[0]
|
52
|
+
return self if head.nil?
|
53
|
+
|
50
54
|
type = head.split(parse_options.repetition_sep)[8]
|
55
|
+
return self if type.nil?
|
56
|
+
|
51
57
|
code = type.split(parse_options.component_sep)[0]
|
52
58
|
get_message_class(code)
|
53
59
|
end
|
data/lib/yahl7/v2/segment/al1.rb
CHANGED
data/lib/yahl7/v2/segment/dg1.rb
CHANGED
data/lib/yahl7/v2/segment/evn.rb
CHANGED
data/lib/yahl7/v2/segment/in1.rb
CHANGED
data/lib/yahl7/v2/segment/msh.rb
CHANGED
@@ -3,31 +3,32 @@
|
|
3
3
|
module YAHL7
|
4
4
|
module V2
|
5
5
|
class Segment
|
6
|
+
# MSH segments contain the intent, source, and destination of the HL7
|
7
|
+
# message.
|
6
8
|
class MSH < YAHL7::V2::Segment
|
7
9
|
include YAHL7::V2::AliasFieldNames
|
8
10
|
|
9
11
|
define_field_names({
|
10
12
|
field_separator: 1,
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
message_profile_identifier: 21
|
13
|
+
sending_application: 2,
|
14
|
+
sending_facility: 3,
|
15
|
+
receiving_application: 4,
|
16
|
+
receiving_facility: 5,
|
17
|
+
message_datetime: { index: 6, class: YAHL7::V2::DataType::TS },
|
18
|
+
security: 7,
|
19
|
+
message_type: 8,
|
20
|
+
message_control_id: 9,
|
21
|
+
processing_id: 10,
|
22
|
+
version_id: 11,
|
23
|
+
sequence_number: 12,
|
24
|
+
continuation_pointer: 13,
|
25
|
+
accept_acknowledgement_type: 14,
|
26
|
+
application_acknowledgement_type: 15,
|
27
|
+
country_code: 16,
|
28
|
+
character_set: 17,
|
29
|
+
principal_language: 18,
|
30
|
+
alternate_character_set_handling_scheme: 19,
|
31
|
+
message_profile_identifier: 20
|
31
32
|
})
|
32
33
|
end
|
33
34
|
end
|
data/lib/yahl7/v2/segment/nte.rb
CHANGED
data/lib/yahl7/v2/segment/obr.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
module YAHL7
|
4
4
|
module V2
|
5
5
|
class Segment
|
6
|
+
# OBR segments contain observation request information about a patient.
|
6
7
|
class OBR < YAHL7::V2::Segment
|
7
8
|
include YAHL7::V2::AliasFieldNames
|
8
9
|
|
@@ -33,7 +34,7 @@ module YAHL7
|
|
33
34
|
diagnostic_service_section_id: 24,
|
34
35
|
result_status: 25,
|
35
36
|
parent_result: 26,
|
36
|
-
quantity_timing: 27,
|
37
|
+
quantity_timing: { index: 27, class: YAHL7::V2::DataType::TQ },
|
37
38
|
result_copies_to: 28,
|
38
39
|
parent: 29,
|
39
40
|
transportation_mode: 30,
|
data/lib/yahl7/v2/segment/obx.rb
CHANGED
data/lib/yahl7/v2/segment/orc.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
module YAHL7
|
4
4
|
module V2
|
5
5
|
class Segment
|
6
|
+
# ORC segments contain information common to all orders.
|
6
7
|
class ORC < YAHL7::V2::Segment
|
7
8
|
include YAHL7::V2::AliasFieldNames
|
8
9
|
|
@@ -13,7 +14,7 @@ module YAHL7
|
|
13
14
|
placer_group_number: 4,
|
14
15
|
order_status: 5,
|
15
16
|
response_flag: 6,
|
16
|
-
quantity_timing: 7,
|
17
|
+
quantity_timing: { index: 7, class: YAHL7::V2::DataType::TQ },
|
17
18
|
parent_order: 8,
|
18
19
|
transaction_datetime: 9,
|
19
20
|
entered_by: 10,
|
data/lib/yahl7/v2/segment/pd1.rb
CHANGED
data/lib/yahl7/v2/segment/pid.rb
CHANGED
data/lib/yahl7/v2/segment/pv1.rb
CHANGED
data/lib/yahl7/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yahl7
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mylan Connolly
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple HL7 parser that focuses on being robust and easy to use
|
14
14
|
email:
|
@@ -19,6 +19,7 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
21
21
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
22
|
+
- ".github/dependabot.yml"
|
22
23
|
- ".github/workflows/main.yml"
|
23
24
|
- ".gitignore"
|
24
25
|
- ".rspec"
|
@@ -42,6 +43,7 @@ files:
|
|
42
43
|
- lib/yahl7/v2/data_type/dt.rb
|
43
44
|
- lib/yahl7/v2/data_type/ft.rb
|
44
45
|
- lib/yahl7/v2/data_type/ndl.rb
|
46
|
+
- lib/yahl7/v2/data_type/tq.rb
|
45
47
|
- lib/yahl7/v2/data_type/ts.rb
|
46
48
|
- lib/yahl7/v2/data_type/xad.rb
|
47
49
|
- lib/yahl7/v2/data_type/xpn.rb
|